<?php
/**
 *
 * @author min晓天
 * @url http://bbs.we7.cc/
 */
defined('IN_IA') or exit('Access Denied');
global $_GPC, $_W;
load()->func('tpl');
$operation = ! empty($_GPC['op']) ? $_GPC['op'] : 'copyset';
$setting = pdo_fetch("SELECT * FROM".tablename("evzg_express_setting")."WHERE uniacid='{$_W['uniacid']}' ");

if($operation=='copyset'){
    if (checksubmit('submit')) {
        $data['uniacid'] = $_W['uniacid'];
        $data['copytitle'] = $_GPC['copytitle'];
        $data['copyright'] = $_GPC['copyright'];
        if(empty($setting)){
            $result = pdo_insert("evzg_express_setting",$data);
        }else {
            $result =  pdo_update("evzg_express_setting",$data,array('uniacid'=>$_W['uniacid']));
        }
        if($result){
          message("设置成功",referer(),"success");
        }else{
          message("设置失败",referer(),"error");
        }
    }
}
if($operation=='priceset'){
    if (checksubmit('submit')) {
        $data['uniacid'] = $_W['uniacid'];
        $data['trendsprice'] = $_GPC['trendsprice'];
        $data['smsprice'] = $_GPC['smsprice'];
        if(empty($setting)){
            $result = pdo_insert("evzg_express_setting",$data);
        }else {
            $result =  pdo_update("evzg_express_setting",$data,array('uniacid'=>$_W['uniacid']));
        }
        if($result){
            message("设置成功",referer(),"success");
        }else{
            message("设置失败",referer(),"error");
        }
    }
}
include $this->template('setting');
