48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?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 => '拒签',
|
||
);
|
||
/*
|
||
* 添加或更新快递信息
|
||
* */
|
||
public static function save($order_id, $data)
|
||
{
|
||
$express['order_id'] = $order_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();
|
||
}
|
||
} |