|
|
@@ -45,7 +45,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
$detail['timestamp'] = time();
|
|
|
$detail['goods'] = self::getEquityGoods($detail['equity_id']);
|
|
|
//查询用户是否已有付款订单
|
|
|
- $detail['order'] = GroupUserOrder::with('group_order')->where(['user_id'=>$userId,'group_activity_id'=>$id,'pay_status'=>1])->where('refund_status','<>',1)->field('id,status,pay_way,pay_time,pay_status,remark,create_time,group_order_id')->findOrEmpty()->toArray();
|
|
|
+ $detail['order'] = GroupUserOrder::with('group_order')->where(['user_id'=>$userId,'group_activity_id'=>$id,'pay_status'=>1])->where('refund_status','<>',1)->field('id,status,num,pay_way,pay_time,pay_status,remark,create_time,group_order_id')->findOrEmpty()->toArray();
|
|
|
}
|
|
|
|
|
|
return $detail;
|
|
|
@@ -77,7 +77,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
$detail['users'] = GroupUserOrder::alias('a')
|
|
|
->leftJoin('user b','a.user_id=b.id')
|
|
|
->where(['a.group_order_id'=>$order_id,'a.status'=>1])
|
|
|
- ->field(['a.id','a.user_id','a.status','a.create_time','b.avatar','b.nickname'])
|
|
|
+ ->field(['a.id','a.user_id','a.status','a.num','a.create_time','b.avatar','b.nickname'])
|
|
|
->order('a.create_time','asc')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
@@ -125,7 +125,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
* @notes 用户订单详情
|
|
|
*/
|
|
|
public static function userOrderDetail($order_id,$userId){
|
|
|
- $detail = GroupUserOrder::with('groupOrder')->where(['id'=>$order_id, 'user_id' => $userId])->field('id,mobile,sn,status,pay_way,pay_time,pay_status,refund_status,remark,create_time,group_order_id,group_activity_id,user_equity_id,area,address')->findOrEmpty()->toArray();
|
|
|
+ $detail = GroupUserOrder::with('groupOrder')->where(['id'=>$order_id, 'user_id' => $userId])->field('id,mobile,sn,status,num,pay_way,pay_time,pay_status,refund_status,remark,create_time,group_order_id,group_activity_id,user_equity_id,area,address')->findOrEmpty()->toArray();
|
|
|
if ($detail) {
|
|
|
$detail['is_refund'] = 0;
|
|
|
if ($detail['pay_status'] == 1 && $detail['refund_status'] == 0) {
|
|
|
@@ -277,7 +277,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
$order = GroupUserOrder::where([
|
|
|
'user_id' => $params['user_id'],
|
|
|
'id'=>$params['order_id']
|
|
|
- ])->field('id,group_order_id,sn,status,order_amount,pay_status,pay_way,user_equity_id,user_id,order_terminal,transaction_id')->findOrEmpty()->toArray();
|
|
|
+ ])->field('id,group_order_id,sn,status,num,order_amount,pay_status,pay_way,user_equity_id,user_id,order_terminal,transaction_id')->findOrEmpty()->toArray();
|
|
|
if(empty($order)){
|
|
|
throw new Exception('订单不存在');
|
|
|
}
|
|
|
@@ -300,7 +300,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
|
|
|
//更新拼团订单
|
|
|
GroupOrder::where('id',$order['group_order_id'])->update([
|
|
|
- 'num' => Db::raw('num-1'),
|
|
|
+ 'num' => Db::raw('num-'.$order['num']),
|
|
|
]);
|
|
|
|
|
|
// 生成退款记录
|
|
|
@@ -311,15 +311,15 @@ class GroupActivityLogic extends BaseLogic
|
|
|
'order_id' => $order['id'],
|
|
|
'order_sn' => $order['sn'],
|
|
|
'order_type' => RefundEnum::ORDER_TYPE_GROUP,
|
|
|
- 'order_amount' => $order['order_amount'],
|
|
|
- 'refund_amount' => $order['order_amount'],
|
|
|
+ 'order_amount' => $order['paid_amount'],
|
|
|
+ 'refund_amount' => $order['paid_amount'],
|
|
|
'refund_type' => RefundEnum::TYPE_ADMIN,
|
|
|
'transaction_id' => $order['transaction_id'] ?? '',
|
|
|
'refund_way' => RefundEnum::getRefundWayByPayWay($order['pay_way']),
|
|
|
]);
|
|
|
|
|
|
// 退款
|
|
|
- $result = RefundLogic::refund($order, $record['id'], $order['order_amount'], 1);
|
|
|
+ $result = RefundLogic::refund($order, $record['id'], $order['paid_amount'], 1);
|
|
|
|
|
|
$flag = true;
|
|
|
$resultMsg = '退款成功';
|