<?php
namespace app\admin\logic;
use app\admin\model\User;
use app\admin\model\Role;
use app\shared\model\Option;
use think\exception\ValidateException;
use app\BaseController;
class SystemUploadForm extends  Base
{
	public function info(){
		$info=Option::get_data(-1,'admin','system_upload_config');
		if(!$info){
			$info=[
				'al'=>[
					'ak'=>'',
		            'sk'=>'',
		            'bucket'=>'',
		            'endpoint'=>'',
		            'domain'=>'',
		            'cname'=>''
				]
			];
		}else{
			$info=json_decode($info,1);
		}
		return fetchJson($info);
	}
	public function setting(){
		 $data=request()->post();
		 Option::set_data(-1,'admin','system_upload_config',json_encode([
		 	'al'=>input('al'),
		 	'upload'=>input('upload')
		 ]));
		 return fetchJson([],'保存成功');        
	}

}