<?php
define('DEBUG',true); //调试开关, 开发时建议开启，关闭将获取最佳性能
define('VER_STATIC','?ver=26'); //strtotime(date('y-m-d h:i')))
!defined('MVC_OS') && define('MVC_OS',strtolower(substr(PHP_OS,0,3)));
!defined('MVC_OS_IS_WIN') && define('MVC_OS_IS_WIN',MVC_OS=='win'); //是否是windows
!defined('MVC_SAPI') && define('MVC_SAPI',strtolower(PHP_SAPI));
!defined('MVC_SAPI_IS_CLI') && define('MVC_SAPI_IS_CLI',MVC_SAPI=='cli'); //是否是命令行控制台模式

define('NUMIDX_CKRESULT2_OK','10121'); //交叉索引复核结论为OK的ID
define('NUMIDX_CKRESULT2_WAIT','10120'); //交叉索引复核结论需确认的ID
define('MODEL_CKRESULT2_OK','10180'); //车型复核结论为OK的ID
define('OBJECT_KTYPE','10116'); //KETYPE OBJECT ID
define('IS_DEVELOP',in_array(gethostname(),['Hzq-Company'])); //是否是开发者

$tmp = explode(DIRECTORY_SEPARATOR,__DIR__);
array_pop($tmp);
array_pop($tmp);
$mvcdir = implode('/',$tmp).'/v1.0/mvc';
$Http = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';  
$Http =  $Http.$_SERVER['HTTP_HOST'];
return [
	'mvcDir'=> $mvcdir,
	'short_open_tag' => false, //php.ini 是否设置了支持短标签,false:没有,系统将给<? 替换成 <?php, 给 <?= 替换成 <?php echo 
	'lang'=> null, //当前语言 index.php 中指定
    "domain" => null, //含有语言版本的领域网址路径 index.php 中指定
	'locale'=> null, //本地化当前域 admin.php 中指定
    "project" => null, //工程名标识 admin.php 中指定
	'projectDir'=> null, //工程目录, index.php 中指定
	'site'=> null, //站点名标识, index.php 中指定
	"siteTitle" => null, //站点主标题, index.php 中指定
	'siteDir'=> null, //站点目录, index.php 中指定
	'sitePath'=> null, //站点路径, index.php 中指定
	'lang'=> null, //当前语言 index.php 中指定
	'dir'=> null, //物理目录 admin.php 中指定
	'path'=> null, //网址路径 admin.php 中指定
	/*自定义类映射地图,默认关闭
	'classMap'=>[
		'xxx\xx'            => \mvc::$cfg['siteDir'] . '/xxx/xxx.php',
	],
	*/
	/* 容器绑定
	* 注意不要使用 类::class 来配置，因为它会直接反射，增加include的IO操作
	*/
	'providers'=>[
		//'\Overtrue\Pinyin\Pinyin' => ['single'=>true, 'params'=>[]],
	],
	//文件上传
	'upload' =>[
		//上传最大超时时间
		'time_limit' => 3600 * 24 * 1, // 1 天
		//为上传分配的内存
		'memory_limit' => (1024 * 16) .'M',
		//允许上传的文件类型
		'type' => ['jpg','jpeg','png','gif','tif','bmp',
			'dat','zip','rar','gz',
			'txt','csv','doc','xls','ppt','docx','xlsx','pptx','pdf',
			'css','json','xml',
			'mp3','mp4','av',
			'cad','dwg','psd','ai',
		],
		//php默认上传，文件大小限制
		'size' => 2 * 1024 * 1024, //2M
		//大文件上传，文件大小限制
		'bigSize' => (1024 * 1024 * 1024) * 5, //5G
		//模块
		'category'=>[
			'general'=>[
				'items'=>[
					'img'=> [
						'maxfile'=>1,
						'filetype'=>'image',
						'size'=>false,
						'tojpeg'=>false,
						'check'=> [
							'class' => \model\upload::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\upload::class,
							'method' =>'uploadGet',
						],
					],
					'pdf'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['pdf'],
                        'accept'=>'.pdf',
						'check'=> [
							'class' => \model\upload::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\upload::class,
							'method' =>'uploadGet',
						],
					],
					'file'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['jpg','jpeg','png','gif','tif','bmp','txt','csv','doc','xls','ppt','docx','xlsx','pptx','pdf'],
						'check'=> [
							'class' => \model\upload::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\upload::class,
							'method' =>'uploadGet',
						],
					],
				],
				'type' => ['jpg','jpeg','png','gif','tif','bmp','txt','csv','doc','xls','ppt','docx','xlsx','pptx','pdf'],
				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return 'general/'.date('Ym');
				},
				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return $uploadID; //不需要加扩展名
				}
			],//general
			'import'=>[
				'items'=>[
					'importxls'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['csv','xlsx'],
						'accept'=>'.xlsx,.csv',
						'check'=> [
							'class' => \model\uploadXls::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\uploadXls::class,
							'method' =>'uploadGet',
						],
					],
					'importphoto'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['zip','gz','gzip'],
						'accept'=>'.zip,.gz,.gzip',
						'check'=> [
							'class' => \model\import\uploadImportProPhoto::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\import\uploadImportProPhoto::class,
							'method' =>'uploadGet',
						],
					],
					'importSample'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['zip','gz','gzip'],
						'accept'=>'.zip,.gz,.gzip',
						'check'=> [
							'class' => \model\uploadImportSample::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\uploadImportSample::class,
							'method' =>'uploadGet',
						],
					],
					'importTousu'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['zip','gz','gzip'],
						'accept'=>'.zip,.gz,.gzip',
						'check'=> [
							'class' => \model\import\uploadImportTousu::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\import\uploadImportTousu::class,
							'method' =>'uploadGet',
						],
					],
					'importMarkline'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['xlsx','csv'],
						'accept'=>'.xlsx,.xls',
						'check'=> [
							'class' => \model\import\uploadImportMarkline::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\import\uploadImportMarkline::class,
							'method' =>'uploadGet',
						],
					]
				],
				'type' => ['csv','xlsx','xls','gz','zip'],
				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return 'import/'.date('Ym');
				},
				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return $uploadID; //不需要加扩展名
				}
			],//导入文件
		]//category
	],
	/* 安全有关的配置应当在这个键下面配置，，如加密键，短信接口KEY，TOKEN等等
	   safe 禁止在模板使用，并且不会被 /phpinfo模式打印
	   注: 站点配置会覆盖工程配置
	*/
	'safe'=> [
		'passwordSalt'=>'', //自定义盐 password 盐, 即使为空系统也会加内置盐
	],
	 /*站点特有配置,提供UI管理*/
    'siteCustom'=>[
        'pro'=>[
            'pic'=>[
                'tecdoc'=> ['width'=>600,'height'=>400,'watermark'=>false],
                'gsp'=> ['width'=>640,'height'=>480,'watermark'=> 'static/images/watermark/gsp.png'],
                'g'=> ['width'=>640,'height'=>480,'watermark'=>'static/images/watermark/g.png'],
                'usa'=> ['width'=>640,'height'=>480,'watermark'=>false],
            ]
        ],
    ],
	'urls'=>[
		//'outfiles'=>$Http.'/qgmvc/gsp/files',//文件对外网址
		'outfiles'=>'http://file.gsp.cn',//文件对外网址
	],
	//预警消息
	'warnMsgUser'=>['admin', 'gsp.admin']
];