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

删除小区bug修改

... ... @@ -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'));
}
}
... ...
... ... @@ -86,11 +86,11 @@ class House extends Api
->where('id',$user_id)
->field('id,house_id')
->find();
if(empty($data['house_id'])){
$info['is_binding'] = 2;
}else{
$house = Db::name('house')->where('id',$data['house_id'])->field('name')->find();
$info['is_binding'] = 2;
if(!empty($data['house_id']) && !empty($house)){
$info['is_binding'] = 1;
$info['house_name'] = Db::name('house')->where('id',$data['house_id'])->value('name');
$info['house_name'] = $house['name'];
//查询该社区的社区公告
$house_board = Db::name('house_board')
... ... @@ -536,7 +536,7 @@ class House extends Api
"remark" => ['请尽快处理!','#FF0000'],
);
$url = $this->request->root(true).'/admininfo.php/index/login';
(new \app\index\controller\Ajax)->wxsendmessage('otlkQ0l4L3wsmz8dhDIbHJQVJnI8',$send_data,config('option.template')['examine'],$url);
(new \app\index\controller\Ajax)->wxsendmessage(config('option.examine_openid'),$send_data,config('option.template')['examine'],$url);
$this->success('成功');
}
}else{
... ...
... ... @@ -71,15 +71,14 @@ class HouseBoard extends Api
{
$user_id = $this->auth->id;
$data = Db::name('user')->where('id',$user_id)->field('id,house_id')->find();
if(empty($data['house_id'])){
$info['is_binding'] = 2;
}else{
$info['is_binding'] = 1;
/*小区信息*/
$house = Db::name('house')
/*小区信息*/
$house = Db::name('house')
->where('id',$data['house_id'])
->field('id,image,name,thumbnail,bindnum')
->find();
$info['is_binding'] = 2;
if(!empty($data['house_id']) && !empty($house)){
$info['is_binding'] = 1;
// 消息红点
$message = Db::name('message')
->where('object_id',$data['house_id'])
... ...