Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zptz-sass-kelaidian
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
李大见
zptz-sass-kelaidian
Commits
fbca4542
提交
fbca4542
authored
3月 13, 2026
作者:
窦斌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
6253cecd
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
213 行增加
和
19 行删除
+213
-19
SynJdRapidController.php
app/Http/Controllers/Api/SynJdRapidController.php
+45
-15
MyTestController.php
app/Http/Controllers/Dou/MyTestController.php
+161
-1
AotuorderController.php
app/Http/Controllers/Orders/AotuorderController.php
+3
-2
JdDataService.php
app/Services/JdDataService.php
+4
-1
没有找到文件。
app/Http/Controllers/Api/SynJdRapidController.php
浏览文件 @
fbca4542
...
...
@@ -194,25 +194,16 @@ class SynJdRapidController extends BaseController
}
if
(
!
empty
(
$token
)){
$json
[
'orderId'
]
=
$oj_billId
;
$sysParams
[
"jd_param_json"
]
=
json_encode
(
$json
);
$sysParams
[
'token'
]
=
$token
[
'access_token'
];
$sysParams
[
'app_key'
]
=
$token
[
'app_key'
];
$sysParams
[
'format'
]
=
'json'
;
$sysParams
[
'timestamp'
]
=
date
(
"Y-m-d H:i:s"
);
$sysParams
[
'v'
]
=
'1.0'
;
$apiParams
[
"jd_param_json"
]
=
json_encode
(
$json
);
$sysParams
[
"sign"
]
=
JdDataService
::
generateSign
(
array_merge
(
$sysParams
,
$apiParams
),
$token
[
'app_secret'
]);
$apiParams
=
array_merge
(
$sysParams
,
$apiParams
);
ksort
(
$apiParams
);
foreach
(
$apiParams
as
$k
=>
$v
){
if
(
strpos
(
$v
,
' '
)){
$urldata
[]
=
$k
.
"="
.
urlencode
(
$v
);
}
else
{
$urldata
[]
=
$k
.
"="
.
$v
;
}
}
$urldata
=
implode
(
"&"
,
$urldata
);
$url
=
"https://openapi.jddj.com/djapi/order/es/query?"
.
$urldata
;
$resp
=
CommonService
::
https_get
(
$url
);
$sysParams
[
'v'
]
=
'2.0'
;
$sysParams
[
"sign"
]
=
JdDataService
::
generateSign
(
$sysParams
,
$token
[
'app_secret'
]);
$apiParams
=
$sysParams
;
$url
=
"https://openapi.jddj.com/djapi/order/es/query"
;
$resp
=
$this
->
curl
(
$url
,
$apiParams
);
$resp
=
json_decode
(
$resp
,
true
);
if
(
isset
(
$resp
[
'encryptData'
])
&&
!
empty
(
$resp
[
'encryptData'
])){
$data
=
JdDataService
::
decryptAES
(
$resp
[
'encryptData'
],
$token
[
'app_secret'
]);
...
...
@@ -434,6 +425,45 @@ class SynJdRapidController extends BaseController
return
[
"code"
=>
"201"
,
"msg"
=>
"获取订单信息失败"
,
"data"
=>
"获取订单信息失败"
];
}
public
function
curl
(
$url
,
$postFields
=
null
)
{
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_FAILONERROR
,
false
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
60000
);
curl_setopt
(
$ch
,
CURLOPT_CONNECTTIMEOUT
,
3000
);
if
(
strlen
(
$url
)
>
5
&&
strtolower
(
substr
(
$url
,
0
,
5
))
==
"https"
)
{
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
}
if
(
is_array
(
$postFields
)
&&
0
<
count
(
$postFields
))
{
$header
=
array
(
"content-type: application/x-www-form-urlencoded; charset=UTF-8"
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
$header
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$postFields
,
''
,
'&'
));
}
$reponse
=
curl_exec
(
$ch
);
if
(
curl_errno
(
$ch
))
{
throw
new
Exception
(
curl_error
(
$ch
),
0
);
}
else
{
$httpStatusCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
if
(
200
!==
$httpStatusCode
)
{
throw
new
Exception
(
$reponse
,
$httpStatusCode
);
}
}
curl_close
(
$ch
);
return
$reponse
;
}
function
https_request
(
$url
,
$data
=
null
)
{
$curl
=
curl_init
();
...
...
app/Http/Controllers/Dou/MyTestController.php
浏览文件 @
fbca4542
...
...
@@ -57,7 +57,7 @@ class MyTestController extends BaseController
if
(
empty
(
$input
[
'method'
])){
return
$this
->
error
(
'缺少必要参数1'
,
ErrorInc
::
FAILED_PARAM
);
}
$api
=
[
'getSerStatistics'
,
'getSerStatisticsDetail'
,
'BasicExport'
,
'addOrderData'
,
'addOrderDatas'
,
'sysServiseCenter'
,
'getJdOrderStatus'
,
'getDataDecrypt'
,
'calculateOrderPrice'
,
'omnicOrderList'
];
$api
=
[
'getSerStatistics'
,
'getSerStatisticsDetail'
,
'BasicExport'
,
'addOrderData'
,
'addOrderDatas'
,
'sysServiseCenter'
,
'getJdOrderStatus'
,
'getDataDecrypt'
,
'calculateOrderPrice'
,
'omnicOrderList'
,
'Distrib'
,
'tests'
];
if
(
!
in_array
(
$input
[
'method'
],
$api
)){
return
$this
->
error
(
'接口不参数异常'
,
ErrorInc
::
INVALID_PARAM
,
$input
);
}
else
{
...
...
@@ -65,6 +65,98 @@ class MyTestController extends BaseController
return
$this
->
$api
(
$input
);
}
}
public
function
tests
(
$input
){
$SynJdRapidController
=
new
SynJdRapidController
();
return
$SynJdRapidController
->
sysJdData
(
'3430418001359023'
,
'144f968e-7f35-4088-995b-ee802f0a398d'
,
1
);
$apiParams
=
array
();
//应用级参数
$json
[
'orderId'
]
=
'3430418001359023'
;
$apiParams
[
'jd_param_json'
]
=
json_encode
(
$json
);
//系统级别参数
$apiParams
[
'token'
]
=
'144f968e-7f35-4088-995b-ee802f0a398d'
;
$apiParams
[
'app_key'
]
=
'cf032fff54744e3bb7c49aa5e8109417'
;
$apiParams
[
'timestamp'
]
=
date
(
'Y-m-d H:i:s'
);
$apiParams
[
'v'
]
=
"2.0"
;
$apiParams
[
'format'
]
=
'json'
;
$apiParams
[
"sign"
]
=
$this
->
generateSigns
(
$apiParams
);
try
{
//GET提交
//$requestUrl = $this->connectUrl . $request->getApiPath().'?'.$this -> query_str_fetch($apiParams,'urlencode');
//$resp = $this->curl($requestUrl);
//POST提交
$requestUrl
=
'https://openapi.jddj.com/djapi/order/es/query'
;
$resp
=
$this
->
curl
(
$requestUrl
,
$apiParams
);
echo
"<br>url=>"
.
$requestUrl
;
echo
"<br>params=>"
.
json_encode
(
$apiParams
);
echo
"<br>response=>"
.
$resp
;
}
catch
(
Exception
$e
)
{
throw
$e
;
}
}
public
function
curl
(
$url
,
$postFields
=
null
)
{
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_FAILONERROR
,
false
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
60000
);
curl_setopt
(
$ch
,
CURLOPT_CONNECTTIMEOUT
,
3000
);
if
(
strlen
(
$url
)
>
5
&&
strtolower
(
substr
(
$url
,
0
,
5
))
==
"https"
)
{
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
}
if
(
is_array
(
$postFields
)
&&
0
<
count
(
$postFields
))
{
$header
=
array
(
"content-type: application/x-www-form-urlencoded; charset=UTF-8"
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
$header
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$postFields
,
''
,
'&'
));
}
$reponse
=
curl_exec
(
$ch
);
if
(
curl_errno
(
$ch
))
{
throw
new
Exception
(
curl_error
(
$ch
),
0
);
}
else
{
$httpStatusCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
if
(
200
!==
$httpStatusCode
)
{
throw
new
Exception
(
$reponse
,
$httpStatusCode
);
}
}
curl_close
(
$ch
);
return
$reponse
;
}
protected
function
generateSigns
(
$params
)
{
$stringToBeSigned
=
$this
->
paramsToString
(
$params
);
return
strtoupper
(
md5
(
$stringToBeSigned
));
}
protected
function
paramsToString
(
$params
)
{
ksort
(
$params
);
$sortedString
=
'285ad85204144f41981bab04953790b1'
;
foreach
(
$params
as
$k
=>
$v
)
{
$v
=
(
string
)
$v
;
if
(
"sign"
!==
$k
/*&& strlen($v) > 0*/
)
{
$sortedString
.=
"
$k$v
"
;
}
}
$sortedString
.=
'285ad85204144f41981bab04953790b1'
;
return
$sortedString
;
}
/**|---------------------------------------------------------------------------------
* @name 获取京东token
* @param string ju_ordernum 订单单号
...
...
@@ -1645,4 +1737,72 @@ class MyTestController extends BaseController
}
}
}
/**|---------------------------------------------------------------------------------
* @name 验证自动派单
* @param string ju_ordernum 订单单号
* @retrun \Illuminate\Http\JsonResponse /multitype:array
* @author dou 2026/2/26 9:20
* |---------------------------------------------------------------------------------
*/
public
function
Distrib
(
$input
)
{
$sys_nums
=
$input
[
'sys_num'
];
$ip
=
'192.168.1.1'
;
$admin_acc
=
"系统录入"
;
$admin_id
=
'1133'
;
if
(
$sys_nums
!=
''
){
$sys_num
=
$sys_nums
;
//判定是否为多品牌订单
$goods_brand
=
DB
::
table
(
"order_msg"
)
->
where
(
'sys_num'
,
$sys_num
)
->
select
(
'goods_brand'
,
'goods_id'
,
'goods_num'
)
->
groupBy
(
"goods_brand"
)
->
get
()
->
toArray
();
if
(
count
(
$goods_brand
)
>
1
){
$content
=
'包含品牌大于一个('
.
count
(
$goods_brand
)
.
');'
;
$this
->
manual
(
$sys_num
);
$this
->
insertingLog
(
"系统派单,"
,
$sys_num
,
$content
,
"订单管理"
,
$ip
,
$admin_acc
);
//日志
return
true
;
}
$goods_num
=
array_column
(
$goods_brand
,
'goods_num'
);
$goods_num
=
array_sum
(
$goods_num
);
if
(
$goods_num
>=
3
){
$content
=
'包含数量大于3个('
.
$goods_num
.
');'
;
$this
->
manual
(
$sys_num
);
$this
->
insertingLog
(
"系统派单,"
,
$sys_num
,
$content
,
"订单管理"
,
$ip
,
$admin_acc
);
//日志
return
true
;
}
$order
=
DB
::
table
(
"orders"
)
->
where
(
'sys_num'
,
$sys_num
)
->
first
();
if
(
empty
(
$order
)){
$this
->
insertingLog
(
"系统派单,"
,
$sys_num
,
'单号异常获取失败'
,
"订单管理"
,
$ip
,
$admin_acc
);
//日志
return
true
;
}
//判定是否为锁定订单
if
(
$order
[
'lock_type'
]
==
'2'
){
$this
->
manual
(
$sys_num
);
$this
->
insertingLog
(
"系统派单,"
,
$sys_num
,
'锁定订单禁止下派'
,
"订单管理"
,
$ip
,
$admin_acc
);
//日志
return
true
;
}
$order_rejected
=
DB
::
table
(
"order_rejected"
)
->
where
(
'or_order_num'
,
$order
[
'order_num'
])
->
select
(
'or_ser_id'
)
->
get
();
$order_rejected
=
CommonService
::
dataToArray
(
$order_rejected
);
if
(
empty
(
$order_rejected
)){
$or_ser_id
=
''
;
}
else
{
$or_ser_id
=
array_column
(
$order_rejected
,
'or_ser_id'
);
}
//判定用户信息是否重复
$time
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
'-1 month'
));
if
(
$order
[
'clientAccount'
]
!=
''
)
{
$ordernum
=
DB
::
table
(
"orders"
)
->
where
(
'clientAccount'
,
$order
[
'clientAccount'
])
->
where
(
'create_time'
,
'>'
,
$time
)
->
where
(
'order_num'
,
'!='
,
$order
[
'order_num'
])
->
where
(
'order_status'
,
'<'
,
50
)
->
first
();
if
(
$ordernum
)
{
$this
->
manual
(
$sys_num
);
$this
->
insertingLog
(
"系统派单,"
,
$sys_num
,
'下单人重复下单'
,
"订单管理"
,
$ip
,
$admin_acc
);
//日志
return
true
;
}
}
$user
=
DB
::
table
(
"user"
)
->
where
(
'id'
,
$order
[
'new_customer_id'
])
->
first
();
$user_phone
=
DB
::
table
(
"user"
)
->
where
(
'shr_name'
,
$user
[
'shr_name'
])
->
where
(
'shr_sheng'
,
$user
[
'shr_sheng'
])
->
where
(
'shr_shi'
,
$user
[
'shr_shi'
])
->
where
(
'shr_xian'
,
$user
[
'shr_xian'
])
->
select
(
'id'
)
->
get
();
$user_phone
=
CommonService
::
dataToArray
(
$user_phone
);
$phone
=
array_column
(
$user_phone
,
'id'
);
CommonService
::
startmysql
();
$order_num
=
DB
::
table
(
"orders"
)
->
whereIn
(
'new_customer_id'
,
$user_phone
)
->
where
(
'create_time'
,
'>'
,
$time
)
->
count
();
echo
CommonService
::
showmysql
();
}
}
}
app/Http/Controllers/Orders/AotuorderController.php
浏览文件 @
fbca4542
...
...
@@ -67,9 +67,10 @@ class AotuorderController extends BaseController
}
}
$user
=
DB
::
table
(
"user"
)
->
where
(
'id'
,
$order
[
'new_customer_id'
])
->
first
();
$user_phone
=
DB
::
table
(
"user"
)
->
where
(
'shr_name'
,
$user
[
'shr_name'
])
->
where
(
'shr_sheng'
,
$user
[
'shr_sheng'
])
->
where
(
'shr_shi'
,
$user
[
'shr_shi'
])
->
where
(
'shr_xian'
,
$user
[
'shr_xian'
])
->
select
(
'id'
)
->
first
();
$user_phone
=
DB
::
table
(
"user"
)
->
where
(
'shr_name'
,
$user
[
'shr_name'
])
->
where
(
'shr_sheng'
,
$user
[
'shr_sheng'
])
->
where
(
'shr_shi'
,
$user
[
'shr_shi'
])
->
where
(
'shr_xian'
,
$user
[
'shr_xian'
])
->
select
(
'id'
)
->
get
();
$user_phone
=
CommonService
::
dataToArray
(
$user_phone
);
$phone
=
array_column
(
$user_phone
,
'id'
);
$order_num
=
DB
::
table
(
"orders"
)
->
where
(
'new_customer_id'
,
'in'
,
implode
(
','
,
$phone
)
)
->
where
(
'create_time'
,
'>'
,
$time
)
->
count
();
$order_num
=
DB
::
table
(
"orders"
)
->
where
In
(
'new_customer_id'
,
$user_phone
)
->
where
(
'create_time'
,
'>'
,
$time
)
->
count
();
if
(
$order_num
>
1
){
$this
->
manual
(
$sys_num
);
$this
->
insertingLog
(
"系统派单,"
,
$sys_num
,
'重复手机号暂停派单'
,
"订单管理"
,
$ip
,
$admin_acc
);
//日志
...
...
app/Services/JdDataService.php
浏览文件 @
fbca4542
...
...
@@ -31,7 +31,10 @@ class JdDataService extends Service{
$stringToBeSigned
=
$appsecret
;
// 把所有参数名和参数值串在一起
foreach
(
$params
as
$k
=>
$v
)
{
$stringToBeSigned
.=
"
$k$v
"
;
$v
=
(
string
)
$v
;
if
(
"sign"
!==
$k
/*&& strlen($v) > 0*/
)
{
$stringToBeSigned
.=
"
$k$v
"
;
}
}
unset
(
$k
,
$v
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论