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
475ad9c8
Commit
475ad9c8
authored
Nov 28, 2018
by
zhz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into master_dev
parents
926e0b3d
2dbed9ac
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
509 additions
and
223 deletions
+509
-223
Index.php
application/controllers/Index.php
+3
-1
OrderConfirmUtil.php
application/library/Order/OrderConfirmUtil.php
+11
-1
ApiConst.php
application/library/Our/ApiConst.php
+1
-0
DescribeConst.php
application/library/Our/DescribeConst.php
+3
-0
PathConst.php
application/library/Our/PathConst.php
+2
-1
CartService.php
application/models/Business/Cart/CartService.php
+1
-0
OrderService.php
application/models/Business/Order/OrderService.php
+46
-27
RefundService.php
application/models/Business/Order/RefundService.php
+250
-120
DeliveryService.php
application/models/Business/Store/DeliveryService.php
+5
-1
ShareService.php
application/models/Business/User/ShareService.php
+55
-6
DeliveryFormula.php
application/models/DAO/DeliveryFormula.php
+2
-2
Goods.php
application/models/DAO/Goods.php
+2
-0
RefundReturn.php
application/models/DAO/Order/RefundReturn.php
+101
-47
PBundling.php
application/models/DAO/PBundling.php
+0
-1
PBundlingGoods.php
application/models/DAO/PBundlingGoods.php
+1
-0
CodeConfig.php
application/models/Error/CodeConfig.php
+6
-1
Shopkeeper.php
application/modules/Client/controllers/Shopkeeper.php
+20
-15
No files found.
application/controllers/Index.php
View file @
475ad9c8
...
...
@@ -36,8 +36,10 @@ class IndexController extends \Our\Controller_Abstract {
// ErrorModel::throwException(CodeConfigModel::authExpire);
}
$this
->
memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$paramsStr
=
$this
->
memberDb0Redis
->
tablelpop
(
$this
->
key
);
$paramsStr
=
json_decode
(
$paramsStr
,
true
);
$this
->
_view
->
assign
(
"params"
,
$paramsStr
);
if
(
$paramsStr
[
'type'
]
==
\Our\ApiConst
::
sharePlat
){
$this
->
_view
->
display
(
'index/plat.phtml'
);
...
...
@@ -45,7 +47,7 @@ class IndexController extends \Our\Controller_Abstract {
if
(
$paramsStr
[
'type'
]
==
\Our\ApiConst
::
shareStore
){
$this
->
_view
->
display
(
'index/store.phtml'
);
}
if
(
$paramsStr
[
'type'
]
==
\Our\ApiConst
::
shareGoods
){
if
(
$paramsStr
[
'type'
]
==
\Our\ApiConst
::
shareGoods
||
$paramsStr
[
'type'
]
==
\Our\ApiConst
::
shareGroup
){
$this
->
_view
->
display
(
'index/goods.phtml'
);
}
if
(
$paramsStr
[
'type'
]
==
\Our\ApiConst
::
shareSaler
){
...
...
application/library/Order/OrderConfirmUtil.php
View file @
475ad9c8
...
...
@@ -387,6 +387,7 @@ class OrderConfirmUtil {
$delivery
[
'deliveryFee'
]
=
$deliveryFee
;
$delivery
[
'deliveryType'
]
=
$requestData
[
'deliveryType'
];
$delivery
[
'deliveryTime'
]
=
isset
(
$deliveryTime
)
?
$deliveryTime
:
\Our\ApiConst
::
zero
;
$delivery
[
'needShippingFee'
]
=
isset
(
$temp
[
'other'
])
?
$temp
[
'other'
]
:
\Our\ApiConst
::
zero
;
$storeCartData
[
'cartList'
][
$storeId
][
'delivery'
]
=
$delivery
;
if
((
$requestData
[
'payway'
]
==
\Our\ApiConst
::
payOnline
&&
$temp
[
'onelinePay'
]
==
\Our\ApiConst
::
one
)
||
(
$requestData
[
'payway'
]
==
\Our\ApiConst
::
payOffline
&&
$temp
[
'offlinePay'
]
==
\Our\ApiConst
::
one
)
||
...
...
@@ -510,7 +511,15 @@ class OrderConfirmUtil {
$order
[
'store_name'
]
=
$storeCarts
[
'storeName'
];
$order
[
'buyer_id'
]
=
$this
->
memberId
;
$order
[
'buyer_name'
]
=
$this
->
member
[
'memberName'
];
$order
[
'buyer_email'
]
=
$this
->
member
[
'memberEmail'
];
if
(
CURRENTVERSION
==
\Our\NameConst
::
versionOne
){
if
(
$storeCarts
[
'delivery'
][
'deliveryType'
]
==
\Our\ApiConst
::
deliveryBuyer
){
$order
[
'buyer_email'
]
=
$storeCarts
[
'delivery'
][
'buyerMobile'
];
}
else
{
$order
[
'buyer_email'
]
=
$this
->
address
[
'mob_phone'
];
}
}
else
{
$order
[
'buyer_email'
]
=
$this
->
member
[
'memberEmail'
];
}
$order
[
'add_time'
]
=
TIMESTAMP
;
$order
[
'payment_type'
]
=
$storeCarts
[
'payway'
];
$order
[
'order_amount'
]
=
$storeCarts
[
'orderAmount'
];
...
...
@@ -527,6 +536,7 @@ class OrderConfirmUtil {
$logMsg
=
\Our\DescribeConst
::
addNoPayOrderLog
;
}
$order
[
'shipping_fee'
]
=
$storeCarts
[
'delivery'
][
'deliveryFee'
];
$order
[
'need_shipping_fee'
]
=
isset
(
$storeCarts
[
'delivery'
][
'needShippingFee'
])
?
$storeCarts
[
'delivery'
][
'needShippingFee'
]
:
\Our\ApiConst
::
zero
;
$order
[
'goods_amount'
]
=
$storeCarts
[
'storeTotalPrice'
];
$order
[
'shipping_type'
]
=
$storeCarts
[
'delivery'
][
'deliveryType'
];
if
(
$storeCarts
[
'delivery'
][
'deliveryType'
]
==
\Our\ApiConst
::
deliveryStore
){
...
...
application/library/Our/ApiConst.php
View file @
475ad9c8
...
...
@@ -394,6 +394,7 @@ class ApiConst
const
shareStore
=
2
;
//店铺
const
shareGoods
=
3
;
//商品
const
shareSaler
=
4
;
//销售员分享
const
shareGroup
=
31
;
//分享组合商品
const
wxAppPayType
=
1
;
//APP微信支付
const
aliPayType
=
2
;
//APP支付宝支付
...
...
application/library/Our/DescribeConst.php
View file @
475ad9c8
...
...
@@ -152,6 +152,9 @@ class DescribeConst
const
refund
=
'退款'
;
const
refundRetund
=
'退货'
;
const
sellerRefuseReturn
=
'卖家拒绝退货'
;
const
sellerAgreeReturn
=
'卖家同意退货'
;
//用户订单送达消息
const
reacheRemindTitle
=
'你的订单卖家已经送达'
;
const
reacheRemindContent
=
'你有新的订单号为{0}的订单已经已经送达'
;
...
...
application/library/Our/PathConst.php
View file @
475ad9c8
...
...
@@ -26,7 +26,8 @@ class PathConst {
const
sharePlat
=
"http://www.shenbd.com"
;
const
shareStore
=
"http://share.shenbd.com/share.html?type=store&id=
{
0
}
"
;
const
shareGoods
=
"http://share.shenbd.com/share.html?type=goods&gid=
{
0}&cid={1}&sid={2
}
"
;
const
shareGroups
=
"http://share.shenbd.com/share.html?type=group&gid=
{
0}&sid={1
}
"
;
const
timeParam
=
'¶m='
.
TIMESTAMP
;
const
cutVertical
=
'|'
;
...
...
application/models/Business/Cart/CartService.php
View file @
475ad9c8
...
...
@@ -734,6 +734,7 @@ class CartServiceModel extends \Business\AbstractModel{
$deliverySetting
[
'deliverTimeList'
]
=
$deliverTimeList
[
'timeList'
];
$storeCartData
[
'cartList'
][
$storeId
][
'storeDistance'
]
=
$storeDistance
;
$deliverySetting
[
'sellerDefaultFee'
]
=
$deliverTimeList
[
'default'
]
?
$deliverTimeList
[
'default'
]
:
\Our\ApiConst
::
zero
;
$deliverySetting
[
'other'
]
=
$deliverTimeList
[
'other'
]
?
$deliverTimeList
[
'other'
]
:
\Our\ApiConst
::
zero
;
}
}
}
...
...
application/models/Business/Order/OrderService.php
View file @
475ad9c8
...
...
@@ -74,7 +74,7 @@ class OrderServiceModel extends \Business\AbstractModel
$query2
[]
=
array
(
'match'
=>
array
(
'storeName'
=>
$keyword
));
$query2
[]
=
array
(
'match'
=>
array
(
'goodsName'
=>
$keyword
));
$query2
[]
=
array
(
'match'
=>
array
(
'orderSn'
=>
"
$keyword
"
));
// $query2[] = array('wildcard' => array('orderSn' => "*{$keyword}*"));
// $query2[] = array('wildcard' => array('orderSn' => "*{$keyword}*"));
$res1
[
'must'
][
1
][
'bool'
][
'should'
]
=
$query2
;
$allQuery
[
'bool'
]
=
$res1
;
// echo json_encode($allQuery);exit;
...
...
@@ -267,7 +267,7 @@ class OrderServiceModel extends \Business\AbstractModel
//商店相关信息
// $this->store=$storeDao->get($this->order['storeId']);
// $this->store=Common::convertUnderline($this->store[0]);
$this
->
store
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreRedisModel
::
getInstance
(),
array
(
&
$storeDao
,
'getInfoById'
),
array
(
$this
->
order
[
'storeId'
],
$storeDao
->
detailField
),
\Our\ApiConst
::
sevenDaySecond
,
array
(
$this
->
order
[
'storeId'
]));
$this
->
store
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreRedisModel
::
getInstance
(),
array
(
&
$storeDao
,
'getInfoById'
),
array
(
$this
->
order
[
'storeId'
],
$storeDao
->
detailField
),
\Our\ApiConst
::
sevenDaySecond
,
array
(
$this
->
order
[
'storeId'
]));
$returnData
=
$this
->
order
;
//配送员信息
$this
->
diliveryman
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db5\OrderRedisModel
::
getInstance
(),
array
(
&
$diliverymanDao
,
'findById'
),
array
(
$returnData
[
'diliverymanId'
]),
\Our\ApiConst
::
oneDaySecond
);
...
...
@@ -302,7 +302,7 @@ class OrderServiceModel extends \Business\AbstractModel
$returnData
[
'storeMemberId'
]
=
$this
->
store
[
'memberId'
];
$returnData
[
'totalGoodsNum'
]
=
$orderGoodsDao
->
getGoodsCount
(
$this
->
orderGoodsList
);
// $returnData['offlinePayway'] =$this->store['offlinePayway'] ? $this->store['offlinePayway'] : '';
// $returnData['offlinePayway'] =$this->store['offlinePayway'] ? $this->store['offlinePayway'] : '';
$this
->
address
[
'address'
]
=
$orderCommonDao
->
convertReceiveAddress
(
$this
->
address
[
'address'
]);
$returnData
[
'reciverInfo'
]
=
$this
->
address
;
$returnData
[
'reciverInfo'
][
'mobPhone'
]
=!
empty
(
$returnData
[
'reciverInfo'
][
'mobPhone'
])
?
$returnData
[
'reciverInfo'
][
'mobPhone'
]
:
''
;
...
...
@@ -418,7 +418,7 @@ class OrderServiceModel extends \Business\AbstractModel
'orderId'
=>
$order
[
'order_id'
]));
$push
->
addOneToClient
(
$pushData
);
$push
->
sendTcpMessage
();
// \Our\RedisHelper::rpush('client_push',array('storeId'=>$order['storeId'],'type'=>$type,'op'=>NameConst::reduce,'num'=>ApiConst::one,'params'=>array('c'=>'shopkeeper','m'=>'orderDetail','orderId'=>$order['orderId'])));
// \Our\RedisHelper::rpush('client_push',array('storeId'=>$order['storeId'],'type'=>$type,'op'=>NameConst::reduce,'num'=>ApiConst::one,'params'=>array('c'=>'shopkeeper','m'=>'orderDetail','orderId'=>$order['orderId'])));
$orderDao
->
deleteOrderCache
(
$memberId
,
$orderId
,
$order
[
'store_id'
],
true
,
true
);
$storeDao
->
deleteStoreCache
(
$order
[
'storeId'
],
$order
[
'orderId'
]);
return
true
;
...
...
@@ -509,7 +509,7 @@ class OrderServiceModel extends \Business\AbstractModel
'orderId'
=>
$order
[
'orderId'
]));
$push
->
addOneToClient
(
$pushData
);
$push
->
sendTcpMessage
();
// \Our\RedisHelper::rpush('client_push',array('storeId'=>$order['storeId'],'type'=>ApiConst::messageWaitReceive,'op'=>NameConst::add,'num'=>ApiConst::one,'params'=>array('c'=>'shopkeeper','m'=>'orderDetail','orderId'=>$order['orderId'])));
// \Our\RedisHelper::rpush('client_push',array('storeId'=>$order['storeId'],'type'=>ApiConst::messageWaitReceive,'op'=>NameConst::add,'num'=>ApiConst::one,'params'=>array('c'=>'shopkeeper','m'=>'orderDetail','orderId'=>$order['orderId'])));
$push
->
sendTcpMessage
();
$messageService
=
\Business\Message\MessageServiceModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
$messageService
->
addMessageCenterToDb
();
...
...
@@ -570,7 +570,7 @@ class OrderServiceModel extends \Business\AbstractModel
{
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$refundReturnDao
=
\DAO\Order\RefundReturnModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
// $orderGoods=$orderGoodsDao->getOrderGoodsByOrderIds($orderInfo['orderId']);
try
{
$orderId
=
$orderInfo
[
'orderId'
];
...
...
@@ -644,7 +644,7 @@ class OrderServiceModel extends \Business\AbstractModel
}
catch
(
Exception
$e
)
{
throw
new
\Exception
(
$e
->
getMessage
(),
$e
->
getCode
());
throw
new
\Exception
(
$e
->
getMessage
(),
$e
->
getCode
());
}
}
...
...
@@ -671,7 +671,7 @@ class OrderServiceModel extends \Business\AbstractModel
$updateCommonData
[
'order_message'
]
=
DescribeConst
::
cancelOrderMessage
;
$res
=
$orderCommonDao
->
update
(
array
(
'order_id'
=>
$order
[
'orderId'
]),
$updateCommonData
);
if
(
!
$update
||
!
$res
){
echo
'订单:'
.
$order
[
'orderId'
]
.
'没取消成功!'
;
echo
'订单:'
.
$order
[
'orderId'
]
.
'没取消成功!'
;
}
//$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData
[
'is_refund'
]
=
1
;
...
...
@@ -721,17 +721,16 @@ class OrderServiceModel extends \Business\AbstractModel
$beginTime
=
$beginTime
?
$beginTime
:
ApiConst
::
zero
;
$endTime
=
TIMESTAMP
-
ApiConst
::
orderStateWaitConfirmBeyond
;
$storeDao
=
\DAO\StoreModel
::
getInstance
();
// $beginTime=0;
// $beginTime=0;
$orders
=
$orderDao
->
getMustCecelRecieveOrders
(
$beginTime
,
$endTime
,
$orderDao
->
getOrderDetailField
());
if
(
!
empty
(
$orders
))
{
foreach
(
$orders
as
$order
)
{
//更新订单信息
$updateData
=
array
(
'order_state'
=>
ApiConst
::
orderStateClose
,
'refund_amount'
=>
$order
[
'orderAmount'
]);
$update
=
$orderDao
->
update
(
array
(
'order_id'
=>
$order
[
'orderId'
]),
$updateData
);
if
(
$update
){
if
(
$order
[
'paymentTime'
]
>
ApiConst
::
zero
&&
in_array
(
$order
[
'paymentType'
],
ArrayConst
::
orderPayTypeOnlines
))
{
$this
->
changeOrderStateCancelUnconditional
(
$order
);
}
foreach
(
$orders
as
$order
)
{
//更新订单信息
$updateData
=
array
(
'order_state'
=>
ApiConst
::
orderStateClose
,
'refund_amount'
=>
$order
[
'orderAmount'
]);
$update
=
$orderDao
->
update
(
array
(
'order_id'
=>
$order
[
'orderId'
]),
$updateData
);
if
(
$update
){
if
(
$order
[
'paymentTime'
]
>
ApiConst
::
zero
&&
in_array
(
$order
[
'paymentType'
],
ArrayConst
::
orderPayTypeOnlines
))
{
$this
->
changeOrderStateCancelUnconditional
(
$order
);
}
$orderDao
->
deleteOrderCache
(
$order
[
'buyerId'
],(
string
)
$order
[
'orderId'
],
$order
[
'storeId'
],
true
);
$storeDao
->
deleteStoreCache
(
$order
[
'storeId'
],
$order
[
'orderId'
]);
...
...
@@ -750,8 +749,26 @@ class OrderServiceModel extends \Business\AbstractModel
'm'
=>
'orderDetail'
,
'orderId'
=>
$order
[
'orderId'
]));
$push
->
addOneToClient
(
$pushData
);
}
$orderDao
->
deleteOrderCache
(
$order
[
'buyerId'
],(
string
)
$order
[
'orderId'
],
$order
[
'storeId'
],
true
);
$storeDao
->
deleteStoreCache
(
$order
[
'storeId'
],
$order
[
'orderId'
]);
$push
=
\Our\Push
::
getInstance
();
$pushData
=
array
(
'storeId'
=>
$order
[
'storeId'
],
'type'
=>
ApiConst
::
messageWaitReceive
,
'waitReceiveCount'
=>
ApiConst
::
reduceOne
,
'waitDeliveryCount'
=>
0
,
'waitGetCount'
=>
0
,
'orderCount'
=>
ApiConst
::
reduceOne
,
'waitRefundProccessCount'
=>
ApiConst
::
zero
,
'waitRefundReceiveCount'
=>
ApiConst
::
zero
,
'refundCount'
=>
ApiConst
::
zero
,
'alertCount'
=>
ApiConst
::
zero
,
'params'
=>
array
(
'c'
=>
'shopkeeper'
,
'm'
=>
'orderDetail'
,
'orderId'
=>
$order
[
'orderId'
]));
$push
->
addOneToClient
(
$pushData
);
}
$orderIds
=
array_column
(
$orders
,
'orderId'
);
//更新商品库存
...
...
@@ -867,8 +884,8 @@ class OrderServiceModel extends \Business\AbstractModel
}
$qmDeliveryLogList
=
$qmDeliveryLogDao
->
getListByDeliverymanIdAndTypeCache
(
$diliverymanIds
,
$type
,
$pageIndex
,
$pageSize
,
array
(
'get_time'
=>
'desc'
),
$memberId
);
$orderIds
=
array_column
(
$qmDeliveryLogList
[
'list'
],
'orderId'
);
// echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder;
// echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder;
$orderIds
=
implode
(
','
,
$orderIds
);
...
...
@@ -906,7 +923,7 @@ class OrderServiceModel extends \Business\AbstractModel
$delivery
[
'subAddress'
]
=
isset
(
$delivery
[
'reciverInfo'
][
'sub_address'
])
?
$delivery
[
'reciverInfo'
][
'sub_address'
]
:
''
;
$delivery
[
'distributionFee'
]
=
$value
[
'distributionFee'
];
unset
(
$delivery
[
'goodsAmount'
]);
// unset($delivery['orderState']);
// unset($delivery['orderState']);
unset
(
$delivery
[
'refundState'
]);
unset
(
$delivery
[
'goodsAmount'
]);
unset
(
$delivery
[
'reciverInfo'
]);
...
...
@@ -1029,11 +1046,11 @@ class OrderServiceModel extends \Business\AbstractModel
$updateResult
=
$qmDeliverymanLogDao
->
updateStatusById
(
$id
);
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
();
$order
=
$orderDao
->
findByOrderId
(
$qmDeliveryManLog
[
'orderId'
],
$orderDao
->
getOrderDetailField
());
if
(
$updateResult
)
{
$push
=
Push
::
getInstance
();
$push
->
reacheRemind
(
$order
[
'buyerId'
],
$order
[
'orderId'
],
$order
[
'orderSn'
]);
$push
->
sendTcpMessage
();
}
if
(
$updateResult
)
{
$push
=
Push
::
getInstance
();
$push
->
reacheRemind
(
$order
[
'buyerId'
],
$order
[
'orderId'
],
$order
[
'orderSn'
]);
$push
->
sendTcpMessage
();
}
$orderDao
->
deleteOrderCache
(
$memberid
,
$qmDeliveryManLog
[
'orderId'
],
$order
[
'storeId'
],
true
,
true
,
true
,
$memberid
);
$qmDeliverymanLogDao
->
deleteOrderCache
(
$memberid
,
$id
);
return
$updateResult
;
...
...
@@ -1065,7 +1082,9 @@ class OrderServiceModel extends \Business\AbstractModel
$dlyoPickupCode
=
\Our\NameConst
::
emptyString
;
foreach
(
$orderList
as
$order
)
{
$orderNos
[]
=
$order
[
'order_sn'
];
$dlyoPickupCode
=
substr
(
$order
[
'order_sn'
],
ApiConst
::
positionPickupCodeBegin
);
if
(
$order
[
'shipping_type'
]
==
\Our\ApiConst
::
bySelf
){
$dlyoPickupCode
=
substr
(
$order
[
'order_sn'
],
ApiConst
::
positionPickupCodeBegin
);
}
if
(
$order
[
'order_state'
]
==
\Our\ApiConst
::
orderStateWaitPay
)
{
$orderTips
=
\Our\DescribeConst
::
payFailedTips
;
$orderSubTips
=
\Our\DescribeConst
::
payFailedSubTips
;
...
...
application/models/Business/Order/RefundService.php
View file @
475ad9c8
...
...
@@ -191,7 +191,134 @@ class RefundServiceModel extends \Business\AbstractModel
return
false
;
}
/**
* 退货审核页
*
*/
public
function
returnGoods
(
$storeId
,
$refundId
,
$sellerState
,
$sellerMessage
,
$isGiveUp
=
ApiConst
::
zero
)
{
$refundReturnDao
=
\DAO\Order\RefundReturnModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$condition
=
array
();
$condition
[
'store_id'
]
=
$storeId
;
$condition
[
'refund_id'
]
=
$refundId
;
$returnDetail
=
$refundReturnDao
->
findByRefundId
(
$refundId
);
if
(
$returnDetail
[
'store_id'
]
!=
$storeId
){
ErrorModel
::
throwException
(
CodeConfigModel
::
notExistRefund
);
}
$return
=
$returnDetail
;
try
{
$return_goods
=
$refundReturnDao
->
getRefundOperateState
(
'return_goods'
,
$return
);
if
(
!
$return_goods
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
wrongRefundState
);
}
$order_info
=
$orderDao
->
findByOrderId
(
$return
[
'order_id'
],
$orderDao
->
getOrderDetailField
());
$refund_array
=
array
();
$refund_array
[
'seller_time'
]
=
TIMESTAMP
;
$refund_array
[
'seller_state'
]
=
$sellerState
;
//卖家处理状态:1为待审核,2为同意,3为不同意
$refund_array
[
'seller_message'
]
=
$sellerMessage
;
//如果卖家不同意退款回写is_refund
if
(
$return
[
'refund_type'
]
==
ApiConst
::
refundTypeGoods
&&
!
$isGiveUp
){
$waitRefundReceiveCount
=
ApiConst
::
one
;
$refundCount
=
ApiConst
::
zero
;
}
else
{
$waitRefundReceiveCount
=
ApiConst
::
zero
;
$refundCount
=
ApiConst
::
reduceOne
;
}
if
(
$refund_array
[
'seller_state'
]
!=
'2'
){
$orderGoodsUpdateData
[
'is_refund'
]
=
ApiConst
::
zero
;
$orderGoodsUpdateData
[
'refund_state_name'
]
=
DescribeConst
::
sellerRefuseReturn
;
$orderGoodsUpdateData
[
'gmt_update'
]
=
TIMESTAMP
;
$orderGoodsWhere
[
'rec_id'
]
=
$return
[
'order_goods_id'
];
$result
=
$orderGoodsDao
->
update
(
$orderGoodsWhere
,
$orderGoodsUpdateData
);
if
(
!
$result
){
ErrorModel
::
throwException
(
CodeConfigModel
::
updateIsRefundFail
);
}
$push
=
\Our\Push
::
getInstance
();
$pushData
=
array
(
'storeId'
=>
$order_info
[
'storeId'
],
'type'
=>
ApiConst
::
messageRefund
,
'waitReceiveCount'
=>
ApiConst
::
zero
,
'waitDeliveryCount'
=>
ApiConst
::
zero
,
'waitGetCount'
=>
ApiConst
::
zero
,
'orderCount'
=>
ApiConst
::
zero
,
'waitRefundProccessCount'
=>
ApiConst
::
reduceOne
,
'waitRefundReceiveCount'
=>
$waitRefundReceiveCount
,
'refundCount'
=>
$refundCount
,
'alertCount'
=>
ApiConst
::
zero
,
'params'
=>
array
(
'c'
=>
'shopkeeper'
,
'm'
=>
'orderDetail'
,
'refundId'
=>
$return
[
'refund_id'
]));
$push
->
addOneToClient
(
$pushData
);
$push
->
sendTcpMessage
();
}
if
(
$refund_array
[
'seller_state'
]
==
ApiConst
::
refundSellerAgree
){
$orderGoodsUpdateData
[
'refund_state_name'
]
=
DescribeConst
::
sellerAgreeReturn
;
$orderGoodsUpdateData
[
'gmt_update'
]
=
TIMESTAMP
;
$orderGoodsWhere
[
'rec_id'
]
=
$return
[
'order_goods_id'
];
$result
=
$orderGoodsDao
->
update
(
$orderGoodsWhere
,
$orderGoodsUpdateData
);
if
(
!
$result
){
ErrorModel
::
throwException
(
CodeConfigModel
::
updateRefundStateNameFail
);
}
}
if
(
$refund_array
[
'seller_state'
]
==
'2'
&&
!
$isGiveUp
)
{
$refund_array
[
'return_type'
]
=
'2'
;
//退货类型:1为不用退货,2为需要退货
$refund_array
[
'goods_state'
]
=
2
;
}
elseif
(
$refund_array
[
'seller_state'
]
==
'3'
)
{
$refund_array
[
'refund_state'
]
=
'3'
;
//状态:1为处理中,2为待管理员处理,3为已完成
}
else
{
$refund_array
[
'seller_state'
]
=
'2'
;
$refund_array
[
'refund_state'
]
=
'2'
;
$refund_array
[
'return_type'
]
=
'1'
;
//选择弃货
}
$state
=
$refundReturnDao
->
update
(
$condition
,
$refund_array
);
if
(
$state
)
{
$sellerLogDao
=
\DAO\SellerLogModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$sellerLogDao
->
record
(
'退货处理,退货编号:'
.
$return
[
'refund_sn'
]);
$push
=
\Our\Push
::
getInstance
();
$pushData
=
array
(
'storeId'
=>
$order_info
[
'storeId'
],
'type'
=>
ApiConst
::
messageRefund
,
'waitReceiveCount'
=>
ApiConst
::
zero
,
'waitDeliveryCount'
=>
ApiConst
::
zero
,
'waitGetCount'
=>
ApiConst
::
zero
,
'orderCount'
=>
ApiConst
::
zero
,
'waitRefundProccessCount'
=>
ApiConst
::
reduceOne
,
'waitRefundReceiveCount'
=>
$waitRefundReceiveCount
,
'refundCount'
=>
$refundCount
,
'alertCount'
=>
ApiConst
::
zero
,
'params'
=>
array
(
'c'
=>
'shopkeeper'
,
'm'
=>
'orderDetail'
,
'refundId'
=>
$return
[
'refund_id'
]));
$push
->
addOneToClient
(
$pushData
);
$push
->
sendTcpMessage
();
return
true
;
}
else
{
throw
new
Exception
(
'系统错误'
);
}
}
catch
(
Exception
$e
)
{
throw
new
\Exception
(
$e
->
getMessage
());
}
// Tpl::output('return',$return);
// $info['buyer'] = array();
// if(!empty($return['pic_info'])) {
// $info = unserialize($return['pic_info']);
// }
// Tpl::output('pic_list',$info['buyer']);
// $model_member = Model('member');
// $member = $model_member->getMemberInfoByID($return['buyer_id']);
// Tpl::output('member',$member);
// $condition = array();
// $condition['order_id'] = $return['order_id'];
// $model_refund->getRightOrderList($condition, $return['order_goods_id']);
// $deliveryman_list = Model('diliveryman')->getDiliverymanList(array('store_id'=>$_SESSION['store_id'],'is_del'=>0),'scores desc');
// Tpl::output('deliveryman_list',$deliveryman_list);
// Tpl::showpage('store_return_edit');
}
/**
* 退货退款处理
* @param $storeId 店铺id
...
...
@@ -199,145 +326,148 @@ class RefundServiceModel extends \Business\AbstractModel
* @param $refundAmount 退款金额
* @param string $text 退款消息
*/
public
function
refund
(
$storeId
,
$sellerId
,
$sellerName
,
$refundId
,
$refundAmount
=
0
,
$text
=
''
,
$seller_state
=
2
)
public
function
refund
(
$storeId
,
$sellerId
,
$sellerName
,
$refundId
,
$refundAmount
=
0
,
$text
=
''
,
$seller_state
=
2
,
$isGiveUp
=
ApiConst
::
zero
)
{
$refundReturnDao
=
\DAO\Order\RefundReturnModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$storeDao
=
\DAO\StoreModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$whereRefund
=
array
();
$whereRefund
[
'store_id'
]
=
$storeId
;
$whereRefund
[
'refund_id'
]
=
$refundId
;
$refund
=
$refundReturnDao
->
find
(
$whereRefund
);
if
(
!
$refund
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
notExistRefund
);
}
if
(
$refund
[
'seller_state'
]
!=
1
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
alreadyExsitRefundGoods
);
}
//获取订单
$order_id
=
$refund
[
'order_id'
];
$order_info
=
$orderDao
->
find
(
array
(
'order_id'
=>
$order_id
));
if
(
$refund
[
'refund_type'
]
==
ApiConst
::
refundTypeGoods
){
if
(
$this
->
returnGoods
(
$storeId
,
$refundId
,
$seller_state
,
$text
,
$isGiveUp
)){
$refundReturnDao
->
deleteRefundCache
(
$refund
[
'buyer_id'
],
$refund
[
'refund_id'
]);
$orderDao
->
deleteOrderCache
(
$refund
[
'buyer_id'
],
$refund
[
'order_id'
],
$refund
[
'store_id'
]);
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db5\OrderRedisModel
::
getInstance
(),
array
(
&
$refundReturnDao
,
'getList'
),
array
(),
array
(
$refund
[
'store_id'
]));
$storeDao
->
deleteStoreCache
(
$refund
[
'store_id'
],
$refund
[
'order_id'
]);
$storeDao
->
deleteStoreRefundCache
(
$refund
[
'store_id'
],
$refund
[
'order_id'
]);
}
return
true
;
}
else
{
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$refund_array
=
array
();
$refund_array
[
'seller_time'
]
=
time
();
$refund_array
[
'seller_state'
]
=
$seller_state
;
//卖家处理状态:1为待审核,2为同意,3为不同意
$refund_array
[
'seller_message'
]
=
$text
;
$refund_array
[
'refund_amount'
]
=
$refundAmount
;
$refundReturnDao
->
db
->
setDb
(
$refundReturnDao
->
dbName
);
$refundReturnDao
->
db
->
doTransaction
();
if
(
$seller_state
!=
2
){
//拒绝退款
$result
=
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$refund
[
'order_goods_id'
]),
array
(
'is_refund'
=>
0
,
'refund_state_name'
=>
'卖家拒绝退货'
,
'gmt_update'
=>
TIMESTAMP
));
if
(
!
$result
){
$refundReturnDao
->
db
->
doRollback
();
return
false
;
if
(
!
$refund
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
notExistRefund
);
}
if
(
$refund
[
'seller_state'
]
!=
1
)
{
ErrorModel
::
throwException
(
CodeConfigModel
::
alreadyExsitRefundGoods
);
}
if
(
$order_info
[
'refund_state'
]
==
2
)
{
$result
=
$orderDao
->
updateByOrderId
(
array
(
'refund_state'
=>
1
),
$refund
[
'order_id'
]);
//获取订单
$order_id
=
$refund
[
'order_id'
];
$order_info
=
$orderDao
->
find
(
array
(
'order_id'
=>
$order_id
));
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$refund_array
=
array
();
$refund_array
[
'seller_time'
]
=
time
();
$refund_array
[
'seller_state'
]
=
$seller_state
;
//卖家处理状态:1为待审核,2为同意,3为不同意
$refund_array
[
'seller_message'
]
=
$text
;
$refund_array
[
'refund_amount'
]
=
$refundAmount
;
$refundReturnDao
->
db
->
doTransaction
();
if
(
$seller_state
!=
2
){
//拒绝退款
$result
=
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$refund
[
'order_goods_id'
]),
array
(
'is_refund'
=>
0
,
'refund_state_name'
=>
'卖家拒绝退货'
,
'gmt_update'
=>
TIMESTAMP
));
if
(
!
$result
){
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
if
(
$order_info
[
'refund_state'
]
==
2
)
{
$result
=
$orderDao
->
updateByOrderId
(
array
(
'refund_state'
=>
1
),
$refund
[
'order_id'
]);
if
(
!
$result
){
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
}
$refund_array
[
'refund_state'
]
=
'3'
;
//状态:1为处理中,2为待管理员处理,3为已完成
$state
=
$refundReturnDao
->
editRefundReturn
(
$whereRefund
,
$refund_array
);
if
(
!
$state
){
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
//$this->recordSellerLog('退款处理,退款编号:'.$refund['refund_sn']); //待确认
//记录操作日志
$sellerLogDAO
=
\DAO\SellerLogModel
::
getInstance
();
$sellerLogDAO
->
record
(
'拒绝退款处理,退款编号:'
.
$refund
[
'refund_sn'
],
array
(
'seller_id'
=>
$sellerId
,
'seller_name'
=>
$sellerName
,
'store_id'
=>
$storeId
));
$refundReturnDao
->
deleteRefundCache
(
$refund
[
'buyer_id'
],
$refund
[
'refund_id'
]);
$orderDao
->
deleteOrderCache
(
$refund
[
'buyer_id'
],
$refund
[
'order_id'
],
$refund
[
'store_id'
]);
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db5\OrderRedisModel
::
getInstance
(),
array
(
&
$refundReturnDao
,
'getList'
),
array
(),
array
(
$refund
[
'store_id'
]));
$refundReturnDao
->
db
->
doCommit
();
return
true
;
}
$refund_array
[
'refund_state'
]
=
'3'
;
//状态:1为处理中,2为待管理员处理,3为已完成
$state
=
$refundReturnDao
->
editRefundReturn
(
$whereRefund
,
$refund_array
);
if
(
!
$state
){
if
(
$refundAmount
>
$refund
[
'buyer_refund_amount'
]){
//showDialog('退款金额不可大于本订单支付金额','','error');
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
//$this->recordSellerLog('退款处理,退款编号:'.$refund['refund_sn']); //待确认
//记录操作日志
$sellerLogDAO
=
\DAO\SellerLogModel
::
getInstance
();
$sellerLogDAO
->
record
(
'拒绝退款处理,退款编号:'
.
$refund
[
'refund_sn'
],
array
(
'seller_id'
=>
$sellerId
,
'seller_name'
=>
$sellerName
,
'store_id'
=>
$storeId
));
$refundReturnDao
->
deleteRefundCache
(
$refund
[
'buyer_id'
],
$refund
[
'refund_id'
]);
$orderDao
->
deleteOrderCache
(
$refund
[
'buyer_id'
],
$refund
[
'order_id'
],
$refund
[
'store_id'
]);
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db5\OrderRedisModel
::
getInstance
(),
array
(
&
$refundReturnDao
,
'getList'
),
array
(),
array
(
$refund
[
'store_id'
]));
$refundReturnDao
->
db
->
doCommit
();
return
true
;
}
if
(
$refundAmount
>
$refund
[
'buyer_refund_amount'
]){
//showDialog('退款金额不可大于本订单支付金额','','error');
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
//以下为同意退款流程
if
(
$order_info
[
'order_state'
]
==
40
){
//交易完成订单,退积分
$res
=
$this
->
edit_points
(
$refund
,
$order_info
);
if
(
!
$res
){
$refundReturnDao
->
db
->
doRollback
();
ErrorModel
::
throwException
(
CodeConfigModel
::
refundAddPointsLogError
);
//以下为同意退款流程
if
(
$order_info
[
'order_state'
]
==
40
){
//交易完成订单,退积分
$res
=
$this
->
edit_points
(
$refund
,
$order_info
);
if
(
!
$res
){
$refundReturnDao
->
db
->
doRollback
();
ErrorModel
::
throwException
(
CodeConfigModel
::
refundAddPointsLogError
);
}
}
}
$refund_array
[
'refund_state'
]
=
'3'
;
//状态:1为处理中,2为待管理员处理,3为已完成
$refund_array
[
'refund_state'
]
=
'3'
;
//状态:1为处理中,2为待管理员处理,3为已完成
$state
=
$refundReturnDao
->
editRefundReturn
(
$whereRefund
,
$refund_array
);
if
(
$state
){
//退款记录成功
//记录操作日志
$sellerLogDAO
=
\DAO\SellerLogModel
::
getInstance
();
$sellerLogDAO
->
record
(
'同意退款处理,退款编号:'
.
$refund
[
'refund_sn'
],
array
(
'seller_id'
=>
$sellerId
,
'seller_name'
=>
$sellerName
,
'store_id'
=>
$storeId
));
// add by ky start
//检测该店铺是否开启直接退款功能
$storeDAO
=
\DAO\StoreModel
::
getInstance
();
//店铺积分
$is_direct_refund
=
$storeDAO
->
getInfoById
(
$storeId
,
'is_direct_refund'
,
'is_direct_refund'
);
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$refund
[
'order_goods_id'
]),
array
(
'refund_state_name'
=>
'卖家同意退款'
));
if
(
$is_direct_refund
==
1
){
//支持直接退款
//退款 检测该订单是否为线上支付
$updateData
=
array
(
'is_suc_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
);
if
(
$refund_array
[
'refund_amount'
]
>
0
){
$payment_type
=
$order_info
[
'payment_type'
];
if
(
!
in_array
(
$payment_type
,
array
(
0
,
2
))){
$state
=
$refundReturnDao
->
storeRefund
(
array_merge
(
$order_info
,
array
(
'refund_order_no'
=>
$refund
[
'order_sn'
],
'refund_amount'
=>
$refund_array
[
'refund_amount'
])));
if
(
!
$state
)
{
//throw new Exception('更新订单信息失败');
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
if
(
$payment_type
==
1
)
{
//微信支付
$updateData
=
array
(
'is_suc_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
,
'seller_state'
=>
$refund_array
[
'seller_state'
],
'refund_state'
=>
$refund_array
[
'refund_state'
]);
}
else
{
$updateData
=
array
(
'is_suc_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
);
$state
=
$refundReturnDao
->
editRefundReturn
(
$whereRefund
,
$refund_array
);
if
(
$state
){
//退款记录成功
//记录操作日志
$sellerLogDAO
=
\DAO\SellerLogModel
::
getInstance
();
$sellerLogDAO
->
record
(
'同意退款处理,退款编号:'
.
$refund
[
'refund_sn'
],
array
(
'seller_id'
=>
$sellerId
,
'seller_name'
=>
$sellerName
,
'store_id'
=>
$storeId
));
// add by ky start
//检测该店铺是否开启直接退款功能
$storeDAO
=
\DAO\StoreModel
::
getInstance
();
//店铺积分
$is_direct_refund
=
$storeDAO
->
getInfoById
(
$storeId
,
'is_direct_refund'
,
'is_direct_refund'
);
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$refund
[
'order_goods_id'
]),
array
(
'refund_state_name'
=>
'卖家同意退款'
));
if
(
$is_direct_refund
==
1
){
//支持直接退款
//退款 检测该订单是否为线上支付
$updateData
=
array
(
'is_suc_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
);
if
(
$refund_array
[
'refund_amount'
]
>
0
){
$payment_type
=
$order_info
[
'payment_type'
];
if
(
!
in_array
(
$payment_type
,
array
(
0
,
2
))){
$state
=
$refundReturnDao
->
storeRefund
(
array_merge
(
$order_info
,
array
(
'refund_order_no'
=>
$refund
[
'order_sn'
],
'refund_amount'
=>
$refund_array
[
'refund_amount'
])));
if
(
!
$state
)
{
//throw new Exception('更新订单信息失败');
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
if
(
$payment_type
==
1
)
{
//微信支付
$updateData
=
array
(
'is_suc_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
,
'seller_state'
=>
$refund_array
[
'seller_state'
],
'refund_state'
=>
$refund_array
[
'refund_state'
]);
}
else
{
$updateData
=
array
(
'is_suc_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
);
}
}
}
}
$res
=
$refundReturnDao
->
update
(
array
(
'refund_id'
=>
$refund
[
'refund_id'
]),
$updateData
);
if
(
!
$res
){
$refundReturnDao
->
db
->
doRollback
();
$res
=
$refundReturnDao
->
update
(
array
(
'refund_id'
=>
$refund
[
'refund_id'
]),
$updateData
);
if
(
!
$res
){
$refundReturnDao
->
db
->
doRollback
();
// showDialog('退款成功,退款表写入失败,请联系工作人员!',$reload,'error');
return
false
;
}
$result
=
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$refund
[
'order_goods_id'
]),
array
(
'is_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
));
if
(
!
$result
){
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
$result
=
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$refund
[
'order_goods_id'
]),
array
(
'is_refund'
=>
1
,
'gmt_update'
=>
TIMESTAMP
));
if
(
!
$result
){
$refundReturnDao
->
db
->
doRollback
();
// showDialog('refund_state_name',$reload,'error');
return
false
;
return
false
;
}
}
$refundReturnDao
->
db
->
doCommit
();
$refundReturnDao
->
deleteRefundCache
(
$refund
[
'buyer_id'
],
$refund
[
'refund_id'
]);
$orderDao
->
deleteOrderCache
(
$refund
[
'buyer_id'
],
$refund
[
'order_id'
],
$refund
[
'store_id'
]);
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db5\OrderRedisModel
::
getInstance
(),
array
(
&
$refundReturnDao
,
'getList'
),
array
(),
array
(
$refund
[
'store_id'
]));
$storeDao
->
deleteStoreCache
(
$refund
[
'store_id'
],
$refund
[
'order_id'
]);
$storeDao
->
deleteStoreRefundCache
(
$refund
[
'store_id'
],
$refund
[
'order_id'
]);
return
true
;
}
$refundReturnDao
->
db
->
doCommit
();
$refundReturnDao
->
deleteRefundCache
(
$refund
[
'buyer_id'
],
$refund
[
'refund_id'
]);
$orderDao
->
deleteOrderCache
(
$refund
[
'buyer_id'
],
$refund
[
'order_id'
],
$refund
[
'store_id'
]);
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db5\OrderRedisModel
::
getInstance
(),
array
(
&
$refundReturnDao
,
'getList'
),
array
(),
array
(
$refund
[
'store_id'
]));
$push
=
\Our\Push
::
getInstance
();
$pushData
=
array
(
'storeId'
=>
$storeId
,
'type'
=>
ApiConst
::
messageRefund
,
'waitReceiveCount'
=>
ApiConst
::
zero
,
'waitDeliveryCount'
=>
0
,
'waitGetCount'
=>
0
,
'orderCount'
=>
ApiConst
::
zero
,
'waitRefundProccessCount'
=>
ApiConst
::
reduceOne
,
'waitRefundReceiveCount'
=>
ApiConst
::
zero
,
'refundCount'
=>
ApiConst
::
reduceOne
,
'alertCount'
=>
ApiConst
::
zero
,
'params'
=>
array
(
'c'
=>
'shopkeeper'
,
'm'
=>
'orderDetail'
,
'refundId'
=>
$order_id
));
$push
->
addOneToClient
(
$pushData
);
$push
->
sendTcpMessage
();
return
true
;
$refundReturnDao
->
db
->
doRollback
();
}
$refundReturnDao
->
db
->
doRollback
();
return
false
;
}
...
...
@@ -418,7 +548,7 @@ class RefundServiceModel extends \Business\AbstractModel
* @param int $pageSize
* @return \stdClass
*/
public
function
getStoreRefundList
(
$storeId
,
$type
=
0
,
$pageIndex
=
ApiConst
::
zero
,
$pageSize
=
ApiConst
::
pageSize
,
$refundId
=
false
)
public
function
getStoreRefundList
(
$storeId
,
$type
=
ApiConst
::
zero
,
$pageIndex
=
ApiConst
::
zero
,
$pageSize
=
ApiConst
::
pageSize
,
$refundId
=
false
)
{
$refundReturnDao
=
\DAO\Order\RefundReturnModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
...
...
@@ -478,7 +608,7 @@ class RefundServiceModel extends \Business\AbstractModel
$value
[
'deliveryTimeEnd'
]
=
$value
[
'deliveryTime'
]
+
ApiConst
::
arriveTimeRadius
;
$value
[
'goodsImage'
]
=
ImageUtil
::
getGoodsImgUrl
(
$value
[
'goodsImage'
],
ApiConst
::
goodsSmallSize
);
$value
[
'goodsAttr'
]
=
$goodsDao
->
getFormatGoodsAttr
(
$value
[
'goodsSpec'
]);
$extent
=
$orderDao
->
getClienOrderCommon
(
$orders
[
$value
[
'orderId'
]]);
$extent
=
$orderDao
->
getClienOrderCommon
(
$orders
[
$value
[
'orderId'
]]);
$value
=
array_merge
(
$value
,
$extent
);
$goodGroup
=
unserialize
(
$value
[
'goodsGroup'
]);
$value
[
'goodsGroup'
]
=!
empty
(
$goodGroup
)
?
$goodGroup
:
[];
...
...
@@ -494,7 +624,7 @@ class RefundServiceModel extends \Business\AbstractModel
$value
[
'picInfo'
]
=
$refundReturnDao
->
getRefundPics
(
$value
[
'picInfo'
][
'buyer'
]);
}
unset
(
$value
[
'goodsSpec'
]);
// unset($value['picInfo']);
// unset($value['picInfo']);
}
$returnData
[
'refundReturns'
]
=
$refundMerge
;
$returnData
[
'totalCount'
]
=
$refundReturns
[
'totalCount'
];
...
...
@@ -695,7 +825,7 @@ class RefundServiceModel extends \Business\AbstractModel
}
$shippingTypes
=
array
();
array_push
(
$shippingTypes
,
ArrayConst
::
refundShippingType
[
$orderInfo
[
'shippingType'
]]);
// $shippingTypes = ArrayConst::refundShippingType[$orderInfo['shippingType']];
// $shippingTypes = ArrayConst::refundShippingType[$orderInfo['shippingType']];
//获得订单商品
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
();
$orderGoodses
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db5\RefundReasonRedisModel
::
getInstance
(),
array
(
&
$orderGoodsDao
,
'getOrderGoodsByOrderIds'
),
array
(
$orderInfo
[
'orderId'
],
$this
->
orderGoodsField
),
\Our\ApiConst
::
oneDaySecond
);
...
...
@@ -850,7 +980,7 @@ class RefundServiceModel extends \Business\AbstractModel
$picArray
[
'buyer'
]
=
array
();
if
(
!
empty
(
$refund
[
'images'
]))
{
foreach
(
$refund
[
'images'
]
as
$key
=>
$image
){
$ismuch
=
preg_match
(
'/^(data:\s*image\/(\w+);base64,)/'
,
$image
,
$result
);
$ismuch
=
preg_match
(
'/^(data:\s*image\/(\w+);base64,)/'
,
$image
,
$result
);
if
(
$ismuch
){
$fileName
=
ImageUtil
::
uploadBase64Image
(
$image
,
ImageConst
::
refund
,
ImageUtil
::
getFileName
(
$memberId
.
$key
));
$fileName
=
basename
(
$fileName
);
...
...
@@ -859,7 +989,7 @@ class RefundServiceModel extends \Business\AbstractModel
}
array_push
(
$picArray
[
'buyer'
],
$fileName
);
}
// $picArray['buyer'] = $refund['images'];
// $picArray['buyer'] = $refund['images'];
}
else
{
$picArray
[
'buyer'
]
=
array
();
}
...
...
@@ -989,7 +1119,7 @@ class RefundServiceModel extends \Business\AbstractModel
if
(
$info
[
'returnType'
]
==
ApiConst
::
returnTypeMustReturn
){
if
(
!
$info
[
'diliverymanId'
]){
$info
[
'diliveryman'
]
=
new
\stdClass
();
// $info['diliveryman']=ArrayConst::defaultDeliveryMan;
// $info['diliveryman']=ArrayConst::defaultDeliveryMan;
}
else
{
$diliveryMan
=
$diliveryManDao
->
findById
(
$info
[
'diliverymanId'
]);
if
(
!
empty
(
$diliveryMan
)){
...
...
@@ -1028,7 +1158,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$where
[
'buyer_id'
]
=
$buyerId
;
$where
[
'refund_id'
]
=
$refundId
;
$res
=
$refundReturnDao
->
find
(
$where
,
$refundReturnDao
->
refundDetailField
);
$res
=
$refundReturnDao
->
find
(
$where
,
$refundReturnDao
->
refundDetailField
);
if
(
isset
(
$res
[
'isPlatformIn'
])
&&
!
empty
(
$res
[
'isPlatformIn'
])){
ErrorModel
::
throwException
(
CodeConfigModel
::
platFormAreadyIn
);
}
...
...
application/models/Business/Store/DeliveryService.php
View file @
475ad9c8
...
...
@@ -58,7 +58,11 @@ class DeliveryServiceModel extends \Business\AbstractModel
$qmDeliveryManLogData
[
'delivery_state'
]
=
ApiConst
::
deliveryStateWait
;
$qmDeliveryManLogData
[
'distribution_fee'
]
=
$data
[
'distributionFee'
];
$qmDeliveryManLogData
[
'order_type'
]
=
$data
[
'orderType'
];
$qmDeliveryManLogData
[
'shipping_fee'
]
=
$orderD
[
'shippingFee'
];
if
(
$data
[
'orderType'
]
==
ApiConst
::
orderTypeRefund
){
$qmDeliveryManLogData
[
'shipping_fee'
]
=
$orderD
[
'need_shipping_fee'
];
}
else
{
$qmDeliveryManLogData
[
'shipping_fee'
]
=
$orderD
[
'shippingFee'
];
}
$qmDeliveryManLogData
[
'order_sn'
]
=
$orderD
[
'orderSn'
];
$qmDeliveryManLogData
[
'get_time'
]
=
TIMESTAMP
;
// $qmDeliveryWhere['diliveryman_id']= $qmDeliveryManLogData['diliveryman_id'];
...
...
application/models/Business/User/ShareService.php
View file @
475ad9c8
...
...
@@ -34,6 +34,23 @@ class ShareServiceModel extends \Business\AbstractModel
public
function
getSaveData
(
$data
){
$driverType
=
\Our\Common
::
getDriverType
();
$data
[
'driverType'
]
=
$driverType
;
if
(
$data
[
'type'
]
==
ApiConst
::
shareGoods
){
if
(
!
empty
(
$data
[
'id'
])){
$goodsDao
=
\DAO\GoodsModel
::
getInstance
();
$goods
=
$goodsDao
->
getOnlineOne
(
$data
[
'id'
]);
$data
[
'goodsId'
]
=
$goods
[
'goods_id'
];
$data
[
'goodsCommonid'
]
=
$goods
[
'goods_commonid'
];
$data
[
'storeId'
]
=
$goods
[
'store_id'
];
}
}
if
(
$data
[
'type'
]
==
ApiConst
::
shareGroup
){
if
(
!
empty
(
$data
[
'id'
])){
$pBundlingDao
=
\DAO\PBundlingModel
::
getInstance
();
$pBundling
=
$pBundlingDao
->
findById
(
$data
[
'groupId'
]);
$data
[
'groupId'
]
=
$data
[
'groupId'
];
$data
[
'storeId'
]
=
$pBundling
[
'store_id'
];
}
}
$data
[
'qrCode'
]
=
$this
->
growQrcode
(
$data
);
if
(
$data
[
'type'
]
==
ApiConst
::
shareStore
||
$data
[
'type'
]
==
ApiConst
::
shareSaler
){
if
(
!
empty
(
$data
[
'id'
])){
...
...
@@ -47,6 +64,7 @@ class ShareServiceModel extends \Business\AbstractModel
}
// $data['qrCode']=\Our\RedisHelper::cachedFunction(\Redis\Db0\MemberRedisModel::getInstance(), array(&$this, 'growQrcode'), array($data));
return
$data
;
...
...
@@ -74,8 +92,17 @@ class ShareServiceModel extends \Business\AbstractModel
));
return
$res
;
}
public
function
getQrUrl
(
$id
){
return
Common
::
format
(
PathConst
::
shareStore
,
$id
);
public
function
getQrUrl
(
$data
,
$type
=
'store'
){
if
(
$type
==
'store'
){
return
Common
::
format
(
PathConst
::
shareStore
,
$data
[
'id'
]);
}
if
(
$type
==
'goods'
){
return
Common
::
format
(
PathConst
::
shareGoods
,
$data
[
'goodsId'
],
$data
[
'goodsCommonid'
],
$data
[
'storeId'
]);
}
if
(
$type
==
'group'
){
return
Common
::
format
(
PathConst
::
shareGroups
,
$data
[
'groupId'
],
$data
[
'storeId'
]);
}
}
public
function
growQrcode
(
$data
){
...
...
@@ -93,11 +120,11 @@ class ShareServiceModel extends \Business\AbstractModel
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$url
,
ApiConst
::
zero
);
return
$url
;
}
else
{
return
$this
->
getQrUrl
(
$data
[
'id'
]
);
return
$this
->
getQrUrl
(
$data
);
// return PathConst::wxDefaultPath;
}
}
else
{
return
$this
->
getQrUrl
(
$data
[
'id'
]
);
return
$this
->
getQrUrl
(
$data
);
//不是微信分享就是普通下载的二维码图片
//return PathConst::downLoadQrcode;
}
...
...
@@ -115,12 +142,34 @@ class ShareServiceModel extends \Business\AbstractModel
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$url
,
ApiConst
::
zero
);
return
$url
;
}
else
{
return
$this
->
getQrUrl
(
$data
[
'id'
]
);
return
$this
->
getQrUrl
(
$data
,
'goods'
);
//return PathConst::wxDefaultPath;
}
}
else
{
//不是微信分享就是普通下载的二维码图片
return
$this
->
getQrUrl
(
$data
[
'id'
]);
return
$this
->
getQrUrl
(
$data
,
'goods'
);
//return PathConst::downLoadQrcode;
}
}
if
(
$data
[
'type'
]
==
\Our\ApiConst
::
shareGroup
){
if
((
$data
[
'shareType'
]
==
ApiConst
::
shareWxFriend
||
$data
[
'shareType'
]
==
ApiConst
::
shareWxFriends
)){
if
(
\Our\ApiConst
::
isWxPublish
){
$scene
=
\Our\Common
::
format
(
\Our\PathConst
::
wxGoodsParams
,
$data
[
'id'
]);
$page
=
\Our\PathConst
::
wxGoodsPath
;
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
$fileName
=
md5
(
$page
.
$res
);
$fileName
=
$fileName
.
NameConst
::
jpgSuffix
;
$base64image
=
$this
->
dataUri
(
$res
,
ImageConst
::
imagePgn
);
$url
=
ImageUtil
::
uploadBase64Image
(
$base64image
,
ImageConst
::
shareImage
,
$fileName
);
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$url
,
ApiConst
::
zero
);
return
$url
;
}
else
{
return
$this
->
getQrUrl
(
$data
,
'group'
);
//return PathConst::wxDefaultPath;
}
}
else
{
//不是微信分享就是普通下载的二维码图片
return
$this
->
getQrUrl
(
$data
,
'group'
);
//return PathConst::downLoadQrcode;
}
}
...
...
application/models/DAO/DeliveryFormula.php
View file @
475ad9c8
...
...
@@ -133,7 +133,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}
public
function
delDeliverFormulaByStoreId
(
$storeId
){
return
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\DeliveryFormulaRedisModel
::
getInstance
(),
array
(
&
$this
,
'getOne'
),
array
(),
\Our\ApiConst
::
sevenDaySecond
,
array
(
$storeId
));
return
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\DeliveryFormulaRedisModel
::
getInstance
(),
array
(
&
$this
,
'getOne'
),
array
(),
array
(
$storeId
));
}
/**
...
...
@@ -297,7 +297,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
$dayList
[
'list'
]
=
$value
;
$returnList
[]
=
$dayList
;
}
return
array
(
'timeList'
=>
$returnList
,
'default'
=>
$defaultFee
);
return
array
(
'timeList'
=>
$returnList
,
'default'
=>
$defaultFee
,
'other'
=>
$formula
[
'other'
]
*
\Our\ApiConst
::
hundred
);
}
return
$return
;
...
...
application/models/DAO/Goods.php
View file @
475ad9c8
...
...
@@ -20,6 +20,8 @@ class GoodsModel extends \DAO\AbstractModel {
private
$cartGoodsField
=
'goods_id,goods_storage,store_id,goods_commonid,goods_name,goods_image,goods_spec,snapshot_id'
;
public
$goodsDetailField
=
'goods_id as goodsId,goods_commonid as goodsCommonid,goods_name as goodsName,store_id as storeId'
;
/**
* 主键
*
...
...
application/models/DAO/Order/RefundReturn.php
View file @
475ad9c8
...
...
@@ -84,7 +84,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
return
$this
->
db
->
update
(
$this
->
_tableName
)
->
where
(
$where
)
->
rows
(
$data
)
->
execute
();
}
//更新退货物流信息
//更新退货物流信息
public
function
updateReturnShippingByRefundId
(
$refundId
,
$data
){
$where
[
$this
->
_primaryKey
]
=
$refundId
;
$updateData
[
'express_id'
]
=
$data
[
'expressId'
];
...
...
@@ -164,53 +164,53 @@ class RefundReturnModel extends \DAO\AbstractModel {
}
public
function
getStatusExtent
(
$returnRefund
,
$isSeller
=
false
){
// if($returnRefund['refundState']!=ApiConst::refundCompleted){
if
(
$returnRefund
[
'sellerState'
]
==
ApiConst
::
refundSellerAgree
){
if
(
$returnRefund
[
'isSucRefund'
]
==
ApiConst
::
refundSuccess
){
return
OrderConst
::
alreadyReufndMoney
;
}
if
(
$returnRefund
[
'refundType'
]
==
ApiConst
::
refundTypeMoney
){
return
OrderConst
::
sellerAgree
;
}
if
(
$returnRefund
[
'refundType'
]
==
ApiConst
::
refundTypeGoods
){
if
(
$returnRefund
[
'isSucRefund'
]
==
ApiConst
::
refundSuccess
){
return
OrderConst
::
alreadyReufndMoney
;
}
if
(
$returnRefund
[
'goodsState'
]
==
ApiConst
::
goodsStateUnRecieve
){
return
OrderConst
::
goodsStateUnRecieve
;
}
if
(
$returnRefund
[
'goodsState'
]
==
ApiConst
::
goodsStateRecieved
){
return
OrderConst
::
goodsStateRecieved
;
}
if
(
$returnRefund
[
'returnType'
]
==
ApiConst
::
returnTypeNotReturn
){
return
OrderConst
::
sellerAgreeReturn
;
}
if
(
$returnRefund
[
'returnType'
]
==
ApiConst
::
returnTypeMustReturn
){
return
OrderConst
::
waitSellerRecieve
;
}
}
// if($returnRefund['refundState']!=ApiConst::refundCompleted){
if
(
$returnRefund
[
'sellerState'
]
==
ApiConst
::
refundSellerAgree
){
if
(
$returnRefund
[
'isSucRefund'
]
==
ApiConst
::
refundSuccess
){
return
OrderConst
::
alreadyReufndMoney
;
}
if
(
$returnRefund
[
'refundType'
]
==
ApiConst
::
refundTypeMoney
){
return
OrderConst
::
sellerAgree
;
}
if
(
$returnRefund
[
'
sellerState'
]
==
ApiConst
::
refundSellerRefuse
){
if
(
$returnRefund
[
'
refundType'
]
==
ApiConst
::
refundTypeGoods
){
if
(
$returnRefund
[
'isSucRefund'
]
==
ApiConst
::
refundSuccess
){
return
OrderConst
::
alreadyReufndMoney
;
}
if
(
$returnRefund
[
'
platformState'
]
==
ApiConst
::
platAgre
e
){
return
OrderConst
::
platFormAgre
e
;
if
(
$returnRefund
[
'
goodsState'
]
==
ApiConst
::
goodsStateUnReciev
e
){
return
OrderConst
::
goodsStateUnReciev
e
;
}
if
(
$returnRefund
[
'
platformState'
]
==
ApiConst
::
platRefuse
){
return
OrderConst
::
platFormRefuse
;
if
(
$returnRefund
[
'
goodsState'
]
==
ApiConst
::
goodsStateRecieved
){
return
OrderConst
::
goodsStateRecieved
;
}
if
(
$returnRefund
[
'
isPlatformIn'
]
==
ApiConst
::
platI
n
){
return
OrderConst
::
platFromProccess
;
if
(
$returnRefund
[
'
returnType'
]
==
ApiConst
::
returnTypeNotRetur
n
){
return
OrderConst
::
sellerAgreeReturn
;
}
if
(
$returnRefund
[
're
fundType'
]
==
ApiConst
::
refundTypeMoney
){
return
OrderConst
::
sellerRefus
e
;
if
(
$returnRefund
[
're
turnType'
]
==
ApiConst
::
returnTypeMustReturn
){
return
OrderConst
::
waitSellerReciev
e
;
}
if
(
$returnRefund
[
'refundType'
]
==
ApiConst
::
refundTypeGoods
){
return
OrderConst
::
sellerRefuseGoods
;
}
}
}
if
(
$returnRefund
[
'sellerState'
]
==
ApiConst
::
refundSellerRefuse
){
if
(
$returnRefund
[
'isSucRefund'
]
==
ApiConst
::
refundSuccess
){
return
OrderConst
::
alreadyReufndMoney
;
}
if
(
$returnRefund
[
'platformState'
]
==
ApiConst
::
platAgree
){
return
OrderConst
::
platFormAgree
;
}
if
(
$returnRefund
[
'platformState'
]
==
ApiConst
::
platRefuse
){
return
OrderConst
::
platFormRefuse
;
}
if
(
$returnRefund
[
'isPlatformIn'
]
==
ApiConst
::
platIn
){
return
OrderConst
::
platFromProccess
;
}
if
(
$returnRefund
[
'refundType'
]
==
ApiConst
::
refundTypeMoney
){
return
OrderConst
::
sellerRefuse
;
}
if
(
$returnRefund
[
'refundType'
]
==
ApiConst
::
refundTypeGoods
){
return
OrderConst
::
sellerRefuseGoods
;
}
}
// }else{
// return OrderConst::refoundSuccess;
// }
...
...
@@ -240,11 +240,11 @@ class RefundReturnModel extends \DAO\AbstractModel {
*/
public
function
isPlatformIn
(
$refundInfo
){
if
((
$refundInfo
[
'isPlatformIn'
]
==
ApiConst
::
platNotIn
&&
(
$refundInfo
[
'sellerState'
]
==
ApiConst
::
refundSellerRefuse
)
||
$refundInfo
[
'buyerRefundAmount'
]
>
$refundInfo
[
'refundAmount'
])){
return
TRUE
;
}
else
{
return
FALSE
;
}
if
((
$refundInfo
[
'isPlatformIn'
]
==
ApiConst
::
platNotIn
&&
(
$refundInfo
[
'sellerState'
]
==
ApiConst
::
refundSellerRefuse
)
||
$refundInfo
[
'buyerRefundAmount'
]
>
$refundInfo
[
'refundAmount'
])){
return
TRUE
;
}
else
{
return
FALSE
;
}
}
/**
* 根据订单状态判断是否可以退款退货
...
...
@@ -489,7 +489,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
'type'
=>
$type
,
'refund_sn'
=>
$refund_array
[
'refund_sn'
]
);
// QueueClient::push('sendStoreMsg', $param);
// QueueClient::push('sendStoreMsg', $param);
return
$refund_id
;
}
...
...
@@ -515,12 +515,27 @@ class RefundReturnModel extends \DAO\AbstractModel {
$this
->
deleteFindByOrderIdCache
(
$refundId
);
}
}
// public function editOrderUnlock($order_id) {
// $order_id = intval($order_id);
// if ($order_id > 0) {
// $condition = array();
// $condition['order_id'] = $order_id;
// $condition['lock_state'] = array('egt','1');
// $data = array();
// $data['lock_state'] = array('exp','lock_state-1');
// $data['delay_time'] = time();
// $model_order =\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
// $result = $model_order->update($condition,$data);
// return $result;
// }
// return false;
// }
/**
*获得退货退款列表
*
* @var \DAO\getList
*/
public
function
getList
(
$where
,
$field
,
$pageIndex
,
$
pageSize
,
$order
=
array
(
'add_time'
=>
'desc'
))
public
function
getList
(
$where
,
$field
,
$pageIndex
=
ApiConst
::
zero
,
$pageSize
=
ApiConst
::
pageSize
,
$order
=
array
(
'add_time'
=>
'desc'
))
{
$this
->
setDb
(
$this
->
dbName
);
$refunds
=
$this
->
lists
(
$where
,
$order
,
$field
,
$pageIndex
,
$pageSize
);
...
...
@@ -535,6 +550,44 @@ class RefundReturnModel extends \DAO\AbstractModel {
return
$returnType
;
}
public
function
getRefundOperateState
(
$operate
,
$refund_info
,
$order_info
=
null
)
{
if
(
!
is_array
(
$refund_info
)
||
empty
(
$refund_info
))
return
false
;
switch
(
$operate
){
//选择配送员
case
'select_deliveryman'
:
$state
=
(
$refund_info
[
'refund_shipping_type'
]
==
1
&&
$refund_info
[
'return_type'
]
==
2
&&
$refund_info
[
'goods_state'
]
==
2
&&
(
$refund_info
[
'seller_state'
]
==
2
||
$refund_info
[
'platform_state'
]
==
1
));
break
;
//收货
case
'take_delivery'
:
$state
=
(
$refund_info
[
'return_type'
]
==
2
&&
$refund_info
[
'goods_state'
]
==
2
&&
(
$refund_info
[
'seller_state'
]
==
2
||
$refund_info
[
'platform_state'
]
==
1
));
//修改退款金额/处理
break
;
case
'change_refund'
:
$state
=
(
$refund_info
[
'seller_state'
]
==
1
);
break
;
//退货
case
'return_goods'
:
$state
=
(
$refund_info
[
'seller_state'
]
==
1
&&
$refund_info
[
'refund_type'
]
==
2
);
break
;
//退款
case
'return_money'
:
$state
=
(
$refund_info
[
'seller_state'
]
==
1
&&
$refund_info
[
'refund_type'
]
==
1
);
break
;
//修改收货时间
case
'change_time'
:
$state
=
(
!
$refund_info
[
'receive_time'
]
&&
$refund_info
[
'refund_shipping_type'
]
==
1
&&
$refund_info
[
'return_type'
]
==
2
&&
$refund_info
[
'goods_state'
]
==
2
&&
(
$refund_info
[
'seller_state'
]
==
2
||
$refund_info
[
'platform_state'
]
==
1
));
break
;
//原路退回
case
'return_origin'
:
$state
=
(
$refund_info
[
'refund_type'
]
==
1
||
(
$refund_info
[
'refund_type'
]
==
2
&&
$refund_info
[
'goods_state'
]
==
4
))
&&
$refund_info
[
'is_suc_refund'
]
==
0
&&
(
$refund_info
[
'seller_state'
]
==
2
||
$refund_info
[
'platform_state'
]
==
1
)
&&
(
$order_info
&&
$order_info
[
'payment_type'
]
!=
0
&&
$order_info
[
'payment_type'
]
!=
2
);
break
;
//标记为已退款
case
'mark'
:
$state
=
(
$refund_info
[
'refund_type'
]
==
1
||
(
$refund_info
[
'refund_type'
]
==
2
&&
$refund_info
[
'goods_state'
]
==
4
))
&&
$refund_info
[
'is_suc_refund'
]
==
0
&&
(
$refund_info
[
'seller_state'
]
==
2
||
$refund_info
[
'platform_state'
]
==
1
)
&&
(
$order_info
&&
(
$order_info
[
'payment_type'
]
==
0
||
$order_info
[
'payment_type'
]
==
2
))
;
break
;
}
return
$state
;
}
public
function
getMemberStoreStaticsByGmtUpdate
(
$gmtUpdate
,
$pageIndex
,
$pageSize
){
$this
->
setDb
(
$this
->
dbName
);
$where
=
\Our\Common
::
format
(
' gmt_update>={0} and gmt_update<{1} and refund_state={2}'
,
$gmtUpdate
,
TIMESTAMP
,
ApiConst
::
refundStateComplete
);
...
...
@@ -587,13 +640,14 @@ class RefundReturnModel extends \DAO\AbstractModel {
//获得售后待处理订单条件
public
function
getProccessOrderBySeller
(
$id
){
$where
[
'store_id'
]
=
$id
;
$where
[
'
refund
_state'
]
=
ApiConst
::
refundSellerVerify
;
$where
[
'
seller
_state'
]
=
ApiConst
::
refundSellerVerify
;
return
$where
;
}
//获得售后待收货订单条件
public
function
getReturnWaitReceive
(
$id
){
$where
[
'store_id'
]
=
$id
;
$where
[
'refund_type'
]
=
ApiConst
::
refundTypeGoods
;
$where
[
'return_type'
]
=
ApiConst
::
returnTypeMustReturn
;
$where
[
'goods_state'
]
=
ApiConst
::
goodsStateWaitRecieve
;
return
$where
;
}
...
...
application/models/DAO/PBundling.php
View file @
475ad9c8
...
...
@@ -81,7 +81,6 @@ class PBundlingModel extends \DAO\AbstractModel {
public
function
findById
(
$blId
,
$field
=
\Our\NameConst
::
allField
){
$where
[
'bl_id'
]
=
$blId
;
$data
=
$this
->
find
(
$where
,
$field
);
return
$data
;
}
...
...
application/models/DAO/PBundlingGoods.php
View file @
475ad9c8
...
...
@@ -37,6 +37,7 @@ class PBundlingGoodsModel extends \DAO\AbstractModel {
$this
->
setDb
(
$this
->
dbName
);
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
join
(
'han_p_bundling_goods'
,
"han_p_bundling_goods.bl_id = han_p_bundling.bl_id"
,
'inner'
)
->
where
(
$where
)
->
where
(
"bl_quota_starttime <= "
.
time
())
->
where
(
'bl_quota_endtime >= '
.
time
())
->
where
(
'bl_state=1'
)
->
limit
(
$limit
)
->
fetchAll
();
}
/**
* 类实例
*
...
...
application/models/Error/CodeConfig.php
View file @
475ad9c8
...
...
@@ -315,7 +315,9 @@ class CodeConfigModel
const
orderWxPayError
=
30137
;
const
orderWxPaySignError
=
30138
;
const
wrongRefundState
=
300139
;
const
updateIsRefundFail
=
300140
;
const
updateRefundStateNameFail
=
300141
;
//店铺相关错误码
//商品分类
...
...
@@ -811,6 +813,9 @@ class CodeConfigModel
self
::
selfGoodsForStoreOrder
=>
'店主不能购买自己的商品'
,
self
::
orderWxPayError
=>
'微信支付尚未开通'
,
self
::
orderWxPaySignError
=>
'微信支付签名错误'
,
self
::
wrongRefundState
=>
'订单状态有误'
,
self
::
updateIsRefundFail
=>
'更新is_refund失败'
,
self
::
updateRefundStateNameFail
=>
'更新order表refund_state_name失败'
,
//销售员
self
::
emptySaleGoodsId
=>
'商品id不能为空'
,
self
::
emptySaleGoods
=>
'销售商品不存在'
,
...
...
application/modules/Client/controllers/Shopkeeper.php
View file @
475ad9c8
...
...
@@ -202,16 +202,16 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
* 查询配送员
*
*/
public
function
searchDeliveryAction
(){
$shopkeeperService
=
\Business\Store\ShopkeeperServiceModel
::
getInstance
();
$res
=
$shopkeeperService
->
getDiliveryMan
(
$this
->
req
[
'data'
][
'mobile'
]);
$res
=
$res
?
$res
:
new
\stdClass
();
$this
->
success
(
$res
,
\Our\DescribeConst
::
successMessage
);
}
/**
* 单一属性商品库存预警
* @author king
*/
public
function
searchDeliveryAction
(){
$shopkeeperService
=
\Business\Store\ShopkeeperServiceModel
::
getInstance
();
$res
=
$shopkeeperService
->
getDiliveryMan
(
$this
->
req
[
'data'
][
'mobile'
]);
$res
=
$res
?
$res
:
new
\stdClass
();
$this
->
success
(
$res
,
\Our\DescribeConst
::
successMessage
);
}
/**
* 单一属性商品库存预警
* @author king
*/
public
function
warningAction
(){
$goodsCommonService
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
();
$pageIndex
=
$this
->
getPageIndex
();
...
...
@@ -259,8 +259,13 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$refundService
=
\Business\Order\RefundServiceModel
::
getInstance
();
$refundAmount
=
floatval
(
$this
->
req
[
'data'
][
'refundAmount'
]);
$text
=
trim
(
$this
->
req
[
'data'
][
'text'
]);
$res
=
$refundService
->
refund
(
$this
->
storeId
,
$this
->
sellerId
,
$this
->
sellerName
,
$refundId
,
$refundAmount
,
$text
);
$this
->
success
(
$res
);
$isGiveUp
=
$this
->
req
[
'data'
][
'isGiveUp'
]
?
$this
->
req
[
'data'
][
'isGiveUp'
]
:
\Our\ApiConst
::
zero
;
$res
=
$refundService
->
refund
(
$this
->
storeId
,
$this
->
sellerId
,
$this
->
sellerName
,
$refundId
,
$refundAmount
,
$text
,
\Our\ApiConst
::
refundSellerAgree
,
$isGiveUp
);
if
(
$res
){
$this
->
success
(
'操作成功'
);
}
ErrorModel
::
throwException
(
CodeConfigModel
::
commonError
);
}
/**
...
...
@@ -278,9 +283,9 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
}
/**
* 确认收货
* @throws Exception
*/
* 确认收货
* @throws Exception
*/
public
function
confirmReceiveAction
(){
$refundId
=
intval
(
$this
->
req
[
'data'
][
'refundId'
]);
if
(
!
$refundId
)
{
...
...
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