-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.php
150 lines (148 loc) · 5.04 KB
/
Config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**
* Created by PhpStorm.
* User: pizepei
* Date: 2018/7/25
* Time: 13:44
* @title 项目配置
*/
namespace normphp\config;
class Config
{
/**
* 网站信息
*/
const PRODUCT_INFO = [
'title'=>'Lifestyle',//网站标题 比如 阿里
'name'=>'Lifestyle',//网站名称 比如阿里巴巴
'describe'=>'一个非常适合团队协作的微型框架',//网站首页介绍
'meta'=>'Lifestyle',//网站META关键词
'extend'=>[
'homeLoginLay'=>'',//首页登录页面的通知弹出
],//扩展信息
];
/**
* 为了确保空间唯一的
* 本服务的uuid标识(分布式时可保证不同服务之间的空间唯一)
*/
CONST UUID_IDENTIFIER = 'normphp-1';
/**
* 全局盐
*/
CONST SALT ='d~ds@d980652#re1ss$%^ds43x';
/**
* 错误日志保存方式 file|db
*/
CONST ERROR_LOG_SAVE = 'file';
/**
* 一般配置
* cache 缓存
* driveType 缓存类型(驱动drive)redis file
* targetDir 缓存路径(file类型下) DIRECTORY_SEPARATOR 目录分割符
* init 初始化
* json_encode json_encode 参数
* header 默认自定义响应
* headerType 设置返回详细的数据类型 http://tool.oschina.net/commons/
* requestParam 是否对请求参数进行过滤(删除不在注解中的参数key)
* requestParamTier 请求过来的xml 数据层级 限制(防止攻击)
* clientInfo 是否开启获取客户端详情true
* SYSTEMSTATUS 设置返回信息内容(非开发模式下)
* 'controller',//路由控制器
* 'function_method',// 请求方法 get post
* 'request_method',//控制器方法
* 'request_url',//完整路由(去除域名的url地址)
* 'route',//解释路由
* 'sql',//历史slq
* 'clientInfo',//ip信息
* 'system',//系统状态
* 'memory',//内存状态
* 成功返回格式
* successReturnJsonCode
* errorReturnJsonCode
* 失败返回格式
* successReturnJsonMsg
* errorReturnJsonMsg
* returnJsonData 返回的数据总体
* returnJsonCount 返回的数据数量
* jurisdictionCode 没有权限
* notLoggedCode 没有登录
* 路由配置
* route 路由
* type 路由类型 note 注解
* index 默认 \ 路由的路径-》已经存在的注解地址
* return 控制器return默认数据类型json html
* postfix 自定义路由后缀在前后端完全分离时有用:nginx 配置中固定的后缀转发到后端
* returnSubjoin 自定义路由 数据格式
*/
CONST UNIVERSAL =[
'route' => [
'type' =>'note',
'index'=>'/demo/index.html',
'return' => 'json',
'postfix' => [
'.json',
'.jsp',
'.data'
],
'returnSubjoin'=>[
],
],
'cache' => [
'driveType'=>'file',
'targetDir' => '..'.DIRECTORY_SEPARATOR.'runtime'.DIRECTORY_SEPARATOR,
],
'init' =>[
'json_encode'=>JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES,
'header'=>[
'X-Powered-By'=>'ASP.NET',
'Server'=>'Apache/2.4.23 (Win32) OpenSSL/1.0.2j mod_fcgid/2.3.9',
],
'headerType'=>[
'pdf'=>['Content-Type'=>'application/pdf'],
],
'requestParam'=>true,
'requestParamTier'=>50,
'clientInfo'=>false,
'SYSTEMSTATUS'=>[
'controller',//路由控制器
'function_method',// 请求方法 get post
'request_method',//控制器方法
'request_url',//完整路由(去除域名的url地址)
'route',//解释路由
'sql',//历史slq
'clientInfo',//ip信息
'system',//系统状态
'memory',//内存状态
],
'successReturnJsonCode'=>[
'name'=>'code',
'value'=>200,
],
'errorReturnJsonCode'=>[
'name'=>'code',
'value'=>100,
],
'successReturnJsonMsg'=>[
'name'=>'msg',
'value'=>'success',
],
'errorReturnJsonMsg'=>[
'name'=>'msg',
'value'=>'error',
],
'returnJsonData'=>'data',
'returnJsonCount'=>'count',
'jurisdictionCode'=>40003,
'notLoggedCode'=>10001,
],
];
/**
* 微服务核心配置
*/
const MICROSERVICE_CONFIG = [
'appid' => '',
'token' => '',
'appsecret' => '',
'encodingAesKey' => ''
];
}