<?php
/**
 * 更新
 */

defined('InShopNC') or exit('Access Invalid!');

require_once(BASE_ROOT_PATH . '/helper/ugc_helper.php');

class configControl extends mobileHomeControl
{
    public function __construct()
    {
        parent::__construct();
    }

    public function getconfigexOp()
    {
        $result['app_config'] = ['sale_mobile' => '021-64260858',
             'index_tip' => '登录后会显示您的专属红包价',
             'login_tip' => '提示: 领到红包用户，可直接用微信登录',
             'cancel_order_tip' => '取消订单后只退还红包,不退F码,确定要取消订单吗?',
             'refund_money_tip' => '申请退款后红包与F码均不会退还,确定要申请退款吗?',
             'cart_unlogin_tip' => '登录后，才能显示总价',
             'ugc_categories' => ugc_helper::categories()];
        return self::outsuccess($result);
    }
    
    /**
     * 获取配置文件
     * 参数： platform 1:android 2:ios
     */
    public function getconfigOp()
    {
        $platform = trim($_GET['platform']);
        $ver_code = trim($_GET['ver_code']);
        if (!isset($platform) || empty($platform)) {
            return self::outerr(errcode::ErrInputParam);
        }
        if (!isset($ver_code) || empty($ver_code)) {
            return self::outerr(errcode::ErrInputParam);
        }

        $result = Model()->table('config')->select();
        if (empty($result)) {
            return self::outerr(errcode::ErrGetConfig);
        }
        else
        {
            $ret = array();
            foreach ($result as $value) {
                $ret[$value['name']] = array('value'=>$value['value']);
            }
            $ret['feed_back_url'] = array('value'=> 'http://p.lrlz.com/' . '/mobile/index.php?act=member_feedback&op=add&client_type=ios');
        }
        return self::outsuccess($ret);
    }
}
