diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php index e10720c93..c5f56dfea 100755 --- a/app/Http/Controllers/Api/DialogController.php +++ b/app/Http/Controllers/Api/DialogController.php @@ -40,10 +40,10 @@ public function lists() { $user = User::auth(); // - $list = WebSocketDialog::select(['web_socket_dialogs.*','u.top','u.top_at']) + $list = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at']) ->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id') ->where('u.userid', $user->userid) - ->orderByDesc('u.top') + ->orderByDesc('u.top_at') ->orderByDesc('web_socket_dialogs.last_at') ->paginate(Base::getPaginate(200, 100)); $list->transform(function (WebSocketDialog $item) use ($user) { @@ -481,7 +481,7 @@ public function msg__withdraw() /** * @api {get} api/dialog/top 12. 会话置顶 * - * @apiDescription 消息撤回限制24小时内,需要token身份 + * @apiDescription 需要token身份 * @apiVersion 1.0.0 * @apiGroup dialog * @apiName top @@ -500,12 +500,8 @@ public function top() if (!$dialogUser) { return Base::retError("会话不存在"); } - $top = $dialogUser->top === 1 ? 0 : 1; - $topAt = $dialogUser->top === 1 ? null : Carbon::now(); - $dialogUser->top = $top; - $dialogUser->top_at = $topAt; + $dialogUser->top_at = $dialogUser->top_at ? null : Carbon::now(); $dialogUser->save(); return Base::retSuccess("success", $dialogId); } - } diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 8ee807a63..03f921959 100755 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -42,24 +42,7 @@ public function login() $type = trim(Request::input('type')); $email = trim(Request::input('email')); $password = trim(Request::input('password')); - if(!$email){ - return Base::retError('请输入邮箱地址'); - } if ($type == 'reg') { - $password2 = trim(Request::input('password2')); - //邮箱 - if (!Base::isMail($email)) { - return Base::retError('请输入正确的邮箱地址'); - } - if (User::email2userid($email) > 0) { - return Base::retError('邮箱地址已存在'); - } - if (empty($password)) { - return Base::retError('请输入密码'); - } - if ($password != $password2) { - return Base::retError('确认密码输入不一致'); - } $setting = Base::setting('system'); if ($setting['reg'] == 'close') { return Base::retError('未开放注册'); @@ -81,9 +64,6 @@ public function login() return Base::retError('请输入正确的验证码', ['code' => 'need']); } } - if (empty($password)) { - return Base::retError('请输入密码'); - } // $retError = function ($msg) use ($email) { Cache::forever("code::" . $email, "need"); diff --git a/app/Models/User.php b/app/Models/User.php index ece75b2d2..2c647a873 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -180,6 +180,13 @@ public function checkSystem($onlyUserid = null) */ public static function reg($email, $password, $other = []) { + //邮箱 + if (!Base::isEmail($email)) { + throw new ApiException('请输入正确的邮箱地址'); + } + if (User::email2userid($email) > 0) { + throw new ApiException('邮箱地址已存在'); + } //密码 self::passwordPolicy($password); //开始注册 diff --git a/app/Models/WebSocketDialogUser.php b/app/Models/WebSocketDialogUser.php index 619a7e811..8c7297936 100644 --- a/app/Models/WebSocketDialogUser.php +++ b/app/Models/WebSocketDialogUser.php @@ -8,7 +8,6 @@ * @property int $id * @property int|null $dialog_id 对话ID * @property int|null $userid 会员ID - * @property int|null $top 是否置顶:0否,1是 * @property \Illuminate\Support\Carbon|null $top_at 置顶时间 * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at diff --git a/app/Module/Base.php b/app/Module/Base.php index fef3c3ad3..6d52f0909 100755 --- a/app/Module/Base.php +++ b/app/Module/Base.php @@ -967,7 +967,7 @@ public static function isMobile($str) * @param string $str 需要检测的字符串 * @return int */ - public static function isMail($str) + public static function isEmail($str) { $RegExp = '/^[a-z0-9][a-z\.0-9-_]+@[a-z0-9_-]+(?:\.[a-z]{0,3}\.[a-z]{0,2}|\.[a-z]{0,3}|\.[a-z]{0,2})$/i'; return preg_match($RegExp, $str); diff --git a/app/Tasks/BatchRemoveFileTask.php b/app/Tasks/BatchRemoveFileTask.php deleted file mode 100644 index 5ef3d711b..000000000 --- a/app/Tasks/BatchRemoveFileTask.php +++ /dev/null @@ -1,55 +0,0 @@ -_ids = $ids; - $this->_userid = $userid; - } - - public function start() - { - foreach ($this->_ids as $id) { - Log::info("---------- $id ----------"); - Log::info("尝试删除Id为[$id]的文件"); - $file = File::find($id); - if (empty($file)) { - Log::warning("Id为[$id]的文件不存在或已被删除"); - continue; - } - Log::info("获取到文件名为[" . $file->name . "],类型为[" . ( $file->type ?: $file->ext ) . "]"); - $permission = $file->getPermission($this->_userid); - if ($permission < 1000) { - Log::warning("文件[$id][" . $file->name . "]仅限所有者或创建者操作"); - continue; - } - try { - $file->deleteFile(); - Log::info("删除Id为[$id]的文件成功"); - } catch (Throwable $throwable) { - Log::error("删除Id为[$id]的文件失败,原因是:" . $throwable->getMessage()); - } - } - } -} diff --git a/database/migrations/2022_02_16_145641_web_socket_dialog_users_add_top.php b/database/migrations/2022_02_16_145641_web_socket_dialog_users_add_top.php deleted file mode 100644 index dab630e4d..000000000 --- a/database/migrations/2022_02_16_145641_web_socket_dialog_users_add_top.php +++ /dev/null @@ -1,34 +0,0 @@ -tinyInteger('top')->nullable()->default(0)->after('userid')->comment('是否置顶:0否,1是'); - } - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('web_socket_dialog_users', function (Blueprint $table) { - $table->dropColumn("top"); - }); - } -} diff --git a/resources/assets/js/components/ImgUpload.vue b/resources/assets/js/components/ImgUpload.vue index bf2e1193e..33c666bd4 100755 --- a/resources/assets/js/components/ImgUpload.vue +++ b/resources/assets/js/components/ImgUpload.vue @@ -48,7 +48,7 @@