From 886cfbaf9fe85df1728830eccd25cea8d1e64200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=96=E5=8F=AB?= <392494244@qq.com> Date: Fri, 8 Dec 2023 17:12:31 +0800 Subject: [PATCH] 1 --- app/api/controller/food/User.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/api/controller/food/User.php b/app/api/controller/food/User.php index e892d16..861c0ae 100644 --- a/app/api/controller/food/User.php +++ b/app/api/controller/food/User.php @@ -134,16 +134,20 @@ class User extends Controller */ public function getWxUserCoupon() { - $post = $this->request->get(); + $post = $_GET; - if (isset($post['coupon_id'])) { - $where['coupon_user_id'] = $post['coupon_id']; - } - - if (isset($post['openid'])) { + if (!empty($post['openid'])) { $where['openid'] = $post['openid']; } + if (!empty($post['coupon_id'])) { + $where['coupon_user_id'] = $post['coupon_id']; + if (!empty($where['openid'])) { + unset($where['openid']); + } + } + + $data = Db::name('food_coupon_user_wx')->where($where)->select(); return $this->renderSuccess($data, '成功'); }