From 9b55b04e5f8a1c5d9a79ed791b3daa1e8f1cfb95 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 19 Aug 2022 15:30:49 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=87=E7=BA=A7cos-sdk?= =?UTF-8?q?=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=8F=82=E6=95=B0=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootstrap/HttpErrorHandler.php | 2 + db/migrations/20210403184518.php | 75 +++----------------------------- 2 files changed, 8 insertions(+), 69 deletions(-) diff --git a/bootstrap/HttpErrorHandler.php b/bootstrap/HttpErrorHandler.php index dd8fd8af..8b1e080c 100644 --- a/bootstrap/HttpErrorHandler.php +++ b/bootstrap/HttpErrorHandler.php @@ -81,6 +81,8 @@ class HttpErrorHandler extends Injectable $logger = $this->getLogger(); $logger->error($content); + + $logger->error($e->getTraceAsString()); } /** diff --git a/db/migrations/20210403184518.php b/db/migrations/20210403184518.php index 8f854d97..85189d44 100644 --- a/db/migrations/20210403184518.php +++ b/db/migrations/20210403184518.php @@ -173,19 +173,6 @@ final class V20210403184518 extends AbstractMigration 'published' => 1, 'create_time' => $now, ], - [ - 'id' => 6, - 'parent_id' => 0, - 'level' => 1, - 'name' => '群组', - 'path' => ',6,', - 'target' => '_self', - 'url' => '/im/group/list', - 'position' => 1, - 'priority' => 6, - 'published' => 1, - 'create_time' => $now, - ], [ 'id' => 7, 'parent_id' => 0, @@ -371,56 +358,6 @@ final class V20210403184518 extends AbstractMigration 'item_key' => 'secret_key', 'item_value' => '', ], - [ - 'section' => 'im.cs', - 'item_key' => 'enabled', - 'item_value' => '0', - ], - [ - 'section' => 'im.cs', - 'item_key' => 'user1_id', - 'item_value' => '', - ], - [ - 'section' => 'im.cs', - 'item_key' => 'user2_id', - 'item_value' => '', - ], - [ - 'section' => 'im.cs', - 'item_key' => 'user3_id', - 'item_value' => '', - ], - [ - 'section' => 'im.main', - 'item_key' => 'title', - 'item_value' => '菜鸟驿站', - ], - [ - 'section' => 'im.main', - 'item_key' => 'msg_max_length', - 'item_value' => '1000', - ], - [ - 'section' => 'im.main', - 'item_key' => 'upload_img_enabled', - 'item_value' => '0', - ], - [ - 'section' => 'im.main', - 'item_key' => 'upload_file_enabled', - 'item_value' => '0', - ], - [ - 'section' => 'im.main', - 'item_key' => 'tool_audio_enabled', - 'item_value' => '0', - ], - [ - 'section' => 'im.main', - 'item_key' => 'tool_video_enabled', - 'item_value' => '0', - ], [ 'section' => 'live.push', 'item_key' => 'domain', @@ -624,17 +561,17 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'secret', 'item_key' => 'secret_key', - 'item_value' => '', + 'item_value' => 'xxx', ], [ 'section' => 'secret', 'item_key' => 'secret_id', - 'item_value' => '', + 'item_value' => 'xxx', ], [ 'section' => 'secret', 'item_key' => 'app_id', - 'item_value' => '', + 'item_value' => 'xxx', ], [ 'section' => 'site', @@ -746,12 +683,12 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'cos', 'item_key' => 'bucket', - 'item_value' => '', + 'item_value' => 'course-1255691183', ], [ 'section' => 'cos', 'item_key' => 'region', - 'item_value' => '', + 'item_value' => 'ap-guangzhou', ], [ 'section' => 'cos', @@ -761,7 +698,7 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'cos', 'item_key' => 'domain', - 'item_value' => '', + 'item_value' => 'course-1255691183.file.myqcloud.com', ], [ 'section' => 'vod', From 923095700f4903dfe46ef61e793b2f54bf9ed961 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 19 Aug 2022 17:10:30 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=95=B4=E7=90=86migrations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrations/20210324064239.php | 613 ------------------------------- db/migrations/20210403184518.php | 10 - db/migrations/20210720153027.php | 70 +++- db/migrations/20210802021814.php | 11 +- db/migrations/20210809153030.php | 22 +- db/migrations/20210820064755.php | 10 +- db/migrations/20210825111618.php | 6 +- db/migrations/20210903040558.php | 8 +- db/migrations/20210916072842.php | 10 +- db/migrations/20210917093354.php | 10 +- db/migrations/20211017085325.php | 11 +- db/migrations/20211019093522.php | 22 +- db/migrations/20211231013226.php | 23 +- db/migrations/20220607014823.php | 43 ++- db/migrations/20220801025747.php | 30 +- 15 files changed, 178 insertions(+), 721 deletions(-) diff --git a/db/migrations/20210324064239.php b/db/migrations/20210324064239.php index b5eaafd4..3c170df3 100644 --- a/db/migrations/20210324064239.php +++ b/db/migrations/20210324064239.php @@ -3268,619 +3268,6 @@ final class V20210324064239 extends AbstractMigration 'after' => 'create_time', ]) ->create(); - $this->table('kg_im_friend_group', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'identity' => 'enable', - 'comment' => '主键编号', - ]) - ->addColumn('user_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '用户编号', - 'after' => 'id', - ]) - ->addColumn('name', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 100, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '名称', - 'after' => 'user_id', - ]) - ->addColumn('priority', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '优先级', - 'after' => 'name', - ]) - ->addColumn('deleted', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '删除标识', - 'after' => 'priority', - ]) - ->addColumn('user_count', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '成员数', - 'after' => 'deleted', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'user_count', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->addIndex(['user_id'], [ - 'name' => 'user_id', - 'unique' => true, - ]) - ->create(); - $this->table('kg_im_friend_user', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'identity' => 'enable', - 'comment' => '主键编号', - ]) - ->addColumn('user_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '用户编号', - 'after' => 'id', - ]) - ->addColumn('friend_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '目标编号', - 'after' => 'user_id', - ]) - ->addColumn('group_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '分组编号', - 'after' => 'friend_id', - ]) - ->addColumn('msg_count', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '消息数', - 'after' => 'group_id', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'msg_count', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->addIndex(['user_id', 'friend_id'], [ - 'name' => 'user_friend', - 'unique' => false, - ]) - ->create(); - $this->table('kg_im_group', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'identity' => 'enable', - 'comment' => '主键编号', - ]) - ->addColumn('owner_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '群主编号', - 'after' => 'id', - ]) - ->addColumn('course_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '课程编号', - 'after' => 'owner_id', - ]) - ->addColumn('type', 'integer', [ - 'null' => false, - 'default' => '1', - 'limit' => MysqlAdapter::INT_REGULAR, - 'comment' => '类型', - 'after' => 'course_id', - ]) - ->addColumn('name', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 100, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '名称', - 'after' => 'type', - ]) - ->addColumn('avatar', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 100, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '头像', - 'after' => 'name', - ]) - ->addColumn('about', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 255, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '简介', - 'after' => 'avatar', - ]) - ->addColumn('published', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '发布标识', - 'after' => 'about', - ]) - ->addColumn('deleted', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '删除标识', - 'after' => 'published', - ]) - ->addColumn('user_count', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '成员数', - 'after' => 'deleted', - ]) - ->addColumn('msg_count', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '消息数', - 'after' => 'user_count', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'msg_count', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->create(); - $this->table('kg_im_group_user', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'identity' => 'enable', - 'comment' => '主键编号', - ]) - ->addColumn('group_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '群组编号', - 'after' => 'id', - ]) - ->addColumn('user_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '用户编号', - 'after' => 'group_id', - ]) - ->addColumn('priority', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '优先级', - 'after' => 'user_id', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'priority', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->addIndex(['group_id'], [ - 'name' => 'group_id', - 'unique' => false, - ]) - ->addIndex(['group_id', 'user_id'], [ - 'name' => 'group_user', - 'unique' => false, - ]) - ->addIndex(['user_id'], [ - 'name' => 'user_id', - 'unique' => false, - ]) - ->create(); - $this->table('kg_im_message', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'identity' => 'enable', - 'comment' => '主键编号', - ]) - ->addColumn('chat_id', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 30, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '对话编号', - 'after' => 'id', - ]) - ->addColumn('sender_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '发送方', - 'after' => 'chat_id', - ]) - ->addColumn('receiver_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '接收方', - 'after' => 'sender_id', - ]) - ->addColumn('receiver_type', 'integer', [ - 'null' => false, - 'default' => '1', - 'limit' => MysqlAdapter::INT_REGULAR, - 'comment' => '接收方类型', - 'after' => 'receiver_id', - ]) - ->addColumn('content', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 3000, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '内容', - 'after' => 'receiver_type', - ]) - ->addColumn('viewed', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '已读标识', - 'after' => 'content', - ]) - ->addColumn('deleted', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '删除标识', - 'after' => 'viewed', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'deleted', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->addIndex(['chat_id'], [ - 'name' => 'chat_id', - 'unique' => false, - ]) - ->addIndex(['receiver_id', 'receiver_type'], [ - 'name' => 'receiver', - 'unique' => false, - ]) - ->create(); - $this->table('kg_im_notice', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'identity' => 'enable', - 'comment' => '主键编号', - ]) - ->addColumn('sender_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '发送方', - 'after' => 'id', - ]) - ->addColumn('receiver_id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '接收方', - 'after' => 'sender_id', - ]) - ->addColumn('item_type', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '条目类型', - 'after' => 'receiver_id', - ]) - ->addColumn('item_info', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 1500, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '条目内容', - 'after' => 'item_type', - ]) - ->addColumn('viewed', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '已读标识', - 'after' => 'item_info', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'viewed', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->addIndex(['receiver_id'], [ - 'name' => 'receiver_id', - 'unique' => false, - ]) - ->addIndex(['sender_id'], [ - 'name' => 'sender_id', - 'unique' => false, - ]) - ->create(); - $this->table('kg_im_user', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '主键编号', - ]) - ->addColumn('name', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 30, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '名称', - 'after' => 'id', - ]) - ->addColumn('avatar', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 100, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '头像', - 'after' => 'name', - ]) - ->addColumn('sign', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 30, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '签名', - 'after' => 'avatar', - ]) - ->addColumn('skin', 'string', [ - 'null' => false, - 'default' => '', - 'limit' => 100, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '皮肤', - 'after' => 'sign', - ]) - ->addColumn('status', 'string', [ - 'null' => false, - 'default' => 'hide', - 'limit' => 15, - 'collation' => 'utf8mb4_general_ci', - 'encoding' => 'utf8mb4', - 'comment' => '在线状态', - 'after' => 'skin', - ]) - ->addColumn('deleted', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '删除标识', - 'after' => 'status', - ]) - ->addColumn('friend_count', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '好友数', - 'after' => 'deleted', - ]) - ->addColumn('group_count', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '群组数', - 'after' => 'friend_count', - ]) - ->addColumn('create_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '创建时间', - 'after' => 'group_count', - ]) - ->addColumn('update_time', 'integer', [ - 'null' => false, - 'default' => '0', - 'limit' => MysqlAdapter::INT_REGULAR, - 'signed' => false, - 'comment' => '更新时间', - 'after' => 'create_time', - ]) - ->create(); $this->table('kg_learning', [ 'id' => false, 'primary_key' => ['id'], diff --git a/db/migrations/20210403184518.php b/db/migrations/20210403184518.php index 85189d44..5c3aa05a 100644 --- a/db/migrations/20210403184518.php +++ b/db/migrations/20210403184518.php @@ -46,15 +46,6 @@ final class V20210403184518 extends AbstractMigration ]; $this->table('kg_user')->insert($user)->saveData(); - - $imUser = [ - 'id' => $user['id'], - 'name' => $user['name'], - 'avatar' => $user['avatar'], - 'create_time' => $now, - ]; - - $this->table('kg_im_user')->insert($imUser)->saveData(); } protected function initRoleData() @@ -949,7 +940,6 @@ final class V20210403184518 extends AbstractMigration 'course_review' => ['enabled' => 1, 'point' => 50], 'chapter_study' => ['enabled' => 1, 'point' => 10], 'site_visit' => ['enabled' => 1, 'point' => 10], - 'im_discuss' => ['enabled' => 1, 'point' => 10], 'article_post' => ['enabled' => 1, 'point' => 20, 'limit' => 50], 'question_post' => ['enabled' => 1, 'point' => 5, 'limit' => 50], 'answer_post' => ['enabled' => 1, 'point' => 5, 'limit' => 50], diff --git a/db/migrations/20210720153027.php b/db/migrations/20210720153027.php index 21e1f9d8..0a980597 100644 --- a/db/migrations/20210720153027.php +++ b/db/migrations/20210720153027.php @@ -27,7 +27,13 @@ final class V20210720153027 extends AbstractMigration protected function createCourseTagTable() { - $this->table('kg_course_tag', [ + $tableName = 'kg_course_tag'; + + if ($this->table($tableName)->exists()) { + return; + } + + $this->table($tableName, [ 'id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', @@ -80,8 +86,10 @@ final class V20210720153027 extends AbstractMigration protected function alterCourseTable() { - $this->table('kg_course') - ->addColumn('tags', 'string', [ + $table = $this->table('kg_course'); + + if ($table->hasColumn('tags') == false) { + $table->addColumn('tags', 'string', [ 'null' => false, 'default' => '', 'limit' => 255, @@ -89,13 +97,18 @@ final class V20210720153027 extends AbstractMigration 'encoding' => 'utf8mb4', 'comment' => '标签', 'after' => 'summary', - ])->save(); + ]); + } + + $table->save(); } protected function alterCategoryTable() { - $this->table('kg_category') - ->addColumn('alias', 'string', [ + $table = $this->table('kg_category'); + + if ($table->hasColumn('alias') == false) { + $table->addColumn('alias', 'string', [ 'null' => false, 'default' => '', 'limit' => 30, @@ -103,7 +116,11 @@ final class V20210720153027 extends AbstractMigration 'encoding' => 'utf8mb4', 'comment' => '别名', 'after' => 'name', - ])->addColumn('icon', 'string', [ + ]); + } + + if ($table->hasColumn('icon') == false) { + $table->addColumn('icon', 'string', [ 'null' => false, 'default' => '', 'limit' => 100, @@ -111,13 +128,19 @@ final class V20210720153027 extends AbstractMigration 'encoding' => 'utf8mb4', 'comment' => '图标', 'after' => 'name', - ])->save(); + ]); + } + + $table->save(); } protected function alterTagTable() { - $this->table('kg_tag') - ->addColumn('scopes', 'string', [ + $table = $this->table('kg_tag'); + + if ($table->hasColumn('scopes') == false) { + + $table->addColumn('scopes', 'string', [ 'null' => false, 'default' => '', 'limit' => 100, @@ -125,32 +148,43 @@ final class V20210720153027 extends AbstractMigration 'encoding' => 'utf8mb4', 'comment' => '范围', 'after' => 'icon', - ]) - ->addColumn('course_count', 'integer', [ + ]); + } + + if ($table->hasColumn('course_count') == false) { + $table->addColumn('course_count', 'integer', [ 'null' => false, 'default' => '0', 'limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'comment' => '课程数', 'after' => 'follow_count', - ]) - ->addColumn('article_count', 'integer', [ + ]); + } + + if ($table->hasColumn('article_count') == false) { + $table->addColumn('article_count', 'integer', [ 'null' => false, 'default' => '0', 'limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'comment' => '文章数', 'after' => 'course_count', - ]) - ->addColumn('question_count', 'integer', [ + ]); + } + + if ($table->hasColumn('question_count') == false) { + $table->addColumn('question_count', 'integer', [ 'null' => false, 'default' => '0', 'limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'comment' => '问题数', 'after' => 'article_count', - ]) - ->save(); + ]); + } + + $table->save(); } protected function handleCourseTags() diff --git a/db/migrations/20210802021814.php b/db/migrations/20210802021814.php index 51852a92..59f542dd 100644 --- a/db/migrations/20210802021814.php +++ b/db/migrations/20210802021814.php @@ -17,8 +17,10 @@ final class V20210802021814 extends AbstractMigration protected function alterPageTable() { - $this->table('kg_page') - ->addColumn('alias', 'string', [ + $table = $this->table('kg_page'); + + if ($table->hasColumn('alias') == false) { + $table->addColumn('alias', 'string', [ 'null' => false, 'default' => '', 'limit' => 50, @@ -26,7 +28,10 @@ final class V20210802021814 extends AbstractMigration 'encoding' => 'utf8mb4', 'comment' => '别名', 'after' => 'title', - ])->save(); + ]); + } + + $table->save(); } } diff --git a/db/migrations/20210809153030.php b/db/migrations/20210809153030.php index a8d7ee89..bd94311b 100644 --- a/db/migrations/20210809153030.php +++ b/db/migrations/20210809153030.php @@ -5,19 +5,22 @@ * @link https://www.koogua.com */ +require_once 'SettingTrait.php'; + use Phinx\Migration\AbstractMigration; final class V20210809153030 extends AbstractMigration { + use SettingTrait; + public function up() { - $this->handleVodSetting(); - $this->handleImSetting(); + $this->handleVodSettings(); $this->handleRemotePlayUrl(); } - protected function handleVodSetting() + protected function handleVodSettings() { $rows = [ [ @@ -32,18 +35,7 @@ final class V20210809153030 extends AbstractMigration ], ]; - $this->table('kg_setting')->insert($rows)->save(); - } - - protected function handleImSetting() - { - $row = [ - 'section' => 'im.main', - 'item_key' => 'enabled', - 'item_value' => '1', - ]; - - $this->table('kg_setting')->insert($row)->saveData(); + $this->insertSettings($rows); } protected function handleRemotePlayUrl() diff --git a/db/migrations/20210820064755.php b/db/migrations/20210820064755.php index 657de33f..8c19c82b 100644 --- a/db/migrations/20210820064755.php +++ b/db/migrations/20210820064755.php @@ -5,17 +5,21 @@ * @link https://www.koogua.com */ +require_once 'SettingTrait.php'; + use Phinx\Migration\AbstractMigration; final class V20210820064755 extends AbstractMigration { + use SettingTrait; + public function up() { - $this->handleContactSetting(); + $this->handleContactSettings(); } - protected function handleContactSetting() + protected function handleContactSettings() { $rows = [ [ @@ -65,7 +69,7 @@ final class V20210820064755 extends AbstractMigration ], ]; - $this->table('kg_setting')->insert($rows)->save(); + $this->insertSettings($rows); } } diff --git a/db/migrations/20210825111618.php b/db/migrations/20210825111618.php index 5b337651..d3553457 100644 --- a/db/migrations/20210825111618.php +++ b/db/migrations/20210825111618.php @@ -19,9 +19,11 @@ final class V20210825111618 extends AbstractMigration { $table = $this->table('kg_upload'); - $table->removeIndexByName('md5')->save(); + if ($table->hasIndexByName('md5')) { + $table->removeIndexByName('md5')->save(); + $table->addIndex('md5')->save(); + } - $table->addIndex('md5')->save(); } } diff --git a/db/migrations/20210903040558.php b/db/migrations/20210903040558.php index d998c32b..57f655b1 100644 --- a/db/migrations/20210903040558.php +++ b/db/migrations/20210903040558.php @@ -5,17 +5,21 @@ * @link https://www.koogua.com */ +require_once 'SettingTrait.php'; + use Phinx\Migration\AbstractMigration; final class V20210903040558 extends AbstractMigration { + use SettingTrait; + public function up() { - $this->handleVodSetting(); + $this->handleVodSettings(); } - protected function handleVodSetting() + protected function handleVodSettings() { $row = $this->getQueryBuilder() ->select('*') diff --git a/db/migrations/20210916072842.php b/db/migrations/20210916072842.php index e8b001eb..8aa7b850 100644 --- a/db/migrations/20210916072842.php +++ b/db/migrations/20210916072842.php @@ -7,15 +7,19 @@ use Phinx\Migration\AbstractMigration; +require_once 'SettingTrait.php'; + final class V20210916072842 extends AbstractMigration { + use SettingTrait; + public function up() { - $this->handleLocalAuthSetting(); + $this->handleLocalAuthSettings(); } - protected function handleLocalAuthSetting() + protected function handleLocalAuthSettings() { $rows = [ [ @@ -30,7 +34,7 @@ final class V20210916072842 extends AbstractMigration ] ]; - $this->table('kg_setting')->insert($rows)->save(); + $this->insertSettings($rows); } } diff --git a/db/migrations/20210917093354.php b/db/migrations/20210917093354.php index 08a64015..0b68b55b 100644 --- a/db/migrations/20210917093354.php +++ b/db/migrations/20210917093354.php @@ -5,16 +5,20 @@ * @link https://www.koogua.com */ +require_once 'SettingTrait.php'; + use Phinx\Db\Adapter\MysqlAdapter; class V20210917093354 extends Phinx\Migration\AbstractMigration { + use SettingTrait; + public function up() { $this->alterConnectTable(); $this->alterWechatSubscribeTable(); - $this->handleLocalAuthSetting(); + $this->handleLocalAuthSettings(); } protected function alterConnectTable() @@ -92,7 +96,7 @@ class V20210917093354 extends Phinx\Migration\AbstractMigration $table->save(); } - protected function handleLocalAuthSetting() + protected function handleLocalAuthSettings() { $rows = [ [ @@ -107,7 +111,7 @@ class V20210917093354 extends Phinx\Migration\AbstractMigration ] ]; - $this->table('kg_setting')->insert($rows)->save(); + $this->insertSettings($rows); } } diff --git a/db/migrations/20211017085325.php b/db/migrations/20211017085325.php index 6d01c66a..f9f52167 100644 --- a/db/migrations/20211017085325.php +++ b/db/migrations/20211017085325.php @@ -18,15 +18,20 @@ final class V20211017085325 extends AbstractMigration protected function alterCourseTable() { - $this->table('kg_course') - ->addColumn('fake_user_count', 'integer', [ + $table = $this->table('kg_course'); + + if ($table->hasColumn('fake_user_count') == false) { + $table->addColumn('fake_user_count', 'integer', [ 'null' => false, 'default' => '0', 'limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'comment' => '伪造用户数', 'after' => 'user_count', - ])->save(); + ]); + } + + $table->save(); } } diff --git a/db/migrations/20211019093522.php b/db/migrations/20211019093522.php index 5946d094..9c9c2d0e 100644 --- a/db/migrations/20211019093522.php +++ b/db/migrations/20211019093522.php @@ -19,28 +19,38 @@ final class V20211019093522 extends AbstractMigration protected function alterUserSessionTable() { - $this->table('kg_user_session') - ->addColumn('deleted', 'integer', [ + $table = $this->table('kg_user_session'); + + if ($table->hasColumn('deleted') == false) { + $table->addColumn('deleted', 'integer', [ 'null' => false, 'default' => '0', 'limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'comment' => '删除标识', 'after' => 'client_ip', - ])->save(); + ]); + } + + $table->save(); } protected function alterUserTokenTable() { - $this->table('kg_user_token') - ->addColumn('deleted', 'integer', [ + $table = $this->table('kg_user_token'); + + if ($table->hasColumn('deleted') == false) { + $table->addColumn('deleted', 'integer', [ 'null' => false, 'default' => '0', 'limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'comment' => '删除标识', 'after' => 'client_ip', - ])->save(); + ]); + } + + $table->save(); } } diff --git a/db/migrations/20211231013226.php b/db/migrations/20211231013226.php index a3f35979..69337b25 100644 --- a/db/migrations/20211231013226.php +++ b/db/migrations/20211231013226.php @@ -2,26 +2,29 @@ use Phinx\Migration\AbstractMigration; +require_once 'SettingTrait.php'; + final class V20211231013226 extends AbstractMigration { + use SettingTrait; + public function up() { - $this->handleSmsSetting(); + $this->handleSmsSettings(); } - protected function handleSmsSetting() + protected function handleSmsSettings() { - $row = + $rows = [ [ - [ - 'section' => 'sms', - 'item_key' => 'region', - 'item_value' => 'ap-guangzhou', - ] - ]; + 'section' => 'sms', + 'item_key' => 'region', + 'item_value' => 'ap-guangzhou', + ] + ]; - $this->table('kg_setting')->insert($row)->save(); + $this->insertSettings($rows); } } diff --git a/db/migrations/20220607014823.php b/db/migrations/20220607014823.php index 5c8a5778..95b40e8d 100644 --- a/db/migrations/20220607014823.php +++ b/db/migrations/20220607014823.php @@ -21,29 +21,28 @@ final class V20220607014823 extends AbstractMigration protected function handleSiteSettings() { - $rows = + $rows = [ [ - [ - 'section' => 'site', - 'item_key' => 'isp_sn', - 'item_value' => '', - ], - [ - 'section' => 'site', - 'item_key' => 'isp_link', - 'item_value' => 'https://dxzhgl.miit.gov.cn', - ], - [ - 'section' => 'site', - 'item_key' => 'company_sn', - 'item_value' => '', - ], - [ - 'section' => 'site', - 'item_key' => 'company_sn_link', - 'item_value' => '', - ], - ]; + 'section' => 'site', + 'item_key' => 'isp_sn', + 'item_value' => '', + ], + [ + 'section' => 'site', + 'item_key' => 'isp_link', + 'item_value' => 'https://dxzhgl.miit.gov.cn', + ], + [ + 'section' => 'site', + 'item_key' => 'company_sn', + 'item_value' => '', + ], + [ + 'section' => 'site', + 'item_key' => 'company_sn_link', + 'item_value' => '', + ], + ]; $this->insertSettings($rows); } diff --git a/db/migrations/20220801025747.php b/db/migrations/20220801025747.php index 21a3e9ea..6ceec26c 100644 --- a/db/migrations/20220801025747.php +++ b/db/migrations/20220801025747.php @@ -20,7 +20,13 @@ class V20220801025747 extends Phinx\Migration\AbstractMigration protected function createMigrationTaskTable() { - $this->table('kg_migration_task', [ + $tableName = 'kg_migration_task'; + + if ($this->table($tableName)->exists()) { + return; + } + + $this->table($tableName, [ 'id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', @@ -70,13 +76,21 @@ class V20220801025747 extends Phinx\Migration\AbstractMigration protected function dropImTables() { - $this->table('kg_im_friend_group')->drop()->save(); - $this->table('kg_im_friend_user')->drop()->save(); - $this->table('kg_im_group')->drop()->save(); - $this->table('kg_im_group_user')->drop()->save(); - $this->table('kg_im_message')->drop()->save(); - $this->table('kg_im_notice')->drop()->save(); - $this->table('kg_im_user')->drop()->save(); + $tableNames = [ + 'kg_im_friend_group', + 'kg_im_friend_user', + 'kg_im_group', + 'kg_im_group_user', + 'kg_im_message', + 'kg_im_notice', + 'kg_im_user', + ]; + + foreach ($tableNames as $tableName) { + if ($this->table($tableName)->exists()) { + $this->table($tableName)->drop()->save(); + } + } } protected function deleteImGroupNav() From b60f8fe485d5bee362fe4e4fba3be6a31a3b5618 Mon Sep 17 00:00:00 2001 From: koogua Date: Mon, 22 Aug 2022 15:06:52 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95/?= =?UTF-8?q?=E6=B3=A8=E5=86=8C/=E5=BF=98=E8=AE=B0=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 ++- .../Home/Controllers/AccountController.php | 7 +-- app/Http/Home/Views/account/forget.volt | 42 ++++++++++++++ .../Home/Views/account/forget_by_email.volt | 28 +++++++++ .../Home/Views/account/forget_by_phone.volt | 28 +++++++++ .../Home/Views/account/forget_password.volt | 48 --------------- app/Http/Home/Views/account/login.volt | 3 +- app/Http/Home/Views/account/register.volt | 58 ++++++------------- .../Home/Views/account/register_by_email.volt | 35 +++++++++++ .../Home/Views/account/register_by_phone.volt | 35 +++++++++++ app/Services/Utils/IndexCourseCache.php | 52 +++++++---------- 11 files changed, 220 insertions(+), 125 deletions(-) create mode 100644 app/Http/Home/Views/account/forget.volt create mode 100644 app/Http/Home/Views/account/forget_by_email.volt create mode 100644 app/Http/Home/Views/account/forget_by_phone.volt delete mode 100644 app/Http/Home/Views/account/forget_password.volt create mode 100644 app/Http/Home/Views/account/register_by_email.volt create mode 100644 app/Http/Home/Views/account/register_by_phone.volt diff --git a/CHANGELOG.md b/CHANGELOG.md index 84517528..a59a261d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ -### [v1.5.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.7)(2022-08-28) +### [v1.5.8](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.8)(2022-08-28) + +- 整理migrations +- 更新自动安装脚本 +- 优化登录/注册/忘记密码页 +- 修复移动端首页课程缓存刷新 + +### [v1.5.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.7)(2022-08-18) - 清理群组残留 - 升级腾讯云存储SDK到v2.5.6 diff --git a/app/Http/Home/Controllers/AccountController.php b/app/Http/Home/Controllers/AccountController.php index 4efc598a..320cb9c5 100644 --- a/app/Http/Home/Controllers/AccountController.php +++ b/app/Http/Home/Controllers/AccountController.php @@ -148,9 +148,9 @@ class AccountController extends Controller } /** - * @Get("/password/forget", name="home.account.forget_pwd") + * @Get("/forget", name="home.account.forget") */ - public function forgetPasswordAction() + public function forgetAction() { $service = new FullH5UrlService(); @@ -167,9 +167,8 @@ class AccountController extends Controller $captcha = $service->getSettings('captcha'); - $this->seo->prependTitle('忘记密码'); + $this->seo->prependTitle('重置密码'); - $this->view->pick('account/forget_password'); $this->view->setVar('captcha', $captcha); } diff --git a/app/Http/Home/Views/account/forget.volt b/app/Http/Home/Views/account/forget.volt new file mode 100644 index 00000000..8056110f --- /dev/null +++ b/app/Http/Home/Views/account/forget.volt @@ -0,0 +1,42 @@ +{% extends 'templates/main.volt' %} + +{% block content %} + + {% set action_url = url({'for':'home.account.reset_pwd'}) %} + + + + + +{% endblock %} + +{% block include_js %} + + {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} + {{ js_include('home/js/captcha.verify.js') }} + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/account/forget_by_email.volt b/app/Http/Home/Views/account/forget_by_email.volt new file mode 100644 index 00000000..2a61dff4 --- /dev/null +++ b/app/Http/Home/Views/account/forget_by_email.volt @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/app/Http/Home/Views/account/forget_by_phone.volt b/app/Http/Home/Views/account/forget_by_phone.volt new file mode 100644 index 00000000..fc766c82 --- /dev/null +++ b/app/Http/Home/Views/account/forget_by_phone.volt @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/app/Http/Home/Views/account/forget_password.volt b/app/Http/Home/Views/account/forget_password.volt deleted file mode 100644 index 39cbef41..00000000 --- a/app/Http/Home/Views/account/forget_password.volt +++ /dev/null @@ -1,48 +0,0 @@ -{% extends 'templates/main.volt' %} - -{% block content %} - - - - - -{% endblock %} - -{% block include_js %} - - {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('home/js/captcha.verify.js') }} - -{% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/account/login.volt b/app/Http/Home/Views/account/login.volt index 34641c28..e2746070 100644 --- a/app/Http/Home/Views/account/login.volt +++ b/app/Http/Home/Views/account/login.volt @@ -4,6 +4,7 @@ @@ -25,7 +26,7 @@
{% if oauth_provider.qq.enabled == 1 %} diff --git a/app/Http/Home/Views/account/register.volt b/app/Http/Home/Views/account/register.volt index 4d86fdb1..6e72d254 100644 --- a/app/Http/Home/Views/account/register.volt +++ b/app/Http/Home/Views/account/register.volt @@ -4,54 +4,34 @@ {% set register_with_phone = local_oauth.register_with_phone == 1 %} {% set register_with_email = local_oauth.register_with_email == 1 %} + {% set action_url = url({'for':'home.account.do_register'}) %} -
- - - - - + + + + +
\ No newline at end of file diff --git a/app/Http/Home/Views/account/forget_by_phone.volt b/app/Http/Home/Views/account/forget_by_phone.volt index fc766c82..f70b6c69 100644 --- a/app/Http/Home/Views/account/forget_by_phone.volt +++ b/app/Http/Home/Views/account/forget_by_phone.volt @@ -1,7 +1,7 @@
- - - - - + + + + +
\ No newline at end of file diff --git a/app/Http/Home/Views/account/login.volt b/app/Http/Home/Views/account/login.volt index e2746070..5bbcc1f1 100644 --- a/app/Http/Home/Views/account/login.volt +++ b/app/Http/Home/Views/account/login.volt @@ -4,8 +4,7 @@ diff --git a/app/Http/Home/Views/account/register.volt b/app/Http/Home/Views/account/register.volt index 6e72d254..ab4329cc 100644 --- a/app/Http/Home/Views/account/register.volt +++ b/app/Http/Home/Views/account/register.volt @@ -8,8 +8,7 @@ @@ -39,6 +38,7 @@ {% block include_js %} {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('home/js/captcha.verify.js') }} + {{ js_include('home/js/captcha.verify.phone.js') }} + {{ js_include('home/js/captcha.verify.email.js') }} {% endblock %} diff --git a/app/Http/Home/Views/account/register_by_email.volt b/app/Http/Home/Views/account/register_by_email.volt index cc4d917c..75471e99 100644 --- a/app/Http/Home/Views/account/register_by_email.volt +++ b/app/Http/Home/Views/account/register_by_email.volt @@ -2,7 +2,7 @@ diff --git a/app/Http/Home/Views/account/register_by_phone.volt b/app/Http/Home/Views/account/register_by_phone.volt index dd5104a5..e08f494a 100644 --- a/app/Http/Home/Views/account/register_by_phone.volt +++ b/app/Http/Home/Views/account/register_by_phone.volt @@ -2,7 +2,7 @@ diff --git a/app/Http/Home/Views/user/console/account_email.volt b/app/Http/Home/Views/user/console/account_email.volt index 0f549223..101aeacb 100644 --- a/app/Http/Home/Views/user/console/account_email.volt +++ b/app/Http/Home/Views/user/console/account_email.volt @@ -19,7 +19,7 @@
- +
@@ -28,16 +28,16 @@
- +
- - - - - + + + + +
@@ -50,6 +50,6 @@ {% block include_js %} {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('home/js/captcha.verify.js') }} + {{ js_include('home/js/captcha.verify.email.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/user/console/account_phone.volt b/app/Http/Home/Views/user/console/account_phone.volt index f2475cd2..2b4f9cd1 100644 --- a/app/Http/Home/Views/user/console/account_phone.volt +++ b/app/Http/Home/Views/user/console/account_phone.volt @@ -19,7 +19,7 @@
- +
@@ -28,16 +28,16 @@
- +
- - - - - + + + + +
@@ -50,6 +50,6 @@ {% block include_js %} {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('home/js/captcha.verify.js') }} + {{ js_include('home/js/captcha.verify.phone.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Services/Logic/Account/PasswordReset.php b/app/Services/Logic/Account/PasswordReset.php index 57f71008..cdc2e635 100644 --- a/app/Services/Logic/Account/PasswordReset.php +++ b/app/Services/Logic/Account/PasswordReset.php @@ -19,6 +19,15 @@ class PasswordReset extends LogicService { $post = $this->request->getPost(); + /** + * 使用[account|phone|email]做账户名字段兼容 + */ + if (isset($post['phone'])) { + $post['account'] = $post['phone']; + } elseif (isset($post['email'])) { + $post['account'] = $post['email']; + } + $accountValidator = new AccountValidator(); $account = $accountValidator->checkAccount($post['account']); diff --git a/app/Services/Logic/Account/Register.php b/app/Services/Logic/Account/Register.php index e2c36e02..449e7030 100644 --- a/app/Services/Logic/Account/Register.php +++ b/app/Services/Logic/Account/Register.php @@ -21,6 +21,15 @@ class Register extends LogicService { $post = $this->request->getPost(); + /** + * 使用[account|phone|email]做账户名字段兼容 + */ + if (isset($post['phone'])) { + $post['account'] = $post['phone']; + } elseif (isset($post['email'])) { + $post['account'] = $post['email']; + } + $verifyValidator = new VerifyValidator(); $verifyValidator->checkCode($post['account'], $post['verify_code']); diff --git a/public/static/home/js/captcha.verify.email.js b/public/static/home/js/captcha.verify.email.js new file mode 100644 index 00000000..8ab8f11b --- /dev/null +++ b/public/static/home/js/captcha.verify.email.js @@ -0,0 +1,80 @@ +layui.use(['jquery', 'layer', 'util', 'helper'], function () { + + var $ = layui.jquery; + var layer = layui.layer; + var util = layui.util; + var helper = layui.helper; + + var timeCounting = false; + var $account = $('#cv-email'); + var $emit = $('#cv-email-emit-btn'); + var $submit = $('#cv-email-submit-btn'); + + if ($('#cv-email-captcha-enabled').val() === '1') { + var captcha = new TencentCaptcha( + $emit[0], + $('#cv-email-captcha-appId').val(), + function (res) { + if (res.ret === 0) { + $('#cv-email-captcha-ticket').val(res.ticket); + $('#cv-email-captcha-rand').val(res.randstr); + sendVerifyCode(); + } + } + ); + } else { + $emit.on('click', function () { + sendVerifyCode(); + }); + } + + $account.on('keyup', function () { + var account = $(this).val(); + var accountOk = helper.isEmail(account); + if (accountOk && !timeCounting) { + $emit.removeClass('layui-btn-disabled').removeAttr('disabled'); + } else { + $emit.addClass('layui-btn-disabled').attr('disabled', 'disabled'); + } + }); + + function sendVerifyCode() { + if (helper.isEmail($account.val())) { + var postUrl = '/verify/mail/code'; + var postData = { + email: $account.val(), + captcha: { + ticket: $('#cv-email-captcha-ticket').val(), + rand: $('#cv-email-captcha-rand').val(), + } + }; + $.ajax({ + type: 'POST', + url: postUrl, + data: postData, + success: function () { + layer.msg('发送验证码成功', {icon: 1}); + } + }); + $submit.removeClass('layui-btn-disabled').removeAttr('disabled'); + $emit.addClass('layui-btn-disabled').attr('disabled', 'disabled'); + showCountDown($emit); + } + } + + function showCountDown() { + var serverTime = new Date().getTime(); + var endTime = serverTime + 60 * 1000; + util.countdown(endTime, serverTime, function (date, serverTime, timer) { + var left = date[0] * 86400 + date[1] * 3600 + date[2] * 60 + date[3]; + $emit.text(left + '秒'); + if (left === 0) { + $emit.removeClass('layui-btn-disabled').removeAttr('disabled').text('重新发送'); + clearInterval(timer); + timeCounting = false; + } + }); + timeCounting = true; + } + +}); \ No newline at end of file diff --git a/public/static/home/js/captcha.verify.js b/public/static/home/js/captcha.verify.js index 5340f9fb..a8bcf813 100644 --- a/public/static/home/js/captcha.verify.js +++ b/public/static/home/js/captcha.verify.js @@ -1,8 +1,9 @@ -layui.use(['jquery', 'layer', 'util'], function () { +layui.use(['jquery', 'layer', 'util', 'helper'], function () { var $ = layui.jquery; var layer = layui.layer; var util = layui.util; + var helper = layui.helper; var timeCounting = false; var $account = $('#cv-account'); @@ -28,16 +29,8 @@ layui.use(['jquery', 'layer', 'util'], function () { } $account.on('keyup', function () { - var accountOk; - var type = $(this).data('type'); var account = $(this).val(); - if (type === 'phone') { - accountOk = isPhone(account); - } else if (type === 'email') { - accountOk = isEmail(account); - } else { - accountOk = isPhone(account) || isEmail(account); - } + var accountOk = helper.isPhone(account) || helper.isEmail(account); if (accountOk && !timeCounting) { $emit.removeClass('layui-btn-disabled').removeAttr('disabled'); } else { @@ -46,7 +39,7 @@ layui.use(['jquery', 'layer', 'util'], function () { }); function sendVerifyCode() { - if (isEmail($account.val()) || isPhone($account.val())) { + if (helper.isEmail($account.val()) || helper.isPhone($account.val())) { var postUrl; var postData = { captcha: { @@ -54,10 +47,10 @@ layui.use(['jquery', 'layer', 'util'], function () { rand: $('#cv-captcha-rand').val(), } }; - if (isPhone($account.val())) { + if (helper.isPhone($account.val())) { postData.phone = $account.val(); postUrl = '/verify/sms/code'; - } else if (isEmail($account.val())) { + } else if (helper.isEmail($account.val())) { postData.email = $account.val(); postUrl = '/verify/mail/code'; } @@ -90,12 +83,4 @@ layui.use(['jquery', 'layer', 'util'], function () { timeCounting = true; } - function isEmail(email) { - return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email); - } - - function isPhone(phone) { - return /^1(3|4|5|6|7|8|9)\d{9}$/.test(phone); - } - }); \ No newline at end of file diff --git a/public/static/home/js/captcha.verify.phone.js b/public/static/home/js/captcha.verify.phone.js new file mode 100644 index 00000000..95f0a731 --- /dev/null +++ b/public/static/home/js/captcha.verify.phone.js @@ -0,0 +1,80 @@ +layui.use(['jquery', 'layer', 'util', 'helper'], function () { + + var $ = layui.jquery; + var layer = layui.layer; + var util = layui.util; + var helper = layui.helper; + + var timeCounting = false; + var $account = $('#cv-phone'); + var $emit = $('#cv-phone-emit-btn'); + var $submit = $('#cv-phone-submit-btn'); + + if ($('#cv-phone-captcha-enabled').val() === '1') { + var captcha = new TencentCaptcha( + $emit[0], + $('#cv-phone-captcha-appId').val(), + function (res) { + if (res.ret === 0) { + $('#cv-phone-captcha-ticket').val(res.ticket); + $('#cv-phone-captcha-rand').val(res.randstr); + sendVerifyCode(); + } + } + ); + } else { + $emit.on('click', function () { + sendVerifyCode(); + }); + } + + $account.on('keyup', function () { + var account = $(this).val(); + var accountOk = helper.isPhone(account); + if (accountOk && !timeCounting) { + $emit.removeClass('layui-btn-disabled').removeAttr('disabled'); + } else { + $emit.addClass('layui-btn-disabled').attr('disabled', 'disabled'); + } + }); + + function sendVerifyCode() { + if (helper.isPhone($account.val())) { + var postUrl = '/verify/sms/code'; + var postData = { + phone: $account.val(), + captcha: { + ticket: $('#cv-phone-captcha-ticket').val(), + rand: $('#cv-phone-captcha-rand').val(), + } + }; + $.ajax({ + type: 'POST', + url: postUrl, + data: postData, + success: function () { + layer.msg('发送验证码成功', {icon: 1}); + } + }); + $submit.removeClass('layui-btn-disabled').removeAttr('disabled'); + $emit.addClass('layui-btn-disabled').attr('disabled', 'disabled'); + showCountDown($emit); + } + } + + function showCountDown() { + var serverTime = new Date().getTime(); + var endTime = serverTime + 60 * 1000; + util.countdown(endTime, serverTime, function (date, serverTime, timer) { + var left = date[0] * 86400 + date[1] * 3600 + date[2] * 60 + date[3]; + $emit.text(left + '秒'); + if (left === 0) { + $emit.removeClass('layui-btn-disabled').removeAttr('disabled').text('重新发送'); + clearInterval(timer); + timeCounting = false; + } + }); + timeCounting = true; + } + +}); \ No newline at end of file diff --git a/public/static/lib/layui/extends/helper.js b/public/static/lib/layui/extends/helper.js index 2c3c686b..336d1b36 100644 --- a/public/static/lib/layui/extends/helper.js +++ b/public/static/lib/layui/extends/helper.js @@ -6,6 +6,14 @@ layui.define(['jquery', 'layer'], function (exports) { var helper = {}; + helper.isEmail = function (email) { + return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email); + }; + + helper.isPhone = function (phone) { + return /^1(3|4|5|6|7|8|9)\d{9}$/.test(phone); + }; + helper.getRequestId = function () { var id = Date.now().toString(36); id += Math.random().toString(36).substr(3); From ea78fd3c5c8091ae0530f4b1270a3d149a1af1ef Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 31 Aug 2022 10:27:03 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/home/css/common.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index 8c20cd92..c37dc67e 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -479,8 +479,8 @@ .article-card .cover { flex: 0 0 auto; - width: 150px; - height: 84px; + width: 180px; + height: 100px; margin-left: 10px; }