<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/11/20
 * Time: 16:17
 */

namespace App\Http\Controllers\Channel\Promotion;
use App\Http\Controllers\Channel\BaseController;
use App\Http\Controllers\Channel\Promotion\Transformers\BodyTemplatesTransformer;
use App\Modules\Promotion\Services\PromotionService;
use DB;

class BodyTemplatesController extends BaseController
{
    /**
     * @apiDefine promotion 推广
     */

    /**
     * @apiVersion 1.0.0
     * @api {GET} promotion/bodyTemplates 获取推广内容模板列表
     * @apiGroup promotion
     * @apiName getPromotionBodyTemplates
     * @apiSuccess {Number}  id 标题ID.
     * @apiSuccess {String}  content 内容.
     * @apiSuccessExample {json} Success-Response:
     *
     *     {
     *         "code": 0,
     *         "msg": "",
     *
     *         "data": [
     *           {
     *              "id": 1,
     *              "content": "sfsd"
     *            },
     *           {
     *              "id": 2,
     *              "content": "sfsd"
     *            }
     *        ]
     *     }
     */

    function getPromotionBodyTemplates()
    {
        $promotionBodyTemplatesResult = PromotionService::getAllBodyTemplates();
        return response()->collection(new BodyTemplatesTransformer(), $promotionBodyTemplatesResult);
    }
}