<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/11/22
 * Time: 10:45
 */

namespace App\Http\Controllers\Channel\Promotion;

use App\Http\Controllers\Channel\BaseController;
use App\Http\Controllers\Channel\Promotion\Transformers\PromotionPagesTransformer;
use App\Modules\Promotion\Services\PromotionService;

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

    /**
     * @apiVersion 1.0.0
     * @api {GET} promotion/promotionPages 获取推广页面列表
     * @apiGroup promotion
     * @apiName getPromotionPages
     * @apiSuccess {Number}  id ID.
     * @apiSuccess {String}  title 标题
     * @apiSuccess {String}  description 描述
     * @apiSuccess {String}  link 推广链接
     * @apiSuccessExample {json} Success-Response:
     *
     *     {
     *         "code": 0,
     *         "msg": "",
     *
     *         "data": [
     *           {
     *              "id": 1,
     *              "title": "sfsd",
     *              "link": "111111111",
     *              "description": "测试1111"
     *            },
     *           {
     *              "id": 2,
     *              "title": "sfsd",
     *               "link": "111111111",
     *                "description": "测试1111"
     *            }
     *        ]
     *     }
     */

    function getPromotionPages()
    {
        $promotionPagesResult = PromotionService::getAllPromotionPage();
        return response()->collection(new PromotionPagesTransformer(), $promotionPagesResult);
    }
}