feat : check
This commit is contained in:
@@ -12,6 +12,7 @@ namespace App\Service\Admin\Catering;
|
|||||||
|
|
||||||
use App\Cache\Redis\Api\SiteCache;
|
use App\Cache\Redis\Api\SiteCache;
|
||||||
use App\Cache\Redis\Common\ConfigCache;
|
use App\Cache\Redis\Common\ConfigCache;
|
||||||
|
use App\Constants\Common\OrderCode;
|
||||||
use App\Constants\Common\RoleCode;
|
use App\Constants\Common\RoleCode;
|
||||||
use App\Exception\ErrException;
|
use App\Exception\ErrException;
|
||||||
use App\Model\AdminUser;
|
use App\Model\AdminUser;
|
||||||
@@ -20,6 +21,7 @@ use App\Model\DriverSequence;
|
|||||||
use App\Model\Site;
|
use App\Model\Site;
|
||||||
use App\Model\Sku;
|
use App\Model\Sku;
|
||||||
use App\Service\Admin\BaseService;
|
use App\Service\Admin\BaseService;
|
||||||
|
use App\Service\ServiceTrait\Admin\Catering\PrintTrait;
|
||||||
use App\Service\ServiceTrait\Admin\GetUserInfoTrait;
|
use App\Service\ServiceTrait\Admin\GetUserInfoTrait;
|
||||||
use App\Service\ServiceTrait\Common\CycleTrait;
|
use App\Service\ServiceTrait\Common\CycleTrait;
|
||||||
use Hyperf\Di\Annotation\Inject;
|
use Hyperf\Di\Annotation\Inject;
|
||||||
@@ -28,8 +30,14 @@ use Psr\Container\NotFoundExceptionInterface;
|
|||||||
|
|
||||||
abstract class CateringBaseService extends BaseService
|
abstract class CateringBaseService extends BaseService
|
||||||
{
|
{
|
||||||
use GetUserInfoTrait,
|
use GetUserInfoTrait;
|
||||||
CycleTrait;
|
use CycleTrait;
|
||||||
|
use PrintTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int 1=自选 2=套餐
|
||||||
|
*/
|
||||||
|
protected int $type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
@@ -110,6 +118,12 @@ abstract class CateringBaseService extends BaseService
|
|||||||
'option' => $this->roleId != RoleCode::OPTION_CATERING ? throw new ErrException('您没有权限访问该功能') : null,
|
'option' => $this->roleId != RoleCode::OPTION_CATERING ? throw new ErrException('您没有权限访问该功能') : null,
|
||||||
default => throw new ErrException('不存在该路由功能')
|
default => throw new ErrException('不存在该路由功能')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$this->type = match ($urlArr[2]) {
|
||||||
|
'meal' => OrderCode::ORDER_TYPE_OPTIONAL,
|
||||||
|
'option' => OrderCode::ORDER_TYPE_MEAL,
|
||||||
|
default => throw new ErrException('不存在该路由功能'),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,7 +234,7 @@ abstract class CateringBaseService extends BaseService
|
|||||||
'order_quantity' => $cycleCateringLogs[$oneSite['id']]['quantity'],
|
'order_quantity' => $cycleCateringLogs[$oneSite['id']]['quantity'],
|
||||||
'status' => $cycleCateringLogs[$oneSite['id']]['status'],
|
'status' => $cycleCateringLogs[$oneSite['id']]['status'],
|
||||||
'id' => $cycleCateringLogs[$oneSite['id']]['id'],
|
'id' => $cycleCateringLogs[$oneSite['id']]['id'],
|
||||||
// 'is_print' => (int)(RedisCache::sIsMember($key, $childVal['id'].':'.($one['distribution_floor_id'] ?? 0)))
|
'is_print' => $this->type == OrderCode::ORDER_TYPE_OPTIONAL ? (int)$this->checkIsPrintByList((int)$cycleCateringLogs[$oneSite['id']]['id'],$this->cycleId) : 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,20 @@ trait PrintTrait
|
|||||||
return CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($this->printKey, (string)$this->logInfo->id);
|
return CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($this->printKey, (string)$this->logInfo->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $cycleId
|
||||||
|
* @return bool
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
protected function checkIsPrintByList(int $id,int $cycleId): bool
|
||||||
|
{
|
||||||
|
$printKey = AdminRedisKey::optionCateringIsPrint($this->cycleId);
|
||||||
|
|
||||||
|
return CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($printKey, (string)$id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
|
|||||||
Reference in New Issue
Block a user