正在显示
4 个修改的文件
包含
27 行增加
和
4 行删除
@@ -247,4 +247,25 @@ class Sundry extends Api | @@ -247,4 +247,25 @@ class Sundry extends Api | ||
247 | $data['list'] = explode(',', config('site.recharge')); | 247 | $data['list'] = explode(',', config('site.recharge')); |
248 | $this->success('SUCCESS', $data); | 248 | $this->success('SUCCESS', $data); |
249 | } | 249 | } |
250 | + | ||
251 | + /** | ||
252 | + * @ApiTitle (获取充值会员金额) | ||
253 | + * @ApiSummary (获取充值会员金额) | ||
254 | + * @ApiMethod (POST) | ||
255 | + * @ApiRoute (/api/sundry/getVipPrice) | ||
256 | + * @ApiHeaders (name=token, type=string, required=false, description="请求的Token") | ||
257 | + * @ApiReturn({ | ||
258 | + "code": 1, | ||
259 | + "msg": "SUCCESS", | ||
260 | + "time": "1553839125", | ||
261 | + "data": { | ||
262 | + "id": "id",// 地区id | ||
263 | + "name": "name",// 名称 | ||
264 | + }, | ||
265 | + }) | ||
266 | + */ | ||
267 | + public function getVipPrice() | ||
268 | + { | ||
269 | + $this->success('SUCCESS', config('site.vip_price')); | ||
270 | + } | ||
250 | } | 271 | } |
@@ -30,7 +30,7 @@ class TeamGroup extends Model | @@ -30,7 +30,7 @@ class TeamGroup extends Model | ||
30 | $res1 = $this->where(['id'=>['in',$ids]])->update(['status'=>3]); | 30 | $res1 = $this->where(['id'=>['in',$ids]])->update(['status'=>3]); |
31 | //修改订单表拼团状态 | 31 | //修改订单表拼团状态 |
32 | $res2 = $orderModel->where(['team_group_id'=>['in',$ids]])->update(['team_group_status'=>3]); | 32 | $res2 = $orderModel->where(['team_group_id'=>['in',$ids]])->update(['team_group_status'=>3]); |
33 | - $orderList = $orderModel->where(['team_group_id'=>['in',$ids]])->field('order_num,pay_total,pay_type,user_id')->select(); | 33 | + $orderList = $orderModel->where(['team_group_id'=>['in',$ids]])->field('id,order_num,pay_total,pay_type,user_id')->select(); |
34 | //退款 | 34 | //退款 |
35 | foreach ($orderList as $k => $orderInfo){ | 35 | foreach ($orderList as $k => $orderInfo){ |
36 | if ($orderInfo['pay_type'] == 1){ | 36 | if ($orderInfo['pay_type'] == 1){ |
@@ -38,7 +38,7 @@ class TeamGroup extends Model | @@ -38,7 +38,7 @@ class TeamGroup extends Model | ||
38 | $res3 = $pay->refund($orderInfo['order_num'],$orderInfo['pay_total']); | 38 | $res3 = $pay->refund($orderInfo['order_num'],$orderInfo['pay_total']); |
39 | }else{ | 39 | }else{ |
40 | //余额退款 | 40 | //余额退款 |
41 | - $res3 = $userModel->refund($orderInfo['user_id'],$orderInfo['pay_total']); | 41 | + $res3 = $userModel->refund($orderInfo['user_id'],$orderInfo['pay_total'],$orderInfo['id']); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | if ($res1 && $res2 && $res3){ | 44 | if ($res1 && $res2 && $res3){ |
@@ -125,8 +125,9 @@ class User extends Model | @@ -125,8 +125,9 @@ class User extends Model | ||
125 | * @param $total | 125 | * @param $total |
126 | * @return boolean | 126 | * @return boolean |
127 | */ | 127 | */ |
128 | - public function refund($user_id,$total){ | 128 | + public function refund($user_id,$total,$order_id){ |
129 | $userMoneyLogModel = new UserMoneyLog(); | 129 | $userMoneyLogModel = new UserMoneyLog(); |
130 | + $orderModel = new Order(); | ||
130 | $before = $this->where('id',$user_id)->value('money'); | 131 | $before = $this->where('id',$user_id)->value('money'); |
131 | Db::startTrans(); | 132 | Db::startTrans(); |
132 | try { | 133 | try { |
@@ -139,7 +140,8 @@ class User extends Model | @@ -139,7 +140,8 @@ class User extends Model | ||
139 | ]; | 140 | ]; |
140 | $res1 = $userMoneyLogModel->save($moneyLogData); | 141 | $res1 = $userMoneyLogModel->save($moneyLogData); |
141 | $res2 = $this->where('id',$user_id)->setInc('money',$total); | 142 | $res2 = $this->where('id',$user_id)->setInc('money',$total); |
142 | - if ($res1 && $res2){ | 143 | + $res3 = $orderModel->where('id',$order_id)->update(['status'=>3]); |
144 | + if ($res1 && $res2 && $res3){ | ||
143 | Db::commit(); | 145 | Db::commit(); |
144 | return true; | 146 | return true; |
145 | }else{ | 147 | }else{ |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论