Merge pull request #75 from zoujingli/master

合并master到v3
This commit is contained in:
邹景立 2018-03-15 22:52:03 +08:00 committed by GitHub
commit 337f11df16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 42 additions and 73 deletions

View File

@ -4,7 +4,7 @@
<!--{notempty name='title'}--> <!--{notempty name='title'}-->
<div class="layui-header notselect"> <div class="layui-header notselect">
<div class="pull-left"><span>{$title}</span></div> <div class="pull-left"><span>{$title}</span></div>
<div class="pull-right margin-right-15">{block name="button"}{/block}</div> <div class="pull-right margin-right-15 nowrap">{block name="button"}{/block}</div>
</div> </div>
<!--{/notempty}--> <!--{/notempty}-->
<div class="layui-card-body">{block name='content'}{/block}</div> <div class="layui-card-body">{block name='content'}{/block}</div>

View File

@ -46,9 +46,9 @@ class Block extends BasicAdmin
*/ */
public function index() public function index()
{ {
$this->title = '微信粉丝黑名单管理'; $this->title = '微信黑名单管理';
$get = $this->request->get(); $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']); (isset($get['sex']) && $get['sex'] !== '') && $db->where('sex', $get['sex']);
foreach (['nickname', 'country', 'province', 'city'] as $key) { foreach (['nickname', 'country', 'province', 'city'] as $key) {
(isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$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'] !== '') { if (isset($get['tag']) && $get['tag'] !== '') {
$db->where("concat(',',tagid_list,',') like :tag", ['tag' => "%,{$get['tag']},%"]); $db->where("concat(',',tagid_list,',') like :tag", ['tag' => "%,{$get['tag']},%"]);
} }
if (isset($get['date']) && $get['date'] !== '') { if (isset($get['create_at']) && $get['create_at'] !== '') {
list($start, $end) = explode(' - ', $get['date']); list($start, $end) = explode(' - ', $get['create_at']);
$db->whereBetween('subscribe_at', ["{$start} 00:00:00", "{$end} 23:59:59"]); $db->whereBetween('subscribe_at', ["{$start} 00:00:00", "{$end} 23:59:59"]);
} }
return parent::_list($db); return parent::_list($db->order('subscribe_time desc'));
} }
/** /**

View File

@ -44,14 +44,15 @@ class Config extends BasicAdmin
{ {
if ($this->request->isGet()) { if ($this->request->isGet()) {
$code = encode(url('@admin', '', true, true) . '#' . $this->request->url()); $code = encode(url('@admin', '', true, true) . '#' . $this->request->url());
return $this->fetch('', [ $assign = [
'title' => '微信接口配置', 'title' => '微信接口配置',
'appuri' => url("@wechat/api.push", '', true, true), 'appuri' => url("@wechat/api.push", '', true, true),
'appid' => $this->request->get('appid', sysconf('wechat_appid')), 'appid' => $this->request->get('appid', sysconf('wechat_appid')),
'appkey' => $this->request->get('appkey', sysconf('wechat_appkey')), '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(), 'wechat' => WechatService::instance('config')->getConfig(),
]); ];
return $this->fetch('', $assign);
} }
try { try {
sysconf('wechat_appid', $this->request->post('wechat_appid')); sysconf('wechat_appid', $this->request->post('wechat_appid'));

View File

@ -50,7 +50,7 @@ class Fans extends BasicAdmin
{ {
$this->title = '微信粉丝管理'; $this->title = '微信粉丝管理';
$get = $this->request->get(); $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']); (isset($get['sex']) && $get['sex'] !== '') && $db->where('sex', $get['sex']);
foreach (['nickname', 'country', 'province', 'city'] as $key) { foreach (['nickname', 'country', 'province', 'city'] as $key) {
(isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$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'] !== '') { if (isset($get['tag']) && $get['tag'] !== '') {
$db->where("concat(',',tagid_list,',') like :tag", ['tag' => "%,{$get['tag']},%"]); $db->where("concat(',',tagid_list,',') like :tag", ['tag' => "%,{$get['tag']},%"]);
} }
if (isset($get['date']) && $get['date'] !== '') { if (isset($get['create_at']) && $get['create_at'] !== '') {
list($start, $end) = explode(' - ', $get['date']); list($start, $end) = explode(' - ', $get['create_at']);
$db->whereBetween('subscribe_at', ["{$start} 00:00:00", "{$end} 23:59:59"]); $db->whereBetween('subscribe_at', ["{$start} 00:00:00", "{$end} 23:59:59"]);
} }
return parent::_list($db); return parent::_list($db->order('subscribe_time desc'));
} }
/** /**

View File

@ -84,19 +84,6 @@ class Keys extends BasicAdmin
return $this->_form($this->table, 'form'); 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 * @return string
@ -111,14 +98,6 @@ class Keys extends BasicAdmin
return $this->_form($this->table, 'form'); 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() public function subscribe()
{ {
$this->assign('title', '编辑默认回复'); $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() public function defaults()
{ {
$this->assign('title', '编辑无配置默认回复'); $this->assign('title', '编辑无配置默认回复');
return $this->_form($this->table, 'form'); $extend = ['keys' => 'default'];
return $this->_form($this->table, 'form', 'keys', $extend, $extend);
} }
/** /**
* 无配置默认回复表单处理 * 添加数据处理
* @param array $data * @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()) { if ($this->request->isPost() && isset($data['keys'])) {
$data = Db::name($this->table)->where(['keys' => 'default'])->find(); $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';
} }
/** /**

View File

@ -172,8 +172,9 @@ class News extends BasicAdmin
foreach ($data as &$vo) { foreach ($data as &$vo) {
$vo['create_by'] = session('user.id'); $vo['create_by'] = session('user.id');
$vo['create_at'] = date('Y-m-d H:i:s'); $vo['create_at'] = date('Y-m-d H:i:s');
$vo['content'] = htmlspecialchars_decode($vo['content']);
if (empty($vo['digest'])) { 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'])) { if (empty($vo['id'])) {
$result = $id = Db::name('WechatNewsArticle')->insertGetId($vo); $result = $id = Db::name('WechatNewsArticle')->insertGetId($vo);

View File

@ -35,7 +35,7 @@ class Review extends Controller
*/ */
public function index() public function index()
{ {
$content = str_replace("\n", "<br>", $this->request->get('content', '')); // 内容 $content = str_replace("\n", "<br>", $this->request->get('content', '', 'urldecode')); // 内容
$type = $this->request->get('type', 'text'); // 类型 $type = $this->request->get('type', 'text'); // 类型
// 图文处理 // 图文处理
if ($type === 'news' && is_numeric($content) && !empty($content)) { if ($type === 'news' && is_numeric($content) && !empty($content)) {

View File

@ -207,6 +207,7 @@ class Push
protected function sendMessage($type, $data) protected function sendMessage($type, $data)
{ {
$msgData = ['touser' => $this->openid, 'msgtype' => $type, "{$type}" => $data]; $msgData = ['touser' => $this->openid, 'msgtype' => $type, "{$type}" => $data];
p($msgData);
return WechatService::custom()->send($msgData); return WechatService::custom()->send($msgData);
} }

View File

@ -43,7 +43,6 @@ class MediaService
foreach ($articles as $article) { foreach ($articles as $article) {
if (intval($article['id']) === intval($article_id)) { if (intval($article['id']) === intval($article_id)) {
unset($article['create_by'], $article['create_at']); unset($article['create_by'], $article['create_at']);
$article['content'] = htmlspecialchars_decode($article['content']);
$data['articles'][] = $article; $data['articles'][] = $article;
} }
} }

View File

@ -7,7 +7,7 @@
<!--{/if}--> <!--{/if}-->
<!--{if auth('wechat/fans/sync')}--> <!--{if auth('wechat/fans/sync')}-->
<button data-load="{:url('wechat/fans/sync')}" class='layui-btn layui-btn-sm'>获取远程粉丝列表</button> <button data-load="{:url('wechat/fans/sync')}" class='layui-btn layui-btn-sm'>远程获取粉丝</button>
<!--{/if}--> <!--{/if}-->
{/block} {/block}
@ -79,7 +79,7 @@
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label"> </label> <label class="layui-form-label"> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input name="date" id='range-date' value="{$Think.get.date|default=''}" placeholder="关注时间" class="layui-input"> <input name="create_at" id='create_at' value="{$Think.get.create_at|default=''}" placeholder="关注时间" class="layui-input">
</div> </div>
</div> </div>
@ -151,7 +151,7 @@
{block name="script"} {block name="script"}
<!--表单初始化--> <!--表单初始化-->
<script> <script>
window.laydate.render({range: true, elem: '#range-date'}); window.laydate.render({range: true, elem: '#create_at'});
window.form.render(); window.form.render();
</script> </script>
<!--引入标签设置--> <!--引入标签设置-->

View File

@ -7,7 +7,7 @@
<div class="row"> <div class="row">
<div class="col-sm-2"></div> <div class="col-sm-2"></div>
<div class="col-sm-10 padding-bottom-20"> <div class="col-sm-10 padding-bottom-20">
<div class="pull-left padding-right-15"> <div class="pull-left padding-right-15 notselect">
<img data-tips-image src="{$wechat.qrcode_url|local_image}" style="width:160px;margin-left:-15px"> <img data-tips-image src="{$wechat.qrcode_url|local_image}" style="width:160px;margin-left:-15px">
</div> </div>
<div class="pull-left padding-15 padding-left-0"> <div class="pull-left padding-15 padding-left-0">

View File

@ -7,7 +7,7 @@
<!--{/if}--> <!--{/if}-->
<!--{if auth("$classuri/sync")}--> <!--{if auth("$classuri/sync")}-->
<button data-load="{:url('sync')}" class='layui-btn layui-btn-sm'>获取远程粉丝列表</button> <button data-load="{:url('sync')}" class='layui-btn layui-btn-sm'>远程获取粉丝</button>
<!--{/if}--> <!--{/if}-->
{/block} {/block}
@ -79,7 +79,7 @@
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label"> </label> <label class="layui-form-label"> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input name="date" id='range-date' value="{$Think.get.date|default=''}" placeholder="关注时间" class="layui-input"> <input name="create_at" id='create_at' value="{$Think.get.create_at|default=''}" placeholder="关注时间" class="layui-input">
</div> </div>
</div> </div>
@ -151,7 +151,7 @@
{block name="script"} {block name="script"}
<!--表单初始化--> <!--表单初始化-->
<script> <script>
window.laydate.render({range: true, elem: '#range-date'}); window.laydate.render({range: true, elem: '#create_at'});
window.form.render(); window.form.render();
</script> </script>

View File

@ -100,7 +100,7 @@
<div class="form-group" data-keys-type='text'> <div class="form-group" data-keys-type='text'>
<label class="col-md-2 control-label layui-form-label label-required">规则内容</label> <label class="col-md-2 control-label layui-form-label label-required">规则内容</label>
<div class="col-md-9"> <div class="col-md-9">
<textarea name="content" maxlength="10000" class="form-control">{$vo.content|default='说点什么吧'}</textarea> <textarea name="content" maxlength="10000" class="form-control">{$vo.content|default='说点什么吧'|raw}</textarea>
</div> </div>
</div> </div>
@ -153,7 +153,7 @@
<div class="form-group" data-keys-type='music'> <div class="form-group" data-keys-type='music'>
<label class="col-md-2 control-label layui-form-label">音乐描述</label> <label class="col-md-2 control-label layui-form-label">音乐描述</label>
<div class="col-md-9"> <div class="col-md-9">
<input name="music_desc" class="layui-input" value="{$vo.music_desc|default='音乐描述'}"> <input name="music_desc" class="layui-input" value="{$vo.music_desc|default='音乐描述'|raw}">
</div> </div>
</div> </div>
<div class="form-group" data-keys-type='music'> <div class="form-group" data-keys-type='music'>
@ -187,7 +187,7 @@
<div class="form-group" data-keys-type='video'> <div class="form-group" data-keys-type='video'>
<label class="col-md-2 control-label layui-form-label">视频描述</label> <label class="col-md-2 control-label layui-form-label">视频描述</label>
<div class="col-md-9"> <div class="col-md-9">
<textarea name="video_desc" maxlength="50" class="form-control">{$vo.video_desc|default='视频描述'}</textarea> <textarea name="video_desc" maxlength="50" class="form-control">{$vo.video_desc|default='视频描述'|raw}</textarea>
</div> </div>
</div> </div>

View File

@ -34,7 +34,7 @@
<div class="aui-chat-content bg-white"> <div class="aui-chat-content bg-white">
<div class="aui-chat-arrow one"></div> <div class="aui-chat-arrow one"></div>
<div class="aui-chat-arrow two"></div> <div class="aui-chat-arrow two"></div>
{$content|default=''} {$content|default=''|raw|htmlspecialchars_decode}
</div> </div>
{elseif $type eq 'image'} {elseif $type eq 'image'}
<div class="aui-chat-content bg-white"> <div class="aui-chat-content bg-white">

View File

@ -127,7 +127,8 @@ class BasicAdmin extends Controller
for ($i = 1; $i <= $maxNum; $i++) { for ($i = 1; $i <= $maxNum; $i++) {
list($query['rows'], $query['page']) = [$rows, $i]; list($query['rows'], $query['page']) = [$rows, $i];
$url = url('@admin') . '#' . $this->request->baseUrl() . '?' . http_build_query($query); $url = url('@admin') . '#' . $this->request->baseUrl() . '?' . http_build_query($query);
$pageHTML[] = "<option data-url='{$url}' " . ($i === $page->currentPage() ? 'selected' : '') . " value='{$i}'>{$i}</option>"; $selected = $i === intval($page->currentPage()) ? 'selected' : '';
$pageHTML[] = "<option data-url='{$url}' {$selected} value='{$i}'>{$i}</option>";
} }
list($pattern, $replacement) = [['|href="(.*?)"|', '|pagination|'], ['data-open="$1"', 'pagination pull-right']]; list($pattern, $replacement) = [['|href="(.*?)"|', '|pagination|'], ['data-open="$1"', 'pagination pull-right']];
$html = "<span class='pagination-trigger nowrap'>共 {$totalNum} 条记录,每页显示 <select data-auto-none>" . join('', $rowsHTML) . "</select> 条,共 " . ceil($totalNum / $rows) . " 页当前显示第 <select>" . join('', $pageHTML) . "</select> 页。</span>"; $html = "<span class='pagination-trigger nowrap'>共 {$totalNum} 条记录,每页显示 <select data-auto-none>" . join('', $rowsHTML) . "</select> 条,共 " . ceil($totalNum / $rows) . " 页当前显示第 <select>" . join('', $pageHTML) . "</select> 页。</span>";