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, '成功'); }