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

隐私号码解绑

... ... @@ -114,6 +114,7 @@ class Dispute extends Backend
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
// 扣除积分
$order = \app\api\model\Order::get($row['order_id']);
$grab = \app\api\model\OrderGrab::get($row['order_grab_id']);
... ... @@ -135,6 +136,7 @@ class Dispute extends Backend
}
$examine_result = '已拒绝您的反馈,订单已取消,扣除您10积分';
}
// 订单处理反馈通知
$send_data = [
"first" => '你好,您的订单反馈已处理',
... ... @@ -153,13 +155,16 @@ class Dispute extends Backend
$url = config('tmplmsg.vue_url').'/indenta?id='.$row['order_grab_id'].'&type=5';
}
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
// 改变订单状态
$order->status = '6';
$order->save();
$grab->status = '6';
$grab->save();
// 退定金到发单人余额
\app\api\model\User::money($order['deposit'],$order['user_id'],'售后已完成',['order_id'=>$row['order_id']]);
// 退款成功通知
$send_data = [
"first" => '亲,您的订单已成功退款,请稍候查收。',
... ... @@ -173,6 +178,11 @@ class Dispute extends Backend
$templateid = config('tmplmsg.template')['refund_success'];
$url = config('tmplmsg.vue_url').'/wallet';
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
// 解绑隐私通话
\app\api\controller\Order::unbindPrivateNumber($order['id']);
// 修改数据
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
... ...
... ... @@ -442,15 +442,7 @@ class Order extends Api
$url = config('tmplmsg.vue_url').'/wallet';
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
// 解绑隐私通话
$has_number = PrivateNumberModel::get(['order_id'=>$order['id']]);
if($has_number){
$count = PrivateNumberModel::where('subscription_id',$has_number['subscription_id'])->count();
if($count > 1){
$has_number->delete();
}else{
(new PrivateNumber)->unbind($has_number['subscription_id']);
}
}
self::unbindPrivateNumber($order['id']);
return true;
}
... ... @@ -640,15 +632,7 @@ class Order extends Api
$url = config('tmplmsg.vue_url').'/indenta?id='.$grab['id'].'&type=4';
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
// 解绑隐私通话
$has_number = PrivateNumberModel::get(['order_id'=>$order['id']]);
if($has_number){
$count = PrivateNumberModel::where('subscription_id',$has_number['subscription_id'])->count();
if($count > 1){
$has_number->delete();
}else{
(new PrivateNumber)->unbind($has_number['subscription_id']);
}
}
self::unbindPrivateNumber($order['id']);
return true;
}
... ... @@ -807,4 +791,25 @@ class Order extends Api
}
$this->success('成功');
}
/**
* @ApiInternal
* 解绑隐私号码
*/
public static function unbindPrivateNumber($order_id){
// 解绑隐私通话
$has_number = PrivateNumberModel::get(['order_id'=>$order_id]);
if($has_number){
$count = PrivateNumberModel::alias('a')
->join('order b','a.order_id = b.id')
->where('a.subscription_id',$has_number['subscription_id'])
->where('b.status','in','2,3,5')
->count();
if($count > 1){
$has_number->delete();
}else{
(new PrivateNumber)->unbind($has_number['subscription_id']);
}
}
}
}
\ No newline at end of file
... ...