Document.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\api\controller;
  3. /**
  4. *
  5. *
  6. * ----------------------------------------------------------------------------
  7. *
  8. * 平台协议控制器
  9. */
  10. class Document extends MobileMall
  11. {
  12. public function initialize()
  13. {
  14. parent::initialize();
  15. }
  16. /**
  17. * @api {POST} api/Document/agreement 用户协议
  18. * @apiVersion 1.0.0
  19. * @apiGroup Document
  20. *
  21. * @apiParam {String} type 协议类型 agreement 用户协议
  22. *
  23. * @apiSuccess {String} code 返回码,10000为成功
  24. * @apiSuccess {String} message 返回消息
  25. * @apiSuccess {Object} result 返回数据
  26. * @apiSuccess {Int} result.document_id 协议ID
  27. * @apiSuccess {Object} result.document_code 协议代码
  28. * @apiSuccess {Object} result.document_title 协议标题
  29. * @apiSuccess {Object} result.document_content 协议内容
  30. * @apiSuccess {Int} result.document_time 添加时间
  31. */
  32. public function agreement()
  33. {
  34. $type = input('param.type');
  35. if (!$type) {
  36. $type = 'agreement';
  37. }
  38. $doc = model('document')->getOneDocumentByCode($type);
  39. $doc['document_content'] = htmlspecialchars_decode($doc['document_content']);
  40. ds_json_encode(10000, '', $doc);
  41. }
  42. }