切换导航条
此项目
正在载入...
登录
李涵
/
integral
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
李涵
6 years ago
提交
f8e9f943dddc5f7614b8f7b3e9cf42e120e070e4
2 个父辈
7b979a3e
32683505
1 个管道 的构建
通过
耗费 0 秒
合并分支 'xv' 到 'master'
快递接入成功 查看合并请求
!88
变更
5
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
59 行增加
和
39 行删除
api/debug.php
api/home/controller/IndexController.php
app/debug.php
app/kdnapi/controller/KdnApiController.php
data/conf/config.php
api/debug.php
查看文件 @
f8e9f94
...
...
@@ -9,6 +9,6 @@ return [
// 应用调试模式
'app_debug'
=>
true
,
// 应用Trace
'app_trace'
=>
tru
e
,
'app_trace'
=>
fals
e
,
];
\ No newline at end of file
...
...
api/home/controller/IndexController.php
查看文件 @
f8e9f94
...
...
@@ -2,6 +2,7 @@
namespace
api\home\controller
;
use
cmf\controller\RestBaseController
;
use
think\Db
;
/**
* @title 欢迎页
...
...
@@ -35,4 +36,29 @@ class IndexController extends RestBaseController
$this
->
success
(
"恭喜您,API访问成功!"
,
$data
);
}
/**
* 接收快递鸟推送快递信息
*/
public
function
test
(){
$param
=
input
(
'param.'
);
$param
[
'RequestData'
]
=
htmlspecialchars_decode
(
$param
[
'RequestData'
]);
$arr
=
json_decode
(
$param
[
'RequestData'
],
true
);
foreach
(
$arr
[
'Data'
]
as
$k
=>
$v
){
$sta
=
Db
::
name
(
'zj_kd_order'
)
->
where
([
'kd_num'
=>
$v
[
'LogisticCode'
],
'kd_type'
=>
$v
[
'ShipperCode'
]])
->
find
();
if
(
empty
(
$sta
)){
Db
::
name
(
'zj_kd_order'
)
->
insert
([
'kd_num'
=>
$v
[
'LogisticCode'
],
'kd_type'
=>
$v
[
'ShipperCode'
],
'text'
=>
json_encode
(
$v
[
'Traces'
])]);
}
else
{
Db
::
name
(
'zj_kd_order'
)
->
where
([
'kd_num'
=>
$v
[
'LogisticCode'
],
'kd_type'
=>
$v
[
'ShipperCode'
]])
->
update
([
'text'
=>
json_encode
(
$v
[
'Traces'
])]);
}
}
$return
[
'EBusinessID'
]
=
'1385929'
;
$return
[
'UpdateTime'
]
=
date
(
'Y-m-d H:i:s'
);
$return
[
'Success'
]
=
true
;
$return
[
'Reason'
]
=
''
;
return
$return
;
}
}
...
...
app/debug.php
查看文件 @
f8e9f94
...
...
@@ -13,6 +13,6 @@ return [
// 应用调试模式
'app_debug'
=>
true
,
// 应用Trace
'app_trace'
=>
tru
e
,
'app_trace'
=>
fals
e
,
];
\ No newline at end of file
...
...
app/kdnapi/controller/KdnApiController.php
查看文件 @
f8e9f94
...
...
@@ -22,36 +22,46 @@
namespace
app\kdnapi\controller
;
use
think\Controller
;
use
think\Db
;
class
KdnApiController
class
KdnApiController
extends
Controller
{
public
function
aa
(){
return
$this
->
orderTracesSubByJson
(
'77'
);
}
/**
* Json方式 物流信息订阅
*/
public
function
orderTracesSubByJson
(){
$requestData
=
"{'OrderCode': 'SF201608081055208281',"
.
"'ShipperCode':'SF',"
.
"'LogisticCode':'3100707578976',"
.
"'PayType':1,"
.
"'ExpType':1,"
.
"'IsNotice':0,"
.
"'Cost':1.0,"
.
"'OtherCost':1.0,"
.
public
function
orderTracesSubByJson
(
$id
){
$arr1
=
Db
::
name
(
'zj_order'
)
->
alias
(
'o'
)
->
join
(
'zj_kd k'
,
'o.kid=k.id'
,
'left'
)
->
where
(
'o.id'
,
$id
)
->
field
(
'o.*,k.code'
)
->
find
();
$arr2
=
Db
::
name
(
'zj_system'
)
->
find
();
$requestData
=
"{'OrderCode': '',"
.
"'ShipperCode':'"
.
$arr1
[
'code'
]
.
"',"
.
"'LogisticCode':"
.
$arr1
[
'kd_num'
]
.
","
.
"'PayType':'',"
.
"'ExpType':'',"
.
"'IsNotice':'',"
.
"'Cost':'',"
.
"'OtherCost':'',"
.
"'Sender':"
.
"{"
.
"'
Company':'LV','Name':'Taylor','Mobile':'15018442396','ProvinceName':'上海','CityName':'上海','ExpAreaName':'青浦区','Address':'明珠路73号
'},"
.
"'
Name':'"
.
$arr2
[
'name'
]
.
"','Mobile':'"
.
$arr2
[
'fmobile'
]
.
"','ProvinceName':'"
.
$arr2
[
'province'
]
.
"','CityName':'"
.
$arr2
[
'city'
]
.
"','ExpAreaName':'"
.
$arr2
[
'county'
]
.
"','Address':'"
.
$arr2
[
'place'
]
.
"
'},"
.
"'Receiver':"
.
"{"
.
"'
Company':'GCCUI','Name':'Yann','Mobile':'15018442396','ProvinceName':'北京','CityName':'北京','ExpAreaName':'朝阳区','Address':'三里屯街道雅秀大厦
'},"
.
"'
Name':'"
.
$arr1
[
'name'
]
.
"','Mobile':'"
.
$arr1
[
'mobile'
]
.
"','ProvinceName':'"
.
$arr1
[
'province'
]
.
"','CityName':'"
.
$arr1
[
'city'
]
.
"','ExpAreaName':'"
.
$arr1
[
'county'
]
.
"','Address':'"
.
$arr1
[
'place'
]
.
"
'},"
.
"'Commodity':"
.
"[{"
.
"'GoodsName':'鞋子','Goodsquantity':1,'GoodsWeight':1.0}],"
.
"'Weight':1.0,"
.
"'Quantity':1,"
.
"'Volume':0.0,"
.
"'Remark':'小心轻放'}"
;
"'GoodsName':'','Goodsquantity':'','GoodsWeight':''}],"
.
"'Weight':'',"
.
"'Quantity':'',"
.
"'Volume':'',"
.
"'Remark':''}"
;
$datas
=
array
(
'EBusinessID'
=>
config
(
'EBusinessID'
),
...
...
@@ -116,16 +126,4 @@ class KdnApiController
private
function
encrypt
(
$data
,
$appkey
)
{
return
urlencode
(
base64_encode
(
md5
(
$data
.
$appkey
)));
}
/**
* 推送接口
*/
public
function
kdApi
(){
$request
=
request
();
$param
=
'2'
;
if
(
$request
->
param
()){
$param
=
input
(
'param.'
);
}
Db
::
name
(
'zj_kd_order'
)
->
insert
([
'text'
=>
$param
]);
}
}
\ No newline at end of file
...
...
data/conf/config.php
查看文件 @
f8e9f94
...
...
@@ -6,14 +6,10 @@ return [
'MchId'
=>
'1263633001'
,
'EBusinessID'
=>
'1385929'
,
'AppKey'
=>
'a30c2b36-2f16-4a39-9c75-323feddb415f'
,
'ReqURL'
=>
'http://testapi.kdniao.cc:8081/api/dist'
,
'ReqURL'
=>
'http://testapi.kdniao.cc:8081/api/dist'
];
//电商ID
defined
(
'EBusinessID'
)
or
define
(
'EBusinessID'
,
'1385929'
);
//电商加密私钥,快递鸟提供,注意保管,不要泄漏
defined
(
'AppKey'
)
or
define
(
'AppKey'
,
'a30c2b36-2f16-4a39-9c75-323feddb415f'
);
//测试请求url
defined
(
'ReqURL'
)
or
define
(
'ReqURL'
,
'http://testapi.kdniao.cc:8081/api/dist'
);
//http://testapi.kdniao.cc:8081/api/dist
//正式请求url
//
defined
(
'ReqURL'
)
or
define
(
'ReqURL'
,
'http://api.kdniao.cc/api/dist'
);
\ No newline at end of file
//
http
://
api
.
kdniao
.
cc
/
api
/
dist
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论