<?php
/*
 +----------------------------------------------------------------------
 | TEMMOKUMVC [ NO BEST, ONLY BETTER ]
 +----------------------------------------------------------------------
 | Copyright (c) 2018~2019 https://www.temmoku.cn All rights reserved.
 +----------------------------------------------------------------------
 | Author: 张宗强 Email:webmaster@temmoku.cn QQ:158726877 516669373 TEL:17895221001 微信:temmokumvc
 +---------------------------------------------------------------------- 
*/
namespace plugin\sms\public_class;
use temmoku\db;
use \plugin\sms\init;
class cache{
	public static function run($data=''){
		self::setting_cache();
		self::sms_default_cache();
		
	}
	//核心缓存
	public static function setting_cache(){
		$data=db::select('*')->from(init::$table."setting")->query();
		$list=[];
		foreach($data AS $key=>$row){
			$list[$row['u_key']]=$row['u_value'];
		}
		$array=['setting'=>$list];
		createconf($array,'setting',init::$dir,true);
	}
	
	public static function sms_default_cache($PLUGIN=PLUGIN,$P_jab=P_jab){
		$row=db::select('*')->from(init::$table.'list')->where("is_default=1")->row();
		$array=[
			'default'=>[
				'initial_name'=>$row['initial_name'],
				'setting'=>$row['setting']
			]
		];
		createconf($array,'sms_default',init::$dir,true);
	}
}
?>