|
@@ -66,4 +66,21 @@ class User
|
|
|
|
|
|
return $res ? ['token' => $token, 'username' => $username] : false;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 返回正常用户数据
|
|
|
+ * @param int $id
|
|
|
+ * @return array
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function getNormalUserById(int $id): array
|
|
|
+ {
|
|
|
+ $user = $this->userObj->getUserById($id);
|
|
|
+ if (!$user || $user->status !== config('status.mysql.table_normal')) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ return $user->toArray();
|
|
|
+ }
|
|
|
}
|