Skip to content

Commit f51c736

Browse files
committed
update
1 parent ca3b9a9 commit f51c736

File tree

3 files changed

+74
-36
lines changed

3 files changed

+74
-36
lines changed

README.md

+53-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,59 @@ $refundOrder = [
111111
$result = $app->pushOrderRefund($refundOrder);
112112

113113
```
114-
115-
其他具体可以查看代码
114+
115+
## 管家婆API 列表
116+
117+
### 商品管理
118+
- pushProduct() 宝贝上载
119+
- queryProduct() 商品详情查询
120+
121+
### 订单交易
122+
- pushOrder() 订单批量上载/更新接口
123+
- queryOrderStatus() 查询订单处理状态
124+
- querySaleOrder() 订单查询
125+
126+
### 售后场景
127+
- pushOrderRefund() 售后单上载
128+
- queryOrderRefund() 售后详情查询
129+
130+
### 库存管理
131+
- queryQtyInfo() 仓库详情查询
132+
- querySaleQty() 商品库存查询
133+
- queryMoreSaleQty() 批量库存查询
134+
135+
### 全渠道场景/门店
136+
- pushStoreInfo() 门店信息上载
137+
138+
----
139+
140+
分割线: 目前由于章鱼侠相关的测试接口无法正常使用。暂不支持。管家婆相关接口正常
141+
142+
----
143+
144+
##章鱼侠 API 列表
145+
146+
### 商品管理
147+
- pushProduct() 宝贝上载
148+
- queryProduct() 商品详情查询
149+
150+
### 订单交易
151+
- pushOrder() 订单批量上载/更新接口
152+
- queryOrderStatus() 查询订单处理状态
153+
- querySaleOrder() 订单查询
154+
155+
### 售后场景
156+
- pushOrderRefund() 售后单上载
157+
- queryOrderRefund() 售后详情查询
158+
159+
### 库存管理
160+
- queryQtyInfo() 仓库详情查询
161+
- querySaleQty() 商品库存查询
162+
- queryMoreSaleQty() 批量库存查询
163+
164+
### 全渠道场景/门店
165+
- pushStoreInfo() 门店信息上载
166+
116167

117168
TODO
118169

src/Base/Base.php

+12-25
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(array $config)
2222
}
2323

2424
/**
25-
* 接口获取授权认证码
25+
* 接口获取授权认证码 [废弃]
2626
* @return mixed
2727
* @throws HttpException
2828
*/
@@ -58,20 +58,20 @@ public function getAuthCode()
5858
}
5959

6060
/**
61+
* 步骤2 利用授权认证码获取token信息
6162
* 接口获取授权认证码 token
63+
* @param string $auth_code
6264
* @return array|mixed
6365
* @throws HttpException
66+
* @author cc
6467
*/
65-
public function getTokenInfo()
68+
public function getTokenInfo(string $auth_code)
6669
{
67-
$code = $this->getAuthCode();
68-
if (is_array($code)){
69-
return ['code'=>$code['errorcode'],'msg'=>$code['errormessage'].',requestid : '.$code['requestid']];
70-
}
70+
7171
$params = [
7272
'TimeStamp'=>date('Y-m-d H:i:s'),
7373
'GrantType'=>'auth_token',
74-
'AuthParam'=>trim($code)
74+
'AuthParam'=>trim($auth_code)
7575
];
7676
$param = $this->makeSecretData($params);
7777

@@ -86,26 +86,11 @@ public function getTokenInfo()
8686
if ($result['iserror']){
8787
return ['code'=>$result['errorcode'],'msg'=>$result['errormessage'].',requestid : '.$result['requestid']];
8888
}
89-
90-
$response = $result['response']['response'];
91-
89+
$response = rtrim($result['response']['response']);
9290
$tokenInfo = $this->aesFace()->decrypt($response);
91+
$tokenInfo = rtrim($tokenInfo);
9392

94-
/**
95-
* 返回解析之后的结果
96-
array (size=8)
97-
'appkey' => string '68831364318015642713205516431221' (length=32)
98-
'auth_token' => string 'hDFhehHplEYslTsIUPSPODIHhKdqNXJrsGz0Mn14' (length=40)
99-
'profileid' => string '515867705654726157' (length=18)
100-
'employee_id' => string '515867705767072864' (length=18)
101-
'expires_in' => float 864000
102-
'refresh_token' => string 'QErAUm3YsfMUA4VPvA6eMY9KUFThlCOJWvyVmltr' (length=40)
103-
're_expires_in' => float 15552000
104-
'timestamp' => string '2020/11/17 16:52:07' (length=19)
105-
* 调用授权接口授权获得的token有效期是10天,token过期前可以调用token刷新接口进行接口刷新操作。
106-
* 刷新token时不需要登录erp系统,刷新token最多可用180天。然后就必须使用使用授权接口登录erp进行授权
107-
*/
108-
return json_decode($tokenInfo,true);
93+
return \json_decode($tokenInfo,true);
10994
}catch (\Exception $e){
11095
throw new HttpException($e->getMessage(),$e->getCode(),$e);
11196
}
@@ -147,6 +132,7 @@ public function refreshToken($refresh_token){
147132
}
148133

149134
/**
135+
* 步骤1 获取授权认证码
150136
* 站点登录获取授权认证码
151137
* 组装授权登录参数,访问授权登录地址,输入erp账号,认证成功后 ,在回调地址返回auth_code
152138
* @param $redirect_url 授权成功后跳转的地址,主域名必须和申请应用时的主域名一致
@@ -224,6 +210,7 @@ public function queryOrderStatus(array $params){
224210
return $this->httpRequest($post);
225211
}
226212

213+
227214
//---------------------------------------------------
228215
// 库存 start
229216
//---------------------------------------------------

src/Factory.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ public static function make($name, array $config)
2323
$application = "\\Imactool\\Gjpzyx\\{$namespace}\\{$namespace}";
2424

2525
if('gjp' == strtolower($name)){
26-
if (!$config['debug']){
26+
if (isset($config['debug']) && !$config['debug']){
2727
$config = array_merge($config,self::gjpDefaultConfig());
2828
}else{
2929
$config = array_merge(self::testGjpDefaultConfig(),$config);
3030
}
3131

3232
}else if('zyx' == strtolower($name)){
33-
if (!$config['debug']){
33+
if (isset($config['debug']) && !$config['debug']){
3434
$config = array_merge($config,self::zyxDefaultConfig());
3535
}else{
36-
$config = array(self::testZyxDefaultConfig(),$config);
36+
$config = array_merge(self::testZyxDefaultConfig(),$config);
3737
}
3838
}
3939

@@ -71,19 +71,19 @@ public static function testGjpDefaultConfig(){
7171
'appKey' => '68943923115886070418838901844741',
7272
'appSecret' => 'ONxYDyNaCoyTzsp83JoQ3YYuMPHxk3j7',
7373
'signKey' => 'lezitiancheng',
74-
'token' => 'WjKsfpVHkPYtKPWkxICIQ7BWLYBvU5jfAL8Wofe3',
74+
'token' => 'cEb6ARwqhyfQeoF4gL8eSEXyAo0nDOL51MtLryce',
7575
'shopKey' => '92a01da5-3e1a-45bb-9277-c29a0586685e',
7676
//公司名称
7777
'CompanyName'=>'TestMall',
7878
//用户名
7979
'UserId' => 'test9',
8080
//密码
8181
'Password' => 'grasp@909',
82-
'refreshToken' => 'BwfoCBHxPiR8BCY4OtMTDeoDTosLs8dgRxHQg5fd',
83-
//线上登录获取授权认证码的地址
84-
'loginUrl'=>'http://ca.mygjp.com:666/account/login?',
82+
'refreshToken' => 'hIViTJcMiHBwOCEK1fEEvbd7lXlI8uu995tHrDEO',
83+
// 测试环境登录地址
84+
'loginUrl'=>'http://d7.mygjp.com.cn:666/account/login?',
8585
//线上接口调用的地址
86-
'apiUrl'=>'http://ca.mygjp.com:8002/api/',
86+
'apiUrl'=>'http://d7.mygjp.com.cn:8002/api',
8787
//线上管家婆云erp登录地址
8888
'onlineLoginUrl'=>'http://login.wsgjp.com/'
8989
];
@@ -121,7 +121,7 @@ public static function testZyxDefaultConfig(){
121121
'appSecret' => 'ONxYDyNaCoyTzsp83JoQ3YYuMPHxk3j7',
122122
'signKey' => 'lezitiancheng',
123123
'token' => '0I7dHCByoGxlxAHU8I50MzpPVbN0Nl56goE2YGdP',
124-
'shopKey' => 'e7c5289b-07ee-492f-b84f-97ee9659c8b7',
124+
'shopKey' => '2345678sdfg',
125125
//公司名称
126126
'CompanyName'=>'TestMall',
127127
//用户名

0 commit comments

Comments
 (0)