Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zptz-sass-kelaidian
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
李大见
zptz-sass-kelaidian
Commits
16cf9ec1
提交
16cf9ec1
authored
12月 03, 2024
作者:
窦斌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
ceb79d04
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
316 行增加
和
355 行删除
+316
-355
SynJdOrderApi.php
app/Console/Commands/SynJdOrderApi.php
+2
-2
SynJdPopDataController.php
app/Http/Controllers/Api/SynJdPopDataController.php
+305
-348
GoodsBrandController.php
app/Http/Controllers/Common/GoodsBrandController.php
+6
-2
OrderListService.php
app/Services/OrderListService.php
+3
-3
没有找到文件。
app/Console/Commands/SynJdOrderApi.php
浏览文件 @
16cf9ec1
...
...
@@ -12,14 +12,14 @@ class SynJdOrderApi extends Command
*
* @var string
*/
protected
$signature
=
'
getOrder
'
;
protected
$signature
=
'
SynJdOrderApi
'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Command
getJdOrder
'
;
protected
$description
=
'Command
SynJdOrderApi
'
;
/**
* Create a new command instance.
...
...
app/Http/Controllers/Api/SynJdPopDataController.php
浏览文件 @
16cf9ec1
...
...
@@ -31,25 +31,18 @@ class SynJdPopDataController extends BaseController
* @date 2022/4/27
*/
public
function
addOrderData
(){
/* $str = "AAQLAodRrJ360+b6qYevz+HgyXHUehSiWki+A9YqUJVvonqI1G8rNALcCZYF9eo5A5M=";
$data['accessToken'] = 'e0a1c90e617f4b3a9865ed059f99c5f42ztb';
$data['appKey'] = '41D9668E8CB81C9890A065BEC300FD84';
$data['appSecret'] = '93bff142bf5c4422ae7bec9eb992e751';
return $this->decrypt($data,$str);
exit;*/
$url
=
"http://116.196.75.172/index.php/GetOrder/index"
;
$url_ex
=
"http://116.196.75.172/index.php/GetOrder/syncExpress"
;
//出库
$time_start
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
" -
10 minute"
.
date
(
"Y-m-d
"
)));
$time_start
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
" -
720 minute"
.
date
(
"Y-m-d H:i:s
"
)));
$time_end
=
date
(
"Y-m-d H:i:s"
);
$goods
=
DB
::
table
(
'pj_goods'
)
->
select
(
'pg_id'
,
'brand_name'
,
'pg_series'
,
'version'
,
'goods_pic_path'
,
'national_version'
)
->
get
()
->
toarray
();
$goods
=
CommonService
::
jointArrayKey
(
$goods
,
'pg_id'
);
$token
=
DB
::
table
(
'jdpop_token'
)
->
where
(
'status'
,
1
)
->
where
(
'type'
,
1
)
->
select
(
'app_key'
,
'app_secret'
,
'access_token'
,
'pt_id'
)
->
get
()
->
toarray
();
$token
=
DB
::
table
(
'jdpop_token'
)
->
where
(
'status'
,
1
)
->
where
(
'type'
,
1
)
->
select
(
'app_key'
,
'app_secret'
,
'access_token'
,
'pt_id'
,
'appName'
)
->
get
()
->
toarray
();
foreach
(
$token
as
$k
=>
$v
){
// CommonService::addLog('token', json_encode($v['app_key']), $v['pt_id'],'jd_token');
// CommonService::addLog('token', json_encode($v['app_key']), $v['pt_id'],'jd_token');
$res_ult
=
[];
$res_ult
[
$k
][
'appKey'
]
=
$v
[
'app_key'
];
//appkey
$res_ult
[
$k
][
'appSecret'
]
=
$v
[
'app_secret'
];
//secret
...
...
@@ -63,309 +56,324 @@ exit;*/
/**TRADE_CANCELED,POP_ORDER_PAUSE,LOCKED
这三个是取消的状态,还是通过获取订单那个接口,触发时间和获取订单时间一致就行,这个没有变更状态一说,所以需要你判定,比如五分钟查一次最近六分钟的取消订单,如果系统中未取消就锁定订单生成退款单,如果过系统中已经取消或者已经锁定退款单就不用管了**/
$res_ult
[
$k
][
'page'
]
=
1
;
$res
=
$this
->
request_post
(
$url
,
$res_ult
[
$k
]);
$ip
=
$_SERVER
[
"REMOTE_ADDR"
];
CommonService
::
addLog
(
'token1--'
.
$v
[
'pt_id'
],
$res
,
$v
[
'pt_id'
],
'JDPOP-all'
);
$data
=
json_decode
(
$res
,
true
);
if
(
$data
[
'jingdong_pop_order_enSearch_responce'
][
'code'
]
==
0
){
$order_data
=
$data
[
'jingdong_pop_order_enSearch_responce'
][
'searchorderinfo_result'
][
'orderInfoList'
];
//CommonService::addLog('token2', json_encode($order_data), $v['pt_id'],'jd_token');
// CommonService::addLog('原数据--'.$v['pt_id'], json_encode($order_data), 111,'JDPOP-原数据');
// dump($order_data);
if
(
!
empty
(
$order_data
)){
$arr_goods
=
[];
$arr
=
[];
// CommonService::addLog('token3', json_encode($order_data), $v['pt_id'],'jd_token');
foreach
(
$order_data
as
$kk
=>
$vv
)
{
$order_info
=
OrderService
::
getOrderBy
(
'order_num'
,
$vv
[
'orderId'
],[
'id'
,
'order_status'
,
'lock_type'
,
'sys_num'
,
'order_num'
,
'p_id'
,
'ser_id'
,
'create_time'
,
'new_customer_id'
,
'lock_type'
,
'company_id'
]);
$order_info
=
CommonService
::
dataToArray
(
$order_info
);
if
(
!
empty
(
$order_info
)
&&
in_array
(
$vv
[
'orderState'
],
[
'TRADE_CANCELED'
,
'POP_ORDER_PAUSE'
,
'LOCKED'
])){
if
(
$order_info
[
'lock_type'
]
==
2
||
in_array
(
$order_info
[
'order_status'
],
[
50
,
55
])){
continue
;
}
else
{
$datar
[
'allprice'
]
=
$vv
[
'orderTotalPrice'
];
$goods_arr
=
OrderMsg
::
where
(
'sys_num'
,
$order_info
[
'sys_num'
])
->
get
([
'id as msg_id'
,
'goods_name'
,
'goods_price'
,
'goods_id as good_id'
]);
$datar
[
'goodsArr'
]
=
CommonService
::
dataToArray
(
$goods_arr
);
$datar
[
'goods_state'
]
=
2
;
//2:平台; 4:财务
$datar
[
'sys_num'
]
=
$order_info
[
'sys_num'
];
$datar
[
'order_num'
]
=
$order_info
[
'order_num'
];
$datar
[
'apply_type'
]
=
1
;
$datar
[
'content'
]
=
$vv
[
'orderStateRemark'
];
$datar
[
'p_id'
]
=
$order_info
[
'p_id'
];
$datar
[
'ser_id'
]
=
$order_info
[
'ser_id'
];
$datar
[
'new_customer_id'
]
=
$order_info
[
'new_customer_id'
];
$datar
[
'order_status'
]
=
$order_info
[
'order_status'
];
$datar
[
'create_time'
]
=
$order_info
[
'create_time'
];
$userArr
=
User
::
where
(
'id'
,
$order_info
[
'new_customer_id'
])
->
first
();
$session
[
'admin_groupnew'
]
=
7
;
$session
[
'admin_acc'
]
=
'系统录入'
;
$session
[
'id'
]
=
1133
;
$session
[
'company_id'
]
=
$order_info
[
'company_id'
];
$ret
=
OrderService
::
lockByRefund
(
$datar
,
$session
,
$userArr
);
CommonService
::
addLog
(
'取消订单'
,
json_encode
(
$ret
),
$vv
[
'orderId'
],
'JDPOP-cancel'
);
continue
;
}
$res_ult
[
$k
][
'page'
]
=
1
;
$res
=
$this
->
request_post
(
$url
,
$res_ult
[
$k
]);
$ip
=
$_SERVER
[
"REMOTE_ADDR"
];
}
CommonService
::
addLog
(
'token1--'
.
$v
[
'pt_id'
],
$res
,
$v
[
'pt_id'
],
'SynJdPopData-getOrder'
);
// CommonService::addLog('token4', json_encode( $vv['orderId']), $v['pt_id'],'jd_token');
$exsit
=
OrderService
::
getOrderBy
(
'order_num'
,
$vv
[
'orderId'
],[
'id'
]);
$eisit_jd
=
DB
::
table
(
'jd_proprietary'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
!
$exsit
||!
$eisit_jd
){
$flag
=
1
;
unset
(
$skuId
);
foreach
(
$vv
[
'itemInfoList'
]
as
$ka
=>
$va
){
$skuId
[]
=
"'"
.
$va
[
'skuId'
]
.
"'"
;
}
$goodids
=
DB
::
table
(
"jd_bound"
)
->
whereRaw
(
"sku_id in ("
.
implode
(
','
,
$skuId
)
.
")"
)
->
pluck
(
'goods_id'
,
'sku_id'
)
->
toarray
();
if
(
empty
(
$goodids
)){
CommonService
::
addLog
(
'无sku'
,
json_encode
(
$skuId
),
$vv
[
'orderId'
],
'JDPOP-无sku'
);
$flag
=
2
;
$data
=
json_decode
(
$res
,
true
);
if
(
$data
[
'jingdong_pop_order_enSearch_responce'
][
'code'
]
==
0
){
$order_data
=
$data
[
'jingdong_pop_order_enSearch_responce'
][
'searchorderinfo_result'
][
'orderInfoList'
];
if
(
!
empty
(
$order_data
)){
$arr_goods
=
[];
$arr
=
[];
$num
=
0
;
foreach
(
$order_data
as
$ksa
=>
$vsa
){
if
(
!
empty
(
$vsa
[
'consigneeInfo'
][
'oaid'
]))
{
$orderInfos
[
$num
][
'orderId'
]
=
$vsa
[
'orderId'
];
$orderInfos
[
$num
][
'oaid'
]
=
$vsa
[
'consigneeInfo'
][
'oaid'
];
$num
++
;
}
if
(
$goodids
){
if
(
count
(
$goodids
)
<
count
(
$vv
[
'itemInfoList'
])){
$flag
=
2
;
}
if
(
!
empty
(
$orderInfos
)){
$poss
[
'appKey'
]
=
$v
[
'app_key'
];
$poss
[
'accessToken'
]
=
$v
[
'access_token'
];
$poss
[
'appSecret'
]
=
$v
[
'app_secret'
];
$poss
[
'orderType'
]
=
'POP'
;
$poss
[
'appName'
]
=
$v
[
'appName'
];
$poss
[
'orderInfos'
]
=
json_encode
(
$orderInfos
);
$user_data
=
$this
->
https_request
(
'http://zptzchat.bluearp.com/m/index.php/GetUserDataApi/getOaidDecrypt'
,
$poss
);
$user_data
=
json_decode
(
$user_data
,
true
);
if
(
$user_data
[
'jingdong_jos_order_oaid_decrypt_responce'
][
'returnType'
][
'code'
]
==
200
){
$user_data
=
$user_data
[
'jingdong_jos_order_oaid_decrypt_responce'
][
'returnType'
][
'data'
];
$user_datas
=
[];
foreach
(
$user_data
as
$ks
=>
$vs
){
$user_datas
[
$vs
[
'orderId'
]]
=
$vs
;
}
if
(
!
empty
(
$user_datas
)){
foreach
(
$order_data
as
$ka
=>
$va
){
$order_data
[
$ka
][
'user_data_dou'
]
=
isset
(
$user_datas
[
$va
[
'orderId'
]])
?
$user_datas
[
$va
[
'orderId'
]]
:
''
;
}
}
}
//解密
$str
=
$vv
[
'consigneeInfo'
][
'fullname'
];
$datafullname
[
'accessToken'
]
=
$v
[
'access_token'
];
//'e0a1c90e617f4b3a9865ed059f99c5f42ztb';
$datafullname
[
'appKey'
]
=
$v
[
'app_key'
];;
//'41D9668E8CB81C9890A065BEC300FD84';
$datafullname
[
'appSecret'
]
=
$v
[
'app_secret'
];
//'93bff142bf5c4422ae7bec9eb992e751';
$fullname
=
$this
->
decrypt
(
$datafullname
,
$str
,
$vv
[
'orderId'
]);
if
(
strpos
(
$fullname
,
'<body>'
)
!==
false
){
//存另一数据库中
//是否存在
$exs_code
=
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
$exs_code
){
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
update
([
'name_code'
=>
$vv
[
'consigneeInfo'
][
'fullname'
]]);
}
// CommonService::addLog('token3', json_encode($order_data), $v['pt_id'],'jd_token');
foreach
(
$order_data
as
$kk
=>
$vv
)
{
$order_info
=
OrderService
::
getOrderBy
(
'order_num'
,
$vv
[
'orderId'
],[
'id'
,
'order_status'
,
'lock_type'
,
'sys_num'
,
'order_num'
,
'p_id'
,
'ser_id'
,
'create_time'
,
'new_customer_id'
,
'lock_type'
,
'company_id'
]);
$order_info
=
CommonService
::
dataToArray
(
$order_info
);
if
(
!
empty
(
$order_info
)
&&
in_array
(
$vv
[
'orderState'
],
[
'TRADE_CANCELED'
,
'POP_ORDER_PAUSE'
,
'LOCKED'
])){
if
(
$order_info
[
'lock_type'
]
==
2
||
in_array
(
$order_info
[
'order_status'
],
[
50
,
55
])){
continue
;
}
else
{
DB
::
table
(
'jdpop_encode'
)
->
insert
([
'order_id'
=>
$vv
[
'orderId'
],
'pt_id'
=>
$v
[
'pt_id'
],
'name_code'
=>
$vv
[
'consigneeInfo'
][
'fullname'
]]);
$datar
[
'allprice'
]
=
$vv
[
'orderTotalPrice'
];
$goods_arr
=
OrderMsg
::
where
(
'sys_num'
,
$order_info
[
'sys_num'
])
->
get
([
'id as msg_id'
,
'goods_name'
,
'goods_price'
,
'goods_id as good_id'
]);
$datar
[
'goodsArr'
]
=
CommonService
::
dataToArray
(
$goods_arr
);
$datar
[
'goods_state'
]
=
2
;
//2:平台; 4:财务
$datar
[
'sys_num'
]
=
$order_info
[
'sys_num'
];
$datar
[
'order_num'
]
=
$order_info
[
'order_num'
];
$datar
[
'apply_type'
]
=
1
;
$datar
[
'content'
]
=
$vv
[
'orderStateRemark'
];
$datar
[
'p_id'
]
=
$order_info
[
'p_id'
];
$datar
[
'ser_id'
]
=
$order_info
[
'ser_id'
];
$datar
[
'new_customer_id'
]
=
$order_info
[
'new_customer_id'
];
$datar
[
'order_status'
]
=
$order_info
[
'order_status'
];
$datar
[
'create_time'
]
=
$order_info
[
'create_time'
];
$userArr
=
User
::
where
(
'id'
,
$order_info
[
'new_customer_id'
])
->
first
();
$session
[
'admin_groupnew'
]
=
7
;
$session
[
'admin_acc'
]
=
'系统录入'
;
$session
[
'id'
]
=
1133
;
$session
[
'company_id'
]
=
$order_info
[
'company_id'
];
$ret
=
OrderService
::
lockByRefund
(
$datar
,
$session
,
$userArr
);
CommonService
::
addLog
(
'取消订单'
,
json_encode
(
$ret
),
$vv
[
'orderId'
],
'JDPOP-cancel'
);
continue
;
}
$fullname
=
'无'
;
}
$fullname
=
$fullname
??
$vv
[
'consigneeInfo'
][
'fullname'
];
$fullAddress
=
$this
->
decrypt
(
$datafullname
,
$vv
[
'consigneeInfo'
][
'fullAddress'
],
$vv
[
'orderId'
]);
}
if
(
strpos
(
$fullAddress
,
'<body>'
)
!==
false
){
//存另一数据库中
//是否存在
$exs_code
=
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
$exs_code
){
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
update
([
'address_code'
=>
$vv
[
'consigneeInfo'
][
'fullAddress'
]]);
}
else
{
DB
::
table
(
'jdpop_encode'
)
->
insert
([
'order_id'
=>
$vv
[
'orderId'
],
'address_code'
=>
$vv
[
'consigneeInfo'
][
'fullAddress'
],
'pt_id'
=>
$v
[
'pt_id'
]]);
// CommonService::addLog('token4', json_encode( $vv['orderId']), $v['pt_id'],'jd_token');
$exsit
=
OrderService
::
getOrderBy
(
'order_num'
,
$vv
[
'orderId'
],[
'id'
]);
$eisit_jd
=
DB
::
table
(
'jd_proprietary'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
!
$exsit
||!
$eisit_jd
){
$flag
=
1
;
unset
(
$skuId
);
foreach
(
$vv
[
'itemInfoList'
]
as
$ka
=>
$va
){
$skuId
[]
=
"'"
.
$va
[
'skuId'
]
.
"'"
;
}
$goodids
=
DB
::
table
(
"jd_bound"
)
->
whereRaw
(
"sku_id in ("
.
implode
(
','
,
$skuId
)
.
")"
)
->
pluck
(
'goods_id'
,
'sku_id'
)
->
toarray
();
if
(
empty
(
$goodids
)){
CommonService
::
addLog
(
'无sku'
,
json_encode
(
$skuId
),
$vv
[
'orderId'
],
'JDPOP-无sku'
);
$flag
=
2
;
}
if
(
$goodids
){
if
(
count
(
$goodids
)
<
count
(
$vv
[
'itemInfoList'
])){
$flag
=
2
;
}
}
$fullAddress
=
'无'
;
}
$fullAddress
=
$fullAddress
??
$vv
[
'consigneeInfo'
][
'fullAddress'
];
//解密
if
(
isset
(
$vv
[
'user_data_dou'
])){
$str
=
$vv
[
'user_data_dou'
][
'customerName'
];
}
else
{
$str
=
$vv
[
'consigneeInfo'
][
'fullname'
];
}
$datafullname
[
'accessToken'
]
=
$v
[
'access_token'
];
//'e0a1c90e617f4b3a9865ed059f99c5f42ztb';
$datafullname
[
'appKey'
]
=
$v
[
'app_key'
];;
//'41D9668E8CB81C9890A065BEC300FD84';
$datafullname
[
'appSecret'
]
=
$v
[
'app_secret'
];
//'93bff142bf5c4422ae7bec9eb992e751';
$fullname
=
$this
->
decrypt
(
$datafullname
,
$str
,
$vv
[
'orderId'
]);
if
(
strpos
(
$fullname
,
'<body>'
)
!==
false
){
//存另一数据库中
//是否存在
$exs_code
=
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
$exs_code
){
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
update
([
'name_code'
=>
$vv
[
'consigneeInfo'
][
'fullname'
]]);
}
else
{
DB
::
table
(
'jdpop_encode'
)
->
insert
([
'order_id'
=>
$vv
[
'orderId'
],
'pt_id'
=>
$v
[
'pt_id'
],
'name_code'
=>
$vv
[
'consigneeInfo'
][
'fullname'
]]);
}
$fullname
=
'无'
;
}
$resjdgoods
=
DB
::
table
(
'jdgoods'
)
->
where
(
"order_id"
,
$vv
[
'orderId'
])
->
value
(
'id'
);
foreach
(
$vv
[
'itemInfoList'
]
as
$ka
=>
$va
){
if
(
!
$resjdgoods
){
$sql_dgoods
.=
"('"
.
$vv
[
'orderId'
]
.
"',"
.
$v
[
'pt_id'
]
.
",'"
.
$va
[
'skuId'
]
.
"','"
.
$va
[
'skuName'
]
.
"','"
.
$va
[
'itemTotal'
]
.
"','"
.
$va
[
'jdPrice'
]
.
"','0'),"
;
if
(
in_array
(
$vv
[
'orderId'
],
$arr_goods
)){
unset
(
$arr_goods
[
$kk
]);
$fullname
=
$fullname
??
$vv
[
'consigneeInfo'
][
'fullname'
];
if
(
isset
(
$vv
[
'user_data_dou'
])){
$Address
=
$vv
[
'user_data_dou'
][
'address'
];
}
else
{
$Address
=
$vv
[
'consigneeInfo'
][
'fullAddress'
];
}
$fullAddress
=
$this
->
decrypt
(
$datafullname
,
$Address
,
$vv
[
'orderId'
]);
if
(
strpos
(
$fullAddress
,
'<body>'
)
!==
false
){
//存另一数据库中
//是否存在
$exs_code
=
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
$exs_code
){
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$vv
[
'orderId'
])
->
update
([
'address_code'
=>
$vv
[
'consigneeInfo'
][
'fullAddress'
]]);
}
else
{
DB
::
table
(
'jdpop_encode'
)
->
insert
([
'order_id'
=>
$vv
[
'orderId'
],
'address_code'
=>
$vv
[
'consigneeInfo'
][
'fullAddress'
],
'pt_id'
=>
$v
[
'pt_id'
]]);
}
$fullAddress
=
'无'
;
}
$arr_goods
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$arr_goods
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$arr_goods
[
$kk
][
'sku_id'
]
=
$va
[
'skuId'
];
$arr_goods
[
$kk
][
'item_total'
]
=
$va
[
'itemTotal'
];
$arr_goods
[
$kk
][
'jd_price'
]
=
$va
[
'itemTotal'
];
$arr_goods
[
$kk
][
'jd_cost'
]
=
$va
[
'jdPrice'
];
$arr_goods
[
$kk
][
'sku_name'
]
=
$va
[
'skuName'
];
DB
::
table
(
'jdgoods'
)
->
insert
(
$arr_goods
[
$kk
]);
unset
(
$arr_goods
[
$kk
]);
$fullAddress
=
$fullAddress
??
$vv
[
'consigneeInfo'
][
'fullAddress'
];
}
$sys_num
=
'L'
.
date
(
"YmdHis"
)
.
str_pad
(
rand
(
0
,
999
),
3
,
'0'
,
STR_PAD_LEFT
);
if
(
$flag
==
1
)
{
$goodid
=
$goodids
[
$va
[
'skuId'
]];
if
(
$goodid
){
$goods_res
=
$goods
[
$goodid
];
if
(
$goods_res
[
'pg_series'
]
==
''
){
$type
=
$goods_res
[
'version'
];
}
else
{
$type
=
$goods_res
[
'pg_series'
]
.
"-"
.
$goods_res
[
'version'
];
$resjdgoods
=
DB
::
table
(
'jdgoods'
)
->
where
(
"order_id"
,
$vv
[
'orderId'
])
->
value
(
'id'
);
foreach
(
$vv
[
'itemInfoList'
]
as
$ka
=>
$va
){
if
(
!
$resjdgoods
){
$sql_dgoods
.=
"('"
.
$vv
[
'orderId'
]
.
"',"
.
$v
[
'pt_id'
]
.
",'"
.
$va
[
'skuId'
]
.
"','"
.
$va
[
'skuName'
]
.
"','"
.
$va
[
'itemTotal'
]
.
"','"
.
$va
[
'jdPrice'
]
.
"','0'),"
;
if
(
in_array
(
$vv
[
'orderId'
],
$arr_goods
)){
unset
(
$arr_goods
[
$kk
]);
}
$goods_name
=
$goods_name
.
$goods_res
[
'brand_name'
]
.
","
.
$type
.
","
.
$goods_res
[
'general_version'
]
.
","
;
$good_brand
[]
=
$goods_res
[
'brand_name'
];
$arr_goods
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$arr_goods
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$arr_goods
[
$kk
][
'sku_id'
]
=
$va
[
'skuId'
];
$arr_goods
[
$kk
][
'item_total'
]
=
$va
[
'itemTotal'
];
$arr_goods
[
$kk
][
'jd_price'
]
=
$va
[
'itemTotal'
];
$arr_goods
[
$kk
][
'jd_cost'
]
=
$va
[
'jdPrice'
];
$arr_goods
[
$kk
][
'sku_name'
]
=
$va
[
'skuName'
];
DB
::
table
(
'jdgoods'
)
->
insert
(
$arr_goods
[
$kk
]);
unset
(
$arr_goods
[
$kk
]);
}
$sys_num
=
'L'
.
date
(
"YmdHis"
)
.
str_pad
(
rand
(
0
,
999
),
3
,
'0'
,
STR_PAD_LEFT
);
if
(
$flag
==
1
)
{
$goodid
=
$goodids
[
$va
[
'skuId'
]];
if
(
$goodid
){
$goods_res
=
$goods
[
$goodid
];
if
(
$goods_res
[
'pg_series'
]
==
''
){
$type
=
$goods_res
[
'version'
];
}
else
{
$type
=
$goods_res
[
'pg_series'
]
.
"-"
.
$goods_res
[
'version'
];
}
$goods_name
=
$goods_name
.
$goods_res
[
'brand_name'
]
.
","
.
$type
.
","
.
$goods_res
[
'general_version'
]
.
","
;
$good_brand
[]
=
$goods_res
[
'brand_name'
];
$orderMsgData
[
$ka
][
'goods_id'
]
=
$goodid
;
$orderMsgData
[
$ka
][
'goods_name'
]
=
$goods_res
[
'brand_name'
]
.
"-"
.
$type
;
$orderMsgData
[
$ka
][
'goods_price'
]
=
$va
[
'jdPrice'
];
//实收/商品单价
// $orderMsgData['goods_paid'] = $va['jdPrice'];//应收
// $orderMsgData['goods_paid'] = $va['jdPrice'];//应收
$orderMsgData
[
$ka
][
'goods_num'
]
=
$va
[
'itemTotal'
];
$orderMsgData
[
$ka
][
'goods_brand'
]
=
$goods_res
[
'brand_name'
];
$orderMsgData
[
$ka
][
'goods_number'
]
=
$type
;
$orderMsgData
[
$ka
][
'cd_id'
]
=
1
;
// dump($orderMsgData);
// dump($orderMsgData);
}
}
}
}
//添单
//添单
//转换手机号
// $data['pt_name'] = $pt_name;//店铺名
$data_m
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$data_m
[
$kk
][
'appkey'
]
=
$v
[
'app_key'
];
//appkey
$data_m
[
$kk
][
'appsecret'
]
=
$v
[
'app_secret'
];
//secret
$data_m
[
$kk
][
'acctoken'
]
=
$v
[
'access_token'
];
//token
$tel
=
$this
->
changeTelphone
(
$data_m
[
$kk
]);
if
(
$flag
==
1
){
$orders
[
$kk
][
'sys_bh'
]
=
$sys_num
;
$orders
[
$kk
][
'skb_bh'
]
=
$vv
[
'orderId'
];
$orders
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$orders
[
$kk
][
'ser_type'
]
=
1
;
//服务类型:1上门安装,2到店服务
$orders
[
$kk
][
'shr_name'
]
=
$fullname
;
$orders
[
$kk
][
'shr_phone'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'telephone'
];
//$vv['consigneeInfo']['telephone'];//
$orders
[
$kk
][
'shr_sheng'
]
=
$vv
[
'consigneeInfo'
][
'province'
];
//
$orders
[
$kk
][
'shr_shi'
]
=
$vv
[
'consigneeInfo'
][
'city'
];
//
$orders
[
$kk
][
'shr_xian'
]
=
$vv
[
'consigneeInfo'
][
'county'
];
//
$orders
[
$kk
][
'shr_adress'
]
=
$fullAddress
;
//
$orders
[
$kk
][
'shr_other'
]
=
'接单后10分钟内务必联系客户核实车型跟安装时间!不断电安装、如果无法完成 请立刻反馈我们处理~!'
;
$orders
[
$kk
][
'car_audit'
]
=
2
;
//1:新订单;2:可派单;3:处理中
$orders
[
$kk
][
'order_type'
]
=
1
;
//订单类型:1:普通;20加急;10:夜间
$orders
[
$kk
][
'order_time'
]
=
$vv
[
'orderStartTime'
];
$orders
[
$kk
][
'pay_type'
]
=
1
;
//支付方式:1在线支付;2货到付款
$orders
[
$kk
][
'goods'
]
=
$orderMsgData
;
// $session = $request->get('session_token');//获取操作人信息
$session
[
'admin_groupnew'
]
=
7
;
$session
[
'admin_acc'
]
=
'系统录入'
;
$session
[
'id'
]
=
1133
;
$session
[
'company_id'
]
=
11
;
// dump($orders[$kk]);
$return
=
OrderaddService
::
addOrder
(
$orders
[
$kk
],
$session
,
$ip
);
// dump($return);
CommonService
::
addLog
(
'添加定单'
,
json_encode
(
$return
),
$vv
[
'orderId'
],
'jd_addOrder'
);
// $return['ErrorCode'] = 2;
if
(
$return
[
'ErrorCode'
]
==
1
&&
$v
[
'pt_id'
]
!=
33
){
//调用京东出库
$res_ex
=
[];
$res_ex
[
'appKey'
]
=
$v
[
'app_key'
];
//appkey
$res_ex
[
'appSecret'
]
=
$v
[
'app_secret'
];
//secret
$res_ex
[
'accessToken'
]
=
$v
[
'access_token'
];
//token
$res_ex
[
'skb_bh'
]
=
$vv
[
'orderId'
];
//$vv['orderId'];
$res_ex
[
'jdid'
]
=
1274
;
$res_ex
[
'kd_number'
]
=
''
;
$res_ex
[
'estimateDate'
]
=
date
(
"Y-m-d H:i:s"
);
$result
=
$this
->
request_post
(
$url_ex
,
$res_ex
);
//出库同步
$filename
=
'pop_ex'
.
date
(
'Ym'
);
CommonService
::
addLog
(
'出库'
,
json_encode
(
$res_ex
),
$vv
[
'orderId'
],
$filename
);
// $result['code'] = 200;
$reta
=
json_decode
(
$result
,
true
);
if
(
$reta
[
'jingdong_pop_order_shipment_responce'
][
'sopjosshipment_result'
][
'success'
]
==
true
){
CommonService
::
addLog
(
'添单成功出库'
,
$result
,
$vv
[
'orderId'
],
$filename
);
// $data['pt_name'] = $pt_name;//店铺名
$data_m
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$data_m
[
$kk
][
'appkey'
]
=
$v
[
'app_key'
];
//appkey
$data_m
[
$kk
][
'appsecret'
]
=
$v
[
'app_secret'
];
//secret
$data_m
[
$kk
][
'acctoken'
]
=
$v
[
'access_token'
];
//token
$tel
=
$this
->
changeTelphone
(
$data_m
[
$kk
]);
if
(
$flag
==
1
){
$orders
[
$kk
][
'sys_bh'
]
=
$sys_num
;
$orders
[
$kk
][
'skb_bh'
]
=
$vv
[
'orderId'
];
$orders
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$orders
[
$kk
][
'ser_type'
]
=
1
;
//服务类型:1上门安装,2到店服务
$orders
[
$kk
][
'shr_name'
]
=
$fullname
;
$orders
[
$kk
][
'shr_phone'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'telephone'
];
//$vv['consigneeInfo']['telephone'];//
$orders
[
$kk
][
'shr_sheng'
]
=
$vv
[
'consigneeInfo'
][
'province'
];
//
$orders
[
$kk
][
'shr_shi'
]
=
$vv
[
'consigneeInfo'
][
'city'
];
//
$orders
[
$kk
][
'shr_xian'
]
=
$vv
[
'consigneeInfo'
][
'county'
];
//
$orders
[
$kk
][
'shr_adress'
]
=
$fullAddress
;
//
$orders
[
$kk
][
'shr_other'
]
=
'接单后10分钟内务必联系客户核实车型跟安装时间!不断电安装、如果无法完成 请立刻反馈我们处理~!'
;
$orders
[
$kk
][
'car_audit'
]
=
2
;
//1:新订单;2:可派单;3:处理中
$orders
[
$kk
][
'order_type'
]
=
1
;
//订单类型:1:普通;20加急;10:夜间
$orders
[
$kk
][
'order_time'
]
=
$vv
[
'orderStartTime'
];
$orders
[
$kk
][
'pay_type'
]
=
1
;
//支付方式:1在线支付;2货到付款
$orders
[
$kk
][
'goods'
]
=
$orderMsgData
;
// $session = $request->get('session_token');//获取操作人信息
$session
[
'admin_groupnew'
]
=
7
;
$session
[
'admin_acc'
]
=
'系统录入'
;
$session
[
'id'
]
=
1133
;
$session
[
'company_id'
]
=
11
;
// dump($orders[$kk]);
$return
=
OrderaddService
::
addOrder
(
$orders
[
$kk
],
$session
,
$ip
);
// dump($return);
CommonService
::
addLog
(
'添加定单'
,
json_encode
(
$return
),
$vv
[
'orderId'
],
'jd_addOrder'
);
// $return['ErrorCode'] = 2;
if
(
$return
[
'ErrorCode'
]
==
1
){
//调用京东出库
$res_ex
=
[];
$res_ex
[
'appKey'
]
=
$v
[
'app_key'
];
//appkey
$res_ex
[
'appSecret'
]
=
$v
[
'app_secret'
];
//secret
$res_ex
[
'accessToken'
]
=
$v
[
'access_token'
];
//token
$res_ex
[
'skb_bh'
]
=
$vv
[
'orderId'
];
//$vv['orderId'];
$res_ex
[
'jdid'
]
=
1274
;
$res_ex
[
'kd_number'
]
=
''
;
$res_ex
[
'estimateDate'
]
=
date
(
"Y-m-d H:i:s"
);
$result
=
$this
->
request_post
(
$url_ex
,
$res_ex
);
//出库同步
$filename
=
'pop_ex'
.
date
(
'Ym'
);
CommonService
::
addLog
(
'出库'
,
json_encode
(
$res_ex
),
$vv
[
'orderId'
],
$filename
);
$reta
=
json_decode
(
$result
,
true
);
if
(
$reta
[
'jingdong_pop_order_shipment_responce'
][
'sopjosshipment_result'
][
'success'
]
==
true
){
CommonService
::
addLog
(
'添单成功出库'
,
$result
,
$vv
[
'orderId'
],
$filename
);
}
else
{
CommonService
::
addLog
(
'添单出库失败'
,
$result
,
$vv
[
'orderId'
],
$filename
);
}
$newOrderId
=
true
;
}
else
{
CommonService
::
addLog
(
'添单出库失败'
,
$result
,
$vv
[
'orderId'
],
$filename
)
;
$newOrderId
=
false
;
}
$newOrderId
=
true
;
}
else
{
$newOrderId
=
false
;
}
}
$rea
=
DB
::
table
(
'jd_proprietary'
)
->
where
(
"order_id"
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
!
$newOrderId
||
$flag
==
'2'
){
//echo '添加订单信息失败';
if
(
!
$rea
){
// $sqll .= "('".$vv['orderId']."','系统录入',".$v['pt_id'].",'".$vv['payType']."','".$vv['orderSellerPrice']."',".$vv['freightPrice'].",'WAIT_SELLER_STOCK_OUT','不需要开具发票','','".$vv['orderStartTime']."','".$vv['consigneeInfo']['fullname']."','".$tel."','".$vv['consigneeInfo']['mobile']."','".$vv['consigneeInfo']['province']."','".$vv['consigneeInfo']['city']."','".$vv['consigneeInfo']['county']."','".$vv['consigneeInfo']['fullAddress']."','".$vv['orderPayment']."','1','".$vv['parentOrderId']."'),";
if
(
in_array
(
$vv
[
'orderId'
],
array_column
(
$arr
,
'order_id'
))){
$rea
=
DB
::
table
(
'jd_proprietary'
)
->
where
(
"order_id"
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
!
$newOrderId
||
$flag
==
'2'
){
//echo '添加订单信息失败';
if
(
!
$rea
){
if
(
in_array
(
$vv
[
'orderId'
],
array_column
(
$arr
,
'order_id'
))){
unset
(
$arr
[
$kk
]);
}
$arr
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$arr
[
$kk
][
'admin_acc'
]
=
'系统录入'
;
$arr
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$arr
[
$kk
][
'pay_type'
]
=
$vv
[
'payType'
];
$arr
[
$kk
][
'order_seller_price'
]
=
$vv
[
'orderSellerPrice'
];
$arr
[
$kk
][
'freight_price'
]
=
$vv
[
'freightPrice'
];
$arr
[
$kk
][
'order_state'
]
=
$vv
[
'orderState'
];
//'WAIT_SELLER_STOCK_OUT';
$arr
[
$kk
][
'invoice_info'
]
=
'不需要开具发票'
;
$arr
[
$kk
][
'order_remark'
]
=
''
;
$arr
[
$kk
][
'order_start_time'
]
=
$vv
[
'orderStartTime'
];
$arr
[
$kk
][
'fullname'
]
=
$fullname
;
$arr
[
$kk
][
'mobile'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'mobile'
];
$arr
[
$kk
][
'telephone'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'telephone'
];
//
$arr
[
$kk
][
'province'
]
=
$vv
[
'consigneeInfo'
][
'province'
];
$arr
[
$kk
][
'city'
]
=
$vv
[
'consigneeInfo'
][
'city'
];
$arr
[
$kk
][
'county'
]
=
$vv
[
'consigneeInfo'
][
'county'
];
$arr
[
$kk
][
'full_address'
]
=
$fullAddress
;
$arr
[
$kk
][
'order_pay'
]
=
$vv
[
'orderPayment'
];
$arr
[
$kk
][
'is_show'
]
=
1
;
$arr
[
$kk
][
'parent_orderid'
]
=
$vv
[
'parentOrderId'
];
DB
::
table
(
'jd_proprietary'
)
->
insert
(
$arr
[
$kk
]);
unset
(
$arr
[
$kk
]);
}
$arr
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$arr
[
$kk
][
'admin_acc'
]
=
'系统录入'
;
$arr
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$arr
[
$kk
][
'pay_type'
]
=
$vv
[
'payType'
];
$arr
[
$kk
][
'order_seller_price'
]
=
$vv
[
'orderSellerPrice'
];
$arr
[
$kk
][
'freight_price'
]
=
$vv
[
'freightPrice'
];
$arr
[
$kk
][
'order_state'
]
=
$vv
[
'orderState'
];
//'WAIT_SELLER_STOCK_OUT';
$arr
[
$kk
][
'invoice_info'
]
=
'不需要开具发票'
;
$arr
[
$kk
][
'order_remark'
]
=
''
;
$arr
[
$kk
][
'order_start_time'
]
=
$vv
[
'orderStartTime'
];
$arr
[
$kk
][
'fullname'
]
=
$fullname
;
$arr
[
$kk
][
'mobile'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'mobile'
];
$arr
[
$kk
][
'telephone'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'telephone'
];
//
$arr
[
$kk
][
'province'
]
=
$vv
[
'consigneeInfo'
][
'province'
];
$arr
[
$kk
][
'city'
]
=
$vv
[
'consigneeInfo'
][
'city'
];
$arr
[
$kk
][
'county'
]
=
$vv
[
'consigneeInfo'
][
'county'
];
$arr
[
$kk
][
'full_address'
]
=
$fullAddress
;
$arr
[
$kk
][
'order_pay'
]
=
$vv
[
'orderPayment'
];
$arr
[
$kk
][
'is_show'
]
=
1
;
$arr
[
$kk
][
'parent_orderid'
]
=
$vv
[
'parentOrderId'
];
DB
::
table
(
'jd_proprietary'
)
->
insert
(
$arr
[
$kk
]);
unset
(
$arr
[
$kk
]);
}
}
else
{
$reas
=
DB
::
table
(
'jd_proprietary'
)
->
where
(
"order_id"
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
!
$reas
){
// $sqll .= "('".$vv['orderId']."','系统录入',".$v['pt_id'].",'".$vv['payType']."','".$vv['orderSellerPrice']."',".$vv['freightPrice'].",'WAIT_SELLER_STOCK_OUT','不需要开具发票','','".$vv['orderStartTime']."','".$vv['consigneeInfo']['fullname']."','".$tel."','".$vv['consigneeInfo']['mobile']."','".$vv['consigneeInfo']['province']."','".$vv['consigneeInfo']['city']."','".$vv['consigneeInfo']['county']."','".$vv['consigneeInfo']['fullAddress']."','".$vv['orderPayment']."','2','".$vv['parentOrderId']."'),";
if
(
in_array
(
$vv
[
'orderId'
],
array_column
(
$arr
,
'order_id'
))){
}
else
{
$reas
=
DB
::
table
(
'jd_proprietary'
)
->
where
(
"order_id"
,
$vv
[
'orderId'
])
->
value
(
'id'
);
if
(
!
$reas
){
if
(
in_array
(
$vv
[
'orderId'
],
array_column
(
$arr
,
'order_id'
))){
unset
(
$arr
[
$kk
]);
}
$arr
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$arr
[
$kk
][
'admin_acc'
]
=
'系统录入'
;
$arr
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$arr
[
$kk
][
'pay_type'
]
=
$vv
[
'payType'
];
$arr
[
$kk
][
'order_seller_price'
]
=
$vv
[
'orderSellerPrice'
];
$arr
[
$kk
][
'freight_price'
]
=
$vv
[
'freightPrice'
];
$arr
[
$kk
][
'order_state'
]
=
'WAIT_SELLER_STOCK_OUT'
;
$arr
[
$kk
][
'invoice_info'
]
=
'不需要开具发票'
;
$arr
[
$kk
][
'order_remark'
]
=
''
;
$arr
[
$kk
][
'order_start_time'
]
=
$vv
[
'orderStartTime'
];
$arr
[
$kk
][
'fullname'
]
=
$fullname
;
$arr
[
$kk
][
'mobile'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'mobile'
];
$arr
[
$kk
][
'telephone'
]
=
$vv
[
'consigneeInfo'
][
'mobile'
];
//
$arr
[
$kk
][
'province'
]
=
$vv
[
'consigneeInfo'
][
'province'
];
$arr
[
$kk
][
'city'
]
=
$vv
[
'consigneeInfo'
][
'city'
];
$arr
[
$kk
][
'county'
]
=
$vv
[
'consigneeInfo'
][
'county'
];
$arr
[
$kk
][
'full_address'
]
=
$fullAddress
;
$arr
[
$kk
][
'order_pay'
]
=
$vv
[
'orderPayment'
];
$arr
[
$kk
][
'is_show'
]
=
1
;
$arr
[
$kk
][
'parent_orderid'
]
=
$vv
[
'parentOrderId'
];
DB
::
table
(
'jd_proprietary'
)
->
insert
(
$arr
[
$kk
]);
unset
(
$arr
[
$kk
]);
}
$arr
[
$kk
][
'order_id'
]
=
$vv
[
'orderId'
];
$arr
[
$kk
][
'admin_acc'
]
=
'系统录入'
;
$arr
[
$kk
][
'pt_id'
]
=
$v
[
'pt_id'
];
$arr
[
$kk
][
'pay_type'
]
=
$vv
[
'payType'
];
$arr
[
$kk
][
'order_seller_price'
]
=
$vv
[
'orderSellerPrice'
];
$arr
[
$kk
][
'freight_price'
]
=
$vv
[
'freightPrice'
];
$arr
[
$kk
][
'order_state'
]
=
'WAIT_SELLER_STOCK_OUT'
;
$arr
[
$kk
][
'invoice_info'
]
=
'不需要开具发票'
;
$arr
[
$kk
][
'order_remark'
]
=
''
;
$arr
[
$kk
][
'order_start_time'
]
=
$vv
[
'orderStartTime'
];
$arr
[
$kk
][
'fullname'
]
=
$fullname
;
$arr
[
$kk
][
'mobile'
]
=
$tel
??
$vv
[
'consigneeInfo'
][
'mobile'
];
$arr
[
$kk
][
'telephone'
]
=
$vv
[
'consigneeInfo'
][
'mobile'
];
//
$arr
[
$kk
][
'province'
]
=
$vv
[
'consigneeInfo'
][
'province'
];
$arr
[
$kk
][
'city'
]
=
$vv
[
'consigneeInfo'
][
'city'
];
$arr
[
$kk
][
'county'
]
=
$vv
[
'consigneeInfo'
][
'county'
];
$arr
[
$kk
][
'full_address'
]
=
$fullAddress
;
$arr
[
$kk
][
'order_pay'
]
=
$vv
[
'orderPayment'
];
$arr
[
$kk
][
'is_show'
]
=
1
;
$arr
[
$kk
][
'parent_orderid'
]
=
$vv
[
'parentOrderId'
];
DB
::
table
(
'jd_proprietary'
)
->
insert
(
$arr
[
$kk
]);
unset
(
$arr
[
$kk
]);
}
}
}
echo
'添加成功---'
;
}
/* if($sqll!='' && $sql_dgoods!=''){
$sqls = $sqlls.$sqll;//储存订单基本信息
$sqld = $sql1s.$sql_dgoods;//储存订单中的商品详情
$sqld = trim($sqld,",").";";
$sqls = trim($sqls,",").";";
DB::insert($sqls);
DB::insert($sqld);
}*/
/* if(!empty($arr_goods)){
DB::table('jdgoods')->insert($arr_goods);
}
if(!empty($arr)){
DB::table('jd_proprietary')->insert($arr);
}*/
echo
'添加成功---'
;
}
echo
'操作成功--****'
;
}
echo
'操作成功--****'
;
//return ['Data' => [], 'ErrorMessage' => '添加成功', 'ErrorCode' => ErrorInc::MYSQL_FAILED];
}
}
/**
...
...
@@ -376,14 +384,14 @@ exit;*/
* @date 2023/12/12
* @Time: 10:51
*/
public
function
changeTelphone
(
$data
){
// $result = $this->request_post($url,$data);
$url
=
'jx.bluearp.com/m/index.php/Automatic/TzPopOrderGetPhone'
;
$ret
=
$this
->
request_post
(
$url
,
$data
);
$result
=
json_decode
(
$ret
,
true
);
CommonService
::
addLog
(
'手机号'
,
$result
[
'jingdong_pop_order_getmobilelist_responce'
][
"result"
][
"data"
][
$data
[
'order_id'
]][
'consMobilePhone'
]
.
'----'
.
$ret
.
'---'
.
json_encode
(
$data
)
.
'---'
.
$url
,
$data
[
'order_id'
],
'jd_mobile'
);
return
$result
[
'jingdong_pop_order_getmobilelist_responce'
][
"result"
][
"data"
][
$data
[
'order_id'
]][
'consMobilePhone'
];
}
public
function
changeTelphone
(
$data
){
// $result = $this->request_post($url,$data);
$url
=
'jx.bluearp.com/m/index.php/Automatic/TzPopOrderGetPhone'
;
$ret
=
$this
->
request_post
(
$url
,
$data
);
$result
=
json_decode
(
$ret
,
true
);
CommonService
::
addLog
(
'手机号'
,
$result
[
'jingdong_pop_order_getmobilelist_responce'
][
"result"
][
"data"
][
$data
[
'order_id'
]][
'consMobilePhone'
]
.
'----'
.
$ret
.
'---'
.
json_encode
(
$data
)
.
'---'
.
$url
,
$data
[
'order_id'
],
'jd_mobile'
);
return
$result
[
'jingdong_pop_order_getmobilelist_responce'
][
"result"
][
"data"
][
$data
[
'order_id'
]][
'consMobilePhone'
];
}
/**
* @name 出库
...
...
@@ -449,13 +457,6 @@ public function changeTelphone($data){
* @Time: 10:14
*/
public
function
decOrder
(){
/* $str = "AAQLAodRrJ360+b6qYevz+HgyXHUehSiWki+A9YqUJVvonqI1G8rNALcCZYF9eo5A5M=";
$data['accessToken'] = 'e0a1c90e617f4b3a9865ed059f99c5f42ztb';
$data['appKey'] = '41D9668E8CB81C9890A065BEC300FD84';
$data['appSecret'] = '93bff142bf5c4422ae7bec9eb992e751';
return $this->decrypt($data,$str);
exit;*/
$token
=
DB
::
table
(
'jdpop_token'
)
->
where
(
'status'
,
1
)
->
select
(
'app_key'
,
'app_secret'
,
'access_token'
,
'pt_id'
)
->
get
()
->
toarray
();
foreach
(
$token
as
$k
=>
$v
)
{
...
...
@@ -465,39 +466,35 @@ public function changeTelphone($data){
$res_ult
[
$k
][
'appSecret'
]
=
$v
[
'app_secret'
];
//secret
$res_ult
[
$k
][
'accessToken'
]
=
$v
[
'access_token'
];
//token
$list
=
DB
::
table
(
'jdpop_encode'
)
->
where
(
'is_enj'
,
1
)
->
where
(
'pt_id'
,
$v
[
'pt_id'
])
->
OrderBy
(
'id'
,
'desc'
)
->
limit
(
10
)
->
get
();
$list
=
CommonService
::
dataToArray
(
$list
);
$list
=
DB
::
table
(
'jdpop_encode'
)
->
where
(
'is_enj'
,
1
)
->
where
(
'pt_id'
,
$v
[
'pt_id'
])
->
OrderBy
(
'id'
,
'desc'
)
->
limit
(
10
)
->
get
();
$list
=
CommonService
::
dataToArray
(
$list
);
if
(
$list
){
foreach
(
$list
as
$item
)
{
$user_id
=
Orders
::
where
(
'order_num'
,
$item
[
'order_id'
])
->
value
(
'new_customer_id'
);
if
(
empty
(
$user_id
)){
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$item
[
'order_id'
])
->
update
([
'is_enj'
=>
2
]);
}
else
{
if
(
$list
){
foreach
(
$list
as
$item
)
{
$user_id
=
Orders
::
where
(
'order_num'
,
$item
[
'order_id'
])
->
value
(
'new_customer_id'
);
//解密
$fullname
=
$this
->
decrypt
(
$res_ult
[
$k
],
$item
[
'name_code'
],
$item
[
'order_id'
]);
$fullname
=
$this
->
decrypt
(
$res_ult
[
$k
],
$item
[
'name_code'
],
$item
[
'order_id'
]);
// echo $fullname;
if
(
strpos
(
$fullname
,
'<body>'
)
!==
false
)
{
if
(
strpos
(
$fullname
,
'<body>'
)
!==
false
)
{
}
else
{
}
else
{
//修改用户表
$res
=
User
::
where
(
'id'
,
$user_id
)
->
update
([
'shr_name'
=>
$fullname
]);
$res
=
User
::
where
(
'id'
,
$user_id
)
->
update
([
'shr_name'
=>
$fullname
]);
}
$address
=
$this
->
decrypt
(
$res_ult
[
$k
],
$item
[
'address_code'
],
$item
[
'order_id'
]);
if
(
strpos
(
$address
,
'<body>'
)
!==
false
)
{
}
else
{
$address
=
$this
->
decrypt
(
$res_ult
[
$k
],
$item
[
'address_code'
],
$item
[
'order_id'
]);
if
(
strpos
(
$address
,
'<body>'
)
!==
false
)
{
}
else
{
//修改用户表
$ret
=
User
::
where
(
'id'
,
$user_id
)
->
update
([
'shr_adress'
=>
$address
]);
$ret
=
User
::
where
(
'id'
,
$user_id
)
->
update
([
'shr_adress'
=>
$address
]);
}
if
(
$res
&&
$ret
)
{
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$item
[
'order_id'
])
->
update
([
'is_enj'
=>
2
]);
if
(
$res
&&
$ret
)
{
DB
::
table
(
'jdpop_encode'
)
->
where
(
'order_id'
,
$item
[
'order_id'
])
->
update
([
'is_enj'
=>
2
]);
}
CommonService
::
addLog
(
'JD'
,
$fullname
.
'--'
.
$address
,
$item
[
'order_id'
],
'JDPOP-dec'
);
}
CommonService
::
addLog
(
'JD'
,
$fullname
.
'--'
.
$address
,
$item
[
'order_id'
],
'JDPOP-dec'
);
}
}
}
}
}
...
...
@@ -521,46 +518,6 @@ public function changeTelphone($data){
$res
=
(
string
)
$this
->
https_request
(
$url
);
CommonService
::
addLog
(
'URL'
,
$order_num
.
'---'
.
$url
.
'----'
.
$res
,
111
,
'url'
);
return
$res
;
/* // 判断是否需要解密 ReceiverAddress ReceiverMobile ReceiverName
if ($pop_ptdata['is_decrypt'] == 2) {
$jmdecrypt_num = 0;
if (mb_strlen($data['ReceiverName']) > 50) {
$decrypt_data = [];
$decrypt_data['dp'] = $pop_ptdata['pt_name'];
$decrypt_data['jmstr'] = str_replace('+', '%2B', $data['ReceiverName']);
$decrypt_data = json_encode($decrypt_data);
$url = "http://jm.bluearp.com/jd/test?str=" . $decrypt_data;
$data['ReceiverName'] = (string)$this->https_request($url);
$jmdecrypt_num++;
}
if (mb_strlen($data['ReceiverMobile']) > 30) {
$decrypt_data = [];
$decrypt_data['dp'] = $pop_ptdata['pt_name'];
$decrypt_data['jmstr'] = str_replace('+', '%2B', $data['ReceiverMobile']);
$decrypt_data = json_encode($decrypt_data);
$url = "http://jm.bluearp.com/jd/test?str=" . $decrypt_data;
$data['ReceiverMobile'] = (string)$this->https_request($url);
$jmdecrypt_num++;
}
if (strpos($data['ReceiverMobile'], "*") !== false) {
$phone = $this->PopOrderGetPhone($pop_ptdata['appKey'], $pop_ptdata['appSecret'], $pop_ptdata['accessToken'], $data['TidStr']);
if ($phone != '') {
$data['ReceiverMobile'] = $phone;
}
}
if ($jmdecrypt_num > 0) {
$decrypt_data = [];
$decrypt_data['dp'] = $pop_ptdata['pt_name'];
$decrypt_data['jmstr'] = str_replace('+', '%2B', $data['ReceiverAddress']);
$decrypt_data = json_encode($decrypt_data);
$url = "http://jm.bluearp.com/jd/test?str=" . $decrypt_data;
$data['ReceiverAddress'] = (string)$this->https_request($url);
}
}*/
}
...
...
app/Http/Controllers/Common/GoodsBrandController.php
浏览文件 @
16cf9ec1
...
...
@@ -211,7 +211,9 @@ class GoodsBrandController extends BaseController
if
(
RedisService
::
redisGet
(
'gbList'
)){
//echo 1;
$gbList
=
RedisService
::
redisGet
(
'gbList'
);
$gbList
=
CommonService
::
arrayFilterFieldValue
(
$gbList
,[[
'company_id'
=>
$session
[
'company_id'
]]]);
if
(
$session
[
'admin_groupnew'
]
!=
7
)
{
$gbList
=
CommonService
::
arrayFilterFieldValue
(
$gbList
,
[[
'company_id'
=>
$session
[
'company_id'
]]]);
}
return
$this
->
success
(
'获取成功'
,
$gbList
);
//return $cdList;
}
else
{
...
...
@@ -219,7 +221,9 @@ class GoodsBrandController extends BaseController
$gbLists
=
PjBrandsService
::
gbList
();
$gbList
=
json_encode
(
$gbLists
);
RedisService
::
redisSet
(
'gbList'
,
$gbList
);
$gbLists
=
CommonService
::
arrayFilterFieldValue
(
$gbLists
,[[
'company_id'
=>
$session
[
'company_id'
]]]);
if
(
$session
[
'admin_groupnew'
]
!=
7
)
{
$gbLists
=
CommonService
::
arrayFilterFieldValue
(
$gbLists
,
[[
'company_id'
=>
$session
[
'company_id'
]]]);
}
return
$this
->
success
(
'获取成功'
,
$gbLists
);
}
// if(RedisService::redisGet('gbList')){
...
...
app/Services/OrderListService.php
浏览文件 @
16cf9ec1
...
...
@@ -467,9 +467,9 @@ class OrderListService extends Service
$where
[
'stauas_searchin'
]
=
[
10
,
20
];
}
elseif
(
$input
[
'state'
]
==
3
){
//安装中
$where
[
'stauas'
]
=
30
;
$search
[
'day_time_searchlt'
]
=
$time
;
$search
[
'day_time_isnull'
]
=
null
;
$where
[
'day_time_searchor'
]
=
$search
;
//
$search['day_time_searchlt'] = $time;
//
$search['day_time_isnull'] = null;
//
$where['day_time_searchor'] = $search;
}
elseif
(
$input
[
'state'
]
==
4
){
//延期订单
$where
[
'stauas'
]
=
30
;
$where
[
'day_time_searchgt'
]
=
$time
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论