Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 32f6391d1f | |||
| 25ff64defe | |||
| 12f5f71817 |
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk\Action;
|
||||
|
||||
class Info extends Init
|
||||
{
|
||||
|
||||
}
|
||||
176
Action/Init.php
176
Action/Init.php
@@ -1,176 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk\Action;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
|
||||
class Init
|
||||
{
|
||||
|
||||
protected $appId;
|
||||
|
||||
protected $appSecret;
|
||||
|
||||
protected $apiVersion = 'v2';
|
||||
|
||||
protected $params;
|
||||
|
||||
protected $sign;
|
||||
|
||||
protected $url;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->appId = config('pingan.appId');
|
||||
$this->appSecret = config('pingan.appSecret');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 设置数据
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:37
|
||||
* @param $data
|
||||
* @return $this
|
||||
*/
|
||||
public function setParams($data)
|
||||
{
|
||||
//判断是否有sign,有的话是传来的值
|
||||
if (isset($data['sign'])) {
|
||||
$this->sign = $data['sign'];
|
||||
} else {
|
||||
$data = array_merge($data, [
|
||||
'appId' => $this->appId,
|
||||
'apiVersion' => $this->apiVersion,
|
||||
'timestamp' => $this->getMillisecond(),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->params = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取传入值
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:31
|
||||
* @return mixed
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
$params = $this->params;
|
||||
$params['sign'] = $this->getSign();
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取签名
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:32
|
||||
*/
|
||||
public function getSign()
|
||||
{
|
||||
$str = $this->getSignString();
|
||||
|
||||
return md5($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 检验
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:32
|
||||
*/
|
||||
public function checkSign()
|
||||
{
|
||||
$sign = $this->getSign();
|
||||
if ($sign == $this->sign) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 封装跳转链接
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:25
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
$params = $this->params;
|
||||
$params['sign'] = $this->getSign();
|
||||
|
||||
return $this->url . http_build_query($this->params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取时间戳
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:32
|
||||
* @return float
|
||||
*/
|
||||
private function getMillisecond()
|
||||
{
|
||||
[$msec, $sec] = explode(' ', microtime());
|
||||
$msectime = (float) sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
||||
$msectime = explode('.', $msectime);
|
||||
|
||||
return $msectime[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: description
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:32
|
||||
*/
|
||||
public function getSignString()
|
||||
{
|
||||
$params = $this->params;
|
||||
|
||||
if (empty($params)) {
|
||||
throw new \Exception('获取校验数据失败,缺少数据.');
|
||||
}
|
||||
|
||||
if (isset($params['sign'])) {
|
||||
unset($params['sign']);
|
||||
}
|
||||
|
||||
ksort($params);
|
||||
|
||||
return http_build_query($params) . $this->appSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用获取数据接口
|
||||
* @param [type] $url 请求地址
|
||||
* @param array $query 传递参数
|
||||
* @param array $json 需要传的json数据
|
||||
* @param string $method 方式
|
||||
* @return array|mixed [type] [description]
|
||||
*/
|
||||
public function http($url, $query, $method = 'POST')
|
||||
{
|
||||
try {
|
||||
$client = new Client();
|
||||
$response = $client->request($method, $url, $query);
|
||||
$body = $response->getBody();
|
||||
$content = $body->getContents();
|
||||
$result = json_decode($content, true);
|
||||
|
||||
if ($result['ret'] > 0) {
|
||||
$retData = $result['msg'];
|
||||
} else {
|
||||
$retData = $result['data'];
|
||||
}
|
||||
|
||||
return $retData;
|
||||
} catch (RequestException $e) {
|
||||
|
||||
return ['ret' => '99999', $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk\Action;
|
||||
|
||||
class Info extends Conr
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xuanchen/pingan_washcar",
|
||||
"name": "xuanchen/washcar",
|
||||
"description": "平安sdk",
|
||||
"license": "MIT",
|
||||
"homepage": "http://git.yuzhankeji.cn/xuanchen/PingAnWashCar.git",
|
||||
@@ -16,13 +16,13 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"XuanChen\\PingAnSdk\\": "src/"
|
||||
"XuanChen\\WashCar\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"XuanChen\\PingAnSdk\\ServiceProvider"
|
||||
"XuanChen\\WashCar\\ServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,31 @@ return [
|
||||
* 平安洗车券
|
||||
*/
|
||||
|
||||
'appId' => 122121,
|
||||
'appSecret' => '122121',
|
||||
'apiVersion' => 'v2',
|
||||
'this_type' => 'test',
|
||||
/**
|
||||
* 测试环境参数
|
||||
*/
|
||||
'test' => [
|
||||
'client_id' => env('WASH_CAR_APPID', ''),//就是 appId
|
||||
'client_secret' => env('WASH_CAR_SECRET', ''),// 就是 client_secret
|
||||
'apiVersion' => 'v2',
|
||||
'grant_type' => 'client_credentials',
|
||||
'tokenUri' => 'https://open.cyzl.com/beta/api/auth/oauth/token',
|
||||
'baseUri' => 'https://open.cyzl.com/beta/api',
|
||||
'urlKey' => env('WASH_CAR_URLKEY', ''),//免登陆跳转
|
||||
],
|
||||
|
||||
/**
|
||||
* 生产环境参数
|
||||
*/
|
||||
'dev' => [
|
||||
'client_id' => env('WASH_CAR_APPID', ''),//就是 appId
|
||||
'client_secret' => env('WASH_CAR_SECRET', ''),// 就是 client_secret
|
||||
'apiVersion' => 'v2',
|
||||
'grant_type' => 'client_credentials',
|
||||
'tokenUri' => 'https://open.cyzl.com/api/auth/oauth/token',
|
||||
'baseUri' => 'https://open.cyzl.com/api',
|
||||
'urlKey' => env('WASH_CAR_URLKEY', ''),//免登陆跳转
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk\Action;
|
||||
namespace XuanChen\WashCar\Action;
|
||||
|
||||
class BaseAction extends Init
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
re
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
51
src/Action/CouponAction.php
Normal file
51
src/Action/CouponAction.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\WashCar\Action;
|
||||
|
||||
class CouponAction extends Init
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 发券
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:26
|
||||
*/
|
||||
public function grant()
|
||||
{
|
||||
$url = $this->config['baseUri'] . '/v2/rights/coupon/getCoupon';
|
||||
|
||||
$res = $this->http($url, $this->params);
|
||||
dd($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 查询
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:28
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$url = $this->config['baseUri'] . '/v2/rights/coupon/getCouponStatus';
|
||||
|
||||
$this->http($url, $this->params);
|
||||
|
||||
return $this->getResponse();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 取消优惠券
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:29
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
$url = $this->config['baseUri'] . '/v2/rights/coupon/recedeCoupon';
|
||||
|
||||
$this->http($url, $this->params);
|
||||
|
||||
return $this->getResponse();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk\Action;
|
||||
namespace XuanChen\WashCar\Action;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
* 超市购物券
|
||||
*/
|
||||
class Init
|
||||
{
|
||||
|
||||
/**
|
||||
* @var 入参
|
||||
*/
|
||||
protected $params;
|
||||
|
||||
/**
|
||||
* @var 待校验的签名
|
||||
*/
|
||||
protected $sign;
|
||||
|
||||
/**
|
||||
* @var 环境
|
||||
*/
|
||||
protected $this_type;
|
||||
|
||||
protected $baseUri;
|
||||
|
||||
protected $tokenUri;
|
||||
|
||||
protected $client_id;
|
||||
|
||||
protected $grant_type;
|
||||
|
||||
protected $client_secret;
|
||||
|
||||
/**
|
||||
* @var token
|
||||
*/
|
||||
protected $access_token;
|
||||
|
||||
protected $userName;
|
||||
/*
|
||||
* @var 错误标识
|
||||
*/
|
||||
protected $error = 0;
|
||||
|
||||
protected $error;
|
||||
|
||||
protected $aes_code; //aes 密钥
|
||||
|
||||
protected $log;//日志
|
||||
/*
|
||||
* @var 错误原因
|
||||
*/
|
||||
protected $message;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$appId = config('pingan.appId');
|
||||
|
||||
$this->baseUri = $pingan['Uri'];
|
||||
$this->tokenUri = $pingan['tokenUri'];
|
||||
$this->client_id = $pingan['client_id'];
|
||||
$this->grant_type = $pingan['grant_type'];
|
||||
$this->userName = $pingan['userName'];
|
||||
$this->client_secret = $pingan['client_secret'];
|
||||
$this->aes_code = $pingan['AES_CODE'];
|
||||
$this->this_type = config('washcar.this_type');
|
||||
$this->config = config('washcar.' . $this->this_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,36 +51,20 @@ class Init
|
||||
*/
|
||||
public function getToken()
|
||||
{
|
||||
//从数据库里找token
|
||||
$token = PinganToken::where('type', $this->this_type)->orderBy('id', 'desc')->first();
|
||||
$this_type = $this->config['this_type'];
|
||||
|
||||
//从缓存里找token
|
||||
$token = Cache::get('token_' . $this_type);
|
||||
|
||||
if ($token) {
|
||||
$access_token = $token->access_token;
|
||||
$expires_in = $token->expires_in;
|
||||
$get_token_time = $token->get_token_time;
|
||||
$diffMinutes = $get_token_time->diffInMinutes(now(), false);
|
||||
if ($diffMinutes < $expires_in) {
|
||||
$this->access_token = $access_token;
|
||||
} else {
|
||||
$this->getAjaxToken();
|
||||
}
|
||||
$token = collect($token);
|
||||
$this->access_token = $token->access_token;
|
||||
|
||||
} else {
|
||||
$this->getAjaxToken();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取毫秒级别的时间戳
|
||||
*/
|
||||
public function getMsecTime()
|
||||
{
|
||||
[$msec, $sec] = explode(' ', microtime());
|
||||
$msectime = (float) sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
||||
$msectime = explode('.', $msectime);
|
||||
|
||||
return $msectime[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求平台 access_token
|
||||
* @return void [type] [description]
|
||||
@@ -89,44 +72,134 @@ class Init
|
||||
public function getAjaxToken()
|
||||
{
|
||||
$params = [
|
||||
'client_id' => $this->client_id,
|
||||
'grant_type' => $this->grant_type,
|
||||
'client_secret' => $this->client_secret,
|
||||
'client_id' => $this->config['client_id'],
|
||||
'grant_type' => $this->config['grant_type'],
|
||||
'client_secret' => $this->config['client_secret'],
|
||||
];
|
||||
|
||||
$tokenUrl = $this->config['tokenUri'];
|
||||
|
||||
try {
|
||||
$log = $this->createLog($this->tokenUri, 'POST', $params, 'pingan');
|
||||
$this->http($tokenUrl, $params, 'POST');
|
||||
|
||||
$client = new Client();
|
||||
$response = $client->request('POST', $this->tokenUri, [
|
||||
'form_params' => $params,
|
||||
]);
|
||||
$body = $response->getBody();
|
||||
$content = $body->getContents();
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->updateLog($log, $result); //更新日志
|
||||
|
||||
if ($result['ret'] > 0) {
|
||||
$this->error = $result['msg'];
|
||||
} else {
|
||||
$data = $result['data'];
|
||||
PinganToken::create([
|
||||
'type' => $this->this_type,
|
||||
'access_token' => $data['access_token'],
|
||||
'expires_in' => $data['expires_in'],
|
||||
'get_token_time' => now(),
|
||||
]);
|
||||
$this->access_token = $data['access_token'];
|
||||
$this->error = '';
|
||||
if ($this->error > 0) {
|
||||
return new \Exception($this->message);
|
||||
}
|
||||
|
||||
Cache::put('token_' . $this->grant_type, $this->data['expires_in']);
|
||||
|
||||
$this->access_token = $data['access_token'];
|
||||
|
||||
} catch (RequestException $e) {
|
||||
$this->error = $e->getMessage();
|
||||
$this->updateLog($log, [$this->error]); //更新日志
|
||||
$this->error = 9999;
|
||||
$this->message = $e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 设置数据
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:37
|
||||
* @param $data
|
||||
* @return $this
|
||||
*/
|
||||
public function setParams($data)
|
||||
{
|
||||
//判断是否有sign,有的话是传来的值
|
||||
if (isset($data['sign'])) {
|
||||
$this->sign = $data['sign'];
|
||||
} else {
|
||||
$data = array_merge($data, [
|
||||
'appId' => $this->config['client_id'],
|
||||
'apiVersion' => $this->config['apiVersion'],
|
||||
'timestamp' => $this->getMillisecond(),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->params = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取传入值
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:31
|
||||
* @return mixed
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
$params = $this->params;
|
||||
$params['sign'] = $this->getSign();
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取签名
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:32
|
||||
*/
|
||||
public function getSign()
|
||||
{
|
||||
$str = $this->getSignString();
|
||||
|
||||
return md5($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 检验
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:32
|
||||
*/
|
||||
public function checkSign()
|
||||
{
|
||||
$sign = $this->getSign();
|
||||
if ($sign == $this->sign) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取时间戳
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:32
|
||||
* @return float
|
||||
*/
|
||||
private function getMillisecond()
|
||||
{
|
||||
[$msec, $sec] = explode(' ', microtime());
|
||||
$msectime = (float) sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
||||
$msectime = explode('.', $msectime);
|
||||
|
||||
return $msectime[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: description
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 14:32
|
||||
*/
|
||||
public function getSignString()
|
||||
{
|
||||
$params = $this->params;
|
||||
|
||||
if (empty($params)) {
|
||||
throw new \Exception('获取校验数据失败,缺少数据.');
|
||||
}
|
||||
|
||||
if (isset($params['sign'])) {
|
||||
unset($params['sign']);
|
||||
}
|
||||
|
||||
ksort($params);
|
||||
|
||||
return http_build_query($params) . $this->config['client_secret'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用获取数据接口
|
||||
* @param [type] $url 请求地址
|
||||
@@ -135,68 +208,50 @@ class Init
|
||||
* @param string $method 方式
|
||||
* @return array|mixed [type] [description]
|
||||
*/
|
||||
public function getPingAnData($url, $query = [], $json = [], $method = 'POST')
|
||||
public function http($url, $query, $method = 'POST')
|
||||
{
|
||||
$this->getToken();
|
||||
|
||||
if ($this->error) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$postData = [
|
||||
'query' => array_merge([
|
||||
'access_token' => $this->access_token,
|
||||
'request_id' => $this->getMsecTime(),
|
||||
'userName' => $this->userName,
|
||||
], $query),
|
||||
'json' => $json,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json;charset=utf-8',
|
||||
'accept' => 'application/json;charset=utf-8',
|
||||
],
|
||||
];
|
||||
|
||||
$log = $this->createLog($url, $method, $postData, 'pingan'); //日志
|
||||
|
||||
try {
|
||||
$headers = [
|
||||
'Content-Type' => 'application/json',
|
||||
];
|
||||
|
||||
$client = new Client();
|
||||
$response = $client->request($method, $url, $postData);
|
||||
$body = $response->getBody();
|
||||
$content = $body->getContents();
|
||||
$result = json_decode($content, true);
|
||||
$response = $client->request($method, $url, [
|
||||
'json' => $query,
|
||||
'headers' => $headers,
|
||||
]);
|
||||
|
||||
$body = $response->getBody();
|
||||
$content = $body->getContents();
|
||||
$result = json_decode($content, true);
|
||||
|
||||
if ($result['ret'] > 0) {
|
||||
$retData = $result['msg'];
|
||||
$this->error = $result['ret'];
|
||||
$this->message = $result['message'];
|
||||
|
||||
return false;
|
||||
} else {
|
||||
$retData = $result['data'];
|
||||
$retData = $result['data'];
|
||||
$this->data = $retData;
|
||||
}
|
||||
$this->updateLog($log, $retData);//更新日志
|
||||
|
||||
return $retData;
|
||||
} catch (RequestException $e) {
|
||||
$this->updateLog($log, [$e->getMessage()]);//更新日志
|
||||
|
||||
return ['ret' => '99999', $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
//加密
|
||||
public function encrypt($str)
|
||||
/**
|
||||
* Notes: 返回
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:48
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
if (is_array($str)) {
|
||||
$str = json_encode($str);
|
||||
}
|
||||
$data = openssl_encrypt($str, 'aes-128-ecb', $this->aes_code, OPENSSL_RAW_DATA);
|
||||
|
||||
return base64_encode($data);
|
||||
}
|
||||
|
||||
//解密
|
||||
public function decrypt($str)
|
||||
{
|
||||
$encrypted = base64_decode($str);
|
||||
|
||||
return openssl_decrypt($encrypted, 'aes-128-ecb', $this->aes_code, OPENSSL_RAW_DATA);
|
||||
return [
|
||||
'error' => $this->error,
|
||||
'message' => $this->message,
|
||||
'data' => $this->data,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk\Action;
|
||||
|
||||
class Query extends Init
|
||||
{
|
||||
|
||||
public function start()
|
||||
{
|
||||
|
||||
try {
|
||||
//查询网点是否存在
|
||||
$outlet = User::where('outlet_id', $this->outletId)->first();
|
||||
|
||||
if (!$outlet) {
|
||||
throw new \Exception('网点编号错误,未查询到网点信息');
|
||||
}
|
||||
|
||||
$url = $this->baseUri . 'partner/v2/coupondetail';
|
||||
$params = [
|
||||
'redemptionCode' => $this->redemptionCode,
|
||||
'outletNo' => $outlet->PaOutletId,
|
||||
'thirdOutletNo' => $outlet->outlet_id,
|
||||
];
|
||||
|
||||
$res = $this->getPingAnData($url, $params);
|
||||
|
||||
if (!is_array($res)) {
|
||||
throw new \Exception($res);
|
||||
}
|
||||
|
||||
if ($res['code'] != 200) {
|
||||
throw new \Exception($res['message']);
|
||||
}
|
||||
|
||||
return collect($res['data']);
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
36
src/Action/UrlAction.php
Normal file
36
src/Action/UrlAction.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\WashCar\Action;
|
||||
|
||||
class UrlAction extends Init
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 跳转到下单url
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:11
|
||||
*/
|
||||
public function getOrderUrl()
|
||||
{
|
||||
$url = $this->config['baseUri'] . '/v2/h5/redirect/autoLogin/returnUrl';
|
||||
|
||||
$params = array_merge($this->params, [
|
||||
'urlKey' => $this->config['urlKey'],
|
||||
]);
|
||||
|
||||
$this->http($url, $params);
|
||||
|
||||
return $this->getResponse();
|
||||
}
|
||||
|
||||
/***
|
||||
* Notes: 获取优惠券详情地址
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:11
|
||||
*/
|
||||
public function getCouponInfoUrl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk;
|
||||
|
||||
use XuanChen\PingAnSdk\Action\BaseAction;
|
||||
|
||||
class PingAn
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 基础
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:44
|
||||
*/
|
||||
public function base()
|
||||
{
|
||||
return new BaseAction();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\PingAnSdk;
|
||||
namespace XuanChen\WashCar;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||
|
||||
@@ -17,8 +17,8 @@ class ServiceProvider extends LaravelServiceProvider
|
||||
$this->publishes([__DIR__ . '/../config/config.php' => config_path('pingan.php')]);
|
||||
}
|
||||
|
||||
$this->app->bind('xuanchen.pingan_washcar', function ($app) {
|
||||
return new PingAn();
|
||||
$this->app->bind('xuanchen.washcar', function ($app) {
|
||||
return new WashCar();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
42
src/WashCar.php
Normal file
42
src/WashCar.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace XuanChen\WashCar;
|
||||
|
||||
use XuanChen\WashCar\Action\BaseAction;
|
||||
use XuanChen\WashCar\Action\UrlAction;
|
||||
|
||||
class WashCar
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 基础
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/1 15:44
|
||||
*/
|
||||
public function base()
|
||||
{
|
||||
return new BaseAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取url
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 11:34
|
||||
* @return \XuanChen\WashCar\Action\UrlAction
|
||||
*/
|
||||
public function url()
|
||||
{
|
||||
return new UrlAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 优惠券
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/6/4 14:25
|
||||
*/
|
||||
public function coupon()
|
||||
{
|
||||
return new Coupon
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user