Meeting.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <?php
  2. namespace Content\V1;
  3. use Dever;
  4. use Content\Lib\Base;
  5. class Meeting extends Base
  6. {
  7. /**
  8. * @api {get} v1/meeting.index 会议首页
  9. * @apiVersion 1.0.0
  10. * @apiName meeting.index
  11. * @apiGroup Data
  12. *
  13. * @apiDescription 小程序的会议首页接口
  14. *
  15. * @apiParam {Number} appid 小程序id
  16. *
  17. * @apiSuccess {Object[]} info 小程序基本信息
  18. * @apiSuccess {Number} info.id 小程序id
  19. * @apiSuccess {String} info.name 小程序名称
  20. * @apiSuccess {Number} info.cate_id 小程序所属栏目id
  21. * @apiSuccess {String} info.logo 小程序logo
  22. * @apiSuccess {String} info.title 首页标题
  23. * @apiSuccess {String} info.pic 首页头图
  24. *
  25. * @apiSuccess {Object[]} focus 正在进行的会议信息
  26. * @apiSuccess {Number} focus.id 正在进行的会议id
  27. * @apiSuccess {String} focus.name 正在进行的会议标题
  28. * @apiSuccess {String} focus.num 会议人数
  29. * @apiSuccess {String} focus.sdate 会议开始时间
  30. * @apiSuccess {String} focus.edate 会议结束时间
  31. * @apiSuccess {String} focus.img 会议轮播图
  32. * @apiSuccess {String} focus.content 正在进行的会议内容
  33. * @apiSuccess {String} focus.cdate 时间
  34. *
  35. * @apiSuccess {Object[]} cate 分类信息
  36. * @apiSuccess {Number} cate.id 分类id
  37. * @apiSuccess {String} cate.name 分类名称
  38. *
  39. * @apiSuccess {Object[]} cate.meeting 会议信息
  40. * @apiSuccess {Number} cate.meeting.id 会议id
  41. * @apiSuccess {String} cate.meeting.name 会议标题
  42. * @apiSuccess {String} cate.meeting.num 会议人数
  43. * @apiSuccess {String} cate.meeting.pic 会议封面
  44. * @apiSuccess {String} cate.meeting.sdate 会议开始时间
  45. * @apiSuccess {String} cate.meeting.edate 会议结束时间
  46. * @apiSuccess {String} cate.meeting.content 会议内容
  47. * @apiSuccess {String} cate.meeting.num_view 阅读数
  48. * @apiSuccess {String} cate.meeting.num_review 评论数
  49. * @apiSuccess {String} cate.meeting.num_up 赞数
  50. * @apiSuccess {String} cate.meeting.cdate 时间
  51. *
  52. * @apiSuccessExample 操作成功
  53. * {"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}}
  54. *
  55. * @apiErrorExample 操作失败
  56. * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
  57. */
  58. public function index_api()
  59. {
  60. $time = time();
  61. $this->data['focus'] = array();
  62. $wei = Dever::load('content/meeting-getWei', array('option_info_id' => $this->data['info']['id'], 'option_start' => $time));
  63. $cur = Dever::load('content/meeting-getCur', array('option_info_id' => $this->data['info']['id'], 'option_start' => $time, 'option_end' => $time));
  64. $ids = array();
  65. $i = 0;
  66. if ($wei) {
  67. foreach ($wei as $k => $v) {
  68. if ($v['img']) {
  69. $this->data['focus'][$i] = $this->one($v);
  70. array_push($ids, $v['id']);
  71. $i++;
  72. }
  73. }
  74. }
  75. if ($cur) {
  76. foreach ($cur as $k => $v) {
  77. if ($v['img']) {
  78. $this->data['focus'][$i] = $this->one($v);
  79. array_push($ids, $v['id']);
  80. $i++;
  81. }
  82. }
  83. }
  84. $this->data['cate'] = Dever::load('content/meeting_cate-getAll', array('option_info_id' => $this->data['info']['id']));
  85. if ($this->data['cate'] && isset($this->data['cate'][0])) {
  86. $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));
  87. if ($news) {
  88. foreach ($news as $k => $v) {
  89. $this->data['cate'][0]['meeting'][$k] = $this->one($v);
  90. }
  91. }
  92. }
  93. return $this->data;
  94. }
  95. /**
  96. * @api {get} v1/meeting.list 会议列表
  97. * @apiVersion 1.0.0
  98. * @apiName meeting.list
  99. * @apiGroup Data
  100. *
  101. * @apiDescription 小程序的会议列表接口
  102. *
  103. * @apiParam {Number} appid 小程序id
  104. * @apiParam {Number} cateid 子栏目id
  105. *
  106. * @apiSuccess {Object[]} info 小程序基本信息
  107. * @apiSuccess {Number} info.id 小程序id
  108. * @apiSuccess {String} info.name 小程序名称
  109. * @apiSuccess {Number} info.cate_id 小程序所属栏目id
  110. * @apiSuccess {String} info.logo 小程序logo
  111. * @apiSuccess {String} info.title 首页标题
  112. * @apiSuccess {String} info.pic 首页头图
  113. *
  114. * @apiSuccess {Object[]} meeting 会议信息
  115. * @apiSuccess {Number} meeting.id 会议id
  116. * @apiSuccess {String} meeting.name 会议标题
  117. * @apiSuccess {String} meeting.num 会议人数
  118. * @apiSuccess {String} meeting.pic 会议封面
  119. * @apiSuccess {String} meeting.sdate 会议开始时间
  120. * @apiSuccess {String} meeting.edate 会议结束时间
  121. * @apiSuccess {String} meeting.content 会议内容
  122. * @apiSuccess {String} meeting.num_view 阅读数
  123. * @apiSuccess {String} meeting.num_review 评论数
  124. * @apiSuccess {String} meeting.num_up 赞数
  125. * @apiSuccess {String} meeting.cdate 时间
  126. *
  127. * @apiSuccessExample 操作成功
  128. * {"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}}
  129. *
  130. * @apiErrorExample 操作失败
  131. * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
  132. */
  133. public function list_api()
  134. {
  135. $cateid = Dever::input('cateid');
  136. if ($cateid > 0) {
  137. $cate = Dever::load('content/meeting_cate-one', $cateid);
  138. $this->data['meeting'] = array();
  139. if ($cate) {
  140. $this->data['meeting'] = Dever::load('content/meeting-getOld', array('option_info_id' => $this->data['info']['id'], 'option_cate_id' => $cate['id'], 'option_end' => time()));
  141. //echo Dever::sql();die;
  142. if ($this->data['meeting']) {
  143. foreach ($this->data['meeting'] as $k => $v) {
  144. $this->data['meeting'][$k] = $this->one($v);
  145. }
  146. }
  147. }
  148. }
  149. return $this->data;
  150. }
  151. /**
  152. * @api {get} v1/meeting.view 会议详情
  153. * @apiVersion 1.0.0
  154. * @apiName meeting.view
  155. * @apiGroup Data
  156. *
  157. * @apiDescription 小程序的会议详情接口
  158. *
  159. * @apiParam {Number} appid 小程序id
  160. * @apiParam {Number} id 会议id
  161. *
  162. * @apiSuccess {Object[]} info 小程序基本信息
  163. * @apiSuccess {Number} info.id 小程序id
  164. * @apiSuccess {String} info.name 小程序名称
  165. * @apiSuccess {Number} info.cate_id 小程序所属栏目id
  166. * @apiSuccess {String} info.logo 小程序logo
  167. * @apiSuccess {String} info.title 首页标题
  168. * @apiSuccess {String} info.pic 首页头图
  169. *
  170. * @apiSuccess {Object[]} meeting 会议信息
  171. * @apiSuccess {Number} meeting.id 会议id
  172. * @apiSuccess {String} meeting.name 会议标题
  173. * @apiSuccess {String} meeting.num 会议人数
  174. * @apiSuccess {String} meeting.pic 会议封面
  175. * @apiSuccess {String} meeting.sdate 会议开始时间
  176. * @apiSuccess {String} meeting.edate 会议结束时间
  177. * @apiSuccess {String} meeting.content 会议内容
  178. * @apiSuccess {String} meeting.num_view 阅读数
  179. * @apiSuccess {String} meeting.num_review 评论数
  180. * @apiSuccess {String} meeting.num_up 赞数
  181. * @apiSuccess {String} meeting.cdate 时间
  182. *
  183. * @apiSuccessExample 操作成功
  184. * {"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"}}}
  185. *
  186. * @apiErrorExample 操作失败
  187. * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
  188. */
  189. public function view_api()
  190. {
  191. $id = Dever::input('id');
  192. if ($id > 0) {
  193. $this->data['meeting'] = Dever::load('content/meeting-one', $id);
  194. if ($this->data['meeting']) {
  195. $this->data['meeting'] = $this->one($this->data['meeting']);
  196. # 增加阅读量
  197. Dever::load('content/meeting-addView', $id);
  198. } else {
  199. Dever::alert('错误的会议id');
  200. }
  201. } else {
  202. Dever::alert('错误的会议id');
  203. }
  204. $this->data['vote'] = $this->vote(3, $id);
  205. return $this->data;
  206. }
  207. }