mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #100000 更新
This commit is contained in:
parent
31108d613d
commit
c342859b37
@ -7,4 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Waybill extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public static $BUSINESS_EXPRESS_CODE = 247;
|
||||
public static $AIR_FREIGHT_CODE = 266;
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ class WayBillService
|
||||
// 标准模板
|
||||
public $sfStd = 'https://file-link.pinduoduo.com/sf_std';
|
||||
public $sfStdTemplate = 'sf_std1677380804913.xml';
|
||||
// 时效类型
|
||||
public $timedDeliveryCode;
|
||||
|
||||
public function getContents()
|
||||
{
|
||||
@ -148,8 +150,35 @@ class WayBillService
|
||||
return $waybill;
|
||||
}
|
||||
|
||||
private function timedDelivery($order)
|
||||
{
|
||||
$this->timedDeliveryCode = Waybill::$BUSINESS_EXPRESS_CODE;
|
||||
$address = [
|
||||
'辽宁省' => [],
|
||||
'吉林省' => [],
|
||||
'黑龙江省' => [],
|
||||
'甘肃省' => [],
|
||||
'海南省' => [],
|
||||
'宁夏回族自治区' => [
|
||||
'银川市', '石嘴山市', '吴忠市', '固原市'
|
||||
],
|
||||
'青海省' => [
|
||||
'西宁市', '海东市', '海北藏族自治州', '黄南藏族自治州', '海南藏族自治州', '玉树藏族自治州'
|
||||
],
|
||||
];
|
||||
if (isset($address[$order['recipient_province']])) {
|
||||
if (empty($address[$order['recipient_province']])) {
|
||||
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
|
||||
}
|
||||
if ($address[$order['recipient_province']] && in_array($order['recipient_city'], $address[$order['recipient_province']], true)) {
|
||||
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function prepareRequest($order, $shop)
|
||||
{
|
||||
$this->timedDelivery($order);
|
||||
$senderConfig = $shop->senders[0];
|
||||
$sender = [
|
||||
'address' => [
|
||||
@ -168,6 +197,11 @@ class WayBillService
|
||||
$items = [];
|
||||
foreach ($order['items'] as $item) {
|
||||
if ($item['should_print']) {
|
||||
// 使用规格编码后删除,此处暂时使用空运名字判断兼容
|
||||
if (false !== strpos($item['name'], '空运')) {
|
||||
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
|
||||
}
|
||||
|
||||
$items[] = [
|
||||
'name' => $item['name'],
|
||||
'count' => $item['count'],
|
||||
@ -176,6 +210,11 @@ class WayBillService
|
||||
}
|
||||
|
||||
$orderInfo = [
|
||||
'logistics_services' => [
|
||||
'TIMED-DELIVERY' => [
|
||||
'value' => $this->timedDeliveryCode
|
||||
],
|
||||
],
|
||||
'object_id' => $this->objectId,
|
||||
'order_info' => [
|
||||
'order_channels_type' => 'PDD',
|
||||
|
||||
@ -51,6 +51,7 @@ class CreateWaybillsTable extends Migration
|
||||
$table->string('order_sn');
|
||||
$table->integer('order_id');
|
||||
$table->integer('participate_no')->default(0);
|
||||
$table->integer('timed_delivery')->default(247);
|
||||
$table->string('note')->nullable();
|
||||
$table->text('items');
|
||||
$table->tinyInteger('cancel')->default(0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user