cgserver 7.10.2113 → 7.11.2113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/package.json +1 -1
  2. package/src/Framework/AI/AiObject.ts +0 -12
  3. package/src/Framework/AI/Astar.ts +0 -157
  4. package/src/Framework/AI/BehaviorAI.ts +0 -382
  5. package/src/Framework/AI/Entity.ts +0 -37
  6. package/src/Framework/AI/Point.ts +0 -84
  7. package/src/Framework/AI/TriggerMgr.ts +0 -280
  8. package/src/Framework/Config/Config.ts +0 -61
  9. package/src/Framework/Config/FrameworkConfig.ts +0 -286
  10. package/src/Framework/Config/IServerConfig.ts +0 -28
  11. package/src/Framework/Config/_error_.ts +0 -32
  12. package/src/Framework/Core/Core.ts +0 -810
  13. package/src/Framework/Core/Timer.ts +0 -147
  14. package/src/Framework/Database/Decorator/AutoIncrement.ts +0 -9
  15. package/src/Framework/Database/Decorator/DBCache.ts +0 -74
  16. package/src/Framework/Database/Decorator/NotNull.ts +0 -9
  17. package/src/Framework/Database/Decorator/PrimaryKey.ts +0 -9
  18. package/src/Framework/Database/Decorator/Property.ts +0 -64
  19. package/src/Framework/Database/Decorator/Table.ts +0 -13
  20. package/src/Framework/Database/Decorator/Type.ts +0 -21
  21. package/src/Framework/Database/MSSqlManager.ts +0 -52
  22. package/src/Framework/Database/MongoBaseService.ts +0 -136
  23. package/src/Framework/Database/MongoManager.ts +0 -501
  24. package/src/Framework/Database/MysqlBaseService.ts +0 -345
  25. package/src/Framework/Database/MysqlManager.ts +0 -212
  26. package/src/Framework/Database/RedisManager.ts +0 -544
  27. package/src/Framework/Logic/CacheTool.ts +0 -85
  28. package/src/Framework/Logic/EventTool.ts +0 -31
  29. package/src/Framework/Logic/HttpTool.ts +0 -82
  30. package/src/Framework/Logic/Log.ts +0 -171
  31. package/src/Framework/Logic/SyncQueueTool.ts +0 -51
  32. package/src/Framework/Service/AccountService.ts +0 -508
  33. package/src/Framework/Service/MongoAccountService.ts +0 -456
  34. package/src/Framework/Service/MongoCacheService.ts +0 -48
  35. package/src/Framework/Service/MongoUserService.ts +0 -103
  36. package/src/Framework/Service/UserService.ts +0 -168
  37. package/src/Framework/Service/ini.ts +0 -33
  38. package/src/Framework/SocketServer/IClientWebSocket.ts +0 -50
  39. package/src/Framework/SocketServer/IRpc.ts +0 -12
  40. package/src/Framework/SocketServer/IRpcClientWebSocket.ts +0 -75
  41. package/src/Framework/SocketServer/IRpcServerWebSocket.ts +0 -76
  42. package/src/Framework/SocketServer/IServerWebSocket.ts +0 -88
  43. package/src/Framework/SocketServer/ISocketServer.ts +0 -243
  44. package/src/Framework/SocketServer/IWebSocket.ts +0 -243
  45. package/src/Framework/SocketServer/ProtoFilter/GoogleProtoFilter.ts +0 -68
  46. package/src/Framework/SocketServer/ProtoFilter/IProtoFilter.ts +0 -11
  47. package/src/Framework/SocketServer/ProtoFilter/JsonProtoFilter.ts +0 -34
  48. package/src/Framework/SocketServer/ProtoFilter/ProtoFactory.ts +0 -34
  49. package/src/Framework/ThirdParty/AlipayTool.ts +0 -224
  50. package/src/Framework/ThirdParty/Alisms.ts +0 -53
  51. package/src/Framework/ThirdParty/AppleTool.ts +0 -252
  52. package/src/Framework/ThirdParty/CgMq.ts +0 -153
  53. package/src/Framework/ThirdParty/EmailTool.ts +0 -37
  54. package/src/Framework/ThirdParty/OpenSocial.ts +0 -36
  55. package/src/Framework/ThirdParty/QQTool.ts +0 -124
  56. package/src/Framework/ThirdParty/QiniuTool.ts +0 -23
  57. package/src/Framework/ThirdParty/Rpc.ts +0 -75
  58. package/src/Framework/ThirdParty/WechatOATool.ts +0 -61
  59. package/src/Framework/ThirdParty/WechatTool.ts +0 -80
  60. package/src/Framework/WebServer/Controller/BaseController.ts +0 -140
  61. package/src/Framework/WebServer/Controller/BaseUserController.ts +0 -209
  62. package/src/Framework/WebServer/Controller/MongoBaseUserController.ts +0 -209
  63. package/src/Framework/WebServer/Decorator/AdminValidate.ts +0 -19
  64. package/src/Framework/WebServer/Decorator/AuthorityValidate.ts +0 -25
  65. package/src/Framework/WebServer/Decorator/CreatorValidate.ts +0 -19
  66. package/src/Framework/WebServer/Decorator/JsonAdminValidate.ts +0 -16
  67. package/src/Framework/WebServer/Decorator/JsonAuthorityValidate.d.ts +0 -2
  68. package/src/Framework/WebServer/Decorator/JsonAuthorityValidate.ts +0 -23
  69. package/src/Framework/WebServer/Decorator/JsonCreatorValidate.ts +0 -19
  70. package/src/Framework/WebServer/Decorator/SyncCall.ts +0 -20
  71. package/src/Framework/WebServer/Decorator/SyncCallServer.ts +0 -45
  72. package/src/Framework/WebServer/Engine/ControllerManager.ts +0 -134
  73. package/src/Framework/WebServer/Engine/Engine.ts +0 -186
  74. package/src/Framework/WebServer/Engine/RazorJs.ts +0 -720
  75. package/src/Framework/WebServer/Engine/Request.ts +0 -267
  76. package/src/Framework/WebServer/Engine/Response.ts +0 -123
  77. package/src/Framework/WebServer/IWebServer.ts +0 -61
  78. package/src/Framework/cgserver.ts +0 -112
  79. package/src/Framework/index.ts +0 -92
  80. package/src/test/test.ts +0 -12
@@ -1,82 +0,0 @@
1
- import * as request from "request";
2
- import * as qs from "querystring";
3
- import { GLog } from "./Log";
4
- import { core } from "../Core/Core";
5
-
6
- export let GHttpTool:HttpTool=null
7
- class HttpTool
8
- {
9
- get(options_url:request.OptionsWithUrl|string)
10
- {
11
- let options:request.OptionsWithUrl=null
12
- if(core.isString(options_url))
13
- {
14
- options={url:options_url as string}
15
- }
16
- else
17
- {
18
- options=options_url as request.OptionsWithUrl
19
- }
20
- return new Promise<{error,response,body}>((resolve,reject)=>
21
- {
22
- request.get(options, (error, response, body)=>
23
- {
24
- let bd=body
25
- if(error)
26
- {
27
- GLog.error("get:"+options.url)
28
- GLog.error(error)
29
- }
30
- try
31
- {
32
- if(core.isString(body))
33
- {
34
- body = JSON.parse(body)
35
- }
36
- }
37
- catch(e)
38
- {
39
- try{body=qs.parse(body)}catch(e){body=bd}
40
- }
41
- resolve({error, response, body})
42
- })
43
- })
44
- }
45
- post(options_url:request.OptionsWithUrl|string)
46
- {
47
- let options:request.OptionsWithUrl=null
48
- if(core.isString(options_url))
49
- {
50
- options={url:options_url as string}
51
- }
52
- else
53
- {
54
- options=options_url as request.OptionsWithUrl
55
- }
56
- return new Promise<{error,response,body}>((resolve,reject)=>
57
- {
58
- request.post(options, (error, response, body)=>
59
- {
60
- let bd=body
61
- if(error)
62
- {
63
- GLog.error("post:"+options.url)
64
- GLog.error(error)
65
- }
66
- try
67
- {
68
- if(core.isString(body))
69
- {
70
- body = JSON.parse(body)
71
- }
72
- }
73
- catch(e)
74
- {
75
- try{body=qs.parse(body)}catch(e){body=bd}
76
- }
77
- resolve({error, response, body})
78
- })
79
- })
80
- }
81
- }
82
- GHttpTool = new HttpTool()
@@ -1,171 +0,0 @@
1
- import * as colors from "colors";
2
- import * as log4js from "log4js";
3
- /**
4
- * 输出颜色
5
- */
6
- colors.setTheme({
7
- silly: 'rainbow',
8
- input: 'grey',
9
- verbose: 'cyan',
10
- prompt: 'red',
11
- info: 'green',
12
- data: 'blue',
13
- help: 'cyan',
14
- warn: 'yellow',
15
- debug: 'magenta',
16
- error: 'red'
17
- });
18
- export let GLog:Log=null
19
- class Log
20
- {
21
- //default log
22
- protected _logger:log4js.Logger = null
23
- //the log from client
24
- protected _client_logger:log4js.Logger = null
25
- //error and warn
26
- protected _errorLogger:log4js.Logger = null
27
- protected _inited=false
28
- /**
29
- * 该level只是用来控制控制台的显示的
30
- * -1不输出到console,0,仅错误信息输出到console,1,都输出到console
31
- */
32
-
33
- protected _console_level=0
34
- init(cfg:log4js.Configuration,console_level=0)
35
- {
36
- if(this._inited)
37
- {
38
- return
39
- }
40
- this._inited=true
41
- colors.enable()
42
- log4js.configure(cfg)
43
-
44
- this._logger = log4js.getLogger(cfg.categories.default.appenders[0]||"log_date")
45
- this._client_logger = log4js.getLogger(cfg.categories.default.appenders[1]||"client_log_date")
46
- this._errorLogger = log4js.getLogger(cfg.categories.default.appenders[2]||"error_log_file")
47
-
48
- this._console_level=console_level
49
- }
50
- error(message?: any)
51
- {
52
- if(this._isObject(message))
53
- {
54
- if(message.stack)
55
- {
56
- message=message.stack
57
- }
58
- else
59
- {
60
- message = JSON.stringify(message)
61
- }
62
- }
63
- this._errorLogger?.error(message)
64
- if(this._console_level>=0)
65
- {
66
- let time_str = this._getTimeStr()
67
- console.error(time_str+" "+message)
68
- }
69
- }
70
- info(message:any)
71
- {
72
- if(this._isObject(message))
73
- {
74
- message = JSON.stringify(message)
75
- }
76
- this._logger?.info(message)
77
- if(this._console_level>=0)
78
- {
79
- let time_str = this._getTimeStr()
80
- console.log(time_str+" "+message)
81
- }
82
- }
83
- warn(message?: any)
84
- {
85
- if(this._isObject(message))
86
- {
87
- message = JSON.stringify(message)
88
- }
89
- this._errorLogger?.warn(message)
90
- if(this._console_level>=0)
91
- {
92
- let time_str = this._getTimeStr()
93
- console.error(time_str+" "+message)
94
- }
95
- }
96
- record(message?: any)
97
- {
98
- this.info(message)
99
- }
100
- clientLog(message?: any)
101
- {
102
- this._client_logger?.error(message)
103
- }
104
- protected _getTimeStr()
105
- {
106
- let time = new Date()
107
- let time_str=this._format(time,"[YYYY-MM-DD HH:mm:SS.")
108
- time_str+=time.getMilliseconds()+"]"
109
- return time_str
110
- }
111
- protected _isObject(param):boolean
112
- {
113
- return typeof (param) === "object"
114
- }
115
- protected _isString(param):boolean
116
- {
117
- return typeof (param) === "string"
118
- }
119
- protected _isNumber(param):boolean
120
- {
121
- return typeof (param) === "number"
122
- }
123
- protected _format(src,formatStr)
124
- {
125
- if(this._isString(src))
126
- {
127
- let args = Array.prototype.slice.call(arguments, 1)
128
- return src.replace(/\{(\d+)\}/g, function(m, i)
129
- {
130
- return args[i]
131
- })
132
- }
133
- else
134
- {
135
- if(this._isNumber(src))
136
- {
137
- src = new Date(src)
138
- }
139
- let str = formatStr
140
- let Week = ['日','一','二','三','四','五','六']
141
-
142
- let month = src.getMonth()+1
143
- let year = src.getFullYear()
144
- let date = src.getDate()
145
- let hour = src.getHours()
146
- let min = src.getMinutes()
147
- let sec = src.getSeconds()
148
- let day = src.getDay()
149
- str=str.replace(/yyyy|YYYY/,year)
150
- str=str.replace(/yy|YY/,(year % 100)>9?(year % 100).toString():'0' + (year % 100))
151
-
152
- str=str.replace(/MM/,month>9?month.toString():'0' + month)
153
- str=str.replace(/M/g,month)
154
-
155
- str=str.replace(/w|W/g,Week[day])
156
-
157
- str=str.replace(/dd|DD/,date>9?date.toString():'0' + date)
158
- str=str.replace(/d|D/g,date)
159
-
160
- str=str.replace(/hh|HH/,hour>9?hour.toString():'0' + hour)
161
- str=str.replace(/h|H/g,hour)
162
- str=str.replace(/mm/,min>9?min.toString():'0' + min)
163
- str=str.replace(/m/g,min)
164
-
165
- str=str.replace(/ss|SS/,sec>9?sec.toString():'0' + sec)
166
- str=str.replace(/s|S/g,sec)
167
- return str
168
- }
169
- }
170
- }
171
- GLog=new Log()
@@ -1,51 +0,0 @@
1
- import { core } from "../Core/Core"
2
-
3
- class SyncQueueItem
4
- {
5
- key=""
6
- running=false
7
- funcs:{func:Function,thisArg:any,params:any[],resolve?:Function}[]=[]
8
- constructor(key:string)
9
- {
10
- this.key=key
11
- }
12
- async add(func:Function,thisArg:any=null,...params)
13
- {
14
- return new Promise((resolve,reject)=>
15
- {
16
- this.funcs.push({func:func,thisArg:thisArg,params:params,resolve:resolve})
17
- this._run()
18
- })
19
- }
20
- protected async _run()
21
- {
22
- if(this.running)
23
- {
24
- return
25
- }
26
- this.running=true
27
- while(this.funcs.length>0)
28
- {
29
- let funcitem = this.funcs.shift()
30
- if(!funcitem.func)
31
- {
32
- continue
33
- }
34
- let rs = await core.safeCall(funcitem.func,funcitem.thisArg,...funcitem.params)
35
- await core.safeCall(funcitem.resolve,null,rs)
36
- }
37
- this.running=false
38
- }
39
- }
40
- class SyncQueueTool
41
- {
42
- //队列数据,一个key队列必须有先后
43
- protected _queues:{[key:string]:SyncQueueItem}={}
44
- async add(key:string,func:Function,thisArg:any=null,...params)
45
- {
46
- this._queues[key]=this._queues[key]||new SyncQueueItem(key)
47
- let error = await this._queues[key].add(func,thisArg,...params)
48
- return error
49
- }
50
- }
51
- export let GSyncQueueTool=new SyncQueueTool()