<?php
/* 快捷商城系统
 * 版本号：2.0
 * 官网：http://www.kjcms.cn
 * 2015-02-16
 */
class mod_sys_user_vip extends inc_mod_admin {
	/* 按模块查询菜单信息并返回数组列表
	 * module : 指定查询模块
	 */
	function on_save() {
		$ids = fun_get::get("ids");
		$arr_fields = cls_config::get("" , "user.vip" , "" , "");
		foreach($arr_fields as $item => $list) {
			if($list == 0 ) continue;
			foreach($list as $key => $val) {
				if($key == 'discount') {
					if(fun_is::set($key . "_" . $item)) $arr_fields[$item][$key] = (float)fun_get::get($key . "_" . $item);
				} else {
					if(fun_is::set($key . "_" . $item)) $arr_fields[$item][$key] = fun_get::get($key . "_" . $item);
				}
			}
		}
		$val=var_export($arr_fields,true);
		//取之前的备注
		$cont = file_get_contents(KJ_DIR_DATA."/config/cfg.user.vip.php");
		$arr = explode("*/" , $cont);
		if(count($arr)>1) {
			$val = $arr[0] . "*/" . chr(10) . 'return ' . $val . ";";
		} else {
			$val = '<' . '?php' . chr(10) . 'return ' . $val . ";";
		}
		fun_file::file_create(KJ_DIR_DATA."/config/cfg.user.vip.php",$val,1);
		return array("code" => 0 , "msg" => "保存成功");
	}
}