diff --git a/modules/Cms/Http/Controllers/CategoryController.php b/modules/Cms/Http/Controllers/CategoryController.php new file mode 100644 index 0000000..8bb0879 --- /dev/null +++ b/modules/Cms/Http/Controllers/CategoryController.php @@ -0,0 +1,67 @@ +model->getList(); + } + + /** + * store + * + * @param Request $request + * @return mixed + */ + public function store(Request $request): mixed + { + return $this->model->storeBy($request->all()); + } + + /** + * show + * + * @param $id + * @return mixed + */ + public function show($id): mixed + { + return $this->model->firstBy($id); + } + + /** + * + * @param $id + * @param Request $request + * @return mixed + */ + public function update($id, Request $request): mixed + { + return $this->model->updateBy($id, $request->all()); + } + + /** + * + * @param $id + * @return bool|null + */ + public function destroy($id): ?bool + { + return $this->model->deleteBy($id); + } +} diff --git a/modules/Cms/Models/Category.php b/modules/Cms/Models/Category.php new file mode 100644 index 0000000..aa30a1d --- /dev/null +++ b/modules/Cms/Models/Category.php @@ -0,0 +1,43 @@ + 'like' + ]; +} diff --git a/modules/Cms/Providers/CmsServiceProvider.php b/modules/Cms/Providers/CmsServiceProvider.php new file mode 100644 index 0000000..6a0309d --- /dev/null +++ b/modules/Cms/Providers/CmsServiceProvider.php @@ -0,0 +1,20 @@ +id(); + $table->string('nickname', 50)->comment('昵称'); + $table->string('password')->comment('密码'); + $table->string('email', 100)->comment('邮箱'); + $table->string('homepage')->comment('主页地址'); + $table->string('active_key')->comment('激活码'); + $table->tinyInteger('status')->default(0)->comment('状态 0 无需激活 1 未激活 2 激活'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('用户管理表'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_user'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_045616_create_cms_user_meta.php b/modules/Cms/database/migrations/2023_02_23_045616_create_cms_user_meta.php new file mode 100644 index 0000000..0bce207 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_045616_create_cms_user_meta.php @@ -0,0 +1,39 @@ +id(); + $table->integer('user_id')->nullable()->comment('用户ID'); + $table->string('key')->nullable()->comment('元数据的 key'); + $table->string('value')->nullable()->comment('元数据的值'); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('用户关联的元数据表'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_user_meta'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_051406_create_cms_comment.php b/modules/Cms/database/migrations/2023_02_23_051406_create_cms_comment.php new file mode 100644 index 0000000..cabd362 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_051406_create_cms_comment.php @@ -0,0 +1,48 @@ +id(); + $table->integer('parent_id')->comment('父级ID'); + $table->integer('user_id')->default(0)->comment('用户ID,不一定存在'); + $table->integer('post_id')->default(0)->comment('文章ID'); + $table->string('author')->nullable()->comment('作者'); + $table->string('author_email')->comment('作者邮箱'); + $table->string('author_homepage')->comment('作者的主页'); + $table->string('author_ip')->comment('ip地址'); + $table->text('content')->comment('评论内容'); + $table->tinyInteger('is_approved')->default(1)->comment('1 未批准 2 批准'); + $table->string('user_agent')->comment('评论者的USER AGENT'); + $table->string('type')->default(1)->comment('评论类型 1 普通 2 回复'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('评论表'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_comment'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_051620_create_cms_comment_mata.php b/modules/Cms/database/migrations/2023_02_23_051620_create_cms_comment_mata.php new file mode 100644 index 0000000..55ccc78 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_051620_create_cms_comment_mata.php @@ -0,0 +1,39 @@ +id(); + $table->integer('comment_id')->comment('评论ID'); + $table->string('key')->comment('评论元数据 KEY'); + $table->string('value')->comment('评论元数据 Value'); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('评论元数据表'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_comment_mata'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_052223_create_cms_links.php b/modules/Cms/database/migrations/2023_02_23_052223_create_cms_links.php new file mode 100644 index 0000000..d91dfe3 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_052223_create_cms_links.php @@ -0,0 +1,47 @@ +id(); + $table->string('name')->comment('链接名称'); + $table->string('url')->comment('链接的 URL'); + $table->string('image')->comment('链接图片'); + $table->tinyInteger('is_target')->default(1)->comment('打开方式 1 本窗口打开 2 新窗口打开'); + $table->tinyText('description')->comment('描述'); + $table->tinyInteger('is_visible')->default(1)->comment('是否可见 1 不可见 2 可见'); + $table->integer('rating')->comment('评分等级'); + $table->string('rel')->comment('友情链接'); + $table->string('rel_notes', 1000)->comment('友情链接注释'); + $table->string('rss')->comment('rss 链接地址'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('链接表'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_links'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_052606_create_cms_options.php b/modules/Cms/database/migrations/2023_02_23_052606_create_cms_options.php new file mode 100644 index 0000000..a26dfc3 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_052606_create_cms_options.php @@ -0,0 +1,40 @@ +id(); + $table->string('key')->comment('key'); + $table->text('value')->comment('value 值'); + $table->tinyInteger('autoload')->default(1)->comment('是否自动载入 1 是 2 否'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('选项, key value'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_options'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_053834_create_cms_posts.php b/modules/Cms/database/migrations/2023_02_23_053834_create_cms_posts.php new file mode 100644 index 0000000..52404ab --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_053834_create_cms_posts.php @@ -0,0 +1,48 @@ +id(); + $table->string('author')->comment('作者'); + $table->string('title')->comment('标题'); + $table->longText('content')->comment('内容'); + $table->tinyText('excerpt')->comment('摘录'); + $table->tinyInteger('status')->default(1)->comment('文章状态 1 草稿 2 发布'); + $table->tinyInteger('is_can_comment')->default(1)->comment('是否可以评论 1 可以 2 不可以'); + $table->string('password')->comment('文章查看密码'); + $table->integer('order')->default(1)->comment('排序 默认 1'); + $table->integer('user_id')->default(0)->comment('用户ID 0 未知'); + $table->tinyInteger('type')->default(1)->comment('文章类型 1 文章 2 页面'); + $table->integer('comment_count')->default(0)->comment('评论总数'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('文章内容表'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_posts'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_054326_create_cms_category_meta.php b/modules/Cms/database/migrations/2023_02_23_054326_create_cms_category_meta.php new file mode 100644 index 0000000..f935d58 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_054326_create_cms_category_meta.php @@ -0,0 +1,40 @@ +id(); + $table->integer('category_id')->comment('分类ID'); + $table->string('key')->comment('元数据key'); + $table->string('value')->comment('元数据的值'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('分类元数据'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_category_meta'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_055135_create_cms_catetory_relationships.php b/modules/Cms/database/migrations/2023_02_23_055135_create_cms_catetory_relationships.php new file mode 100644 index 0000000..c1bb742 --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_055135_create_cms_catetory_relationships.php @@ -0,0 +1,40 @@ +id(); + $table->integer('category_id')->comment('分类ID'); + $table->integer('object_id')->comment('文章ID/链接ID'); + $table->tinyInteger('type')->default(1)->comment('类型 1 文章 2 链接'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('分类关系'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_catetory_relationships'); + } +}; diff --git a/modules/Cms/database/migrations/2023_02_23_055515_create_cms_category.php b/modules/Cms/database/migrations/2023_02_23_055515_create_cms_category.php new file mode 100644 index 0000000..0d1637e --- /dev/null +++ b/modules/Cms/database/migrations/2023_02_23_055515_create_cms_category.php @@ -0,0 +1,42 @@ +id(); + $table->integer('parent_id')->default(0)->comment('父级ID'); + $table->string('name')->comment('名称'); + $table->string('slug')->comment('缩略名'); + $table->integer('order')->default(1)->comment('排序 默认 1'); + $table->integer('post_count')->default(0)->comment('文章数量'); + $table->creatorId(); + $table->createdAt(); + $table->updatedAt(); + $table->deletedAt(); + + $table->engine='InnoDB'; + $table->comment('分类'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cms_category'); + } +}; diff --git a/modules/Cms/routes/route.php b/modules/Cms/routes/route.php new file mode 100644 index 0000000..83fcc06 --- /dev/null +++ b/modules/Cms/routes/route.php @@ -0,0 +1,10 @@ +group(function(){ + + Route::apiResource('category', CategoryController::class); + //next +}); diff --git a/modules/Cms/views/category/create.vue b/modules/Cms/views/category/create.vue new file mode 100644 index 0000000..3afd760 --- /dev/null +++ b/modules/Cms/views/category/create.vue @@ -0,0 +1,43 @@ + + + diff --git a/modules/Cms/views/category/index.vue b/modules/Cms/views/category/index.vue new file mode 100644 index 0000000..c0b3c88 --- /dev/null +++ b/modules/Cms/views/category/index.vue @@ -0,0 +1,50 @@ + +