作者 郭文星

123

@@ -82,13 +82,21 @@ class Order extends Backend @@ -82,13 +82,21 @@ class Order extends Backend
82 82
83 public function refund($id) 83 public function refund($id)
84 { 84 {
85 - $res=$this->refundSendMessage($id);  
86 - print_r($res);return; 85 +
87 //查询订单 86 //查询订单
88 $order = Db::name("order")->where("id", $id)->find(); 87 $order = Db::name("order")->where("id", $id)->find();
89 if ($order['is_pay'] != 1) { 88 if ($order['is_pay'] != 1) {
90 $this->error("该订单无法退款"); 89 $this->error("该订单无法退款");
91 } 90 }
  91 + if($order['pay_type']="offlinepay"){
  92 + $relogs['update_time'] = time();
  93 + $relogs['is_pay'] = 3;
  94 + $relogs['refund_time'] = time();
  95 + $rs2 = Db::name('order')
  96 + ->where(['id' => $order['id']])
  97 + ->update($relogs);
  98 + $this->success("退款成功");
  99 + }
92 //拼接退款参数 100 //拼接退款参数
93 $pay_fee = $order['price']; 101 $pay_fee = $order['price'];
94 $refund_fee = $pay_fee; 102 $refund_fee = $pay_fee;
@@ -165,6 +165,29 @@ if (!function_exists('getOrderSn')) { @@ -165,6 +165,29 @@ if (!function_exists('getOrderSn')) {
165 } 165 }
166 } 166 }
167 } 167 }
  168 + if(!function_exists('OrderSendMessage')){
  169 + /**
  170 + * 发送模板消息
  171 + * @return void
  172 + * @throws \think\db\exception\DataNotFoundException
  173 + * @throws \think\db\exception\ModelNotFoundException
  174 + * @throws \think\exception\DbException
  175 + */
  176 + function OrderSendMessage($order_id){
  177 + $order=\think\Db::name("order")->find($order_id);
  178 + $wxxcxpush=new WxxcxPush();
  179 + $user=new User();
  180 + $user=$user->find($order['user_id']);
  181 + $driver=new \app\admin\model\Driver();
  182 + $driver=$driver->find($order['driver_id']);
  183 + $driver_user=$user->find($driver['user_id']);
  184 + $res=$wxxcxpush->Message($driver_user['wx_xcx_openid'],$order_id);
  185 + $res=$wxxcxpush->Message($user['wx_xcx_openid'],$order_id);
  186 + if ($res !== false) {
  187 + return $res;
  188 + }
  189 + }
  190 + }
168 191
169 192
170 if(!function_exists('beingPushed')){ 193 if(!function_exists('beingPushed')){
@@ -1615,7 +1615,7 @@ class Car extends Base @@ -1615,7 +1615,7 @@ class Car extends Base
1615 $this->success("请求成功",$data); 1615 $this->success("请求成功",$data);
1616 } 1616 }
1617 public function SendMessage($id){ 1617 public function SendMessage($id){
1618 - $res=SendMessage($id); 1618 + $res=OrderSendMessage($id);
1619 $this->success("推送成功",$res); 1619 $this->success("推送成功",$res);
1620 } 1620 }
1621 1621
@@ -46,3 +46,4 @@ @@ -46,3 +46,4 @@
46 2024-06-05 17:35:07《196》"{\"errcode\":40003,\"errmsg\":\"invalid openid rid: 6660314b-736be89e-400147ed\"}" 46 2024-06-05 17:35:07《196》"{\"errcode\":40003,\"errmsg\":\"invalid openid rid: 6660314b-736be89e-400147ed\"}"
47 2024-06-06 11:50:39《224》"{\"errcode\":0,\"errmsg\":\"ok\",\"msgid\":3490559665207672840}" 47 2024-06-06 11:50:39《224》"{\"errcode\":0,\"errmsg\":\"ok\",\"msgid\":3490559665207672840}"
48 2024-06-06 11:51:16《224》"{\"errcode\":0,\"errmsg\":\"ok\",\"msgid\":3490560289051672577}" 48 2024-06-06 11:51:16《224》"{\"errcode\":0,\"errmsg\":\"ok\",\"msgid\":3490560289051672577}"
  49 +2024-06-06 11:53:30《224》"{\"errcode\":0,\"errmsg\":\"ok\",\"msgid\":3490562533994168330}"