From 85fb0dc23d40a418feeab892bdea333da489a02b Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 15 Sep 2022 17:09:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=8C=E6=88=90=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Wechat.php | 5 +---- app/model/Order.php | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controller/Wechat.php b/app/controller/Wechat.php index 442a308..c3bbc70 100644 --- a/app/controller/Wechat.php +++ b/app/controller/Wechat.php @@ -159,10 +159,7 @@ class Wechat //订单支付成功。查询用户信息 $order_detail = \app\model\Order::where("id", $order->order_id)->find(); - - $order_detail->status = 1; - $order_detail->save(); - + $order_detail->paid(); //为用户增加助力值 $zhuLi = env("ZHULI_VALUE") ?? 150; Db::name("student")->inc("hot", $zhuLi)->where("id", $order_detail->id)->update(); diff --git a/app/model/Order.php b/app/model/Order.php index 37f7a5f..1477321 100644 --- a/app/model/Order.php +++ b/app/model/Order.php @@ -7,4 +7,9 @@ use think\Model; class Order extends Model { protected $autoWriteTimestamp = true; + + public function paid(){ + $this->status = 1; + $this->save(); + } } \ No newline at end of file