...
|
...
|
@@ -18,7 +18,7 @@ use think\Db; |
|
|
*/
|
|
|
class Order extends Api
|
|
|
{
|
|
|
protected $noNeedLogin = ['dealAction','grabCountdown','payCountdown','cancelAction','unbindPrivateNumber'];
|
|
|
protected $noNeedLogin = ['dealAction','grabCountdown','payCountdown','cancelAction','payCountdownAction','unbindPrivateNumber'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
public function _initialize()
|
...
|
...
|
@@ -412,8 +412,12 @@ class Order extends Api |
|
|
if($order->grab_success){
|
|
|
$order->grab_success->save(['status'=>'7']);
|
|
|
}
|
|
|
// 变更会员余额
|
|
|
User::money($order['deposit'],$order['user_id'],'取消订单',['order_id' => $order['id']]);
|
|
|
|
|
|
// // 变更会员余额
|
|
|
// User::money($order['deposit'],$order['user_id'],'取消订单',['order_id' => $order['id']]);
|
|
|
// 退款
|
|
|
(new Wechat)->refund($order,'取消订单');
|
|
|
|
|
|
// 取消订单推送
|
|
|
$send_data = [
|
|
|
"first" => '你好,你的订单已经取消。',
|
...
|
...
|
@@ -427,6 +431,7 @@ class Order extends Api |
|
|
$templateid = config('tmplmsg.template')['order_cancel'];
|
|
|
$url = config('tmplmsg.vue_url').'/indentc?id='.$order['id'];
|
|
|
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
|
|
|
|
|
|
// 给发单用户发送"取消订单"通知
|
|
|
(new Message)->save([
|
|
|
'user_id' => $order['user_id'],
|
...
|
...
|
@@ -435,20 +440,23 @@ class Order extends Api |
|
|
'type' => '2',
|
|
|
'order_status' => '4',
|
|
|
]);
|
|
|
// 退款成功通知
|
|
|
$send_data = [
|
|
|
"first" => '亲,您的订单已成功退款,请稍候查收。',
|
|
|
"keyword1" => $order['order_sn'],
|
|
|
"keyword2" => $order['license_plate'],
|
|
|
"keyword3" => $order['deposit'],
|
|
|
"keyword4" => '退款成功',
|
|
|
"remark" => ['请点击查看详情','#FF0000'],
|
|
|
];
|
|
|
$templateid = config('tmplmsg.template')['refund_success'];
|
|
|
$url = config('tmplmsg.vue_url').'/wallet';
|
|
|
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
|
|
|
|
|
|
// // 退款成功通知
|
|
|
// $send_data = [
|
|
|
// "first" => '亲,您的订单已成功退款,请稍候查收。',
|
|
|
// "keyword1" => $order['order_sn'],
|
|
|
// "keyword2" => $order['license_plate'],
|
|
|
// "keyword3" => $order['deposit'],
|
|
|
// "keyword4" => '退款成功',
|
|
|
// "remark" => ['请点击查看详情','#FF0000'],
|
|
|
// ];
|
|
|
// $templateid = config('tmplmsg.template')['refund_success'];
|
|
|
// $url = config('tmplmsg.vue_url').'/wallet';
|
|
|
// (new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
|
|
|
|
|
|
// 解绑隐私通话
|
|
|
self::unbindPrivateNumber($order['id']);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -763,41 +771,59 @@ class Order extends Api |
|
|
"data": null
|
|
|
})
|
|
|
*/
|
|
|
public function payCountdown()
|
|
|
{
|
|
|
$order_id = $this->request->param('order_id');
|
|
|
empty($order_id) && $this->error('缺少必需参数');
|
|
|
$order = $this->model->get($order_id,['grab_success']);
|
|
|
empty($order) && $this->error('订单信息不存在');
|
|
|
$order['status'] != '2' && $this->error('订单不合法');
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$grab = $order['grab_success'];
|
|
|
$score = -10;
|
|
|
// 订单状态改为缴费超时
|
|
|
$grab->save(['status'=>'8','score'=>$score]);
|
|
|
$order->save(['status'=>'8']);
|
|
|
// 给抢单用户发送"缴费超时"通知
|
|
|
(new Message)->save([
|
|
|
'user_id' => $grab['user_id'],
|
|
|
'order_id' => $grab['order_id'],
|
|
|
'order_grab_id' => $grab['id'],
|
|
|
'type' => '1',
|
|
|
'grab_status' => '4',
|
|
|
]);
|
|
|
// 扣10积分
|
|
|
User::score($score,$grab['user_id'],'缴费超时',['order_id'=>$grab['order_id']]);
|
|
|
// 变更会员余额
|
|
|
User::money($order['deposit'],$order['user_id'],'接单人缴费超时',['order_id' => $order_id]);
|
|
|
// 解绑隐私通话
|
|
|
self::unbindPrivateNumber($order['id']);
|
|
|
Db::commit();
|
|
|
} catch (PDOException $e) {
|
|
|
Db::rollback();
|
|
|
} catch (Exception $e) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$this->success('成功');
|
|
|
// public function payCountdown()
|
|
|
// {
|
|
|
// $order_id = $this->request->param('order_id');
|
|
|
// empty($order_id) && $this->error('缺少必需参数');
|
|
|
// $order = $this->model->get($order_id,['grab_success']);
|
|
|
// empty($order) && $this->error('订单信息不存在');
|
|
|
// $order['status'] != '2' && $this->error('订单不合法');
|
|
|
// Db::startTrans();
|
|
|
// try{
|
|
|
// self::payCountdownAction($order);
|
|
|
// Db::commit();
|
|
|
// } catch (PDOException $e) {
|
|
|
// Db::rollback();
|
|
|
// } catch (Exception $e) {
|
|
|
// Db::rollback();
|
|
|
// }
|
|
|
// $this->success('成功');
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* @ApiInternal
|
|
|
* @ApiTitle (缴费倒计时结束-操作)
|
|
|
* @ApiSummary (缴费倒计时结束-操作)
|
|
|
*/
|
|
|
public static function payCountdownAction($order){
|
|
|
$grab = $order['grab_success'];
|
|
|
$score = -10;
|
|
|
|
|
|
// 订单状态改为缴费超时
|
|
|
$grab->save(['status'=>'8','score'=>$score]);
|
|
|
$order->save(['status'=>'8']);
|
|
|
|
|
|
// 给抢单用户发送"缴费超时"通知
|
|
|
(new Message)->save([
|
|
|
'user_id' => $grab['user_id'],
|
|
|
'order_id' => $grab['order_id'],
|
|
|
'order_grab_id' => $grab['id'],
|
|
|
'type' => '1',
|
|
|
'grab_status' => '4',
|
|
|
]);
|
|
|
|
|
|
// 扣10积分
|
|
|
User::score($score,$grab['user_id'],'缴费超时',['order_id'=>$grab['order_id']]);
|
|
|
|
|
|
// // 变更会员余额
|
|
|
// User::money($order['deposit'],$order['user_id'],'接单人缴费超时',['order_id' => $order_id]);
|
|
|
// 退款
|
|
|
(new Wechat)->refund($order,'接单人缴费超时');
|
|
|
|
|
|
// 解绑隐私通话
|
|
|
self::unbindPrivateNumber($order['id']);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|