<?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\QrCodeTransformer;
use App\Modules\Promotion\Services\PromotionService;
use DB;

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

    /**
     * @apiVersion 1.0.0
     * @api {GET} promotion/getQrCodes 获取二维码列表
     * @apiGroup promotion
     * @apiName getQrCodes
     * @apiSuccess {Number}  id  ID.
     * @apiSuccess {String}  codeUrl 链接地址.
     * @apiSuccessExample {json} Success-Response:
     *
     *     {
     *         "code": 0,
     *         "msg": "",
     *
     *         "data": [
     *           {
     *              "id": 1,
     *              "codeUrl": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
     *            },
     *           {
     *              "id": 2,
     *              "codeUrl": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
     *            }
     *        ]
     *     }
     */

    function getQrCodes()
    {
        $qrCodesResult = PromotionService::getQrCodes();
        return response()->collection(new QrCodeTransformer(), $qrCodesResult);
    }
}