mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改微信图文为软删除
This commit is contained in:
parent
132498c7cf
commit
86a48de9e2
@ -44,7 +44,7 @@ class News extends BasicAdmin {
|
|||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$this->assign('title', '图文列表');
|
$this->assign('title', '图文列表');
|
||||||
$db = Db::name($this->table)->order('id desc');
|
$db = Db::name($this->table)->where('is_deleted', '0')->order('id desc');
|
||||||
parent::_list($db);
|
parent::_list($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,26 +124,13 @@ class News extends BasicAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除图文
|
* 删除用户
|
||||||
*/
|
*/
|
||||||
public function del() {
|
public function del() {
|
||||||
$id = $this->request->post('id', '');
|
if (DataService::update($this->table)) {
|
||||||
empty($id) && $this->error('参数错误,请重新操作删除!');
|
$this->success("图文删除成功!", '');
|
||||||
$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('图文删除失败,请重新再试!');
|
$this->error("图文删除失败, 请稍候再试!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,11 +54,10 @@
|
|||||||
$('body').on('click', '[data-news-del]', function () {
|
$('body').on('click', '[data-news-del]', function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
$.msg.confirm('确定要删除图文吗?', function () {
|
$.msg.confirm('确定要删除图文吗?', function () {
|
||||||
$.form.load('{:url("del")}', {id: self.getAttribute('data-news-del')}, 'post', function (ret) {
|
$.form.load('{:url("del")}', {field: 'delete', value: 0, id: self.getAttribute('data-news-del')}, 'post', function (ret) {
|
||||||
if (ret.code) {
|
if (ret.code) {
|
||||||
$(self).parents('.news_item').remove();
|
$(self).parents('.news_item').remove();
|
||||||
msnry.layout();
|
return $.msg.success(ret.msg), msnry.layout(), false;
|
||||||
return $.msg.success(ret.msg), false;
|
|
||||||
}
|
}
|
||||||
return $.msg.error(ret.msg), false;
|
return $.msg.error(ret.msg), false;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user