...
|
...
|
@@ -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'));
|
|
|
}
|
|
|
} |
...
|
...
|
|