From a99f0c97f815e71694bf9f9224f7730c9d5a0c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sat, 20 Mar 2021 18:35:33 +0800 Subject: [PATCH] Update OrderService.php --- app/data/service/OrderService.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/data/service/OrderService.php b/app/data/service/OrderService.php index 7b3e06188..6c9750cf7 100644 --- a/app/data/service/OrderService.php +++ b/app/data/service/OrderService.php @@ -84,9 +84,10 @@ class OrderService extends Service $query = $this->app->db->table('shop_order a')->join('shop_order_item b', 'a.order_no=b.order_no'); $count = $query->where("a.uid={$uid} and a.status>=4 and a.payment_status=1 and b.vip_entry>0")->count(); $buyVipEntry = $count > 0 ? 1 : 0; - // 查询用户最后支付时间 + // 用户最后支付时间 + $query = $this->app->db->name('ShopOrder'); $buyLastMap = [['uid', '=', $uid], ['status', '>=', 4], ['payment_status', '=', 1]]; - $buyLastDate = $this->app->db->name('ShopOrder')->where($buyLastMap)->max('payment_datetime'); + $buyLastDate = $query->where($buyLastMap)->order('payment_datetime desc')->value('payment_datetime'); // 更新用户支付信息 $this->app->db->name('DataUser')->where(['id' => $uid])->update([ 'buy_vip_entry' => $buyVipEntry, 'buy_last_date' => $buyLastDate,