作者 何书鹏
1 个管道 的构建 通过 耗费 7 秒

合并分支 'heshupeng' 到 'master'

后台删除入驻的商户



查看合并请求 !374
... ... @@ -299,4 +299,58 @@ class Store extends Backend
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = $this->model->where($pk, 'in', $ids)->select();
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
// 删除商家留言
Db::name('store_comment')->where('store_id',$v['id'])->delete();
Db::name('message')->where('object_id',$v['id'])->where('type',2)->delete();
// 删除社区有效期
Db::name('store_house')->where('store_id',$v['id'])->delete();
// 删除商家发布信息
$inform_list = Db::name('store_inform')->where('store_id',$v['id'])->select();
foreach($inform_list as $val){
// 删除商家发布信息点赞
Db::name('store_inform_good')->where('object_id',$val['id'])->delete();
// 删除红包领取记录
Db::name('store_inform_log')->where('inform_id',$val['id'])->delete();
// 删除商圈浏览量记录
Db::name('store_inform_view')->where('object_id',$val['id'])->delete();
Db::name('store_inform')->where('id',$val['id'])->delete();
}
// 删除开通新社区订单
Db::name('store_order')->where('store_id',$v['id'])->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}
... ...
... ... @@ -8,7 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
index_url: 'store/store/index' + location.search,
// add_url: 'store/store/add',
edit_url: 'store/store/edit',
// del_url: 'store/store/del',
del_url: 'store/store/del',
// multi_url: 'store/store/multi',
examine_url: 'store/store/examine',
inform_url: 'store/store_inform/index',
... ...