Commit 437491c4 authored by 蔡闯's avatar 蔡闯

社区联系电话

parent 1986339e
...@@ -134,7 +134,7 @@ class Index extends Base ...@@ -134,7 +134,7 @@ class Index extends Base
$village_id = Request::param('village_id'); $village_id = Request::param('village_id');
$where['village_id'] = $village_id; $where['village_id'] = $village_id;
$where['status'] = 1; $where['status'] = 1;
$data = Db::name('village_phone')->where($where)->order(['is_on_call_phone'=>'desc','sort'=>'desc'])->select()->toArray(); $data = Db::name('village_phone')->where($where)->order(['is_on_call_phone'=>'desc','sort_id'=>'desc'])->select()->toArray();
return $this->returnJson($data); return $this->returnJson($data);
} }
......
...@@ -203,6 +203,60 @@ class Village extends Base ...@@ -203,6 +203,60 @@ class Village extends Base
} }
//社区联系电话列表
public function villagePhone() {
$where['village_id'] = $this->village_id;
$page = Request::param('page',1);
$data = Db::name('village_phone')->where($where)->order('sort_id','desc')->page($page,config('app.limit'))->select()->toArray();
return $this->returnJson($data);
}
//添加或修改社区联系电话
public function changeVillagePhone() {
$village_phone_id = Request::param('village_phone_id');
$save['village_id'] = $this->village_id;
$save['name'] = Request::param('name');;
$save['phone'] =Request::param('phone');
$save['sort_id'] = Request::param('sort_id',0);
$save['status'] = Request::param('status',1);
$save['is_on_call_phone'] = Request::param('is_on_call_phone',0);
if($village_phone_id) {
$where['village_phone_id'] = (int)$village_phone_id;
$operation = Db::name('village_phone')->where($where)->save($save);
$msg = "添加失败";
} else {
$operation = Db::name('village_phone')->insert($save);
$msg = "修改失败";
}
if($operation !== false) {
return $this->returnJson();
} else{
return $this->returnJson([],$msg,400);
}
}
//删除社区联系电话
public function deleteVillagePhone() {
$where['village_phone_id'] = Request::param('village_phone_id');
$where['village_id'] = $this->village_id;
$delete = Db::name('village_phone')->where($where)->delete();
if($delete !=false) {
return $this->returnJson();
} else{
return $this->returnJson([],'删除失败',400);
}
}
......
...@@ -31,6 +31,8 @@ return [ ...@@ -31,6 +31,8 @@ return [
'show_error_msg' => false, 'show_error_msg' => false,
//以下都是自定义配置
//接口数据分页 //接口数据分页
'limit' => 15, 'limit' => 15,
...@@ -74,4 +76,6 @@ return [ ...@@ -74,4 +76,6 @@ return [
]; ];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment