123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?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);
- }
- }
|