微信授权
This commit is contained in:
@@ -54,7 +54,8 @@ class Wechat
|
||||
public function code()
|
||||
{
|
||||
$this->initWechat();
|
||||
$user = $this->app->oauth->user();
|
||||
$code = Request::get('code');
|
||||
$user = $this->app->oauth->userFromCode($code);
|
||||
$callback = Request::get('callback');
|
||||
|
||||
$user = AppUser::where('openid', $user->getId())->find();
|
||||
@@ -94,9 +95,13 @@ class Wechat
|
||||
|
||||
$order = \app\model\Order::find($orderId);
|
||||
|
||||
if(empty($order)) exit('订单信息不存在');
|
||||
if (empty($order)) {
|
||||
exit('订单信息不存在');
|
||||
}
|
||||
|
||||
if(\app\model\Order::where(["user_id"=>$order['userid'],"student_id"=>$order['student_id'],"status"=>1])->find()){
|
||||
if (\app\model\Order::where([
|
||||
"user_id" => $order['userid'], "student_id" => $order['student_id'], "status" => 1
|
||||
])->find()) {
|
||||
exit('已经为该孩子助力过了');
|
||||
}
|
||||
|
||||
@@ -147,12 +152,12 @@ class Wechat
|
||||
$order->paid();
|
||||
|
||||
//订单支付成功。查询用户信息
|
||||
$order_detail = \app\model\Order::where("id",$order->order_id)->find();
|
||||
$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();
|
||||
Db::name("student")->inc("hot_count",1)->where("id",$order_detail->id)->update();
|
||||
$zhuLi = env("ZHULI_VALUE") ?? 150;
|
||||
Db::name("student")->inc("hot", $zhuLi)->where("id", $order_detail->id)->update();
|
||||
Db::name("student")->inc("hot_count", 1)->where("id", $order_detail->id)->update();
|
||||
|
||||
} else {
|
||||
$fail('Order not exists.');
|
||||
|
||||
Reference in New Issue
Block a user