From 80acb020ea4ae216caa0be3a8d33f31f42ee2e26 Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Wed, 19 Mar 2025 17:40:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=92=8C=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminapi/controller/crud/LeaveWord.php | 2 + .../adminapi/controller/crud/ShareList.php | 207 ++++++++++++++++++ crmeb/app/adminapi/route/crud/share_list.php | 23 ++ .../validate/crud/ShareListValidate.php | 53 +++++ .../v1/publics/ProcessController.php | 8 + crmeb/app/api/route/v1.php | 1 + crmeb/app/dao/crud/ShareListDao.php | 59 +++++ crmeb/app/model/crud/LeaveWord.php | 23 ++ crmeb/app/model/crud/ShareList.php | 45 ++++ crmeb/app/services/crud/LeaveWordServices.php | 2 +- crmeb/app/services/crud/ShareListServices.php | 111 ++++++++++ crmeb/public/h5/README.md | 2 +- crmeb/public/index.html | 26 ++- crmeb/route/route.php | 17 +- template/admin/src/api/crud/shareList.js | 112 ++++++++++ .../admin/src/pages/crud/shareList/index.vue | 180 +++++++++++++++ .../src/router/modules/crud/shareList.js | 39 ++++ 17 files changed, 904 insertions(+), 6 deletions(-) create mode 100644 crmeb/app/adminapi/controller/crud/ShareList.php create mode 100644 crmeb/app/adminapi/route/crud/share_list.php create mode 100644 crmeb/app/adminapi/validate/crud/ShareListValidate.php create mode 100644 crmeb/app/dao/crud/ShareListDao.php create mode 100644 crmeb/app/model/crud/ShareList.php create mode 100644 crmeb/app/services/crud/ShareListServices.php create mode 100644 template/admin/src/api/crud/shareList.js create mode 100644 template/admin/src/pages/crud/shareList/index.vue create mode 100644 template/admin/src/router/modules/crud/shareList.js diff --git a/crmeb/app/adminapi/controller/crud/LeaveWord.php b/crmeb/app/adminapi/controller/crud/LeaveWord.php index 242ed5d..2e4834d 100644 --- a/crmeb/app/adminapi/controller/crud/LeaveWord.php +++ b/crmeb/app/adminapi/controller/crud/LeaveWord.php @@ -55,12 +55,14 @@ class LeaveWord extends AuthController */ public function index() { + $where = $this->request->getMore([ ['name', ''], ['mobile', ''], ['content', ''], ['create_time', ''], ]); +// var_dump(1111); return app('json')->success($this->service->getCrudListIndex($where)); } diff --git a/crmeb/app/adminapi/controller/crud/ShareList.php b/crmeb/app/adminapi/controller/crud/ShareList.php new file mode 100644 index 0000000..b8365ff --- /dev/null +++ b/crmeb/app/adminapi/controller/crud/ShareList.php @@ -0,0 +1,207 @@ + + * +---------------------------------------------------------------------- + */ + +/** + * 分享列表 + * @author crud自动生成代码 + * @date 2025/03/17 + */ + +namespace app\adminapi\controller\crud; + +use app\adminapi\controller\AuthController; +use think\facade\App; +use app\services\crud\ShareListServices; + +/** + * Class ShareList + * @date 2025/03/17 + * @package app\adminapi\controller\crud + */ +class ShareList extends AuthController +{ + + /** + * @var ShareListServices + */ + protected $service; + + /** + * ShareListController constructor. + * @param App $app + * @param ShareListServices $service + */ + public function __construct(App $app, ShareListServices $service) + { + parent::__construct($app); + $this->service = $service; + } + + + /** + * 列表 + * @date 2025/03/17 + * @return \think\Response + */ + public function index() + { + $where = $this->request->getMore([ + + ]); + return app('json')->success($this->service->getCrudListIndex($where)); + } + + /** + * 创建 + * @return \think\Response + * @date 2025/03/17 + */ + public function create() + { + return app('json')->success($this->service->getCrudForm()); + } + + /** + * 保存 + * @return \think\Response + * @date 2025/03/17 + */ + public function save() + { + $data = $this->request->postMore([ + ['name', ''], + ['link', ''], + ['img', ''], + ['img_two', ''], + ['sort', ''], + + ]); + + validate(\app\adminapi\validate\crud\ShareListValidate::class)->check($data); + + $this->service->crudSave($data); + + return app('json')->success(100021); + } + + /** + * 编辑获取数据 + * @param $id + * @return \think\Response + * @date 2025/03/17 + */ + public function edit($id) + { + return app('json')->success($this->service->getCrudForm((int)$id)); + } + + /** + * 修改 + * @param $id + * @return \think\Response + * @date 2025/03/17 + */ + public function update($id) + { + if (!$id) { + return app('json')->fail(100100); + } + + $data = $this->request->postMore([ + ['name', ''], + ['link', ''], + ['img', ''], + ['img_two', ''], + ['sort', ''], + + ]); + + validate(\app\adminapi\validate\crud\ShareListValidate::class)->check($data); + + $this->service->crudUpdate((int)$id, $data); + + return app('json')->success(100001); + } + + /** + * 修改状态 + * @param $id + * @return \think\Response + * @date 2025/03/17 + */ + public function status($id) + { + if (!$id) { + return app('json')->fail(100100); + } + + $data = $this->request->postMore([ + ['field', ''], + ['value', ''] + ]); + + $filedAll = []; + + if (!in_array($data['field'], $filedAll)) { + return app('json')->fail(100100); + } + + if ($this->service->update(['id'=> $id], [$data['field']=> $data['value']])) { + return app('json')->success(100001); + } else { + return app('json')->fail(100100); + } + } + + /** + * 删除 + * @param $id + * @return \think\Response + * @date 2025/03/17 + */ + public function delete($id) + { + if (!$id) { + return app('json')->fail(100100); + } + + if ($this->service->destroy((int)$id)) { + return app('json')->success(100002); + } else { + return app('json')->success(100008); + } + } + + /** + * 查看 + * @param $id + * @return \think\Response + * @date 2025/03/17 + */ + public function read($id) + { + if (!$id) { + return app('json')->fail(100100); + } + + $info = $this->service->get($id, ['*'], []); + if (!$info) { + return app('json')->fail(100100); + } + + return app('json')->success($info->toArray()); + } + + + +} diff --git a/crmeb/app/adminapi/route/crud/share_list.php b/crmeb/app/adminapi/route/crud/share_list.php new file mode 100644 index 0000000..0aaff5b --- /dev/null +++ b/crmeb/app/adminapi/route/crud/share_list.php @@ -0,0 +1,23 @@ +option(['real_name' => '分享列表列表接口']); + +Route::get('crud/share_list/create', 'crud.ShareList/create')->option(['real_name' => '分享列表获取创建表单接口']); + +Route::post('crud/share_list', 'crud.ShareList/save')->option(['real_name' => '分享列表保存接口']); + +Route::get('crud/share_list/:id/edit', 'crud.ShareList/edit')->option(['real_name' => '分享列表获取修改表单接口']); + +Route::put('crud/share_list/:id', 'crud.ShareList/update')->option(['real_name' => '分享列表修改接口']); + +Route::put('crud/share_list/status/:id', 'crud.ShareList/status')->option(['real_name' => '分享列表修改状态接口']); + +Route::delete('crud/share_list/:id', 'crud.ShareList/delete')->option(['real_name' => '分享列表删除接口']); + +Route::get('crud/share_list/:id', 'crud.ShareList/read')->option(['real_name' => '分享列表查看接口']); + + + diff --git a/crmeb/app/adminapi/validate/crud/ShareListValidate.php b/crmeb/app/adminapi/validate/crud/ShareListValidate.php new file mode 100644 index 0000000..f0b5ad0 --- /dev/null +++ b/crmeb/app/adminapi/validate/crud/ShareListValidate.php @@ -0,0 +1,53 @@ + + * +---------------------------------------------------------------------- + */ + +/** + * 分享列表 + * @author crud自动生成代码 + * @date 2025/03/17 16:22:48 + */ + +namespace app\adminapi\validate\crud; + + +use think\Validate; + +/** + * Class CrudValidate + * @date 2025/03/17 + * @package app\adminapi\validate\crud + */ +class ShareListValidate extends Validate +{ + + /** + * @var array + */ + protected $rule = [ + + ]; + + /** + * @var array + */ + protected $message = [ + + ]; + + /** + * @var array + */ + protected $scene = [ + + ]; +} diff --git a/crmeb/app/api/controller/v1/publics/ProcessController.php b/crmeb/app/api/controller/v1/publics/ProcessController.php index 1e051b9..ea09533 100644 --- a/crmeb/app/api/controller/v1/publics/ProcessController.php +++ b/crmeb/app/api/controller/v1/publics/ProcessController.php @@ -19,6 +19,7 @@ namespace app\api\controller\v1\publics; +use app\services\crud\ShareListServices; use think\facade\App; use app\services\crud\ProcessServices; @@ -57,6 +58,13 @@ class ProcessController return app('json')->success($this->service->getCrudListIndex($where)); } + public function share_list(ShareListServices $service) + { + $where = []; + return app('json')->success($service->getCrudListIndex($where)); + + } + } diff --git a/crmeb/app/api/route/v1.php b/crmeb/app/api/route/v1.php index ec8055c..2c021e5 100644 --- a/crmeb/app/api/route/v1.php +++ b/crmeb/app/api/route/v1.php @@ -75,6 +75,7 @@ Route::group(function () { Route::group(function () { //公司历程 Route::get('process/list', 'v1.publics.ProcessController/lst')->name('processList')->option(['real_name' => '公司历程列表']);//文章列表 + Route::get('share_list', 'v1.publics.ProcessController/share_list')->name('shareList')->option(['real_name' => '公司分享列表']);//文章列表 })->option(['parent' => 'activity_nologin', 'cate_name' => '公司历程']); diff --git a/crmeb/app/dao/crud/ShareListDao.php b/crmeb/app/dao/crud/ShareListDao.php new file mode 100644 index 0000000..97a5775 --- /dev/null +++ b/crmeb/app/dao/crud/ShareListDao.php @@ -0,0 +1,59 @@ + + * +---------------------------------------------------------------------- + */ + +/** + * 分享列表 + * @author crud自动生成代码 + * @date 2025/03/17 16:22:48 + */ + +namespace app\dao\crud; + + +use app\dao\BaseDao; +use app\model\crud\ShareList; + +/** + * Class ShareListDao + * @date 2025/03/17 + * @package app\dao\crud + */ +class ShareListDao extends BaseDao +{ + + /** + * 设置模型 + * @return string + * @date 2025/03/17 + */ + protected function setModel(): string + { + return ShareList::class; + } + /** + * 搜索 + * @param array $where + * @return \crmeb\basic\BaseModel + * @throws \ReflectionException + * @date {%DATE%} + */ + public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = []) + { + return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) { + $query->order($order); + })->when($with, function ($query) use ($with) { + $query->with($with); + }); + } + +} diff --git a/crmeb/app/model/crud/LeaveWord.php b/crmeb/app/model/crud/LeaveWord.php index bd761dd..f0d6538 100644 --- a/crmeb/app/model/crud/LeaveWord.php +++ b/crmeb/app/model/crud/LeaveWord.php @@ -30,6 +30,7 @@ use crmeb\basic\BaseModel; class LeaveWord extends BaseModel { + /** * 表名 * @var string @@ -41,5 +42,27 @@ class LeaveWord extends BaseModel * @var string */ protected $pk = 'id'; + protected $autoWriteTimestamp = 'int'; + + protected $createTime = 'create_time'; + + + protected function setCreateTimeAttr() + { + return time(); + } + + /** + * 添加时间获取器 + * @param $value + * @return false|string + */ + public function getCreateTimeAttr($value) + { + if (!empty($value)) { + return date('Y-m-d H:i:s', (int)$value); + } + return ''; + } } diff --git a/crmeb/app/model/crud/ShareList.php b/crmeb/app/model/crud/ShareList.php new file mode 100644 index 0000000..1021fc6 --- /dev/null +++ b/crmeb/app/model/crud/ShareList.php @@ -0,0 +1,45 @@ + + * +---------------------------------------------------------------------- + */ + +/** + * 分享列表 + * @author crud自动生成代码 + * @date 2025/03/17 16:22:48 + */ + +namespace app\model\crud; + + +use crmeb\basic\BaseModel; + +/** + * Class ShareList + * @date 2025/03/17 + * @package app\model\crud + */ +class ShareList extends BaseModel +{ + + /** + * 表名 + * @var string + */ + protected $name = 'share_list'; + + /** + * 主键 + * @var string + */ + protected $pk = 'id'; + +} diff --git a/crmeb/app/services/crud/LeaveWordServices.php b/crmeb/app/services/crud/LeaveWordServices.php index e5a5a63..1c55da3 100644 --- a/crmeb/app/services/crud/LeaveWordServices.php +++ b/crmeb/app/services/crud/LeaveWordServices.php @@ -51,7 +51,7 @@ class LeaveWordServices extends BaseServices { [$page, $limit] = $this->getPageValue(); $model = $this->dao->searchCrudModel($where, 'name,mobile,content,create_time,id', 'id desc', []); - +// var_dump(2222); return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()]; } diff --git a/crmeb/app/services/crud/ShareListServices.php b/crmeb/app/services/crud/ShareListServices.php new file mode 100644 index 0000000..ed8facf --- /dev/null +++ b/crmeb/app/services/crud/ShareListServices.php @@ -0,0 +1,111 @@ + + * +---------------------------------------------------------------------- + */ + +/** + * 分享列表 + * @author crud自动生成代码 + * @date 2025/03/17 16:22:48 + */ + +namespace app\services\crud; + +use app\services\BaseServices; +use think\exception\ValidateException; +use app\dao\crud\ShareListDao; +use crmeb\services\FormBuilder; + +/** + * Class CrudService + * @date 2025/03/17 + * @package app\services\crud + */ +class ShareListServices extends BaseServices +{ + + /** + * ShareListServices constructor. + * @param ShareListDao $dao + */ + public function __construct(ShareListDao $dao) + { + $this->dao = $dao; + } + + /** + * 主页数据接口 + * @param array $where + * @return array + * @date 2025/03/17 + */ + public function getCrudListIndex(array $where = []) + { + [$page, $limit] = $this->getPageValue(); + $model = $this->dao->searchCrudModel($where, 'name,link,img,img_two,sort,id', 'id desc', []); + + return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()]; + } + + /** + * 编辑和获取表单 + * @date 2025/03/17 + * @param int $id + * @return array + */ + public function getCrudForm(int $id = 0) + { + $url = '/crud/share_list'; + $info = []; + if ($id) { + $info = $this->dao->get($id); + if (!$info) { + throw new ValidateException(100026); + } + $url .= '/' . $id; + } + $rule = []; + + $rule[] = FormBuilder::input("name", "名称", $info["name"] ?? ''); + $rule[] = FormBuilder::input("link", "分享链接", $info["link"] ?? ''); + $rule[] = FormBuilder::frameImage('img', '图标', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'img']), $info['img'] ?? '')->icon('el-icon-picture-outline')->width('950px')->height('560px')->Props(['footer' => false]); + $rule[] = FormBuilder::frameImage('img_two', '蓝色图标', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'img_two']), $info['img_two'] ?? '')->icon('el-icon-picture-outline')->width('950px')->height('560px')->Props(['footer' => false]); + $rule[] = FormBuilder::number("sort", "排序", $info["sort"] ?? ''); + + return create_form('分享列表', $rule, $url, $id ? 'PUT' : 'POST'); + } + + /** + * 新增 + * @date 2025/03/17 + * @param array $data + * @return mixed + */ + public function crudSave(array $data) + { + return $this->dao->save($data); + } + + /** + * 修改 + * @date 2025/03/17 + * @param int $id + * @param array $data + * @return \crmeb\basic\BaseModel + */ + public function crudUpdate(int $id, array $data) + { + return $this->dao->update($id, $data); + } + + + +} diff --git a/crmeb/public/h5/README.md b/crmeb/public/h5/README.md index 508ce1d..314c295 100644 --- a/crmeb/public/h5/README.md +++ b/crmeb/public/h5/README.md @@ -1,3 +1,3 @@ # navigete-website-webhook -纳威格特官网前端打包h5(webhook) \ No newline at end of file +纳威格特官网前端打包h5(webhook)22222 \ No newline at end of file diff --git a/crmeb/public/index.html b/crmeb/public/index.html index c27e719..32d1160 100644 --- a/crmeb/public/index.html +++ b/crmeb/public/index.html @@ -1,2 +1,24 @@ -加载中
\ No newline at end of file + + + + + + 加载中 + + + + + +

1111111

+
+ +
+ +f + + \ No newline at end of file diff --git a/crmeb/route/route.php b/crmeb/route/route.php index 49ea79f..b334eb0 100644 --- a/crmeb/route/route.php +++ b/crmeb/route/route.php @@ -25,8 +25,19 @@ Route::miss(function () { return view(app()->getRootPath() . 'public' . DS . 'index.html'); default: if (!request()->isMobile()) { - if (is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('mdType')) { - return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html'); +// if (is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('mdType')) { +// return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html'); +// } else { +// if (request()->get('type')) { +// return view(app()->getRootPath() . 'public' . DS . 'index.html'); +// } else { +// return view(app()->getRootPath() . 'public' . DS . 'mobile.html', ['siteName' => sys_config('site_name'), 'siteUrl' => sys_config('site_url') . '/pages/index/index']); +// } +// } + + + if (is_dir(app()->getRootPath() . 'public' . DS . 'web') && !request()->get('mdType')) { + return view(app()->getRootPath() . 'public' . DS . 'web' . DS . 'index.html'); } else { if (request()->get('type')) { return view(app()->getRootPath() . 'public' . DS . 'index.html'); @@ -34,6 +45,8 @@ Route::miss(function () { return view(app()->getRootPath() . 'public' . DS . 'mobile.html', ['siteName' => sys_config('site_name'), 'siteUrl' => sys_config('site_url') . '/pages/index/index']); } } + + } else { return view(app()->getRootPath() . 'public' . DS . 'index.html'); } diff --git a/template/admin/src/api/crud/shareList.js b/template/admin/src/api/crud/shareList.js new file mode 100644 index 0000000..3c3cca4 --- /dev/null +++ b/template/admin/src/api/crud/shareList.js @@ -0,0 +1,112 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- + +import request from '@/libs/request'; + +/** + * 获取列表数据 + * @param params + * @return {*} + */ +export function getShareListListApi(params) { + return request({ + url: 'crud/share_list', + method: 'get', + params, + }); +} + +/** + * 获取添加表单数据 + * @return {*} + */ +export function getShareListCreateApi() { + return request({ + url: 'crud/share_list/create', + method: 'get', + }); +} + +/** + * 添加数据 + * @param data + * @return {*} + */ +export function shareListSaveApi(data) { + return request({ + url: 'crud/share_list', + method: 'post', + data + }); +} + +/** + * 获取编辑表单数据 + * @param id + * @return {*} + */ +export function getShareListEditApi(id) { + return request({ + url: `crud/share_list/${id}/edit`, + method: 'get' + }); +} + +/** + * 修改数据 + * @param id + * @return {*} + */ +export function shareListUpdateApi(id, data) { + return request({ + url: `crud/share_list/${id}`, + method: 'put', + data + }); +} + +/** + * 修改状态 + * @param id + * @return {*} + */ +export function shareListStatusApi(id, data) { + return request({ + url: `crud/share_list/status/${id}`, + method: 'put', + data + }); +} + +/** + * 删除数据 + * @param id + * @return {*} + */ +export function shareListDeleteApi(id) { + return request({ + url: `crud/share_list/${id}`, + method: 'delete' + }); +} + +/** + * 获取数据 + * @param id + * @return {*} + */ +export function getShareListReadApi(id) { + return request({ + url: `crud/share_list/${id}`, + method: 'get' + }); +} + + diff --git a/template/admin/src/pages/crud/shareList/index.vue b/template/admin/src/pages/crud/shareList/index.vue new file mode 100644 index 0000000..6b5659f --- /dev/null +++ b/template/admin/src/pages/crud/shareList/index.vue @@ -0,0 +1,180 @@ + + + + + diff --git a/template/admin/src/router/modules/crud/shareList.js b/template/admin/src/router/modules/crud/shareList.js new file mode 100644 index 0000000..9f731d8 --- /dev/null +++ b/template/admin/src/router/modules/crud/shareList.js @@ -0,0 +1,39 @@ +// +--------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +--------------------------------------------------------------------- +// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved. +// +--------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +--------------------------------------------------------------------- +// | Author: CRMEB Team +// +--------------------------------------------------------------------- + +import LayoutMain from '@/layout'; +import setting from '@/setting' + +let routePre = setting.routePre + +const meta = { + auth: true, +} + +const pre = 'share_list_' + +export default { + path: `${routePre}`, + name: 'crud_share_list', + header: '', + meta, + component: LayoutMain, + children: [ + { + path: 'crud/share_list', + name: `${pre}list`, + meta: { + auth: ['share_list-crud-list-index'], + title: '分享列表', + }, + component: () => import('@/pages/crud/shareList/index'), + }, + ], +}