diff --git a/application/admin/view/public/content.html b/application/admin/view/public/content.html index 26b5227f6..ba530561d 100644 --- a/application/admin/view/public/content.html +++ b/application/admin/view/public/content.html @@ -4,7 +4,7 @@
{$title}
-
{block name="button"}{/block}
+
{block name="button"}{/block}
{block name='content'}{/block}
diff --git a/application/wechat/controller/Block.php b/application/wechat/controller/Block.php index 5eae5a96f..333622c8f 100644 --- a/application/wechat/controller/Block.php +++ b/application/wechat/controller/Block.php @@ -46,9 +46,9 @@ class Block extends BasicAdmin */ public function index() { - $this->title = '微信粉丝黑名单管理'; + $this->title = '微信黑名单管理'; $get = $this->request->get(); - $db = Db::name($this->table)->where(['is_black' => '1'])->order('subscribe_time desc'); + $db = Db::name($this->table)->where(['is_black' => '1']); (isset($get['sex']) && $get['sex'] !== '') && $db->where('sex', $get['sex']); foreach (['nickname', 'country', 'province', 'city'] as $key) { (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%"); @@ -56,11 +56,11 @@ class Block extends BasicAdmin if (isset($get['tag']) && $get['tag'] !== '') { $db->where("concat(',',tagid_list,',') like :tag", ['tag' => "%,{$get['tag']},%"]); } - if (isset($get['date']) && $get['date'] !== '') { - list($start, $end) = explode(' - ', $get['date']); + if (isset($get['create_at']) && $get['create_at'] !== '') { + list($start, $end) = explode(' - ', $get['create_at']); $db->whereBetween('subscribe_at', ["{$start} 00:00:00", "{$end} 23:59:59"]); } - return parent::_list($db); + return parent::_list($db->order('subscribe_time desc')); } /** diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index a2598292b..caacc43ee 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -44,14 +44,15 @@ class Config extends BasicAdmin { if ($this->request->isGet()) { $code = encode(url('@admin', '', true, true) . '#' . $this->request->url()); - return $this->fetch('', [ + $assign = [ 'title' => '微信接口配置', 'appuri' => url("@wechat/api.push", '', true, true), 'appid' => $this->request->get('appid', sysconf('wechat_appid')), 'appkey' => $this->request->get('appkey', sysconf('wechat_appkey')), - 'authurl' => config('wechat.service_url') . "/wechat/api.push/auth/redirect/{$code}.html", + 'authurl' => "http://wm.cuci.cc/wechat/api.push/auth/{$code}.html", 'wechat' => WechatService::instance('config')->getConfig(), - ]); + ]; + return $this->fetch('', $assign); } try { sysconf('wechat_appid', $this->request->post('wechat_appid')); diff --git a/application/wechat/controller/Fans.php b/application/wechat/controller/Fans.php index cc25ac55f..fb1d51775 100644 --- a/application/wechat/controller/Fans.php +++ b/application/wechat/controller/Fans.php @@ -50,7 +50,7 @@ class Fans extends BasicAdmin { $this->title = '微信粉丝管理'; $get = $this->request->get(); - $db = Db::name($this->table)->where(['is_black' => '0'])->order('subscribe_time desc'); + $db = Db::name($this->table)->where(['is_black' => '0']); (isset($get['sex']) && $get['sex'] !== '') && $db->where('sex', $get['sex']); foreach (['nickname', 'country', 'province', 'city'] as $key) { (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%"); @@ -58,11 +58,11 @@ class Fans extends BasicAdmin if (isset($get['tag']) && $get['tag'] !== '') { $db->where("concat(',',tagid_list,',') like :tag", ['tag' => "%,{$get['tag']},%"]); } - if (isset($get['date']) && $get['date'] !== '') { - list($start, $end) = explode(' - ', $get['date']); + if (isset($get['create_at']) && $get['create_at'] !== '') { + list($start, $end) = explode(' - ', $get['create_at']); $db->whereBetween('subscribe_at', ["{$start} 00:00:00", "{$end} 23:59:59"]); } - return parent::_list($db); + return parent::_list($db->order('subscribe_time desc')); } /** diff --git a/application/wechat/controller/Keys.php b/application/wechat/controller/Keys.php index e546f04e6..a1b5a7d9d 100644 --- a/application/wechat/controller/Keys.php +++ b/application/wechat/controller/Keys.php @@ -84,19 +84,6 @@ class Keys extends BasicAdmin return $this->_form($this->table, 'form'); } - /** - * 添加数据处理 - * @param array $data - */ - protected function _add_form_filter(array $data) - { - if ($this->request->isPost() && isset($data['keys'])) { - $db = Db::name($this->table)->where('keys', $data['keys']); - !empty($data['id']) && $db->where('id', 'neq', $data['id']); - $db->count() > 0 && $this->error('关键字已经存在,请使用其它关键字!'); - } - } - /** * 编辑关键字 * @return string @@ -111,14 +98,6 @@ class Keys extends BasicAdmin return $this->_form($this->table, 'form'); } - /** - * 编辑数据处理 - * @param array $data - */ - protected function _edit_form_filter(array $data) - { - $this->_add_form_filter($data); - } /** * 删除关键字 @@ -170,23 +149,10 @@ class Keys extends BasicAdmin public function subscribe() { $this->assign('title', '编辑默认回复'); - return $this->_form($this->table, 'form'); + $extend = ['keys' => 'subscribe']; + return $this->_form($this->table, 'form', 'keys', $extend, $extend); } - /** - * 关注默认回复表单处理 - * @param array $data - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException - */ - protected function _subscribe_form_filter(&$data) - { - if ($this->request->isGet()) { - $data = Db::name($this->table)->where(['keys' => 'subscribe'])->find(); - } - $data['keys'] = 'subscribe'; - } /** * 无配置默认回复 @@ -199,22 +165,22 @@ class Keys extends BasicAdmin public function defaults() { $this->assign('title', '编辑无配置默认回复'); - return $this->_form($this->table, 'form'); + $extend = ['keys' => 'default']; + return $this->_form($this->table, 'form', 'keys', $extend, $extend); } /** - * 无配置默认回复表单处理 + * 添加数据处理 * @param array $data - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException */ - protected function _defaults_form_filter(&$data) + protected function _form_filter(array &$data) { - if ($this->request->isGet()) { - $data = Db::name($this->table)->where(['keys' => 'default'])->find(); + if ($this->request->isPost() && isset($data['keys'])) { + $db = Db::name($this->table)->where('keys', $data['keys']); + !empty($data['id']) && $db->where('id', 'neq', $data['id']); + $data['content'] = htmlspecialchars_decode($data['content']); + $db->count() > 0 && $this->error('关键字已经存在,请使用其它关键字!'); } - $data['keys'] = 'default'; } /** diff --git a/application/wechat/controller/News.php b/application/wechat/controller/News.php index 74bb21803..48766ad3e 100644 --- a/application/wechat/controller/News.php +++ b/application/wechat/controller/News.php @@ -172,8 +172,9 @@ class News extends BasicAdmin foreach ($data as &$vo) { $vo['create_by'] = session('user.id'); $vo['create_at'] = date('Y-m-d H:i:s'); + $vo['content'] = htmlspecialchars_decode($vo['content']); if (empty($vo['digest'])) { - $vo['digest'] = mb_substr(strip_tags(str_replace(["\s", ' '], '', htmlspecialchars_decode($vo['content']))), 0, 120); + $vo['digest'] = mb_substr(strip_tags(str_replace(["\s", ' '], '', $vo['content'])), 0, 120); } if (empty($vo['id'])) { $result = $id = Db::name('WechatNewsArticle')->insertGetId($vo); diff --git a/application/wechat/controller/Review.php b/application/wechat/controller/Review.php index 5ea6bd62c..c656e4021 100644 --- a/application/wechat/controller/Review.php +++ b/application/wechat/controller/Review.php @@ -35,7 +35,7 @@ class Review extends Controller */ public function index() { - $content = str_replace("\n", "
", $this->request->get('content', '')); // 内容 + $content = str_replace("\n", "
", $this->request->get('content', '', 'urldecode')); // 内容 $type = $this->request->get('type', 'text'); // 类型 // 图文处理 if ($type === 'news' && is_numeric($content) && !empty($content)) { diff --git a/application/wechat/controller/api/Push.php b/application/wechat/controller/api/Push.php index 9e9ea9c4a..c1a847b49 100644 --- a/application/wechat/controller/api/Push.php +++ b/application/wechat/controller/api/Push.php @@ -207,6 +207,7 @@ class Push protected function sendMessage($type, $data) { $msgData = ['touser' => $this->openid, 'msgtype' => $type, "{$type}" => $data]; + p($msgData); return WechatService::custom()->send($msgData); } diff --git a/application/wechat/service/MediaService.php b/application/wechat/service/MediaService.php index 342c0dbf7..888f9caec 100644 --- a/application/wechat/service/MediaService.php +++ b/application/wechat/service/MediaService.php @@ -43,7 +43,6 @@ class MediaService foreach ($articles as $article) { if (intval($article['id']) === intval($article_id)) { unset($article['create_by'], $article['create_at']); - $article['content'] = htmlspecialchars_decode($article['content']); $data['articles'][] = $article; } } diff --git a/application/wechat/view/block/index.html b/application/wechat/view/block/index.html index 77e7daa21..f79abcfc8 100644 --- a/application/wechat/view/block/index.html +++ b/application/wechat/view/block/index.html @@ -7,7 +7,7 @@ - + {/block} @@ -79,7 +79,7 @@
- +
@@ -151,7 +151,7 @@ {block name="script"} diff --git a/application/wechat/view/config/index.html b/application/wechat/view/config/index.html index dc1eed6ef..dec8ee245 100644 --- a/application/wechat/view/config/index.html +++ b/application/wechat/view/config/index.html @@ -7,7 +7,7 @@
-
+
diff --git a/application/wechat/view/fans/index.html b/application/wechat/view/fans/index.html index 433638048..c3cffc4dc 100644 --- a/application/wechat/view/fans/index.html +++ b/application/wechat/view/fans/index.html @@ -7,7 +7,7 @@ - + {/block} @@ -79,7 +79,7 @@
- +
@@ -151,7 +151,7 @@ {block name="script"} diff --git a/application/wechat/view/keys/form.html b/application/wechat/view/keys/form.html index f585d4ab3..cf6d79adf 100644 --- a/application/wechat/view/keys/form.html +++ b/application/wechat/view/keys/form.html @@ -100,7 +100,7 @@
- +
@@ -153,7 +153,7 @@
- +
@@ -187,7 +187,7 @@
- +
diff --git a/application/wechat/view/review/index.html b/application/wechat/view/review/index.html index 073164fd8..5d75c7136 100644 --- a/application/wechat/view/review/index.html +++ b/application/wechat/view/review/index.html @@ -34,7 +34,7 @@
- {$content|default=''} + {$content|default=''|raw|htmlspecialchars_decode}
{elseif $type eq 'image'}
diff --git a/extend/controller/BasicAdmin.php b/extend/controller/BasicAdmin.php index d05c5be06..8b9d8d454 100644 --- a/extend/controller/BasicAdmin.php +++ b/extend/controller/BasicAdmin.php @@ -127,7 +127,8 @@ class BasicAdmin extends Controller for ($i = 1; $i <= $maxNum; $i++) { list($query['rows'], $query['page']) = [$rows, $i]; $url = url('@admin') . '#' . $this->request->baseUrl() . '?' . http_build_query($query); - $pageHTML[] = ""; + $selected = $i === intval($page->currentPage()) ? 'selected' : ''; + $pageHTML[] = ""; } list($pattern, $replacement) = [['|href="(.*?)"|', '|pagination|'], ['data-open="$1"', 'pagination pull-right']]; $html = "共 {$totalNum} 条记录,每页显示 条,共 " . ceil($totalNum / $rows) . " 页当前显示第 页。";