This commit is contained in:
尖叫 2023-12-08 17:01:53 +08:00
parent d572738c97
commit 4c8b8df824

View File

@ -135,12 +135,15 @@ class User extends Controller
public function getWxUserCoupon() public function getWxUserCoupon()
{ {
$post = $this->request->get(); $post = $this->request->get();
$where = [
'openid' => $post['openid'], if (isset($post['coupon_id'])) {
]; $where['coupon_user_id'] = $post['coupon_id'];
if (isset($post['id'])) {
$where['coupon_user_id'] = $post['id'];
} }
if (isset($post['openid'])) {
$where['openid'] = $post['openid'];
}
$data = Db::name('food_coupon_user_wx')->where($where)->select(); $data = Db::name('food_coupon_user_wx')->where($where)->select();
return $this->renderSuccess($data, '成功'); return $this->renderSuccess($data, '成功');
} }
@ -200,9 +203,6 @@ class User extends Controller
return $this->renderError('授权失败'); return $this->renderError('授权失败');
} }
$coupon_id = $_GET['coupon_id'] ?? ''; $coupon_id = $_GET['coupon_id'] ?? '';
write_log($coupon_id, __DIR__);
$appid = 'wx89c12dd426a55a2e'; $appid = 'wx89c12dd426a55a2e';
$app_secret = '33e66bcf944f9810abbb5ddd7825403d'; $app_secret = '33e66bcf944f9810abbb5ddd7825403d';
$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$app_secret&code={$get['code']}&grant_type=authorization_code"; $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$app_secret&code={$get['code']}&grant_type=authorization_code";
@ -229,9 +229,6 @@ class User extends Controller
$url = 'https://app.cxhxy.h5.dev.1nww.com/#/?openid=' . $openid; $url = 'https://app.cxhxy.h5.dev.1nww.com/#/?openid=' . $openid;
} }
write_log($url, __DIR__);
return redirect($url); return redirect($url);
} }
} }