<?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\BgInagesTransformer;
use App\Http\Controllers\Channel\Promotion\Transformers\QrCodeTransformer;
use App\Modules\Promotion\Services\PromotionService;
use DB;

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

    /**
     * @apiVersion 1.0.0
     * @api {GET} promotion/getBgImages 获取二维码列表
     * @apiGroup promotion
     * @apiName getBgImages
     * @apiSuccess {Number}  id  ID.
     * @apiSuccess {Number}  sequence 序号
     * @apiSuccess {String}  link  模板图片地址.
     * @apiSuccess {String}  created_at 创建时间.
     * @apiSuccess {String}  updated_at 更新时间.
     * @apiSuccessExample {json} Success-Response:
     *
     *     {
     *         "code": 0,
     *         "msg": "",
     *
     *         "data": [
     *           {
     *              "id": 1,
     *              "sequence": 1,
     *              "created_at": "2018-08-02 15:28:30"
     *              "update_at": "2018-08-02 15:28:30"
     *              "link": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
     *            },
     *           {
     *              "id": 2,
     *              "sequence": 1,
     *              "created_at": "2018-08-02 15:28:30"
     *              "update_at": "2018-08-02 15:28:30"
     *              "link": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
     *            }
     *        ]
     *     }
     */

    function getBgImages()
    {
        $getBgImagesResult = PromotionService::getBgImages();
        return response()->collection(new BgInagesTransformer(), $getBgImagesResult);
    }
}