2026-09-17 16:25:31 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\common\service;
|
|
|
|
|
|
|
|
|
|
use app\common\model\order\Ships as OrderShips;
|
|
|
|
|
use app\common\traits\ServiceTrait;
|
|
|
|
|
|
|
|
|
|
class OrderShipService
|
|
|
|
|
{
|
|
|
|
|
use ServiceTrait;
|
|
|
|
|
|
|
|
|
|
/** @var OrderShips */
|
|
|
|
|
public static $Model = OrderShips::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param $order_no
|
|
|
|
|
* @param $order_goods_spu_id
|
|
|
|
|
* @param $code
|
|
|
|
|
* @param $remark
|
|
|
|
|
* @return mixed
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*/
|
|
|
|
|
public static function createData($order_no, $order_goods_spu_id, $code, $remark = '')
|
|
|
|
|
{
|
|
|
|
|
$data = [
|
|
|
|
|
'order_no' => $order_no,
|
|
|
|
|
'order_goods_spu_id' => $order_goods_spu_id,
|
|
|
|
|
'code' => $code,
|
|
|
|
|
'remark' => $remark,
|
|
|
|
|
];
|
|
|
|
|
$res = self::create($data);
|
|
|
|
|
if (!$res) {
|
|
|
|
|
exception('创建发货单数据失败');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
2026-09-30 14:56:56 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 需求交付发货单(开发者发货:凭证截图+交付附件+备注)
|
|
|
|
|
* @param $order_no
|
|
|
|
|
* @param $order_goods_spu_id
|
|
|
|
|
* @param $demand_id
|
|
|
|
|
* @param array $images
|
|
|
|
|
* @param array $files
|
|
|
|
|
* @param string $remark
|
|
|
|
|
* @return mixed
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*/
|
|
|
|
|
public static function createDemandDelivery($order_no, $order_goods_spu_id, $demand_id, array $images, array $files, $remark = '')
|
|
|
|
|
{
|
|
|
|
|
$imagesStr = json_encode($images, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
$filesStr = json_encode($files, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
if (mb_strlen($imagesStr) > 1000 || mb_strlen($filesStr) > 1000) {
|
|
|
|
|
exception('附件内容过多,请精简后重新发货');
|
|
|
|
|
}
|
|
|
|
|
$data = [
|
|
|
|
|
'order_no' => $order_no,
|
|
|
|
|
'order_goods_spu_id' => $order_goods_spu_id,
|
|
|
|
|
'demand_id' => $demand_id,
|
|
|
|
|
'images' => $imagesStr,
|
|
|
|
|
'files' => $filesStr,
|
|
|
|
|
'remark' => $remark,
|
|
|
|
|
];
|
|
|
|
|
$res = self::create($data);
|
|
|
|
|
if (!$res) {
|
|
|
|
|
exception('创建发货单数据失败');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
2026-09-17 16:25:31 +08:00
|
|
|
}
|