mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改微信图文模块
This commit is contained in:
parent
5ce6ce4239
commit
d4f48eea8f
@ -118,6 +118,40 @@ class News extends BasicAdmin {
|
|||||||
return join(',', $ids);
|
return join(',', $ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图文推送
|
||||||
|
*/
|
||||||
|
public function push() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除图文
|
||||||
|
*/
|
||||||
|
public function del() {
|
||||||
|
$id = $this->request->post('id', '');
|
||||||
|
empty($id) && $this->error('参数错误,请重新操作删除!');
|
||||||
|
$info = Db::name('WechatNews')->where('id', $id)->find();
|
||||||
|
empty($info) && $this->error('删除的记录不存在,请重新操作删除!');
|
||||||
|
if (isset($info['article_id'])) {
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
Db::name('WechatNewsArticle')->where('id', 'in', explode(',', $info['article_id']))->delete();
|
||||||
|
Db::name('WechatNews')->where('id', $id)->delete();
|
||||||
|
Db::commit();
|
||||||
|
$isSuccess = true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
}
|
||||||
|
(isset($isSuccess) && $isSuccess) && $this->success('图文删除成功!');
|
||||||
|
}
|
||||||
|
$this->error('图文删除失败,请重新再试!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图文选择器
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function select() {
|
public function select() {
|
||||||
return '开发中';
|
return '开发中';
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div class='news_tools hide'>
|
<div class='news_tools hide'>
|
||||||
<a href='javascript:alert("开发中...")'>推送</a>
|
<a href='javascript:alert("开发中...")'>推送</a>
|
||||||
<a data-open='{:url("edit")}?id={$vo.id}' href='javascript:void(0)'>编辑</a>
|
<a data-open='{:url("edit")}?id={$vo.id}' href='javascript:void(0)'>编辑</a>
|
||||||
<a href='javascript:alert("开发中...")'>删除</a>
|
<a data-news-del="{$vo.id}" href='javascript:void(0)'>删除</a>
|
||||||
</div>
|
</div>
|
||||||
{foreach $vo.articles as $k => $v}
|
{foreach $vo.articles as $k => $v}
|
||||||
{if $k < 1}
|
{if $k < 1}
|
||||||
@ -47,10 +47,23 @@
|
|||||||
$(this).find('.news_tools').addClass('hide');
|
$(this).find('.news_tools').addClass('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['jquery.masonry'], function (Masonry, tpl) {
|
require(['jquery.masonry'], function (Masonry) {
|
||||||
var container = document.querySelector('#news_box');
|
var container = document.querySelector('#news_box');
|
||||||
var msnry = new Masonry(container, {itemSelector: '.news_item', columnWidth: 0});
|
var msnry = new Masonry(container, {itemSelector: '.news_item', columnWidth: 0});
|
||||||
msnry.layout();
|
msnry.layout();
|
||||||
|
$('body').on('click', '[data-news-del]', function () {
|
||||||
|
var self = this;
|
||||||
|
$.msg.confirm('确定要删除图文吗?', function () {
|
||||||
|
$.form.load('{:url("del")}', {id: self.getAttribute('data-news-del')}, 'post', function (ret) {
|
||||||
|
if (ret.code) {
|
||||||
|
$(self).parents('.news_item').remove();
|
||||||
|
msnry.layout();
|
||||||
|
return $.msg.success(ret.msg), false;
|
||||||
|
}
|
||||||
|
return $.msg.error(ret.msg), false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user