123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\model\BuildingModel;
- use app\common\model\BusinessModel;
- use think\Db;
- /**
- * 智慧党建
- */
- class Building extends Api
- {
- protected $noNeedLogin = ['lists', 'banner', 'listInfo', 'qustion', 'qustionInfo', 'buildInfo', 'protable', 'protableInfo', 'NoticeInfo', 'GgInfo'];
- protected $noNeedRight = ['*'];
- /**
- * 智慧党建轮播图
- */
- public function banner()
- {
- $data = Db::name('building_banner')
- ->where('switch',1)
- ->order('sort desc')
- ->select();
- if ($data) {
- foreach ($data as &$v) {
- $v['image'] = config('site.httpurl') . $v['image'];
- }
- return $this->success('', $data);
- } else {
- return $this->success('暂无数据');
- }
- }
- /**
- * 党建资讯列表
- * @param string $page 页数
- * @param string $limit 条数
- */
- public function lists()
- {
- $page = $this->request->get('page');
- $limit = $this->request->get('limit');
- if (!$page) {
- $pages = '0,10';
- } else {
- $page = $page - 1;
- if ($page < 0) $page = 0;
- $pages = $page . ',' . $limit;
- }
- $buildingModel = new BuildingModel();
- $data = $buildingModel->where('switch', 1)
- ->order('sort desc')
- ->limit($pages)
- ->select();
- return $this->success('', $data);
- }
- /**
- * 党建资讯详情
- * @param string $id id
- *
- */
- public function listInfo()
- {
- $id = $this->request->get('id');
- if (!isset($id) || empty($id)) return $this->error('缺少参数');
- $buildingModel = new BuildingModel();
- $data = $buildingModel->where('switch', 1)
- ->where('id', $id)
- ->order('sort desc')
- ->find();
- return $this->success('', $data);
- }
- /**
- * 党组织介绍
- */
- public function buildInfo()
- {
- $data = Db::name('building_info')
- ->where('id',1)
- ->find();
- if ($data) {
- $data['content'] = str_replace('src="','src="'.config('site.httpurl'),$data['content']);
- return $this->success('', $data);
- } else {
- return $this->success('暂无数据');
- }
- }
- /**
- * 党建常见问题
- * @param string $page 页数
- * @param string $limit 条数
- */
- public function qustion()
- {
- $page = $this->request->get('page');
- $limit = $this->request->get('limit');
- if (!$page) {
- $pages = '0,10';
- } else {
- $page = $page - 1;
- if ($page < 0) $page = 0;
- $pages = $page . ',' . $limit;
- }
- $data = Db::name('building_qustion')->where('switch', 1)
- ->order('sort desc')
- ->limit($pages)
- ->select();
- if ($data) {
- foreach ($data as &$v) {
- $v['content'] = str_replace('src="','src="'.config('site.httpurl'),$v['content']);
- }
- return $this->success('', $data);
- } else {
- return $this->success('暂无数据');
- }
- }
- /**
- * 常见问题详情
- * @param string $id id
- *
- */
- public function qustionInfo()
- {
- $id = $this->request->get('id');
- if (!isset($id) || empty($id)) return $this->error('缺少参数');
- $data = Db::name('building_qustion')->where('switch', 1)
- ->where('id', $id)
- ->order('sort desc')
- ->find();
- if ($data) {
- $data['content'] = str_replace('src="','src="'.config('site.httpurl'),$data['content']);
- return $this->success('', $data);
- } else {
- return $this->success('暂无数据');
- }
- }
- }
|