From 290fda610ba314df172817bb2d5d67ca3ff36cd4 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 19 Aug 2022 15:30:49 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=87=E7=BA=A7cos-s?= =?UTF-8?q?dk=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=8F=82=E6=95=B0=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=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 21f79dad809a3967b1a1e7fe36317008bd649933 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 19 Aug 2022 17:10:30 +0800 Subject: [PATCH 02/13] =?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 42f591173df021acf9f95904db7522dc940153a0 Mon Sep 17 00:00:00 2001 From: koogua Date: Tue, 6 Sep 2022 11:03:19 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controllers/UploadController.php | 43 ++++--------------- .../Home/Controllers/UploadController.php | 43 ++++--------------- 2 files changed, 16 insertions(+), 70 deletions(-) diff --git a/app/Http/Admin/Controllers/UploadController.php b/app/Http/Admin/Controllers/UploadController.php index 26c76045..73e34e5e 100644 --- a/app/Http/Admin/Controllers/UploadController.php +++ b/app/Http/Admin/Controllers/UploadController.php @@ -99,43 +99,16 @@ class UploadController extends Controller $file = $service->uploadContentImage(); if (!$file) { - return $this->jsonError(['msg' => '上传文件失败']); + return $this->jsonError([ + 'message' => '上传图片失败', + 'error' => 1, + ]); } - $data = [ - 'src' => $service->getImageUrl($file->path), - 'title' => $file->name, - ]; - - return $this->jsonSuccess(['data' => $data]); - } - - /** - * @Post("/remote/img", name="admin.upload.remote_img") - */ - public function uploadRemoteImageAction() - { - $originalUrl = $this->request->getPost('url', ['trim', 'string']); - - $service = new StorageService(); - - $file = $service->uploadRemoteImage($originalUrl); - - $newUrl = $originalUrl; - - if ($file) { - $newUrl = $service->getImageUrl($file->path); - } - - /** - * 编辑器要求返回的数据结构 - */ - $data = [ - 'url' => $newUrl, - 'originalURL' => $originalUrl, - ]; - - return $this->jsonSuccess(['data' => $data]); + return $this->jsonSuccess([ + 'url' => $service->getImageUrl($file->path), + 'error' => 0, + ]); } /** diff --git a/app/Http/Home/Controllers/UploadController.php b/app/Http/Home/Controllers/UploadController.php index c2b403db..2e1f0f4d 100644 --- a/app/Http/Home/Controllers/UploadController.php +++ b/app/Http/Home/Controllers/UploadController.php @@ -56,43 +56,16 @@ class UploadController extends Controller $file = $service->uploadContentImage(); if (!$file) { - return $this->jsonError(['msg' => '上传文件失败']); + return $this->jsonError([ + 'message' => '上传图片失败', + 'error' => 1, + ]); } - $data = [ - 'src' => $service->getImageUrl($file->path), - 'title' => $file->name, - ]; - - return $this->jsonSuccess(['data' => $data]); - } - - /** - * @Post("/remote/img", name="home.upload.remote_img") - */ - public function uploadRemoteImageAction() - { - $originalUrl = $this->request->getPost('url', ['trim', 'string']); - - $service = new StorageService(); - - $file = $service->uploadRemoteImage($originalUrl); - - $newUrl = $originalUrl; - - if ($file) { - $newUrl = $service->getImageUrl($file->path); - } - - /** - * 编辑器要求返回的数据结构 - */ - $data = [ - 'url' => $newUrl, - 'originalURL' => $originalUrl, - ]; - - return $this->jsonSuccess(['data' => $data]); + return $this->jsonSuccess([ + 'url' => $service->getImageUrl($file->path), + 'error' => 0, + ]); } } \ No newline at end of file From de38cc756d7f102de6b7843f482886fe4ae10630 Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 21 Sep 2022 17:44:25 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E8=B0=83=E6=95=B4layui-main=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=9B=B4=E6=96=B0=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/home/css/common.css | 20 +++++++++----------- public/static/home/js/index.js | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index e5e6fb4f..e494a893 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -120,7 +120,7 @@ } .layout-sidebar { - width: 320px; + width: 340px; } .writer-content { @@ -306,8 +306,8 @@ } .index-carousel { - width: 1100px; - height: 330px; + width: 1120px; + height: 336px; text-align: center; } @@ -748,7 +748,7 @@ .toolbar-sticky { position: fixed; top: 150px; - margin-left: -65px; + margin-left: -85px; } .toolbar-sticky .item { @@ -805,8 +805,8 @@ } .course-card .cover img { - width: 270px; - height: 152px; + width: 275px; + height: 155px; transition: all 0.6s; } @@ -1220,10 +1220,9 @@ } .sidebar-course-card .cover { - float: left; width: 90px; height: 50px; - margin-right: 5px; + margin-right: 10px; } .sidebar-course-card .cover img { @@ -1232,8 +1231,7 @@ } .sidebar-course-card .info { - float: left; - width: 190px; + width: 200px; color: #666; font-size: 12px; overflow: hidden; @@ -1845,7 +1843,7 @@ } .my-sidebar { - width: 220px; + width: 240px; } .my-content { diff --git a/public/static/home/js/index.js b/public/static/home/js/index.js index 379cd190..7bb92b61 100644 --- a/public/static/home/js/index.js +++ b/public/static/home/js/index.js @@ -6,7 +6,7 @@ layui.use(['carousel', 'flow'], function () { carousel.render({ elem: '#carousel', width: '100%', - height: '330px' + height: '336px' }); flow.lazyimg(); From 3e7082b2518229070317eaafdf7521a19a9f9ca6 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 28 Oct 2022 15:41:20 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=A4=A7=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E5=9B=BE=E6=A0=87=E4=B8=8D=E5=B1=85=E4=B8=AD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/home/css/common.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index c3ad2e18..2ecbedc5 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -1328,6 +1328,8 @@ width: 760px; height: 428px; margin-bottom: 20px; + background: black; + position: relative; } .dplayer { From 6edbcc4638da3d40654d2a43603e156a65fd8048 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 28 Oct 2022 17:05:24 +0800 Subject: [PATCH 06/13] =?UTF-8?q?v1.6.1=E5=BC=80=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Library/AppInfo.php | 2 +- public/static/home/js/chapter.vod.player.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 1ea13df1..1242f294 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -16,7 +16,7 @@ class AppInfo protected $link = 'https://www.koogua.com'; - protected $version = '1.6.0'; + protected $version = '1.6.1'; public function __get($name) { diff --git a/public/static/home/js/chapter.vod.player.js b/public/static/home/js/chapter.vod.player.js index c072658f..3aaa7f69 100644 --- a/public/static/home/js/chapter.vod.player.js +++ b/public/static/home/js/chapter.vod.player.js @@ -29,8 +29,6 @@ layui.use(['jquery', 'helper'], function () { } }); - console.log(quality) - var player = new DPlayer({ container: document.getElementById('player'), video: { From 372b996365620738860ea43833a09aa8ab6f8558 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 31 Oct 2022 09:53:24 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Article.php | 23 ----------- app/Http/Admin/Services/Course.php | 16 -------- app/Http/Admin/Services/Page.php | 16 -------- app/Http/Admin/Services/Question.php | 23 ----------- app/Services/Logic/PointGiftTrait.php | 2 +- app/Services/MyStorage.php | 56 +-------------------------- 6 files changed, 3 insertions(+), 133 deletions(-) diff --git a/app/Http/Admin/Services/Article.php b/app/Http/Admin/Services/Article.php index 6a9931f2..368dc2cb 100644 --- a/app/Http/Admin/Services/Article.php +++ b/app/Http/Admin/Services/Article.php @@ -9,7 +9,6 @@ namespace App\Http\Admin\Services; use App\Builders\ArticleList as ArticleListBuilder; use App\Builders\ReportList as ReportListBuilder; -use App\Caches\Article as ArticleCache; use App\Library\Paginator\Query as PagerQuery; use App\Library\Utils\Word as WordUtil; use App\Models\Article as ArticleModel; @@ -27,7 +26,6 @@ use App\Services\Logic\Article\XmTagList as XmTagListService; use App\Services\Logic\Notice\Internal\ArticleApproved as ArticleApprovedNotice; use App\Services\Logic\Notice\Internal\ArticleRejected as ArticleRejectedNotice; use App\Services\Logic\Point\History\ArticlePost as ArticlePostPointHistory; -use App\Services\Sync\ArticleIndex as ArticleIndexSync; use App\Validators\Article as ArticleValidator; class Article extends Service @@ -209,8 +207,6 @@ class Article extends Service $this->saveDynamicAttrs($article); - $this->rebuildArticleIndex($article); - $owner = $this->findUser($article->owner_id); $this->recountUserArticles($owner); @@ -230,8 +226,6 @@ class Article extends Service $this->saveDynamicAttrs($article); - $this->rebuildArticleIndex($article); - $owner = $this->findUser($article->owner_id); $this->recountUserArticles($owner); @@ -251,8 +245,6 @@ class Article extends Service $this->saveDynamicAttrs($article); - $this->rebuildArticleIndex($article); - $owner = $this->findUser($article->owner_id); $this->recountUserArticles($owner); @@ -292,7 +284,6 @@ class Article extends Service if ($type == 'approve') { - $this->rebuildArticleIndex($article); $this->handleArticlePostPoint($article); $this->handleArticleApprovedNotice($article, $sender); @@ -403,20 +394,6 @@ class Article extends Service $user->update(); } - protected function rebuildArticleCache(ArticleModel $article) - { - $cache = new ArticleCache(); - - $cache->rebuild($article->id); - } - - protected function rebuildArticleIndex(ArticleModel $article) - { - $sync = new ArticleIndexSync(); - - $sync->addItem($article->id); - } - protected function handleArticlePostPoint(ArticleModel $article) { if ($article->published != ArticleModel::PUBLISH_APPROVED) return; diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index cdd951f9..e3f20997 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -8,7 +8,6 @@ namespace App\Http\Admin\Services; use App\Builders\CourseList as CourseListBuilder; -use App\Caches\Course as CourseCache; use App\Caches\CourseCategoryList as CourseCategoryListCache; use App\Caches\CourseRelatedList as CourseRelatedListCache; use App\Caches\CourseTeacherList as CourseTeacherListCache; @@ -25,7 +24,6 @@ use App\Repos\CourseCategory as CourseCategoryRepo; use App\Repos\CourseRelated as CourseRelatedRepo; use App\Repos\CourseUser as CourseUserRepo; use App\Repos\User as UserRepo; -use App\Services\Sync\CourseIndex as CourseIndexSync; use App\Validators\Course as CourseValidator; use App\Validators\CourseOffline as CourseOfflineValidator; @@ -399,20 +397,6 @@ class Course extends Service return $validator->checkCourse($id); } - protected function rebuildCourseCache(CourseModel $course) - { - $cache = new CourseCache(); - - $cache->rebuild($course->id); - } - - protected function rebuildCourseIndex(CourseModel $course) - { - $sync = new CourseIndexSync(); - - $sync->addItem($course->id); - } - protected function saveTeachers(CourseModel $course, $teacherIds) { $courseRepo = new CourseRepo(); diff --git a/app/Http/Admin/Services/Page.php b/app/Http/Admin/Services/Page.php index 022afa64..3ed047c3 100644 --- a/app/Http/Admin/Services/Page.php +++ b/app/Http/Admin/Services/Page.php @@ -7,7 +7,6 @@ namespace App\Http\Admin\Services; -use App\Caches\Page as PageCache; use App\Library\Paginator\Query as PagerQuery; use App\Models\Page as PageModel; use App\Repos\Page as PageRepo; @@ -53,8 +52,6 @@ class Page extends Service $page->create($data); - $this->rebuildPageCache($page); - return $page; } @@ -96,8 +93,6 @@ class Page extends Service $page->update($data); - $this->rebuildPageCache($page); - return $page; } @@ -109,8 +104,6 @@ class Page extends Service $page->update(); - $this->rebuildPageCache($page); - return $page; } @@ -122,18 +115,9 @@ class Page extends Service $page->update(); - $this->rebuildPageCache($page); - return $page; } - protected function rebuildPageCache(PageModel $page) - { - $cache = new PageCache(); - - $cache->rebuild($page->id); - } - protected function findOrFail($id) { $validator = new PageValidator(); diff --git a/app/Http/Admin/Services/Question.php b/app/Http/Admin/Services/Question.php index 52b548b7..44a456ef 100644 --- a/app/Http/Admin/Services/Question.php +++ b/app/Http/Admin/Services/Question.php @@ -9,7 +9,6 @@ namespace App\Http\Admin\Services; use App\Builders\QuestionList as QuestionListBuilder; use App\Builders\ReportList as ReportListBuilder; -use App\Caches\Question as QuestionCache; use App\Library\Paginator\Query as PagerQuery; use App\Models\Category as CategoryModel; use App\Models\Question as QuestionModel; @@ -26,7 +25,6 @@ use App\Services\Logic\Point\History\QuestionPost as QuestionPostPointHistory; use App\Services\Logic\Question\QuestionDataTrait; use App\Services\Logic\Question\QuestionInfo as QuestionInfoService; use App\Services\Logic\Question\XmTagList as XmTagListService; -use App\Services\Sync\QuestionIndex as QuestionIndexSync; use App\Validators\Question as QuestionValidator; class Question extends Service @@ -191,8 +189,6 @@ class Question extends Service $this->saveDynamicAttrs($question); - $this->rebuildQuestionIndex($question); - $owner = $this->findUser($question->owner_id); $this->recountUserQuestions($owner); @@ -212,8 +208,6 @@ class Question extends Service $this->saveDynamicAttrs($question); - $this->rebuildQuestionIndex($question); - $owner = $this->findUser($question->owner_id); $this->recountUserQuestions($owner); @@ -231,8 +225,6 @@ class Question extends Service $question->update(); - $this->rebuildQuestionIndex($question); - $owner = $this->findUser($question->owner_id); $this->recountUserQuestions($owner); @@ -268,7 +260,6 @@ class Question extends Service if ($type == 'approve') { - $this->rebuildQuestionIndex($question); $this->handleQuestionPostPoint($question); $this->handleQuestionApprovedNotice($question, $sender); @@ -379,20 +370,6 @@ class Question extends Service $user->update(); } - protected function rebuildQuestionCache(QuestionModel $question) - { - $cache = new QuestionCache(); - - $cache->rebuild($question->id); - } - - protected function rebuildQuestionIndex(QuestionModel $question) - { - $sync = new QuestionIndexSync(); - - $sync->addItem($question->id); - } - protected function handleQuestionPostPoint(QuestionModel $question) { if ($question->published != QuestionModel::PUBLISH_APPROVED) return; diff --git a/app/Services/Logic/PointGiftTrait.php b/app/Services/Logic/PointGiftTrait.php index 8750b552..c81a577e 100644 --- a/app/Services/Logic/PointGiftTrait.php +++ b/app/Services/Logic/PointGiftTrait.php @@ -19,7 +19,7 @@ trait PointGiftTrait return $validator->checkPointGift($id); } - public function checkFlashSaleCache($id) + public function checkPointGiftCache($id) { $validator = new PointGiftValidator(); diff --git a/app/Services/MyStorage.php b/app/Services/MyStorage.php index 34729ccc..2ddc1927 100644 --- a/app/Services/MyStorage.php +++ b/app/Services/MyStorage.php @@ -183,58 +183,6 @@ class MyStorage extends Storage return $this->upload('/resource/', self::MIME_FILE, UploadModel::TYPE_RESOURCE); } - /** - * @param string $url - * - * @return UploadModel|bool - */ - public function uploadRemoteImage($url) - { - $path = parse_url($url, PHP_URL_PATH); - $extension = pathinfo($path, PATHINFO_EXTENSION); - $originalName = pathinfo($path, PATHINFO_BASENAME); - - $fileName = $this->generateFileName($extension); - - $filePath = tmp_path($fileName); - - $contents = file_get_contents($url); - - if (file_put_contents($filePath, $contents) === false) { - return false; - } - - $keyName = "/img/content/{$fileName}"; - - $uploadPath = $this->putFile($keyName, $filePath); - - if (!$uploadPath) return false; - - $md5 = md5_file($filePath); - - $uploadRepo = new UploadRepo(); - - $upload = $uploadRepo->findByMd5($md5); - - if ($upload == false) { - - $upload = new UploadModel(); - - $upload->name = $originalName; - $upload->mime = mime_content_type($filePath); - $upload->size = filesize($filePath); - $upload->type = UploadModel::TYPE_CONTENT_IMG; - $upload->path = $uploadPath; - $upload->md5 = $md5; - - $upload->create(); - } - - unlink($filePath); - - return $upload; - } - /** * 上传文件 * @@ -256,7 +204,7 @@ class MyStorage extends Storage foreach ($files as $file) { - if ($this->checkFile($file->getRealType(), $mimeType) == false) { + if (!$this->checkFile($file->getRealType(), $mimeType)) { continue; } @@ -264,7 +212,7 @@ class MyStorage extends Storage $upload = $uploadRepo->findByMd5($md5); - if ($upload == false) { + if (!$upload) { $name = $this->filter->sanitize($file->getName(), ['trim', 'string']); From 301557abbcc076e4ef9eb5bc53dc03f4a4d47bdc Mon Sep 17 00:00:00 2001 From: koogua Date: Mon, 31 Oct 2022 18:25:57 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=90=E4=BA=A4=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Views/trade/refund.volt | 14 +++++++++----- public/static/admin/js/common.js | 14 ++++++++------ public/static/home/js/common.js | 14 ++++++++------ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/Http/Admin/Views/trade/refund.volt b/app/Http/Admin/Views/trade/refund.volt index d5c54c7b..0af6fdae 100644 --- a/app/Http/Admin/Views/trade/refund.volt +++ b/app/Http/Admin/Views/trade/refund.volt @@ -71,11 +71,15 @@ -
- - - - +
+ +
+ + + + + +
diff --git a/public/static/admin/js/common.js b/public/static/admin/js/common.js index 08a7acc6..4f4f9451 100644 --- a/public/static/admin/js/common.js +++ b/public/static/admin/js/common.js @@ -49,14 +49,15 @@ layui.use(['jquery', 'form', 'element', 'layer', 'kgDropdown'], function () { form.on('submit(go)', function (data) { var submit = $(this); - submit.attr('disabled', 'disabled').addClass('layui-btn-disabled'); + var orgText = $(this).text(); + submit.text('提交中···').attr('disabled', 'disabled').addClass('layui-btn-disabled'); $.ajax({ type: 'POST', url: data.form.action, data: data.field, success: function (res) { if (res.msg) { - layer.msg(res.msg, {icon: 1}); + layer.msg(res.msg, {icon: 1, time: 1500}); } if (res.location) { var target = res.target || 'self'; @@ -66,13 +67,14 @@ layui.use(['jquery', 'form', 'element', 'layer', 'kgDropdown'], function () { } else { window.location.href = res.location; } - }, 1500); - } else { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1000); } + setTimeout(function () { + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1500); }, error: function () { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); } }); return false; diff --git a/public/static/home/js/common.js b/public/static/home/js/common.js index 67d84753..dff6dd3d 100644 --- a/public/static/home/js/common.js +++ b/public/static/home/js/common.js @@ -68,14 +68,15 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { form.on('submit(go)', function (data) { var submit = $(this); - submit.attr('disabled', 'disabled').addClass('layui-btn-disabled'); + var orgText = $(this).text(); + submit.text('提交中···').attr('disabled', 'disabled').addClass('layui-btn-disabled'); $.ajax({ type: 'POST', url: data.form.action, data: data.field, success: function (res) { if (res.msg) { - layer.msg(res.msg, {icon: 1}); + layer.msg(res.msg, {icon: 1, time: 1500}); } if (res.location) { var target = res.target || 'self'; @@ -85,13 +86,14 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { } else { window.location.href = res.location; } - }, 1500); - } else { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1000); } + setTimeout(function () { + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1500); }, error: function () { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); } }); return false; From 46176071b8c20e860586fc8370df388bbf374c86 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sun, 6 Nov 2022 12:55:12 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E4=BD=9C=E8=80=85=EF=BC=8C=E7=AD=94=E4=B8=BB=E5=92=8C=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Home/Views/article/list.volt | 2 +- app/Http/Home/Views/question/list.volt | 4 ++-- app/Services/Logic/Article/TopAuthorList.php | 10 ++++++++-- app/Services/Logic/Question/HotQuestionList.php | 10 ++++++++-- app/Services/Logic/Question/TopAnswererList.php | 10 ++++++++-- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/Http/Home/Views/article/list.volt b/app/Http/Home/Views/article/list.volt index aced081e..11fe75e8 100644 --- a/app/Http/Home/Views/article/list.volt +++ b/app/Http/Home/Views/article/list.volt @@ -4,7 +4,7 @@ {% set sort_val = request.get('sort','trim','latest') %} {% set pager_url = url({'for':'home.article.pager'}, params) %} - {% set top_authors_url = url({'for':'home.widget.top_authors'}) %} + {% set top_authors_url = url({'for':'home.widget.top_authors'},{'limit':5}) %} {% set my_tags_url = url({'for':'home.widget.my_tags'},{'type':'article'}) %}