diff --git a/app/Model/AdminUser.php b/app/Model/AdminUser.php index a671831..7f34550 100644 --- a/app/Model/AdminUser.php +++ b/app/Model/AdminUser.php @@ -54,7 +54,7 @@ class AdminUser extends Model */ public function getAdminInfoByAccount(string $account): \Hyperf\Database\Model\Model|Builder|null { - return $this->where('username', $account)->where('is_del',UserCode::ENABLE)->first(); + return $this->where('username', $account)->where('is_del',UserCode::IS_NO_DEL)->first(); } /** @@ -63,7 +63,7 @@ class AdminUser extends Model */ public function getAdminInfoByName(string $name): \Hyperf\Database\Model\Model|Builder|null { - return $this->where('chinese_name', $name)->where('is_del',UserCode::ENABLE)->first(); + return $this->where('chinese_name', $name)->where('is_del',UserCode::IS_NO_DEL)->first(); } /** @@ -72,6 +72,6 @@ class AdminUser extends Model */ public function getAdminInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null { - return $this->where('id', $id)->where('is_del',UserCode::ENABLE)->first(); + return $this->where('id', $id)->where('is_del',UserCode::IS_NO_DEL)->first(); } } diff --git a/app/Service/Admin/System/KitchenService.php b/app/Service/Admin/System/KitchenService.php index 8fb99f8..828b712 100644 --- a/app/Service/Admin/System/KitchenService.php +++ b/app/Service/Admin/System/KitchenService.php @@ -169,15 +169,20 @@ class KitchenService extends BaseService */ public function info(): array { - $data = $this - ->kitchenModel - ->where('id', $this->request->input('id')) - ->where('is_del', SiteCode::KITCHEN_NO_DEL) - ->first(['id','city_id','name','address','lng','lat','status']); + $data = $this->kitchenModel + ->getInfoById((int)$this->request->input('id')); if (empty($data)) throw new AdminException('数据不存在'); - $res = $data->toArray(); - $res['city_name'] = $this->systemCityModel->where('id',$data->city_id)->value('title'); + $res = [ + 'id' => $data->id, + 'city_id' => $data->city_id, + 'name' => $data->name, + 'address' => $data->address, + 'lng' => $data->lng, + 'lat' => $data->lat, + 'status' => $data->status, + 'city_name' => $this->systemCityModel->where('id',$data->city_id)->value('title') + ]; return $this->return->success('success', $res); } diff --git a/app/Service/Admin/User/EmployeeService.php b/app/Service/Admin/User/EmployeeService.php index 8233b61..aec99b4 100644 --- a/app/Service/Admin/User/EmployeeService.php +++ b/app/Service/Admin/User/EmployeeService.php @@ -135,7 +135,7 @@ class EmployeeService extends BaseService if (empty($info)) throw new AdminException('员工不存在'); - $info->is_del = UserCode::DISABLE; + $info->is_del = UserCode::IS_DEL; if (!$info->save()) throw new AdminException('账号删除失败');