From a3581f2846c73f53fe2ed9cc3ca33638d874f208 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 22 Dec 2021 13:53:57 +0800 Subject: [PATCH] settter --- app/controller/api/Coupon.php | 2 ++ app/controller/manager/Coupon.php | 1 + app/repository/CommentRepository.php | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index a5d72fc..6483700 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -177,6 +177,7 @@ class Coupon extends Base $whereMap[] = ['consumer_code', '=', $accountCode]; $whereMap[] = ['business_code', '=', $businessCode]; $whereMap[] = ['is_verificated', '=', CouponModel::is_verificated_off]; + $whereMap[] = ['end_time', '> TIME', date("Y-m-d H:i:s")]; $sortOrder = ['sort_weight' => 'desc', 'end_time' => 'asc']; $res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){ @@ -689,6 +690,7 @@ class Coupon extends Base try { $couponMain->save($couponMainData); $couponMain->usingRule->save($usingRule); + CouponRepository::getInstance()->getModel()->where("coupon_id",$couponMain->id)->update(["end_time"=>$couponMainData["end_time"]." 00:00:00"]); Db::commit(); return $this->json(); } catch (RepositoryException $e) { diff --git a/app/controller/manager/Coupon.php b/app/controller/manager/Coupon.php index 970de6c..8ee8781 100644 --- a/app/controller/manager/Coupon.php +++ b/app/controller/manager/Coupon.php @@ -344,6 +344,7 @@ class Coupon extends Base try { $couponMain->save($data); $couponMain->usingRule->save($usingRule); + CouponRepository::getInstance()->getModel()->where("coupon_id",$couponMain->id)->update(["end_time"=>$data["end_time"]." 00:00:00"]); Db::commit(); return $this->json(); } catch (RepositoryException $e) { diff --git a/app/repository/CommentRepository.php b/app/repository/CommentRepository.php index 29df4b9..edac32f 100644 --- a/app/repository/CommentRepository.php +++ b/app/repository/CommentRepository.php @@ -34,7 +34,8 @@ class CommentRepository extends Repository ->where(function ($q){ $q->whereOr( [ - ["b.blank_time","=","null"], +// ["b.blank_time","=","null"], + ["b.blank_time","=",null], ["b.blank_time","=",""], ["b.blank_time","<",date("Y-m-d H:i:s")], ]