<?php namespace App\Http\Controllers\Manage\OfficialAccount; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Modules\Promotion\Services\PromotionService; use App\Http\Controllers\Channel\Promotion\Transformers\DocumentCoversTransformer; use App\Http\Controllers\Channel\Promotion\Transformers\HeadlinelTransformer; use App\Modules\OfficialAccount\Services\WechatTemplateService; use App\Http\Controllers\Channel\OfficialAccount\Transformers\WechatPublicTemplatesTransformer; class WeChatMaterialController extends Controller { /** * @apiDefine WeChatMaterial 公众号素材 */ /** * @apiVersion 1.0.0 * @api {GET} OfficialAccount/getAllDocumentCovers 获取所有图库素材 * @apiGroup WeChatMaterial * @apiName getAllDocumentCovers * @apiSuccessExample {json} Success-Response: * * { * "code": 0, * "msg": "", * "data": [ * { * "id": 1, * "origin_cover": "https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/document_covers\/1.jpg" * }, * { * "id": 2, * "origin_cover": "https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/document_covers\/2.jpg" * }, * { * "id": 3, * "origin_cover": "https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/document_covers\/3.jpg" * } * ] * } */ function getAllDocumentCovers(Request $request) { $promotionService = PromotionService::getAllMessageDocumentCovers(); if(!empty($promotionService)) { return response()->collection(new DocumentCoversTransformer(), $promotionService); }else{ return response()->success(['data'=>0]); } } /** * @apiVersion 1.0.0 * @api {GET} OfficialAccount/getAllHeadlinesNoType 获取所有标签文案 * @apiGroup WeChatMaterial * @apiName getAllHeadlinesNoType * @apiSuccessExample {json} Success-Response: * * { * "code": 0, * "msg": "", * "data": [ * { * "id": 1, * "title": "三姐妹怀孕,孩子的父亲竟是同一人,婆婆竟然这样说..." * }, * { * "id": 2, * "title": "看哭5000万人,一对32岁夫妻离婚后的聊天记录..." * } * ] * } */ function getAllHeadlinesNoType(Request $request) { $promotionService = PromotionService::getHeadlines(); if(!empty($promotionService)) { return response()->collection(new HeadlinelTransformer(), $promotionService); }else{ return response()->success(['data'=>0]); } } function wechatPublicTemplateList(Request $request) { $wechatPublicTemplatesService = WechatTemplateService::wechatPublicTemplateList(); return response()->collection(new WechatPublicTemplatesTransformer(), $wechatPublicTemplatesService); } }