cgserver 6.3.3 → 6.4.1

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.
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GAsyncQueueTool = void 0;
4
+ const cgserver_1 = require("../cgserver");
5
+ const Log_1 = require("./Log");
6
+ class AsyncQueueItem {
7
+ key = "";
8
+ running = false;
9
+ funcs = [];
10
+ constructor(key) {
11
+ this.key = key;
12
+ }
13
+ add(func) {
14
+ this.funcs.push(func);
15
+ this._run();
16
+ }
17
+ async _run() {
18
+ if (this.running) {
19
+ return;
20
+ }
21
+ this.running = true;
22
+ while (this.funcs.length > 0) {
23
+ try {
24
+ let func = this.funcs.shift();
25
+ if (!func) {
26
+ continue;
27
+ }
28
+ if (cgserver_1.core.isAsyncFunc(func)) {
29
+ await func().catch((error) => {
30
+ Log_1.GLog.error(error);
31
+ });
32
+ }
33
+ else {
34
+ func();
35
+ }
36
+ }
37
+ catch (error) {
38
+ Log_1.GLog.error(error);
39
+ }
40
+ }
41
+ this.running = false;
42
+ }
43
+ }
44
+ class AsyncQueueTool {
45
+ //队列数据,一个key队列必须有先后
46
+ _queues;
47
+ add(key, func) {
48
+ this._queues[key] = this._queues[key] || new AsyncQueueItem(key);
49
+ this._queues[key].add(func);
50
+ }
51
+ }
52
+ exports.GAsyncQueueTool = new AsyncQueueTool();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GAlipayTool = void 0;
3
+ exports.GAlipayTool = exports.AlipayCallBack = exports.AlipayResult = void 0;
4
4
  const alipay_sdk_1 = require("alipay-sdk");
5
5
  const aliUtil = require("alipay-sdk/lib/util");
6
6
  const AliPayUtil_1 = require("alipay_sdk2/AliPayUtil");
@@ -8,6 +8,51 @@ const fs = require("fs");
8
8
  const FrameworkConfig_1 = require("../Config/FrameworkConfig");
9
9
  const form_1 = require("alipay-sdk/lib/form");
10
10
  const Log_1 = require("../Logic/Log");
11
+ class AlipayResult {
12
+ alipay_trade_app_pay_response = {
13
+ code: "10000",
14
+ msg: "Success",
15
+ app_id: "2021003143637369",
16
+ auth_app_id: "2021003143637369",
17
+ charset: "utf-8",
18
+ timestamp: "2022-08-10 16:38:04",
19
+ out_trade_no: "62f36e657a355ecc1cb8eec2",
20
+ total_amount: "0.05",
21
+ trade_no: "2022081022001489431433911625",
22
+ seller_id: "2088441785429273"
23
+ };
24
+ sign = "d/Guf6QYnuk9fFlRS1EUFTY+n3/jQKp7IwQENG4WXO+qxMGglPXa3RhUHaJELTMwC4tcKhz8Z8GCiiI1Y7G84kAql1jyoekaOMWvdPRDOjkAqouP3oh5v9r23BziJUxgv/kanBRfOoTKvIT7R0L5DyfxMpEoHdssPHAtENMiniCVZlRUkAhHxjmgMrP0rzMtBvqctC5Me6UiV1yBdGWecLk9RNwMTZF8QSXKVpWXmhmimdjjFjGMcE6r7LoV9YW1Bsvjoq2kdRMX7CJZufGk1Y5Qz8Cv+E9QxTnDJMtA0XyYzte53/dSw0W3Z4Gbosn/kV4QDBRzN39NwwuoFwGuVg==";
25
+ sign_type = "RSA2";
26
+ }
27
+ exports.AlipayResult = AlipayResult;
28
+ class AlipayCallBack {
29
+ gmt_create = "2022-08-10 16=38=03";
30
+ charset = "utf-8";
31
+ seller_email = "zdpuke@163.com";
32
+ subject = "一把砖石";
33
+ sign = "gytkeBGeea9V05lI6Qvvut8CZnXtXJmbb0dMDd76a6fgN2k2IO0HH4wkJylMQG3EXYJQctysURDtIB0dhqaZbDVtePsM3iQVeI2jwT3YS3XGS4xi13k8foag9vCcSgojKjxJS3ihfzuyK/Pc+KDTOQftoWP2s1dPUpJNGLcZp4sUFysl0Iyzf+2vXh4OJUPQ3DvCqePnDUawq1+AUUj63WHWvdsGCP70+eTsbKxJxWBhHfMVrwkOmUI0zivcHpHLVHbfTFvaM5LAa/ivSU8jiDHqgHYFZqqzTyZ1DLxEy0Ypo3sKBs5eK/UhdsNf5tjse7PxYJwMU2ziIo9gnqv6fQ==";
34
+ buyer_id = 2088202482689432;
35
+ invoice_amount = "0.05";
36
+ notify_id = 2.022081000222164e+33;
37
+ fund_bill_list = [{ amount: "0.05", fundChannel: "PCREDIT" }];
38
+ notify_type = "trade_status_sync";
39
+ trade_status = "TRADE_SUCCESS";
40
+ receipt_amount = "0.05";
41
+ app_id = 2021003143637369;
42
+ buyer_pay_amount = "0.05";
43
+ sign_type = "RSA2";
44
+ seller_id = 2088441785429273;
45
+ gmt_payment = "2022-08-10 16:38:03";
46
+ notify_time = "2022-08-10 16:38:04";
47
+ version = 1;
48
+ out_trade_no = "62f36e657a355ecc1cb8eec2";
49
+ total_amount = "0.05";
50
+ trade_no = 2.0220810220014894e+27;
51
+ auth_app_id = 2021003143637369;
52
+ buyer_logon_id = "138****3531";
53
+ point_amount = 0;
54
+ }
55
+ exports.AlipayCallBack = AlipayCallBack;
11
56
  exports.GAlipayTool = null;
12
57
  class AlipayTool {
13
58
  _alipaySdk = null;
@@ -79,10 +124,11 @@ class AlipayTool {
79
124
  */
80
125
  _buildOrderParams(out_trade_no, total_amount, subject = "1", body = "我是测试数据", timeout_express = "30m", product_code = "QUICK_MSECURITY_PAY") {
81
126
  let order_params = {
127
+ notifyUrl: this._cfg.notify_url,
82
128
  bizContent: {
83
129
  timeout_express: timeout_express,
84
130
  product_code: product_code,
85
- total_amount: total_amount + "",
131
+ total_amount: total_amount,
86
132
  subject: encodeURIComponent(subject),
87
133
  body: encodeURIComponent(body),
88
134
  out_trade_no: out_trade_no
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonProtoFilter = exports.GoogleProtoFilter = exports.MongoCacheModel = exports.GMongoCacheSer = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.GMongoAccountSer = exports.MongoAccountService = exports.GMysqlAccountSer = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.GLog = exports.GHttpTool = exports.GCacheTool = exports.RedisManager = exports.GRedisMgr = exports.GMysqlMgr = exports.MysqlBaseService = exports.GMSSqlMgr = exports.GMongoMgr = exports.MongoBaseModel = exports.MysqlBaseModel = exports.MongoBaseService = exports.EPropertyType = exports.Type = exports.Table = exports.Property = exports.PrimaryKey = exports.NotNull = exports.AutoIncrement = exports.Timer = exports.core = exports.ServerConfig = exports.GFCfg = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.GTriggerMgr = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.GDBCache = exports.GProtoFactory = void 0;
4
- exports.GCgServer = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.GCtrMgr = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseUserController = exports.BaseController = exports.IWebServer = exports.GWechatTool = exports.GWechatOATool = exports.GQQTool = exports.GQiniuTool = exports.GOpenSocial = exports.GEmailTool = exports.GAppleTool = exports.GSmsTool = exports.GAlipayTool = exports.IWebSocket = exports.ISocketServer = exports.IServerWebSocket = exports.IClientWebSocket = void 0;
4
+ exports.GCgServer = exports.GAsyncQueueTool = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.GCtrMgr = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseUserController = exports.BaseController = exports.IWebServer = exports.GWechatTool = exports.GWechatOATool = exports.GQQTool = exports.GQiniuTool = exports.GOpenSocial = exports.GEmailTool = exports.GAppleTool = exports.GSmsTool = exports.GAlipayTool = exports.IWebSocket = exports.ISocketServer = exports.IServerWebSocket = exports.IClientWebSocket = void 0;
5
5
  var ProtoFactory_1 = require("./SocketServer/ProtoFilter/ProtoFactory");
6
6
  Object.defineProperty(exports, "GProtoFactory", { enumerable: true, get: function () { return ProtoFactory_1.GProtoFactory; } });
7
7
  var DBCache_1 = require("./Database/Decorator/DBCache");
@@ -157,6 +157,8 @@ var Response_1 = require("./WebServer/Engine/Response");
157
157
  Object.defineProperty(exports, "Response", { enumerable: true, get: function () { return Response_1.Response; } });
158
158
  var FrameworkConfig_2 = require("./Config/FrameworkConfig");
159
159
  Object.defineProperty(exports, "WebServerConfig", { enumerable: true, get: function () { return FrameworkConfig_2.WebServerConfig; } });
160
+ var AsyncQueueTool_1 = require("./Logic/AsyncQueueTool");
161
+ Object.defineProperty(exports, "GAsyncQueueTool", { enumerable: true, get: function () { return AsyncQueueTool_1.GAsyncQueueTool; } });
160
162
  const Log_2 = require("./Logic/Log");
161
163
  class CgServer {
162
164
  constructor() {
@@ -0,0 +1,16 @@
1
+ declare class AsyncQueueItem {
2
+ key: string;
3
+ running: boolean;
4
+ funcs: Function[];
5
+ constructor(key: string);
6
+ add(func: Function): void;
7
+ protected _run(): Promise<void>;
8
+ }
9
+ declare class AsyncQueueTool {
10
+ protected _queues: {
11
+ [key: string]: AsyncQueueItem;
12
+ };
13
+ add(key: string, func: Function): void;
14
+ }
15
+ export declare let GAsyncQueueTool: AsyncQueueTool;
16
+ export {};
@@ -1,5 +1,51 @@
1
1
  import AlipaySdk from 'alipay-sdk';
2
2
  import { AliPayUtil } from "alipay_sdk2/AliPayUtil";
3
+ export declare class AlipayResult {
4
+ alipay_trade_app_pay_response: {
5
+ code: string;
6
+ msg: string;
7
+ app_id: string;
8
+ auth_app_id: string;
9
+ charset: string;
10
+ timestamp: string;
11
+ out_trade_no: string;
12
+ total_amount: string;
13
+ trade_no: string;
14
+ seller_id: string;
15
+ };
16
+ sign: string;
17
+ sign_type: string;
18
+ }
19
+ export declare class AlipayCallBack {
20
+ gmt_create: string;
21
+ charset: string;
22
+ seller_email: string;
23
+ subject: string;
24
+ sign: string;
25
+ buyer_id: number;
26
+ invoice_amount: string;
27
+ notify_id: number;
28
+ fund_bill_list: {
29
+ amount: string;
30
+ fundChannel: string;
31
+ }[];
32
+ notify_type: string;
33
+ trade_status: string;
34
+ receipt_amount: string;
35
+ app_id: number;
36
+ buyer_pay_amount: string;
37
+ sign_type: string;
38
+ seller_id: number;
39
+ gmt_payment: string;
40
+ notify_time: string;
41
+ version: number;
42
+ out_trade_no: string;
43
+ total_amount: string;
44
+ trade_no: number;
45
+ auth_app_id: number;
46
+ buyer_logon_id: string;
47
+ point_amount: number;
48
+ }
3
49
  export declare let GAlipayTool: AlipayTool;
4
50
  declare class AlipayTool {
5
51
  protected _alipaySdk: AlipaySdk;
@@ -28,10 +74,11 @@ declare class AlipayTool {
28
74
  * @returns
29
75
  */
30
76
  protected _buildOrderParams(out_trade_no: string, total_amount: number, subject?: string, body?: string, timeout_express?: string, product_code?: string): {
77
+ notifyUrl: string;
31
78
  bizContent: {
32
79
  timeout_express: string;
33
80
  product_code: string;
34
- total_amount: string;
81
+ total_amount: number;
35
82
  subject: string;
36
83
  body: string;
37
84
  out_trade_no: string;
@@ -72,6 +72,7 @@ export { RazorJs } from './WebServer/Engine/RazorJs';
72
72
  export { Request } from './WebServer/Engine/Request';
73
73
  export { Response } from './WebServer/Engine/Response';
74
74
  export { WebServerConfig } from './Config/FrameworkConfig';
75
+ export { GAsyncQueueTool } from './Logic/AsyncQueueTool';
75
76
  declare class CgServer {
76
77
  constructor();
77
78
  init(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "6.3.3",
3
+ "version": "6.4.1",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",