<?php


namespace App\Client;


class Site
{
    protected $site;

    public function __construct()
    {
        $this->site = app()->make('siteData');
    }

    /**
     * 获取appid
     *
     * @return mixed
     */
    public function getAppid()
    {
        return (string)getProp($this->site, 'appid');
    }

    /**
     * 获取app_token
     *
     * @return mixed
     */
    public function getAppToken()
    {
        return (string)getProp($this->site, 'app_token');
    }

    /**
     * 获取公司名
     *
     * @return mixed
     */
    public function getCompanyName()
    {
        return (string)getProp($this->site, 'company_name');
    }

    /**
     * 获取appid
     *
     * @return mixed
     */
    public function getCompanyId()
    {
        return (string)getProp($this->site, 'company_id');
    }

    /**
     * 获取channel_id
     *
     * @return mixed
     */
    public function getChannelId()
    {
        return (array)getProp($this->site, 'channel_id');
    }

    /**
     * 设置全局返回报错数据
     *
     * @param $data
     */
    public function setErrorResponseData($data)
    {
        $this->site->errorResponseData = $data;
    }

    /**
     * 获取全局返回报错数据
     *
     * @return mixed|string
     */
    public function getErrorResponseData()
    {
        return getProp($this->site, 'errorResponseData', []);
    }
}
