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 @@ +