作者 sgj
1 个管道 的构建 通过 耗费 1 秒

add the user charge notify

@@ -589,7 +589,6 @@ class OrderController extends HomeBaseController{ @@ -589,7 +589,6 @@ class OrderController extends HomeBaseController{
589 } 589 }
590 590
591 591
592 -  
593 //支付回调接口 592 //支付回调接口
594 public function notify(){ 593 public function notify(){
595 $param = $this->request->param(); 594 $param = $this->request->param();
@@ -605,9 +604,19 @@ class OrderController extends HomeBaseController{ @@ -605,9 +604,19 @@ class OrderController extends HomeBaseController{
605 //支付成功回调后变更订单状态 604 //支付成功回调后变更订单状态
606 $mySign = $wxPay->getSign($data); 605 $mySign = $wxPay->getSign($data);
607 $order_no =substr($data['out_trade_no'], 0, -4); 606 $order_no =substr($data['out_trade_no'], 0, -4);
  607 + $order=\db('order')->where(['order_no'=>$order_no])->find();
608 if ($Sign===$mySign && $data['return_code'] == 'SUCCESS') { 608 if ($Sign===$mySign && $data['return_code'] == 'SUCCESS') {
609 try{ 609 try{
610 Db::name('order')->where(['order_no'=>$order_no])->update(['state'=>3]); 610 Db::name('order')->where(['order_no'=>$order_no])->update(['state'=>3]);
  611 + if ($order['type']==2){
  612 + /*用户加积分*/
  613 + \db('users')->where(['id'=>$order['users_id']])->setInc('fee',$order['price']);
  614 + /*记录信息*/
  615 + $log_insert['user_id']=$order['users_id'];
  616 + $log_insert['fee']=$order['price'];
  617 + $log_insert['type']=1;
  618 + \db('fee_log')->insert($log_insert);
  619 + }
611 }catch (\Exception $exception){ 620 }catch (\Exception $exception){
612 $this->apiResponse(301,'error:'.$exception->getMessage()); 621 $this->apiResponse(301,'error:'.$exception->getMessage());
613 } 622 }