Commit 25b6b0e7 authored by 蔡闯's avatar 蔡闯

社区基本信息功能

parent ac5c4c71
...@@ -19,8 +19,14 @@ abstract class BaseController ...@@ -19,8 +19,14 @@ abstract class BaseController
"property" => '物业费', "property" => '物业费',
"electric" => '电费', "electric" => '电费',
"gas" => '燃气费', "gas" => '燃气费',
"parking" => '停车费' "park" => '停车费'
]; ];
protected $myUnit = [
'water' =>"吨",
'electric' =>'度',
'gas' =>'立方'
];
/** /**
* Request实例 * Request实例
* @var \think\Request * @var \think\Request
......
This diff is collapsed.
<?php
namespace app\api\controller;
use app\common\controller\Common;
use think\facade\Db;
use think\facade\Request;
class News extends Base{
//新闻分类
public function newsType() {
$villate_id = Request::param('village_id');
$new_type = Db::name('news_type')->where(['village_id'=>$villate_id])->order('sort_id','desc')->select()->toArray();
return $this->returnJson($new_type);
}
//分类下的新闻列表
public function newsList() {
$type_id = Request::param('type_id');
$page = Request::param('page',1);
$where['news_type_id'] = $type_id;
$data = Db::name('news')->where($where)->page($page,config('app.limit'))->order(['sort_id'=>'desc','create_time'=>'desc'])->field('news_id,title,content,create_time')->page($page,config('app.limit'))->select()->toArray();
foreach ($data as $k => $v) {
$data[$k]['content'] = mb_substr(strip_tags($v['content']),0,100);
}
$res['total'] = Db::name('news')->where($where)->count();
$res['data'] = Common::changeField($data);
return $this->returnJson($res);
}
//新闻详情
public function detailNews() {
$news_id = Request::param('news_id');
$data = Db::name('news')->where(['news_id'=>$news_id])->find();
if($data){
return $this->returnJson(Common::changeField($data));
} else {
return $this->returnJson();
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?php <?php
namespace app\api\controller; namespace app\api\controller;
use app\common\controller\Common; use app\common\controller\Common;
use think\facade\Db; use think\facade\Db;
use think\facade\Request; use think\facade\Request;
class Village extends Base class Village extends Base
{ {
//搜索小区
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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