'integer', 'avatar' => 'integer', 'status' => 'integer', 'is_del' => 'integer', 'role_id' => 'integer']; const CREATED_AT = 'create_time'; const UPDATED_AT = 'update_time'; /** * @param string $account * @return Builder|\Hyperf\Database\Model\Model|null */ public function getAdminInfoByAccount(string $account): \Hyperf\Database\Model\Model|Builder|null { return $this->where('username', $account)->where('is_del',UserCode::IS_NO_DEL)->first(); } /** * @param string $name * @return \Hyperf\Database\Model\Model|Builder|null */ public function getAdminInfoByName(string $name): \Hyperf\Database\Model\Model|Builder|null { return $this->where('chinese_name', $name)->where('is_del',UserCode::IS_NO_DEL)->first(); } /** * @param int $id * @return \Hyperf\Database\Model\Model|Builder|null */ public function getAdminInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null { return $this->where('id', $id)->where('is_del',UserCode::IS_NO_DEL)->first(); } /** * 获取所有数据 * @param array $ids * @return array */ public function getDataByIds(array $ids): array { $data = $this->whereIn('id',$ids)->get(); if (empty($data)){ return []; } $res = []; foreach ($data->toArray() as $one) { $res[$one['id']] = $one; } return $res; } }