1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\common\Service\Order;
- use app\common\model\Shipper as ShipperModel;
- use app\common\model\OrderExpress as OrderExpressModel;
- class OrderShipService
- {
- /**
- * 获取快递公司列表
- * @return bool|string|\PDOStatement|\think\Collection
- */
- public static function getExpressCompany(){
- $list = (new ShipperModel())->order('id desc')->select();
- return $list;
- }
- /**
- * Summary of getExpressById
- * @param mixed $expressId
- * @return array|bool|string|\PDOStatement|\think\Model
- */
- public static function getExpressById($expressId = 0){
- $express = (new ShipperModel())->where('id', $expressId)->find();
- return $express;
- }
-
- /**
- * 创建订单快递记录
- * @param int $orderId 订单ID
- * @param int $userId 用户ID
- * @param string $expressName 快递公司名称
- * @param string $expressCode 快递公司代码
- * @param string $expressNo 快递单号
- * @param string $method 发货方式
- * @param string|null $driver 快递驱动
- * @param array $ext 扩展信息
- * @param array $expressImage 快递图片
- * @return object 快递记录对象
- */
- public static function createOrderExpress($orderId = 0, $userId = 0, $expressName ="", $expressCode = "", $expressNo = "", $method = 'input', $driver = null, $ext = [], $expressImage = [] ){
- $orderExpress = OrderExpressModel::create([
- 'user_id' => $userId,
- 'order_id' => $orderId,
- 'express_name' => $expressName,
- 'express_code' => $expressCode,
- 'express_no' => $expressNo,
- 'express_image' => $expressImage,
- 'method' => $method,
- 'driver' => $driver,
- 'ext' => $ext
- ]);
- return $orderExpress;
- }
- }
|