feat : coupon
This commit is contained in:
@@ -37,7 +37,7 @@ abstract class CateringBaseService extends BaseService
|
||||
protected int $cycleId;
|
||||
|
||||
/**
|
||||
* @var int todo 厨房id 自选的需要
|
||||
* @var int
|
||||
*/
|
||||
protected int $kitchenId;
|
||||
|
||||
|
||||
@@ -14,8 +14,11 @@ use App\Constants\Admin\CateringCode;
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\Order;
|
||||
use App\Model\OrderGood;
|
||||
use App\Model\OrderMealCateringLog;
|
||||
use App\Service\Admin\Catering\CateringBaseService;
|
||||
use Exception;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
class CheckService extends CateringBaseService
|
||||
@@ -38,6 +41,12 @@ class CheckService extends CateringBaseService
|
||||
#[Inject]
|
||||
protected Order $orderModel;
|
||||
|
||||
/**
|
||||
* @var OrderGood
|
||||
*/
|
||||
#[Inject]
|
||||
protected OrderGood $orderGoodModel;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -61,7 +70,10 @@ class CheckService extends CateringBaseService
|
||||
|
||||
if (empty($orderIds)) throw new ErrException('数据错误');
|
||||
|
||||
$this->orderModel->whereIn('id', $orderIds)->update(['status' => OrderCode::PLAN]);
|
||||
// $this->orderModel->whereIn('id', $orderIds)->update(['status' => OrderCode::PLAN]);
|
||||
Db::transaction(function () use ($orderIds) {
|
||||
if (!$this->orderModel->isCateringByOrderIds($orderIds) || !$this->orderGoodModel->isCateringByOrderIds($orderIds)) throw new Exception('修改订单数据状态失败');
|
||||
});
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class CateringService extends CateringBaseService
|
||||
$this->logInfo->status = CateringCode::CATERING_STATUS_FINISH;
|
||||
if (!$this->logInfo->save()) throw new Exception('配餐失败1');
|
||||
|
||||
if (!$this->orderModel->isCateringByOrderIds($this->orderIds)) throw new Exception('配餐失败2');
|
||||
if (!$this->orderModel->isCateringByOrderIds($this->orderIds) || !$this->orderGoodModel->isCateringByOrderIds($this->orderIds)) throw new Exception('配餐失败2');
|
||||
|
||||
Db::commit();
|
||||
|
||||
@@ -190,7 +190,7 @@ class CateringService extends CateringBaseService
|
||||
$currentDate = date('Y-m-d H:i:s');
|
||||
foreach ($this->orderList as &$order) {
|
||||
foreach ($order['copies_list'] as &$copiesItem) {
|
||||
if ($currentCode % $this->printBoxMaxNum === 0) {
|
||||
if ($currentCode / $this->printBoxMaxNum === 0) {
|
||||
$startCode = $currentCode + 1;
|
||||
$endCode = min($currentCode + $this->printBoxMaxNum, $this->totalCopies);
|
||||
$codeGroups = $this->splitArrayIntoPartitions(range($startCode, $endCode));
|
||||
|
||||
Reference in New Issue
Block a user