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

add the user charge notify

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