Files
CompanyProject/芳林公司项目/www.zhiyuanhelp.com/application/api/service/WxNotify.php
2024-09-27 01:32:49 +08:00

43 lines
1.0 KiB
PHP

<?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()]);
}
}