123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\console\model;
- use app\common\enum\order\DeliveryStatus;
- use app\common\enum\order\PayStatus as PayStatusEnum;
- use app\common\enum\order\ReceiptStatus;
- use app\common\model\OrderGoods as OrderGoodsModel;
- use app\common\enum\order\orderGoods\FrozenStatus as FrozenStatusEnum;
- /**
- * 订单商品模型
- * Class OrderGoods
- * @package app\console\model
- */
- class OrderGoods extends OrderGoodsModel
- {
- /**
- * 批量解冻订单商品
- * @param array $orderGoodsIds
- * @return false|int
- */
- public function onUpdateFrozen(array $orderGoodsIds)
- {
- return $this->onBatchUpdate($orderGoodsIds, [
- 'frozen_status'=>FrozenStatusEnum::NOT_FROZEN,
- ]);
- }
- /**
- * 查询截止时间未确认收货的订单列表
- * @param int $storeId 商城ID
- * @param int $deadlineTime 截止时间
- * @return array
- */
- public function getOrderGoodsListByReceive(int $storeId, int $deadlineTime)
- {
- // 查询条件
- $filter = [
- ['g.delivery_status', '=', DeliveryStatus::DELIVERED],
- ['g.receipt_status', '=', ReceiptStatus::NOT_RECEIVED],
- ['g.auto_receipt_time', '<=', $deadlineTime],
- ['g.auto_receipt_time', '>', 0]
- ];
- // 查询列表记录
- return $this->getList($storeId, $filter);
- }
- /**
- * 获取订单ID集
- * @param int $storeId 商城ID
- * @param array $filter
- * @return array
- */
- public function getList(int $storeId, $filter = [])
- {
- return $this->alias('g')->field('g.order_id,g.order_goods_id')
- ->leftJoin('order','order.order_id=g.order_id')
- ->where($filter)
- ->where('order.pay_status',PayStatusEnum::SUCCESS)
- ->where('g.store_id', '=', $storeId)
- ->where('order.is_delete', '=', 0)
- ->select();
- }
- /**
- * 批量更新订单商品状态为已收货
- * @param array $orderGoodsIds
- * @return false|int
- */
- public function onUpdateReceived(array $orderGoodsIds)
- {
- return $this->onBatchUpdate($orderGoodsIds, [
- 'receipt_status' => ReceiptStatus::RECEIVED,
- 'receipt_time' => time(),
- // 'order_status' => OrderStatusEnum::COMPLETED
- ]);
- }
- }
|