...
|
...
|
@@ -341,4 +341,50 @@ class House extends Backend |
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
*/
|
|
|
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('user_house')->where('house_id',$v['id'])->delete();
|
|
|
// 删除社区管理员
|
|
|
Db::name('house_admin')->where('house_id',$v['id'])->delete();
|
|
|
// 删除社区电话
|
|
|
Db::name('house_phone')->where('house_id',$v['id'])->delete();
|
|
|
// 删除社区留言
|
|
|
Db::name('house_comment')->where('house_id',$v['id'])->delete();
|
|
|
Db::name('message')->where('object_id',$v['id'])->where('type',3)->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'));
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|