fix bug
This commit is contained in:
@@ -7,6 +7,7 @@ use app\model\Payment;
|
||||
use EasyWeChat\Factory;
|
||||
use EasyWeChat\OfficialAccount\Application;
|
||||
use think\facade\Config;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use think\facade\Route;
|
||||
use think\facade\View;
|
||||
@@ -93,6 +94,12 @@ class Wechat
|
||||
|
||||
$order = \app\model\Order::find($orderId);
|
||||
|
||||
if(empty($order)) exit('订单信息不存在');
|
||||
|
||||
if(\app\model\Order::where(["userid"=>$order['userid'],"student_id"=>$order['student_id'],"status"=>1])->find()){
|
||||
exit('已经为该孩子助力过了');
|
||||
}
|
||||
|
||||
$notifyUrl = Route::buildUrl('wechat/paid')
|
||||
->suffix(false)
|
||||
->domain(true)
|
||||
@@ -138,6 +145,14 @@ class Wechat
|
||||
|
||||
if (key_exists('result_code', $message) && $message['result_code'] === 'SUCCESS') {
|
||||
$order->paid();
|
||||
|
||||
//订单支付成功。查询用户信息
|
||||
$order_detail = \app\model\Order::where("id",$order->order_id)->find();
|
||||
|
||||
//为用户增加助力值
|
||||
$zhuLi = env("ZHULI_VALUE")??150;
|
||||
Db::name("student")->inc("hot",$zhuLi)->where("id",$order_detail->id)->update();
|
||||
|
||||
} else {
|
||||
$fail('Order not exists.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user