WeChatMaterialController.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace App\Http\Controllers\Manage\OfficialAccount;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use App\Modules\Promotion\Services\PromotionService;
  6. use App\Http\Controllers\Channel\Promotion\Transformers\DocumentCoversTransformer;
  7. use App\Http\Controllers\Channel\Promotion\Transformers\HeadlinelTransformer;
  8. use App\Modules\OfficialAccount\Services\WechatTemplateService;
  9. use App\Http\Controllers\Channel\OfficialAccount\Transformers\WechatPublicTemplatesTransformer;
  10. class WeChatMaterialController extends Controller
  11. {
  12. /**
  13. * @apiDefine WeChatMaterial 公众号素材
  14. */
  15. /**
  16. * @apiVersion 1.0.0
  17. * @api {GET} OfficialAccount/getAllDocumentCovers 获取所有图库素材
  18. * @apiGroup WeChatMaterial
  19. * @apiName getAllDocumentCovers
  20. * @apiSuccessExample {json} Success-Response:
  21. *
  22. * {
  23. * "code": 0,
  24. * "msg": "",
  25. * "data": [
  26. * {
  27. * "id": 1,
  28. * "origin_cover": "https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/document_covers\/1.jpg"
  29. * },
  30. * {
  31. * "id": 2,
  32. * "origin_cover": "https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/document_covers\/2.jpg"
  33. * },
  34. * {
  35. * "id": 3,
  36. * "origin_cover": "https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/document_covers\/3.jpg"
  37. * }
  38. * ]
  39. * }
  40. */
  41. function getAllDocumentCovers(Request $request) {
  42. $promotionService = PromotionService::getAllMessageDocumentCovers();
  43. if(!empty($promotionService)) {
  44. return response()->collection(new DocumentCoversTransformer(), $promotionService);
  45. }else{
  46. return response()->success(['data'=>0]);
  47. }
  48. }
  49. /**
  50. * @apiVersion 1.0.0
  51. * @api {GET} OfficialAccount/getAllHeadlinesNoType 获取所有标签文案
  52. * @apiGroup WeChatMaterial
  53. * @apiName getAllHeadlinesNoType
  54. * @apiSuccessExample {json} Success-Response:
  55. *
  56. * {
  57. * "code": 0,
  58. * "msg": "",
  59. * "data": [
  60. * {
  61. * "id": 1,
  62. * "title": "三姐妹怀孕,孩子的父亲竟是同一人,婆婆竟然这样说..."
  63. * },
  64. * {
  65. * "id": 2,
  66. * "title": "看哭5000万人,一对32岁夫妻离婚后的聊天记录..."
  67. * }
  68. * ]
  69. * }
  70. */
  71. function getAllHeadlinesNoType(Request $request) {
  72. $promotionService = PromotionService::getHeadlines();
  73. if(!empty($promotionService)) {
  74. return response()->collection(new HeadlinelTransformer(), $promotionService);
  75. }else{
  76. return response()->success(['data'=>0]);
  77. }
  78. }
  79. function wechatPublicTemplateList(Request $request)
  80. {
  81. $wechatPublicTemplatesService = WechatTemplateService::wechatPublicTemplateList();
  82. return response()->collection(new WechatPublicTemplatesTransformer(), $wechatPublicTemplatesService);
  83. }
  84. }