123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <?php
- namespace Content\V1;
- use Dever;
- use Content\Lib\Base;
- class Meeting extends Base
- {
- /**
- * @api {get} v1/meeting.index 会议首页
- * @apiVersion 1.0.0
- * @apiName meeting.index
- * @apiGroup Data
- *
- * @apiDescription 小程序的会议首页接口
- *
- * @apiParam {Number} appid 小程序id
- *
- * @apiSuccess {Object[]} info 小程序基本信息
- * @apiSuccess {Number} info.id 小程序id
- * @apiSuccess {String} info.name 小程序名称
- * @apiSuccess {Number} info.cate_id 小程序所属栏目id
- * @apiSuccess {String} info.logo 小程序logo
- * @apiSuccess {String} info.title 首页标题
- * @apiSuccess {String} info.pic 首页头图
- *
- * @apiSuccess {Object[]} focus 正在进行的会议信息
- * @apiSuccess {Number} focus.id 正在进行的会议id
- * @apiSuccess {String} focus.name 正在进行的会议标题
- * @apiSuccess {String} focus.num 会议人数
- * @apiSuccess {String} focus.sdate 会议开始时间
- * @apiSuccess {String} focus.edate 会议结束时间
- * @apiSuccess {String} focus.img 会议轮播图
- * @apiSuccess {String} focus.content 正在进行的会议内容
- * @apiSuccess {String} focus.cdate 时间
- *
- * @apiSuccess {Object[]} cate 分类信息
- * @apiSuccess {Number} cate.id 分类id
- * @apiSuccess {String} cate.name 分类名称
- *
- * @apiSuccess {Object[]} cate.meeting 会议信息
- * @apiSuccess {Number} cate.meeting.id 会议id
- * @apiSuccess {String} cate.meeting.name 会议标题
- * @apiSuccess {String} cate.meeting.num 会议人数
- * @apiSuccess {String} cate.meeting.pic 会议封面
- * @apiSuccess {String} cate.meeting.sdate 会议开始时间
- * @apiSuccess {String} cate.meeting.edate 会议结束时间
- * @apiSuccess {String} cate.meeting.content 会议内容
- * @apiSuccess {String} cate.meeting.num_view 阅读数
- * @apiSuccess {String} cate.meeting.num_review 评论数
- * @apiSuccess {String} cate.meeting.num_up 赞数
- * @apiSuccess {String} cate.meeting.cdate 时间
- *
- * @apiSuccessExample 操作成功
- * {"status":1,"code":1,"msg":"success","data":{"info":{"id":"1","name":"\u7279\u8272\u5c0f\u9547\u600e\u4e48\u641e","cate_id":"1","logo":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg","title":"test","pic":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/da31b5d54d15192fea10406f77f4b0cb.jpg","state":"1","cdate":"1521858466"},"meeting":[{"id":"1","name":"\u6d4b\u8bd5","info_id":"1","desc":"\u98a0\u4e09\u5012\u56db","pic":["http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg"],"top":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg","sdate":"1521734400","edate":"1537804800","content":"","reorder":"1","state":"1","cdate":"4\u5206\u949f\u524d"}]},"page":{"total":"1","current_page":1,"total_page":1,"next_page":1,"prev_page":1,"html":"","status":0}}
- *
- * @apiErrorExample 操作失败
- * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
- */
- public function index_api()
- {
- $time = time();
- $this->data['focus'] = array();
- $wei = Dever::load('content/meeting-getWei', array('option_info_id' => $this->data['info']['id'], 'option_start' => $time));
- $cur = Dever::load('content/meeting-getCur', array('option_info_id' => $this->data['info']['id'], 'option_start' => $time, 'option_end' => $time));
- $ids = array();
- $i = 0;
- if ($wei) {
- foreach ($wei as $k => $v) {
- if ($v['img']) {
- $this->data['focus'][$i] = $this->one($v);
- array_push($ids, $v['id']);
- $i++;
- }
- }
- }
- if ($cur) {
- foreach ($cur as $k => $v) {
- if ($v['img']) {
- $this->data['focus'][$i] = $this->one($v);
- array_push($ids, $v['id']);
- $i++;
- }
- }
- }
- $this->data['cate'] = Dever::load('content/meeting_cate-getAll', array('option_info_id' => $this->data['info']['id']));
- if ($this->data['cate'] && isset($this->data['cate'][0])) {
- $news = Dever::load('content/meeting-getAll', array('option_info_id' => $this->data['info']['id'], 'option_cate_id' => $this->data['cate'][0]['id'], 'option_ids' => $ids));
- if ($news) {
- foreach ($news as $k => $v) {
- $this->data['cate'][0]['meeting'][$k] = $this->one($v);
- }
- }
- }
- return $this->data;
- }
- /**
- * @api {get} v1/meeting.list 会议列表
- * @apiVersion 1.0.0
- * @apiName meeting.list
- * @apiGroup Data
- *
- * @apiDescription 小程序的会议列表接口
- *
- * @apiParam {Number} appid 小程序id
- * @apiParam {Number} cateid 子栏目id
- *
- * @apiSuccess {Object[]} info 小程序基本信息
- * @apiSuccess {Number} info.id 小程序id
- * @apiSuccess {String} info.name 小程序名称
- * @apiSuccess {Number} info.cate_id 小程序所属栏目id
- * @apiSuccess {String} info.logo 小程序logo
- * @apiSuccess {String} info.title 首页标题
- * @apiSuccess {String} info.pic 首页头图
- *
- * @apiSuccess {Object[]} meeting 会议信息
- * @apiSuccess {Number} meeting.id 会议id
- * @apiSuccess {String} meeting.name 会议标题
- * @apiSuccess {String} meeting.num 会议人数
- * @apiSuccess {String} meeting.pic 会议封面
- * @apiSuccess {String} meeting.sdate 会议开始时间
- * @apiSuccess {String} meeting.edate 会议结束时间
- * @apiSuccess {String} meeting.content 会议内容
- * @apiSuccess {String} meeting.num_view 阅读数
- * @apiSuccess {String} meeting.num_review 评论数
- * @apiSuccess {String} meeting.num_up 赞数
- * @apiSuccess {String} meeting.cdate 时间
- *
- * @apiSuccessExample 操作成功
- * {"status":1,"code":1,"msg":"success","data":{"info":{"id":"1","name":"\u7279\u8272\u5c0f\u9547\u600e\u4e48\u641e","cate_id":"1","logo":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg","title":"test","pic":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/da31b5d54d15192fea10406f77f4b0cb.jpg","state":"1","cdate":"1521858466"},"news":[{"id":"1","name":"\u4e07\u8fbe\u57ce\u521b\u65b0\u4e1a\u6001\u7814\u7a76\u62a5\u544a","pic":["http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg"],"top":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/da31b5d54d15192fea10406f77f4b0cb.jpg","cate_id":"3","info_id":"1","author_id":"1","content":"<p>\u5730\u65b9\u5927\u5e45\u5ea6\u53d1<\/p>","num_view":"0","cdate":"9\u5c0f\u65f6\u524d","author":{"id":"1","name":"\u7a0b\u8302","pic":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg","state":"1","cdate":"1521858481"}}]},"page":{"total":"1","current_page":1,"total_page":1,"next_page":1,"prev_page":1,"html":"","status":0}}
- *
- * @apiErrorExample 操作失败
- * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
- */
- public function list_api()
- {
- $cateid = Dever::input('cateid');
- if ($cateid > 0) {
- $cate = Dever::load('content/meeting_cate-one', $cateid);
- $this->data['meeting'] = array();
- if ($cate) {
- $this->data['meeting'] = Dever::load('content/meeting-getOld', array('option_info_id' => $this->data['info']['id'], 'option_cate_id' => $cate['id'], 'option_end' => time()));
- //echo Dever::sql();die;
- if ($this->data['meeting']) {
- foreach ($this->data['meeting'] as $k => $v) {
- $this->data['meeting'][$k] = $this->one($v);
- }
- }
- }
- }
- return $this->data;
- }
- /**
- * @api {get} v1/meeting.view 会议详情
- * @apiVersion 1.0.0
- * @apiName meeting.view
- * @apiGroup Data
- *
- * @apiDescription 小程序的会议详情接口
- *
- * @apiParam {Number} appid 小程序id
- * @apiParam {Number} id 会议id
- *
- * @apiSuccess {Object[]} info 小程序基本信息
- * @apiSuccess {Number} info.id 小程序id
- * @apiSuccess {String} info.name 小程序名称
- * @apiSuccess {Number} info.cate_id 小程序所属栏目id
- * @apiSuccess {String} info.logo 小程序logo
- * @apiSuccess {String} info.title 首页标题
- * @apiSuccess {String} info.pic 首页头图
- *
- * @apiSuccess {Object[]} meeting 会议信息
- * @apiSuccess {Number} meeting.id 会议id
- * @apiSuccess {String} meeting.name 会议标题
- * @apiSuccess {String} meeting.num 会议人数
- * @apiSuccess {String} meeting.pic 会议封面
- * @apiSuccess {String} meeting.sdate 会议开始时间
- * @apiSuccess {String} meeting.edate 会议结束时间
- * @apiSuccess {String} meeting.content 会议内容
- * @apiSuccess {String} meeting.num_view 阅读数
- * @apiSuccess {String} meeting.num_review 评论数
- * @apiSuccess {String} meeting.num_up 赞数
- * @apiSuccess {String} meeting.cdate 时间
- *
- * @apiSuccessExample 操作成功
- * {"status":1,"code":1,"msg":"success","data":{"info":{"id":"1","name":"\u7279\u8272\u5c0f\u9547\u600e\u4e48\u641e","cate_id":"1","logo":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg","title":"test","pic":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/da31b5d54d15192fea10406f77f4b0cb.jpg","state":"1","cdate":"1521858466"},"meeting":{"id":"1","name":"\u6d4b\u8bd5","info_id":"1","desc":"\u98a0\u4e09\u5012\u56db","pic":["http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg"],"top":"http:\/\/192.168.33.10\/plant\/data\/upload\/1\/2018\/03\/24\/1e493a87d4cdddde7fd06ad9762694d2.jpg","sdate":"1521734400","edate":"1537804800","content":"","reorder":"1","state":"1","cdate":"4\u5206\u949f\u524d"}}}
- *
- * @apiErrorExample 操作失败
- * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
- */
- public function view_api()
- {
- $id = Dever::input('id');
- if ($id > 0) {
- $this->data['meeting'] = Dever::load('content/meeting-one', $id);
- if ($this->data['meeting']) {
- $this->data['meeting'] = $this->one($this->data['meeting']);
- # 增加阅读量
- Dever::load('content/meeting-addView', $id);
- } else {
- Dever::alert('错误的会议id');
- }
- } else {
- Dever::alert('错误的会议id');
- }
- $this->data['vote'] = $this->vote(3, $id);
- return $this->data;
- }
- }
|