Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
143d56c7
Commit
143d56c7
authored
Nov 01, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upd
parent
7f1fc3e2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
597 additions
and
54 deletions
+597
-54
RefundService.php
application/models/Business/Order/RefundService.php
+288
-5
FeedBackService.php
application/models/Business/User/FeedBackService.php
+16
-31
PointsLog.php
application/models/DAO/Member/PointsLog.php
+73
-0
QmMemberPoints.php
application/models/DAO/Member/QmMemberPoints.php
+85
-0
RefundReturn.php
application/models/DAO/Order/RefundReturn.php
+69
-0
CodeConfig.php
application/models/Error/CodeConfig.php
+2
-0
Feedback.php
application/modules/Client/controllers/Feedback.php
+1
-4
Shopkeeper.php
application/modules/Client/controllers/Shopkeeper.php
+63
-14
No files found.
application/models/Business/Order/RefundService.php
View file @
143d56c7
This diff is collapsed.
Click to expand it.
application/models/Business/User/FeedBackService.php
View file @
143d56c7
...
...
@@ -11,49 +11,34 @@ class FeedBackServiceModel extends \Business\AbstractModel
}
public
function
saveFeedback
(
$param
,
$memberId
){
/**
* 店铺意见反馈
* @param $param
* @param $storeId
* @param $memberId
* @return bool
* @throws \Exception
*/
public
function
saveFeedback
(
$param
,
$storeId
,
$memberId
)
{
$storeDAO
=
\DAO\StoreModel
::
getInstance
();
$feedbackDescribe
=
trim
(
$param
[
'feedbackDescribe'
]);
$feedbackTelepone
=
trim
(
$param
[
'feedbackTelepone'
]);
$feedbackTelephone
=
trim
(
$param
[
'feedbackTelephone'
]);
$telephone
=
$feedbackTelepone
?
$feedbackTelepone
:
$feedbackTelephone
;
$type
=
(
int
)
$param
[
'type'
];
$feedbackTelephone
=
$storeDAO
->
getInfoById
(
$storeId
,
'store_phone'
,
true
);
if
(
!
$feedbackDescribe
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyFeedbackDescribe
);
}
if
(
!
$telephone
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyFeedbackDescribe
);
}
$return
=
\Our\Common
::
checkMobilePhone
(
$telephone
);
if
(
$return
===
false
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
feedbackTelError
);
}
$imgArr
=
array
();
for
(
$i
=
0
;
$i
<
2
;
$i
++
){
$number
=
str_replace
(
array
(
0
,
1
,
2
),
array
(
'A'
,
'B'
,
'C'
),
$i
);
$image
=
$param
[
'image'
.
$number
];
if
(
$image
&&
$type
==
0
){
$time
=
date
(
'YmdHis_'
);
$file_name
=
$time
.
\Our\Validate
::
getNumberString
();
$result
=
\Our\ImageUtil
::
uploadBase64Image
(
$image
,
\Our\ImageConst
::
feedback
,
$file_name
);
if
(
$result
){
$result
=
\Our\Common
::
getStaticFile
(
$file_name
,
\Our\ImageConst
::
feedback
);
$imgArr
[]
=
pathinfo
(
$result
)[
'basename'
];
}
}
else
{
$imgArr
[]
=
pathinfo
(
$image
)[
'basename'
];
}
}
$insert
=
array
();
$insert
[
'feedback_
image'
]
=
serialize
(
$imgArr
);
$insert
[
'feedback_
type'
]
=
1
;
//店铺意见反馈
$insert
[
'feedback_describe'
]
=
$feedbackDescribe
;
$insert
[
'feedback_time'
]
=
time
()
;
$insert
[
'feedback_telephone'
]
=
$
t
elephone
;
$insert
[
'feedback_time'
]
=
TIMESTAMP
;
$insert
[
'feedback_telephone'
]
=
$
feedbackT
elephone
;
$insert
[
'member_id'
]
=
$memberId
;
$return
=
\DAO\FeedBackModel
::
getInstance
()
->
insert
(
$insert
);
if
(
!
$return
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
saveFeedbackError
);
}
return
true
;
}
private
static
$_instance
=
null
;
...
...
application/models/DAO/Member/PointsLog.php
0 → 100644
View file @
143d56c7
<?php
namespace
DAO\Member
;
use
Our\ApiConst
;
use
Our\ArrayConst
;
use
Our\Common
;
use
Our\DbNameConst
;
use
Our\DescribeConst
;
use
Our\NameConst
;
use
Our\OrderConst
;
/**
* 积分相关
* @date 2018-5-14
* @author csw
*/
class
PointsLogModel
extends
\DAO\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_points_log'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'pl_id'
;
public
function
init
()
{
//$this->setDb();
}
/**
* 新增记录
* @param $data
* @return mixed
*/
public
function
addLog
(
$data
){
$this
->
setDb
(
$this
->
dbName
);
$logId
=
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$data
)
->
execute
();
return
$logId
;
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 单例模式获取类实例
*
*/
public
static
function
getInstance
(
$dbName
=
DbNameConst
::
salveDBConnectName
)
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
(
$dbName
);
}
return
self
::
$_instance
;
}
}
application/models/DAO/Member/QmMemberPoints.php
0 → 100644
View file @
143d56c7
<?php
namespace
DAO\Member
;
use
Our\ApiConst
;
use
Our\ArrayConst
;
use
Our\Common
;
use
Our\DbNameConst
;
use
Our\DescribeConst
;
use
Our\NameConst
;
use
Our\OrderConst
;
/**
* 会员积分相关
* @date 2018-5-14
* @author csw
*/
class
QmMemberPointsModel
extends
\DAO\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_qm_member_points'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'id'
;
public
function
init
()
{
//$this->setDb();
}
/**
* 新增记录
* @param $data
* @return mixed
*/
public
function
addLog
(
$data
){
$this
->
setDb
(
$this
->
dbName
);
$logId
=
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$data
)
->
execute
();
return
$logId
;
}
/**
* 更新会员积分
* @param $param
* @param $where
* @return mixed
*/
public
function
update
(
$param
,
$where
){
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
return
$this
->
db
->
update
(
$this
->
_tableName
)
->
rows
(
$param
)
->
where
(
$where
)
->
execute
();
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 单例模式获取类实例
*
*/
public
static
function
getInstance
(
$dbName
=
DbNameConst
::
salveDBConnectName
)
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
(
$dbName
);
}
return
self
::
$_instance
;
}
}
application/models/DAO/Order/RefundReturn.php
View file @
143d56c7
...
...
@@ -311,6 +311,55 @@ class RefundReturnModel extends \DAO\AbstractModel {
return
$picsRes
;
}
/**
* 店铺退款
* @param $orderInfo 订单信息
*/
public
function
storeRefund
(
$orderInfo
){
$param
[
'refundOrderNo'
]
=
!
empty
(
$orderInfo
[
'refund_order_no'
])
?
$orderInfo
[
'refund_order_no'
]
:
$this
->
getRefundsn
(
$orderInfo
[
'store_id'
]);
//这个有可能多次退款的时候要变
$param
[
'outTradeNo'
]
=
$orderInfo
[
'pay_sn'
];
$param
[
'totalFee'
]
=
$orderInfo
[
'order_amount'
];
$param
[
'refundFee'
]
=
$orderInfo
[
'refund_amount'
];
//退款金额
$param
[
'storeId'
]
=
$orderInfo
[
'store_id'
];
$param
[
'buyerId'
]
=
$orderInfo
[
'buyer_id'
];
if
(
intval
(
$orderInfo
[
'payment_type'
])
==
ApiConst
::
wxAppPayType
)
{
$wxpay
=
\Payment\WxPay
::
getInstance
();
$refund_return
=
$wxpay
->
refund
(
$param
);
$this
->
errorMessage
=
"微信返回:"
.
json_encode
(
$refund_return
);
if
(
!
(
$refund_return
[
'return_code'
]
==
'SUCCESS'
&&
$refund_return
[
'result_code'
]
==
'SUCCESS'
))
{
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
'微信退款操作执行失败!'
.
$orderInfo
[
'order_id'
]
.
"
\r\n
"
;
return
false
;
}
}
else
if
(
intval
(
$orderInfo
[
'payment_type'
])
==
ApiConst
::
alipay
)
{
$aliPay
=
\Payment\Alipay
::
getInstance
();
$return
=
$aliPay
->
refund
(
$param
);
$this
->
errorMessage
=
"支付宝返回:"
.
json_encode
(
$return
);
$resultCode
=
$return
->
code
;
if
(
!
empty
(
$resultCode
)
&&
$resultCode
==
ApiConst
::
alipayRefundSuccess
)
{
return
true
;
}
else
{
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
'支付宝退款操作执行失败:'
.
$orderInfo
[
'order_id'
]
.
"
\r\n
"
;
return
false
;
}
}
else
if
(
intval
(
$orderInfo
[
'payment_type'
])
==
ApiConst
::
wxProgram
){
$wxpay
=
\Payment\WxPay
::
getInstance
();
$refund_return
=
$wxpay
->
refund
(
$param
);
$this
->
errorMessage
=
"微信小程序返回:"
.
json_encode
(
$refund_return
);
if
(
!
(
$refund_return
[
'return_code'
]
==
'SUCCESS'
&&
$refund_return
[
'result_code'
]
==
'SUCCESS'
))
{
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
'微信退款操作执行失败!'
.
$orderInfo
[
'order_id'
]
.
"
\r\n
"
;
return
false
;
}
}
return
true
;
}
/**
* 退款
* @param $orderInfo
* @return bool
*/
public
function
refundMoney
(
$orderInfo
){
$param
[
'refundOrderNo'
]
=
!
empty
(
$orderInfo
[
'refundOrderNo'
])
?
$orderInfo
[
'refundOrderNo'
]
:
$this
->
getRefundsn
(
$orderInfo
[
'storeId'
]);
...
...
@@ -350,6 +399,26 @@ class RefundReturnModel extends \DAO\AbstractModel {
}
return
true
;
}
/**
* 修改记录
*
* @param $condition
* @param $data
* @return bool
*/
public
function
editRefundReturn
(
$condition
,
$data
)
{
if
(
empty
(
$condition
))
{
return
false
;
}
$this
->
setDb
(
$this
->
dbName
);
if
(
is_array
(
$data
))
{
$result
=
$this
->
db
->
update
(
$this
->
_tableName
)
->
rows
(
$data
)
->
where
(
$where
)
->
execute
();
return
$result
;
}
else
{
return
false
;
}
}
/**
* 增加退款退货
*
...
...
application/models/Error/CodeConfig.php
View file @
143d56c7
...
...
@@ -293,6 +293,7 @@ class CodeConfigModel
const
wrongEvaluation
=
30120
;
const
selfGoodsForStoreOrder
=
30121
;
const
refundAddPointsLogError
=
30122
;
//店铺相关错误码
//商品分类
...
...
@@ -509,6 +510,7 @@ class CodeConfigModel
self
::
refundRefuseByStore
=>
'商家不同意退款,如有疑问请联系客服'
,
self
::
returnErrorAfterPay
=>
'货到付款订单在没确认收货前不能退款退货'
,
self
::
returnBeyondTimeError
=>
'收货超时订单不能退款'
,
self
::
refundAddPointsLogError
=>
'退货退款积分更新写入失败'
,
//店铺相关错误
self
::
illegalFavStore
=>
'不能关注自己的店铺'
,
...
...
application/modules/Client/controllers/Feedback.php
View file @
143d56c7
...
...
@@ -7,10 +7,7 @@ class FeedbackController extends \Our\Controller_AbstractApi {
}
public
function
saveFeedbackAction
(){
$msg
=
\Business\User\FeedBackServiceModel
::
getInstance
()
->
saveFeedback
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
);
unset
(
$this
->
req
[
\Our\NameConst
::
data
][
'imageA'
]);
unset
(
$this
->
req
[
\Our\NameConst
::
data
][
'imageB'
]);
unset
(
$this
->
req
[
\Our\NameConst
::
data
][
'imageC'
]);
$msg
=
\Business\User\FeedBackServiceModel
::
getInstance
()
->
saveFeedback
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
storeId
,
$this
->
memberId
);
$this
->
success
(
''
);
}
}
\ No newline at end of file
application/modules/Client/controllers/Shopkeeper.php
View file @
143d56c7
<?php
use
Error\ErrorModel
;
...
...
@@ -178,18 +176,6 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
}
}
/**
* 获得售后列表
*/
public
function
getRefunds
(){
$type
=
intval
(
$this
->
req
[
'data'
][
'type'
]);
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$pageIndex
=
$this
->
getPageIndex
();
$pageSize
=
$this
->
getPageSize
();
$res
=
$refundService
->
getStoreRefundList
(
$this
->
storeId
,
$type
,
$pageIndex
,
$pageSize
);
$this
->
success
(
$res
);
}
/**
* 获得订单数量
*/
...
...
@@ -248,6 +234,69 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$this
->
success
(
$res
);
}
/**
* 获得售后列表
*/
public
function
getRefundsAction
(){
$type
=
intval
(
$this
->
req
[
'data'
][
'type'
]);
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$pageIndex
=
$this
->
getPageIndex
();
$pageSize
=
$this
->
getPageSize
();
$res
=
$refundService
->
getStoreRefundList
(
$this
->
storeId
,
$type
,
$pageIndex
,
$pageSize
);
$this
->
success
(
$res
);
}
/**
* 同意退款
*/
public
function
agreeAction
(){
$refundId
=
intval
(
$this
->
req
[
'data'
][
'refundId'
]);
if
(
!
$refundId
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
notExistRefund
);
}
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$refundAmount
=
floatval
(
$this
->
req
[
'data'
][
'refundAmount'
]);
$text
=
trim
(
$this
->
req
[
'data'
][
'text'
]);
$res
=
$refundService
->
refund
(
$this
->
storeId
,
$refundId
,
$refundAmount
,
$text
);
$this
->
success
(
$res
);
}
/**
* 拒绝退款
*/
public
function
refuseAction
(){
$refundId
=
intval
(
$this
->
req
[
'data'
][
'refundId'
]);
if
(
!
$refundId
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
notExistRefund
);
}
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$text
=
trim
(
$this
->
req
[
'data'
][
'text'
]);
$res
=
$refundService
->
refund
(
$this
->
storeId
,
$refundId
,
0
,
$text
,
3
);
$this
->
success
(
$res
);
}
/**
* 确认收货
* @throws Exception
*/
public
function
confirmReceiveAction
(){
$refundId
=
intval
(
$this
->
req
[
'data'
][
'refundId'
]);
if
(
!
$refundId
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
notExistRefund
);
}
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$goodsState
=
intval
(
$this
->
req
[
'data'
][
'goodsState'
]);
$res
=
$refundService
->
receive
(
$this
->
storeId
,
$refundId
,
$goodsState
);
$this
->
success
(
$res
);
}
/**
* 获取应用版本
*/
public
function
getVersionAction
(){
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment