Meeting.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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.list 会议列表
  9. * @apiVersion 1.0.0
  10. * @apiName meeting.list
  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.content 正在进行的听课内容
  29. * @apiSuccess {String} focus.num_view 正在进行的阅读数
  30. * @apiSuccess {String} focus.cdate 时间
  31. *
  32. * @apiSuccess {Object[]} meeting 听课信息
  33. * @apiSuccess {Number} meeting.id 听课id
  34. * @apiSuccess {String} meeting.name 听课标题
  35. * @apiSuccess {String} meeting.content 听课内容
  36. * @apiSuccess {String} meeting.num_view 阅读数
  37. * @apiSuccess {String} meeting.cdate 时间
  38. *
  39. * @apiSuccessExample 操作成功
  40. * {"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}}
  41. *
  42. * @apiErrorExample 操作失败
  43. * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
  44. */
  45. public function list_api()
  46. {
  47. $time = time();
  48. $this->data['focus'] = Dever::load('content/meeting-getCur', array('option_info_id' => $this->data['info']['id'], 'option_start' => $time, 'option_end' => $time));
  49. $ids = array();
  50. if ($this->data['focus']) {
  51. foreach ($this->data['focus'] as $k => $v) {
  52. $this->data['focus'][$k] = $this->one($v);
  53. array_push($ids, $v['id']);
  54. }
  55. }
  56. $this->data['meeting'] = Dever::load('content/meeting-getAll', array('option_info_id' => $this->data['info']['id'], 'option_ids' => $ids));
  57. if ($this->data['meeting']) {
  58. foreach ($this->data['meeting'] as $k => $v) {
  59. $this->data['meeting'][$k] = $this->one($v);
  60. }
  61. }
  62. return $this->data;
  63. }
  64. /**
  65. * @api {get} v1/meeting.view 会议详情
  66. * @apiVersion 1.0.0
  67. * @apiName meeting.view
  68. * @apiGroup Data
  69. *
  70. * @apiDescription 小程序的会议详情接口
  71. *
  72. * @apiParam {Number} appid 小程序id
  73. * @apiParam {Number} id 会议id
  74. *
  75. * @apiSuccess {Object[]} info 小程序基本信息
  76. * @apiSuccess {Number} info.id 小程序id
  77. * @apiSuccess {String} info.name 小程序名称
  78. * @apiSuccess {Number} info.cate_id 小程序所属栏目id
  79. * @apiSuccess {String} info.logo 小程序logo
  80. * @apiSuccess {String} info.title 首页标题
  81. * @apiSuccess {String} info.pic 首页头图
  82. *
  83. * @apiSuccess {Object[]} meeting 听课信息
  84. * @apiSuccess {Number} meeting.id 听课id
  85. * @apiSuccess {String} meeting.name 听课标题
  86. * @apiSuccess {String} meeting.content 听课内容
  87. * @apiSuccess {String} meeting.num_view 阅读数
  88. * @apiSuccess {String} meeting.cdate 时间
  89. *
  90. * @apiSuccessExample 操作成功
  91. * {"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"}}}
  92. *
  93. * @apiErrorExample 操作失败
  94. * {"status":2,"code":1,"msg":"\u9519\u8bef\u7684\u5c0f\u7a0b\u5e8fid"}
  95. */
  96. public function view_api()
  97. {
  98. $id = Dever::input('id');
  99. if ($id > 0) {
  100. $news = Dever::load('content/meeting-one', $id);
  101. if ($news) {
  102. $this->data['meeting'] = $this->one($news);
  103. } else {
  104. Dever::alert('错误的会议id');
  105. }
  106. } else {
  107. Dever::alert('错误的会议id');
  108. }
  109. return $this->data;
  110. }
  111. }