feat : catering
This commit is contained in:
@@ -29,9 +29,9 @@ trait GetUserInfoTrait
|
||||
/**
|
||||
* 单例获取用户信息
|
||||
* @param $adminId
|
||||
* @return false|Builder|Model|mixed|string
|
||||
* @return AdminUser|false|Model|null
|
||||
*/
|
||||
protected function getUserInfo($adminId): mixed
|
||||
protected function getUserInfo($adminId): AdminUser|Model|false|null
|
||||
{
|
||||
$key = 'admin_id:' . $adminId;
|
||||
if (Context::has($key)) {
|
||||
|
||||
96
app/Service/ServiceTrait/Admin/RoleMembersTrait.php
Normal file
96
app/Service/ServiceTrait/Admin/RoleMembersTrait.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\ServiceTrait\Admin;
|
||||
|
||||
use App\Model\Chef;
|
||||
use App\Model\DriverSequence;
|
||||
use App\Model\WarehouseKeeper;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
trait RoleMembersTrait
|
||||
{
|
||||
/**
|
||||
* @var DriverSequence
|
||||
*/
|
||||
#[Inject]
|
||||
protected DriverSequence $driverSequenceModel;
|
||||
|
||||
/**
|
||||
* @var Chef
|
||||
*/
|
||||
#[Inject]
|
||||
protected Chef $chefModel;
|
||||
|
||||
/**
|
||||
* @var WarehouseKeeper
|
||||
*/
|
||||
#[Inject]
|
||||
protected WarehouseKeeper $warehouseKeeperModel;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
protected function addDriver(int $id, string $name): bool
|
||||
{
|
||||
$insertModel = new DriverSequence();
|
||||
$insertModel->driver_id = $id;
|
||||
$insertModel->driver_name = $name;
|
||||
return $insertModel->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加厨师
|
||||
* @param $id
|
||||
* @return bool
|
||||
*/
|
||||
protected function addChef($id): bool
|
||||
{
|
||||
$chef = new Chef();
|
||||
$chef->user_id = $id;
|
||||
return $chef->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加仓管
|
||||
* @param $id
|
||||
* @return bool
|
||||
*/
|
||||
protected function addWarehouseKeeper($id): bool
|
||||
{
|
||||
$warehouseKeeper = new WarehouseKeeper();
|
||||
$warehouseKeeper->user_id = $id;
|
||||
return $warehouseKeeper->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
protected function delDriver(int $id): bool
|
||||
{
|
||||
return $this->driverSequenceModel->where('driver_id', $id)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加厨师
|
||||
* @param $id
|
||||
* @return bool
|
||||
*/
|
||||
protected function delChef($id): bool
|
||||
{
|
||||
return $this->chefModel->where('user_id', $id)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加仓管
|
||||
* @param $id
|
||||
* @return bool
|
||||
*/
|
||||
protected function delWarehouseKeeper($id): bool
|
||||
{
|
||||
return $this->warehouseKeeperModel->where('user_id', $id)->delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,11 +33,11 @@ trait CycleTrait
|
||||
protected ConfigCache $configCache;
|
||||
|
||||
/**
|
||||
* @return bool|float|Redis
|
||||
* @return float|bool|Redis|int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function initTodayCycleId(): float|bool|Redis
|
||||
protected function initTodayCycleId(): float|bool|Redis|int
|
||||
{
|
||||
$TodayCutOffTime = $this->configCache->getConfigValueByKey(ConfigCode::TODAY_CUT_OFF_TIME_KEY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user