From add71f3d4c71f55642943768749580c8d7db2bae Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Fri, 25 Jun 2021 15:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.php | 2 ++ src/Action/CouponAction.php | 33 ++++++++++++++++++++++++++++++++- src/Action/Init.php | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index 6db1e82..1a846a1 100644 --- a/config/config.php +++ b/config/config.php @@ -18,6 +18,7 @@ return [ 'tokenUri' => 'https://open.cyzl.com/beta/auth/oauth/token', 'baseUri' => 'https://open.cyzl.com/beta/api', 'urlKey' => env('WASH_CAR_URLKEY', ''),//免登陆跳转 + 'infoUrl' => env('WASH_CAR_INFOURL', ''),//优惠券详情地址 ], /** @@ -31,6 +32,7 @@ return [ 'tokenUri' => 'https://open.cyzl.com/api/auth/oauth/token', 'baseUri' => 'https://open.cyzl.com/api', 'urlKey' => env('WASH_CAR_URLKEY', ''),//免登陆跳转 + 'infoUrl' => env('WASH_CAR_INFOURL', ''),//优惠券详情地址 ], ]; diff --git a/src/Action/CouponAction.php b/src/Action/CouponAction.php index 0ece0d5..c23008f 100644 --- a/src/Action/CouponAction.php +++ b/src/Action/CouponAction.php @@ -12,7 +12,7 @@ class CouponAction extends Init */ public function getOrderUrl() { - $url = $this->config['baseUri'] . '/v2/h5/redirect/autoLogin/returnUrl'; + $url = $this->config['baseUri'] . '/v2/h5/redirect/autoLogin/commonReturnUrl'; $this->params = array_merge($this->params, [ 'urlKey' => $this->config['urlKey'], @@ -25,6 +25,37 @@ class CouponAction extends Init return $this->getResponse(); } + /** + * Notes: 获取优惠券详情H5地址 + * @Author: 玄尘 + * @Date : 2021/6/25 14:16 + * @return array + */ + public function getCouponInfoUrl() + { + $url = $this->config['baseUri'] . '/v2/h5/redirect/autoLogin/commonReturnUrl'; + + $accessToken = $this->getToken(); + $data = $this->params; + + $callback_url = $this->config['infoUrl'] . '?' . http_build_query([ + 'activityId' => $data['activityId'], + 'code' => $data['code'], + 'accessToken' => $accessToken, + ]); + + $data = array_merge($data, ['url' => $callback_url]); + unset($data['code']); + unset($data['activityId']); + + $this->params = $data; + + $params = $this->getParams(); + $this->http($url, $params); + + return $this->getResponse(); + } + /** * Notes: 发券 * @Author: 玄尘 diff --git a/src/Action/Init.php b/src/Action/Init.php index d63de69..7922f97 100644 --- a/src/Action/Init.php +++ b/src/Action/Init.php @@ -71,6 +71,8 @@ class Init } else { $this->getAjaxToken(); } + + return $this->access_token; } /**