From ce9f0e72488d87e0dc47afe1a7a35246005ba9cb Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Wed, 18 Dec 2024 18:47:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Buiattach.php | 92 ++++++ .../admin/controller/manystore/Index.php | 57 +++- .../controller/school/MessageConfigItem.php | 77 +++++ .../admin/controller/school/classes/Cate.php | 3 + application/admin/lang/zh-cn/buiattach.php | 41 +++ .../lang/zh-cn/school/message_config.php | 2 +- .../lang/zh-cn/school/message_config_item.php | 28 ++ .../admin/model/school/MessageConfigItem.php | 91 ++++++ .../validate/school/MessageConfigItem.php | 27 ++ .../admin/view/buiattach/category.html | 30 ++ application/admin/view/buiattach/index.html | 77 +++++ .../admin/view/manystore/index/add.html | 12 +- .../admin/view/manystore/index/edit.html | 12 +- .../admin/view/school/message_config/add.html | 142 +++++----- .../view/school/message_config/edit.html | 154 +++++----- .../view/school/message_config_item/add.html | 127 +++++++++ .../view/school/message_config_item/edit.html | 127 +++++++++ .../school/message_config_item/index.html | 29 ++ .../message_config_item/recyclebin.html | 25 ++ application/api/controller/Common.php | 18 +- .../api/controller/school/worker/Base.php | 7 +- .../api/controller/school/worker/Common.php | 212 ++++++++++++++ application/common/library/Upload.php | 14 +- application/manystore/controller/Ajax.php | 4 + .../controller/general/Attachment.php | 41 +++ .../lang/zh-cn/general/attachment.php | 10 + application/manystore/model/ManystoreLog.php | 9 +- .../view/general/attachment/index.html | 28 +- .../view/general/attachment/select.html | 23 +- .../manystore/view/general/profile/index.html | 12 +- extend/bw/Common.php | 7 +- public/assets/js/backend/buiattach.js | 267 ++++++++++++++++++ .../assets/js/backend/general/attachment.js | 8 +- public/assets/js/backend/manystore/index.js | 18 +- .../js/backend/school/message_config.js | 39 ++- .../js/backend/school/message_config_item.js | 127 +++++++++ .../assets/js/manystore/general/attachment.js | 65 +++++ 37 files changed, 1856 insertions(+), 206 deletions(-) create mode 100644 application/admin/controller/Buiattach.php create mode 100644 application/admin/controller/school/MessageConfigItem.php create mode 100644 application/admin/lang/zh-cn/buiattach.php create mode 100644 application/admin/lang/zh-cn/school/message_config_item.php create mode 100644 application/admin/model/school/MessageConfigItem.php create mode 100644 application/admin/validate/school/MessageConfigItem.php create mode 100644 application/admin/view/buiattach/category.html create mode 100644 application/admin/view/buiattach/index.html create mode 100644 application/admin/view/school/message_config_item/add.html create mode 100644 application/admin/view/school/message_config_item/edit.html create mode 100644 application/admin/view/school/message_config_item/index.html create mode 100644 application/admin/view/school/message_config_item/recyclebin.html create mode 100644 application/api/controller/school/worker/Common.php create mode 100644 public/assets/js/backend/buiattach.js create mode 100644 public/assets/js/backend/school/message_config_item.js diff --git a/application/admin/controller/Buiattach.php b/application/admin/controller/Buiattach.php new file mode 100644 index 0000000..eeaeeb1 --- /dev/null +++ b/application/admin/controller/Buiattach.php @@ -0,0 +1,92 @@ +url()); + $this->model = model('Attachment'); + $this->view->assign("mimetypeList", \app\common\model\Attachment::getMimetypeList()); + $this->view->assign("categoryList", \app\common\model\Attachment::getCategoryList()); + $this->assignconfig("categoryList", \app\common\model\Attachment::getCategoryList()); + $module_url = isset($module_url[1]) ? $module_url[1] : $request->module(); + $this->view->assign("domain", sprintf("%s/%s", $request->domain(),$module_url)); + } + + /** + * 查看 + */ + public function index(){ + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + $multiple = $this->request->request('multiple',0); + + if ($this->request->isAjax()) { + $mimetypeQuery = []; + $filter = $this->request->request('filter'); + $filterArr = (array)json_decode($filter, true); + if (isset($filterArr['category']) && $filterArr['category'] == 'unclassed') { + $filterArr['category'] = ',unclassed'; + $this->request->get(['filter' => json_encode(array_diff_key($filterArr, ['category' => '']))]); + } + if (isset($filterArr['mimetype']) && preg_match("/[]\,|\*]/", $filterArr['mimetype'])) { + $mimetype = $filterArr['mimetype']; + $filterArr = array_diff_key($filterArr, ['mimetype' => '']); + $mimetypeQuery = function ($query) use ($mimetype) { + $mimetypeArr = explode(',', $mimetype); + foreach ($mimetypeArr as $index => $item) { + if (stripos($item, "/*") !== false) { + $query->whereOr('mimetype', 'like', str_replace("/*", "/", $item) . '%'); + } else { + $query->whereOr('mimetype', 'like', '%' . $item . '%'); + } + } + }; + } + $this->request->get(['filter' => json_encode($filterArr)]); + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $list = $this->model->where('mimetype', 'like','image/%') + ->where($where) + ->whereRaw("`filename` NOT REGEXP '^[0-9A-Fa-f]{32}'") + ->order($sort, $order) + ->paginate($limit); + $cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root()); + foreach ($list as $k => &$v) { + $v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url']; + } + unset($v); + $result = array("total" => $list->total(), "rows" => $list->items(),"multiple"=>$multiple); + return json($result); + } + $this->view->assign("multiple",$multiple); + return $this->view->fetch(); + } + + /** + * 分类 + */ + public function category(){ + $getCategoryList = \app\common\model\Attachment::getCategoryList(); + unset($getCategoryList['unclassed']); + $this->view->assign("categoryListJson", json_encode($getCategoryList,JSON_UNESCAPED_UNICODE )); + return $this->view->fetch(); + } +} diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index dd893a7..ee985dd 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -137,13 +137,67 @@ class Index extends Backend return $this->selectpage(); } - list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["check_full"]); + + if (isset($excludearray['check_full']['value']) && $excludearray['check_full']['value']) { + $check_full = $excludearray['check_full']['value']; + + + switch ($check_full) { + case 'true': //查完善 + $expireWhere = [ + function ($query) { + $query->where(function ($query){ + $query->where("shop.address_city","<>", '') + ->where("shop.province","<>", '') + ->where("shop.city","<>", '') + ->where("shop.district","<>", '') + ->where("shop.longitude","<>", '') + ->where("shop.latitude","<>", '') + ->where("shop.name","<>", '') + ->where("shop.image","<>", '') + ->where("shop.images","<>", '') + ->where("shop.content","<>", '') + ->where("shop.tel","<>", '') + ->where("shop.logo","<>", ''); + }); + } + ]; + break; + case 'false': //查未完善 + $expireWhere = [ + function ($query) { + $query->where(function ($query){ + $query->where("shop.address_city", '') + ->whereOr("shop.province", '') + ->whereOr("shop.city", '') + ->whereOr("shop.district", '') + ->whereOr("shop.longitude", '') + ->whereOr("shop.latitude", '') + ->whereOr("shop.name", '') + ->whereOr("shop.image", '') + ->whereOr("shop.images", '') + ->whereOr("shop.content", '') + ->whereOr("shop.tel", '') + ->whereOr("shop.logo", ''); + }); + + } + ]; + break; + default: + } + + } else { + $expireWhere = [[]]; + } $total = $this->model ->with(['shop',"user"]) ->where($where) + ->where(...$expireWhere) ->where(array('is_main'=>1)) ->order($sort, $order) ->count(); @@ -151,6 +205,7 @@ class Index extends Backend $list = $this->model ->with(['shop',"user"]) ->where($where) + ->where(...$expireWhere) ->where(array('is_main'=>1)) // ->field(['password', 'salt', 'token'], true) ->order($sort, $order) diff --git a/application/admin/controller/school/MessageConfigItem.php b/application/admin/controller/school/MessageConfigItem.php new file mode 100644 index 0000000..24d08a4 --- /dev/null +++ b/application/admin/controller/school/MessageConfigItem.php @@ -0,0 +1,77 @@ +model = new \app\admin\model\school\MessageConfigItem; + parent::_initialize(); + + $this->view->assign("wechatWapList", $this->model->getWechatWapList()); + $this->view->assign("messageList", $this->model->getMessageList()); + $this->view->assign("selfmailList", $this->model->getSelfmailList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['config']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('config')->visible(['name','logo_image']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/school/classes/Cate.php b/application/admin/controller/school/classes/Cate.php index 276882f..0ad97f4 100644 --- a/application/admin/controller/school/classes/Cate.php +++ b/application/admin/controller/school/classes/Cate.php @@ -25,6 +25,9 @@ class Cate extends Backend $this->model = new \app\admin\model\school\classes\Cate; $this->view->assign("statusList", $this->model->getStatusList()); $this->view->assign("hotList", $this->model->getHotList()); + + +// var_dump(request()->post("category"));die; } diff --git a/application/admin/lang/zh-cn/buiattach.php b/application/admin/lang/zh-cn/buiattach.php new file mode 100644 index 0000000..1dc6cae --- /dev/null +++ b/application/admin/lang/zh-cn/buiattach.php @@ -0,0 +1,41 @@ + 'ID', + 'Admin_id' => '管理员ID', + 'User_id' => '会员ID', + 'Url' => '物理路径', + 'Imagewidth' => '宽度', + 'Imageheight' => '高度', + 'Imagetype' => '图片类型', + 'Imageframes' => '图片帧数', + 'Preview' => '预览', + 'Filename' => '文件名', + 'Filesize' => '文件大小', + 'Mimetype' => 'Mime类型', + 'Image' => '图片', + 'Audio' => '音频', + 'Video' => '视频', + 'Text' => '文档', + 'Application' => '应用', + 'Zip' => '压缩包', + 'Extparam' => '透传数据', + 'Createtime' => '创建日期', + 'Uploadtime' => '上传时间', + 'Storage' => '存储引擎', + 'Category1' => '分类一', + 'Category2' => '分类二', + 'Custom' => '自定义', + 'Unclassed' => '未归类', + 'Category' => '类别', + 'Classify' => '归类', + 'Filter Type' => '类型筛选', + 'Upload to third' => '上传到第三方', + 'Upload to local' => '上传到本地', + 'Upload to third by chunk' => '上传到第三方(分片模式)', + 'Upload to local by chunk' => '上传到本地(分片模式)', + 'Please enter a new name' => '请输入新的类别名称', + 'Please select category' => '请选择一个类别', + 'Category not found' => '指定的类别未找到', + 'Upload from editor' => '从编辑器上传' +]; diff --git a/application/admin/lang/zh-cn/school/message_config.php b/application/admin/lang/zh-cn/school/message_config.php index 2a0460b..da2a3ee 100644 --- a/application/admin/lang/zh-cn/school/message_config.php +++ b/application/admin/lang/zh-cn/school/message_config.php @@ -2,7 +2,7 @@ return [ 'Name' => '事件名', - 'Event' => '事件标识', + 'Event' => '事件标识(英文+下划线)', 'Logo_image' => '事件消息logo', 'Status' => '事件类型', 'Status 1' => '系统推送', diff --git a/application/admin/lang/zh-cn/school/message_config_item.php b/application/admin/lang/zh-cn/school/message_config_item.php new file mode 100644 index 0000000..2607b8f --- /dev/null +++ b/application/admin/lang/zh-cn/school/message_config_item.php @@ -0,0 +1,28 @@ + '事件标识(英文+下划线)', + 'Event_two' => '消息标识(英文+下划线)', + 'Name' => '消息备注', + 'Wechat_wap' => '微信公众号消息', + 'Wechat_wap 1' => '开启', + 'Wechat_wap 2' => '关闭', + 'Message' => '短信消息', + 'Message 1' => '开启', + 'Message 2' => '关闭', + 'Selfmail' => '站内行消息', + 'Selfmail 1' => '开启', + 'Selfmail 2' => '关闭', + 'Message_id' => '短信模板id', + 'Wechat_wap_id' => '公众号模板消息id', + 'Selfmail_title' => '站内信标题', + 'Selfmail_template_text' => '站内信模板', + 'Configjson' => '可用的模板字段变量', + 'Thirdjson' => '额外第三方参数', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Updatetime' => '修改时间', + 'Deletetime' => '删除时间', + 'Config.name' => '事件名', + 'Config.logo_image' => '事件消息logo' +]; diff --git a/application/admin/model/school/MessageConfigItem.php b/application/admin/model/school/MessageConfigItem.php new file mode 100644 index 0000000..3169d4f --- /dev/null +++ b/application/admin/model/school/MessageConfigItem.php @@ -0,0 +1,91 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getWechatWapList() + { + return ['1' => __('Wechat_wap 1'), '2' => __('Wechat_wap 2')]; + } + + public function getMessageList() + { + return ['1' => __('Message 1'), '2' => __('Message 2')]; + } + + public function getSelfmailList() + { + return ['1' => __('Selfmail 1'), '2' => __('Selfmail 2')]; + } + + + public function getWechatWapTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['wechat_wap']) ? $data['wechat_wap'] : ''); + $list = $this->getWechatWapList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getMessageTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['message']) ? $data['message'] : ''); + $list = $this->getMessageList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getSelfmailTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['selfmail']) ? $data['selfmail'] : ''); + $list = $this->getSelfmailList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + + + public function config() + { + return $this->belongsTo('app\admin\model\school\message\Config', 'event', 'event', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/school/MessageConfigItem.php b/application/admin/validate/school/MessageConfigItem.php new file mode 100644 index 0000000..b1f2de2 --- /dev/null +++ b/application/admin/validate/school/MessageConfigItem.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/buiattach/category.html b/application/admin/view/buiattach/category.html new file mode 100644 index 0000000..ffa60bc --- /dev/null +++ b/application/admin/view/buiattach/category.html @@ -0,0 +1,30 @@ +
+
+
+
+
+ {:token()} +
+
+
+
分类名分类值
+
+ 追加 +
+ +
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ diff --git a/application/admin/view/buiattach/index.html b/application/admin/view/buiattach/index.html new file mode 100644 index 0000000..7af2cf3 --- /dev/null +++ b/application/admin/view/buiattach/index.html @@ -0,0 +1,77 @@ + +
+
+
+
+
+
+ 全部 + {foreach name="categoryList" id="item"} + {$item} + {/foreach} +
+
+ +
+
+ + + + + + + + +
+ + +
+
+ + +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/application/admin/view/manystore/index/add.html b/application/admin/view/manystore/index/add.html index 05322a0..e60261d 100644 --- a/application/admin/view/manystore/index/add.html +++ b/application/admin/view/manystore/index/add.html @@ -183,8 +183,8 @@
- - + +
@@ -197,8 +197,8 @@
- - + +
@@ -233,8 +233,8 @@
- - + +
diff --git a/application/admin/view/manystore/index/edit.html b/application/admin/view/manystore/index/edit.html index 591ea78..21d0724 100644 --- a/application/admin/view/manystore/index/edit.html +++ b/application/admin/view/manystore/index/edit.html @@ -199,8 +199,8 @@
- - + +
@@ -213,8 +213,8 @@
- - + +
@@ -250,8 +250,8 @@
- - + +
diff --git a/application/admin/view/school/message_config/add.html b/application/admin/view/school/message_config/add.html index cb6a21a..a58c63e 100644 --- a/application/admin/view/school/message_config/add.html +++ b/application/admin/view/school/message_config/add.html @@ -38,82 +38,82 @@ -
- -
- - + + + + + + + + + -
-
-
- -
- - + + + + + + + + + + + -
-
-
- -
- - + + + + + + + + + + + -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- {:__('Key')} - {:__('Value')} -
-
{:__('Append')}
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
-
+ +
diff --git a/application/admin/view/school/message_config/edit.html b/application/admin/view/school/message_config/edit.html index 4b257ed..847a12e 100644 --- a/application/admin/view/school/message_config/edit.html +++ b/application/admin/view/school/message_config/edit.html @@ -38,88 +38,88 @@
-
- -
- - + + + + + + + + + -
-
-
- -
- - + + + + + + + + + + + -
-
-
- -
- - + + + + + + + + + + + -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- {:__('Key')} - {:__('Value')} -
-
{:__('Append')}
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
-
-
- -
- -
-
+ + + + + + + +