<?php
define('DEBUG',true); //调试开关, 开发时建议开启，关闭将获取最佳性能
define('VER_STATIC','?ver=177'); //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
$tmp = explode(DIRECTORY_SEPARATOR,__DIR__);
array_pop($tmp);
array_pop($tmp);
$mvcdir = implode('/',$tmp).'/qgmvc/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'=>[
			'pdfset'=>[
				'items'=>[
					'photo'=> [
						'maxfile'=>20,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'tojpeg'=>false,
						'check'=> [
							'class' => \model\pdflib\pdfset::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pdflib\pdfset::class,
							'method' =>'uploadGet',
						],
					],
				],
				'type' => ['jpg','jpeg','png','gif'],
				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return 'pdfset';
				},
				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return $uploadID; //不需要加扩展名
				}
			],
			'sample'=>[
				'items'=>[
					'photo'=> [
						'maxfile'=>50,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'tojpeg'=>false,
						'check'=> [
							'class' => \model\sample\sample::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\sample\sample::class,
							'method' =>'uploadGet',
						],
					],
				],
				'type' => ['jpg','jpeg','png','gif'],
				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return 'sample/'.date('Ym');
				},
				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return $uploadID; //不需要加扩展名
				}
			],
			'proimage'=>[
				'items'=>[
					'init'=> [
						'maxfile'=>15,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'tojpeg'=>true,
						'keepFilename'=>false, //同名文件名使用重复的文件ID
						'check'=> [
							'class' => \model\pro\photo::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\photo::class,
							'method' =>'uploadGet',
						],
					],
					'init_add'=> [
						'maxfile'=>15,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'tojpeg'=>true,
						'keepFilename'=>false, //同名文件名使用重复的文件ID
						'check'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadGet',
						],
        				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
        				    $md4 = md4($item.$reqfilename.$uploadID);
        					return strtolower('pro/'.$item.'/'.date('Y').'/'.substr($md4,0,1).substr($md4,-1));
        				},
        				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
        					return md4($item.$reqfilename.$uploadID); //不需要加扩展名
        				}
					],
					'beautify'=> [
						'maxfile'=>15,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'tojpeg'=>true,
						'keepFilename'=>false,
						'check'=> [
							'class' => \model\pro\photo::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\photo::class,
							'method' =>'uploadGet',
						],
					],
					'beautify_add'=> [
						'maxfile'=>15,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'tojpeg'=>true,
						'keepFilename'=>false, //同名文件名使用重复的文件ID
						'check'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadGet',
						],
        				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
        				    $md4 = md4($item.$reqfilename.$uploadID);
        					return strtolower('pro/'.$item.'/'.date('Y').'/'.substr($md4,0,1).substr($md4,-1));
        				},
        				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
        					return md4($item.$reqfilename.$uploadID); //不需要加扩展名
        				}
					],
					'tecdoc'=> [
						'maxfile'=>1,
						'filetype'=>'image',
						'size'=>['small'=>[200,133,],'mid'=>[320,240],'big'=>[600,400]],
						'tojpeg'=>true,
					],
					'usa'=> [
						'maxfile'=>15,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'mid'=>[320,240],'big'=>[640,480]],
						'tojpeg'=>true,
					],
					'catalog_gsp'=> [
						'maxfile'=>1,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'mid'=>[320,240],'big'=>[640,480]],
						'tojpeg'=>true,
					],
					'catalog_g'=> [
						'maxfile'=>1,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'mid'=>[320,240],'big'=>[640,480]],
					],
					'attach'=> [
						'maxfile'=>10,
						'filetype'=>'image',
						'tojpeg'=>true,
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'check'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadGet',
						],
					],
					'notcattle'=> [
						'maxfile'=>10,
						'filetype'=>'image',
						'tojpeg'=>true,
						'size'=>['small'=>[200,133],'big'=>[600,400]],
						'check'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadGet',
						],
					],
					'360'=> [
						'maxfile'=>20,
						'filetype'=>'file',
						'check'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadGet',
						],
					],
					'other'=> [
						'maxfile'=>20,
						'filetype'=>'file',
						'check'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\pro\image::class,
							'method' =>'uploadGet',
						],
					],
				],
				'type' => ['jpg','jpeg','png','gif'],
				'path' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return strtolower('pro/'.$item.'/'.date('Y').'/'.substr($uploadID,0,1).substr($uploadID,-1));
				},
				'filebase' => function($uploadID,$item,$extname,$params,$reqfilename=''){
					return strtolower($uploadID); //不需要加扩展名
				}
			],//proimage
			'general'=>[
				'items'=>[
					'img'=> [
						'maxfile'=>1,
						'filetype'=>'image',
						'size'=>['small'=>[200,133],'big'=>[1280,960]],
						'tojpeg'=>true,
						'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',
						],
					],
					'importSamplephoto'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['zip','gz','gzip'],
						'accept'=>'.zip,.gz,.gzip',
						'check'=> [
							'class' => \model\import\uploadImportSamplePhotoDir::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\import\uploadImportSamplePhotoDir::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',
						],
					],
					'importExcelSelf'=> [
						'maxfile'=>1,
						'filetype'=>'file',
						'size'=>null,
						'tojpeg'=>false,
						'type' => ['xlsx'],
						'accept'=>'.xlsx',
						'check'=> [
							'class' => \model\import\excelSelf::class,
							'method' =>'uploadCheck',
						],
						'call'=> [
							'class' => \model\import\excelSelf::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.'/frey/pdc/files',//文件对外网址
	],
	//预警消息
	'warnMsgUser'=>['admin', 'frey.admin'],
	//包含的所有语种
	'LANGS'=>['cn'=>'中文', 'en'=>'英文','py'=>'俄文'],
	//产品状态
	'PROSTATUS'=>['01'=>'01 开发中','02'=>'02 国内不做外贸订做','03'=>'03 上市','04'=>'04 退市','99'=>'99 删除','05'=>'05 升级中','06'=>'06 可研发生产','07'=>'07 新品在途可预定'],
	//包装扩展配置
	'BrandExt'=>[
		'outbox'=>['pbe_length', 'pbe_width', 'pbe_height', 'pbe_size_unit'],
		'inbox'=>['pbe_length', 'pbe_width', 'pbe_height', 'pbe_size_unit'],
		'inpocket'=>['pbe_length', 'pbe_width', 'pbe_size_unit'],
		'tag'=>['pbe_length', 'pbe_width', 'pbe_size_unit'],
		'material'=>['pbe_length', 'pbe_width', 'pbe_height', 'pbe_size_unit'],
	],
	'YPAPI'=>[
		'base_url'=>'http://192.168.1.115/API/home/index.php/',
		'token'=>'FREY-WEB1-4545-DS987-454S'
	],
];