<?php
/**
 * ShareController.php  UTF-8
 * 游戏分享落地页
 *
 * @date    : 2018/9/14 11:07
 *
 * @license 这不是一个自由软件,未经授权不许任何使用和传播。
 * @author  : chenbingling <cbl@huosdk.com>
 * @version : HuoMP 1.0
 */

namespace box\api\controller;

use box\common\controller\V2ApiBaseController;
use huolib\status\CommonStatus;
use huomp\controller\share\ShareOut;

class ShareController extends V2ApiBaseController {
    /**
     * 游戏分享落地页914
     * http://doc.1tsdk.com/159?page_id=4645
     * 【域名】/share/game/detail
     */
    public function index() {
        $this->checkLogin();
        $_game_id = get_val($this->rq_data, 'game_id');
        $_state = get_val($this->rq_data, 'state');
        if (empty($_game_id) || empty($_state)) {
            $_code = CommonStatus::INVALID_PARAMS;
            $_rdata = [
                'code' => $_code,
                'msg'  => CommonStatus::getMsg($_code),
                'data' => []
            ];
            $this->returnData($_rdata);
        }
        $_rdata = (new ShareOut())->getSharePage($_state, $_game_id);
        $this->returnData($_rdata);
    }
}