作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

争议由平台决定钱的去向

@@ -4,6 +4,7 @@ namespace app\admin\controller\order; @@ -4,6 +4,7 @@ namespace app\admin\controller\order;
4 4
5 use app\api\controller\PrivateNumber; 5 use app\api\controller\PrivateNumber;
6 use app\api\model\PrivateNumber as PrivateNumberModel; 6 use app\api\model\PrivateNumber as PrivateNumberModel;
  7 +use app\api\model\User;
7 use app\common\controller\Backend; 8 use app\common\controller\Backend;
8 use app\common\controller\Wechat; 9 use app\common\controller\Wechat;
9 use app\admin\model\Third; 10 use app\admin\model\Third;
@@ -166,28 +167,22 @@ class Dispute extends Backend @@ -166,28 +167,22 @@ class Dispute extends Backend
166 $grab->status = '6'; 167 $grab->status = '6';
167 $grab->save(); 168 $grab->save();
168 169
169 -// // 退定金到发单人余额  
170 -// \app\api\model\User::money($order['deposit'],$order['user_id'],'售后已完成',['order_id'=>$row['order_id']]);  
171 - // 退款  
172 - $Wecaht = new Wechat();  
173 - if(!$Wecaht->refund($order,'售后已完成')){  
174 - $this->error($Wecaht->getError()); 170 + if($params['status'] == '1') { // 同意
  171 + // 退款
  172 + $Wecaht = new Wechat();
  173 + if (!$Wecaht->refund($order, '售后已完成')) {
  174 + $this->error($Wecaht->getError());
  175 + }
  176 + }else{ //拒绝
  177 + // 添加抢单价格到抢单用户余额
  178 + User::money($grab['grab_price'],$grab['user_id'],'售后已完成',['order_id' => $order['id']]);
  179 + // 把定金多余金额退回发单用户余额
  180 + if($order['deposit'] > $grab['grab_price']){
  181 + $dec = $order['deposit'] - $grab['grab_price'];
  182 + User::money($dec,$order['user_id'],'退定金余额',['order_id' => $order['id']]);
  183 + }
175 } 184 }
176 185
177 -// // 退款成功通知  
178 -// $send_data = [  
179 -// "first" => '亲,您的订单已成功退款,请稍候查收。',  
180 -// "keyword1" => $order['order_sn'],  
181 -// "keyword2" => $order['license_plate'],  
182 -// "keyword3" => $order['deposit'],  
183 -// "keyword4" => '退款成功',  
184 -// "remark" => ['请点击查看详情','#FF0000'],  
185 -// ];  
186 -// $openid = Third::where('user_id',$order['user_id'])->value('openid');  
187 -// $templateid = config('tmplmsg.template')['refund_success'];  
188 -// $url = config('tmplmsg.vue_url').'/wallet';  
189 -// (new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);  
190 -  
191 // 解绑隐私通话 186 // 解绑隐私通话
192 \app\api\controller\Order::unbindPrivateNumber($row['order_id']); 187 \app\api\controller\Order::unbindPrivateNumber($row['order_id']);
193 188