dlh_test_server/app/common/logic/expressage/Kd100Logic.php

77 lines
2.4 KiB
PHP
Raw Normal View History

2024-08-03 10:04:14 +08:00
<?php
namespace app\common\logic\expressage;
use app\common\basics\Logic;
use app\common\model\expressage\Kd100Expressage;
class Kd100Logic extends Logic
{
private static $SEL_TIME = 31 * 60; // 物流查询的时间需要大于30分钟,不然会锁单
public static $EXPRESS_STATE = array(
0 => '送货中',
1 => '已揽收',
2 => '疑难',
3 => '已签收',
4 => '已退签',
5 => '已派件',
8 => '已清关',
14 => '已拒签',
);
/*
* 添加或更新快递信息
* */
2024-08-17 11:39:59 +08:00
// public static function save($order_id, $data)
// {
// $express['order_id'] = $order_id;
// $express['delivery_id'] = $data['delivery_id'];
// $express['state'] = $data['state'];
// $express['com'] = $data['com'];
// $express['nu'] = $data['nu'];
// $express['data'] = json_encode($data['data'], JSON_UNESCAPED_UNICODE);
// $express['sel_time'] = time() + self::$SEL_TIME;
//
// $kd100 = self::detail($order_id);
// if ($kd100) {
// Kd100Expressage::where(['order_id' => $order_id])->update($express);
// } else {
// Kd100Expressage::create($express);
// }
// }
/*
* 获取物流详情
* */
// public static function detail($order_id)
// {
// return Kd100Expressage::where(['order_id' => $order_id])->find();
// }
/*
* 获取物流详情 物流模块改版后新的获取物流方式
* */
public static function expressDetail($delivery_id)
2024-08-03 10:04:14 +08:00
{
2024-08-17 11:39:59 +08:00
return Kd100Expressage::where(['delivery_id' => $delivery_id])->find();
}
/*
* 添加或更新快递信息 物流模块改版后新的添加或更新快递信息
* */
public static function saveExpress($data)
{
$express['order_id'] = $data['order_id'];
$express['delivery_id'] = $data['delivery_id'];
2024-08-03 10:04:14 +08:00
$express['state'] = $data['state'];
$express['com'] = $data['com'];
$express['nu'] = $data['nu'];
$express['data'] = json_encode($data['data'], JSON_UNESCAPED_UNICODE);
$express['sel_time'] = time() + self::$SEL_TIME;
2024-08-17 11:39:59 +08:00
$kd100 = self::expressDetail($data['delivery_id']);
2024-08-03 10:04:14 +08:00
if ($kd100) {
2024-08-17 11:39:59 +08:00
Kd100Expressage::where(['delivery_id' => $data['delivery_id']])->update($express);
2024-08-03 10:04:14 +08:00
} else {
Kd100Expressage::create($express);
}
}
}