first commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/18
|
||||
* Time: 10:49
|
||||
*/
|
||||
|
||||
namespace app\api\service;
|
||||
use app\api\model\Order as OrderModel;
|
||||
use think\Exception;
|
||||
use think\facade\Log;
|
||||
|
||||
require 'D:/wwwroot/www.zhiyuanhelp.com/extend/WxPay/WxPay.Api.php';
|
||||
class WxNotify extends \WxPayNotify
|
||||
{
|
||||
public function NotifyProcess($data, &$msg){
|
||||
if($data['result_code'] == 'SUCCESS'){
|
||||
$orderNo = $data['out_trade_no'];
|
||||
try{
|
||||
$order = OrderModel::where('ord_no','=',$orderNo)->find();
|
||||
//修改订单状态
|
||||
$resUpdate = $this->updateOrderStatus($order['id']);
|
||||
if($resUpdate){
|
||||
return true;
|
||||
}
|
||||
}catch (Exception $e){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//更改状态
|
||||
private function updateOrderStatus($orderID){
|
||||
OrderModel::where('id','=',$orderID)
|
||||
->update(['status'=>1,'pay_way'=>1,'pay_time'=>time()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user