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; } /**