feat:warehouseKeeper

This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-02-11 17:54:00 +08:00
parent 8321940169
commit c96ecc2594
6 changed files with 227 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ use App\Model\AdminRole;
use App\Model\AdminUser;
use App\Model\Chef;
use App\Model\DriverSequence;
use App\Model\WarehouseKeeper;
use App\Service\Admin\BaseService;
use Exception;
use Hyperf\Di\Annotation\Inject;
@@ -112,6 +113,7 @@ class EmployeeService extends BaseService
]),
RoleCode::CHEF =>
$this->addChef($model->id),
RoleCode::WAREHOUSE => $this->addWarehouseKeeper($model->id),
default => true,
};
@@ -126,6 +128,12 @@ class EmployeeService extends BaseService
$chef->user_id = $id;
return $chef->save();
}
public function addWarehouseKeeper($id): bool
{
$warehouseKeeper = new WarehouseKeeper();
$warehouseKeeper->user_id = $id;
return $warehouseKeeper->save();
}
/**
* 修改
@@ -152,6 +160,7 @@ class EmployeeService extends BaseService
$del = match ($info->role_id) {
RoleCode::DRIVER => (new DriverSequence)->where('driver_id', $info->id)->delete(),
RoleCode::CHEF => (new Chef)->where('user_id', $info->id)->delete(),
RoleCode::WAREHOUSE => (new WarehouseKeeper)->where('user_id', $info->id)->delete(),
default => true,
};
@@ -160,6 +169,7 @@ class EmployeeService extends BaseService
'driver_id' => $info->id,
]),
RoleCode::CHEF => $this->addChef($info->id),
RoleCode::WAREHOUSE => $this->addWarehouseKeeper($info->id),
default => true,
};
@@ -199,6 +209,7 @@ class EmployeeService extends BaseService
$del = match ($info->role_id) {
RoleCode::DRIVER => (new DriverSequence)->where('driver_id', $info->id)->update(['is_del' => UserCode::IS_DEL]),
RoleCode::CHEF => (new Chef)->where('user_id', $info->id)->update(['is_del' => UserCode::IS_DEL]),
RoleCode::WAREHOUSE => (new WarehouseKeeper)->where('user_id', $info->id)->update(['is_del' => UserCode::IS_DEL]),
default => true,
};