增加商家寄件回调

This commit is contained in:
liaofei 2023-06-12 09:59:52 +08:00
parent edb3797171
commit 21e83a76dc
4 changed files with 42 additions and 3 deletions

View File

@ -242,7 +242,7 @@ class StoreOrder extends AuthController
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['express_record_type', 2],//发货记录类型
['express_record_type', 2],//发货记录类型:2=电子面单;3=商家寄件
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
@ -465,7 +465,7 @@ class StoreOrder extends AuthController
*/
public function order_info($id)
{
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund','invoice']))) {
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund', 'invoice']))) {
return app('json')->fail(400118);
}
/** @var UserServices $services */

View File

@ -793,4 +793,42 @@ class StoreOrderController
$cartProduct['order_id'] = $this->services->value(['id' => $cartInfo['oid']], 'order_id');
return app('json')->success($cartProduct);
}
/**
* 商家寄件回调
* @param Request $request
* @return \think\Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/12
*/
public function callBack(Request $request)
{
$data = $request->postMore([
['t', ''],
['sign', ''],
['type', ''],
['data', ''],
]);
if (md5(json_encode($data['data']) . $data['t']) != $data['sign']) {
return app('json')->fail();
}
switch ($data['type']) {
case 'order_success':
$update = [
'label' => $data['data']['label'] ?? '',
];
if (isset($data['kuaidinum'])) {
$update['delivery_id'] = $data['kuaidinum'];
}
if (isset($data['task_id'])) {
$this->services->update(['task_id' => $data['task_id']], $update);
}
break;
}
return app('json')->success();
}
}

View File

@ -18,6 +18,7 @@ Route::group(function () {
Route::any('wechat/serve', 'v1.wechat.WechatController/serve')->option(['real_name' => '公众号服务']);//公众号服务
Route::any('wechat/miniServe', 'v1.wechat.WechatController/miniServe')->option(['real_name' => '小程序服务']);//公众号服务
Route::any('pay/notify/:type', 'v1.PayController/notify')->option(['real_name' => '支付回调']);//支付回调
Route::any('order_call_back', 'v1.order.StoreOrderController/callBack')->option(['real_name' => '商家寄件回调']);//商家寄件回调
Route::get('get_script', 'v1.PublicController/getScript')->option(['real_name' => '获取统计代码']);//获取统计代码
Route::get('version', 'v1.PublicController/getVersion')->option(['real_name' => '获取代码版本号']);
})->option(['mark' => 'serve', 'mark_name' => '服务接口']);

View File

@ -96,7 +96,7 @@ class Express extends BaseExpress
'send_real_name' => $data['send_real_name'],
'send_phone' => $data['send_phone'],
'send_address' => $data['send_address'],
'call_back_url' => sys_config(''),
'call_back_url' => sys_config('site_url') . '/api/order_call_back',
'return_type' => $siid ? '10' : '20',
'siid' => $siid,
'tempid' => $data['tempid'],