@be-link/ecommerce-backend-bff-service-node-sdk 0.0.112 → 0.0.114

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 (136) hide show
  1. package/cjs/bff/modules/miniprogram/auth/service.d.ts +46 -0
  2. package/cjs/bff/modules/miniprogram/auth/service.js +66 -0
  3. package/cjs/bff/modules/miniprogram/auth/types.d.ts +133 -0
  4. package/cjs/bff/modules/miniprogram/franchisee/service.d.ts +12 -0
  5. package/cjs/bff/modules/miniprogram/franchisee/service.js +22 -0
  6. package/cjs/bff/modules/miniprogram/franchisee/types.d.ts +25 -0
  7. package/cjs/bff/modules/pandora/auth/service.d.ts +28 -0
  8. package/cjs/bff/modules/pandora/auth/service.js +42 -0
  9. package/cjs/bff/modules/pandora/auth/types.d.ts +94 -0
  10. package/cjs/bff/modules/pandora/auth/types.js +2 -0
  11. package/cjs/bff/modules/pandora/bd/service.d.ts +47 -0
  12. package/cjs/bff/modules/pandora/bd/service.js +67 -0
  13. package/cjs/bff/modules/pandora/bd/types.d.ts +157 -0
  14. package/cjs/bff/modules/pandora/bd/types.js +2 -0
  15. package/cjs/bff/modules/pandora/bdm/service.d.ts +35 -0
  16. package/cjs/bff/modules/pandora/{orderQuery → bdm}/service.js +18 -18
  17. package/cjs/bff/modules/pandora/bdm/types.d.ts +104 -0
  18. package/cjs/bff/modules/pandora/bdm/types.js +2 -0
  19. package/cjs/bff/modules/pandora/common/service.d.ts +34 -0
  20. package/cjs/bff/modules/pandora/common/service.js +50 -0
  21. package/cjs/bff/modules/pandora/common/types.d.ts +125 -0
  22. package/cjs/bff/modules/pandora/common/types.js +2 -0
  23. package/cjs/bff/modules/pandora/coupon/service.d.ts +59 -0
  24. package/cjs/bff/modules/pandora/coupon/service.js +83 -0
  25. package/cjs/bff/modules/pandora/coupon/types.d.ts +403 -0
  26. package/cjs/bff/modules/pandora/coupon/types.js +2 -0
  27. package/cjs/bff/modules/pandora/franchisee/service.d.ts +19 -0
  28. package/cjs/bff/modules/pandora/franchisee/service.js +43 -0
  29. package/cjs/bff/modules/pandora/franchisee/types.d.ts +204 -0
  30. package/cjs/bff/modules/pandora/franchisee/types.js +2 -0
  31. package/cjs/bff/modules/pandora/product/types.d.ts +6 -2
  32. package/cjs/bff/modules/pandora/productExp/service.d.ts +4 -4
  33. package/cjs/bff/modules/pandora/productExp/service.js +7 -7
  34. package/cjs/bff/modules/pandora/productExp/types.d.ts +31 -16
  35. package/cjs/bff/modules/pandora/productLive/service.d.ts +1 -1
  36. package/cjs/bff/modules/pandora/productLive/types.d.ts +1 -1
  37. package/cjs/bff/modules/pandora/role/service.d.ts +47 -0
  38. package/cjs/bff/modules/pandora/role/service.js +67 -0
  39. package/cjs/bff/modules/pandora/role/types.d.ts +135 -0
  40. package/cjs/bff/modules/pandora/role/types.js +2 -0
  41. package/cjs/bff/modules/pandora/storeClerk/service.d.ts +41 -0
  42. package/cjs/bff/modules/pandora/storeClerk/service.js +59 -0
  43. package/cjs/bff/modules/pandora/storeClerk/types.d.ts +130 -0
  44. package/cjs/bff/modules/pandora/storeClerk/types.js +2 -0
  45. package/cjs/bff/modules/pandora/storeManager/service.d.ts +47 -0
  46. package/cjs/bff/modules/pandora/storeManager/service.js +67 -0
  47. package/cjs/bff/modules/pandora/storeManager/types.d.ts +148 -0
  48. package/cjs/bff/modules/pandora/storeManager/types.js +2 -0
  49. package/cjs/bff/modules/pandora/user/service.d.ts +19 -0
  50. package/cjs/bff/modules/pandora/user/service.js +43 -0
  51. package/cjs/bff/modules/pandora/user/types.d.ts +178 -0
  52. package/cjs/bff/modules/pandora/user/types.js +2 -0
  53. package/cjs/bff/request/strategy.js +1 -0
  54. package/cjs/enums.d.ts +1 -0
  55. package/cjs/enums.js +4 -1
  56. package/cjs/index.d.ts +50 -6
  57. package/cjs/index.js +32 -10
  58. package/cjs/utils/env.js +3 -2
  59. package/cjs/utils/http.js +1 -1
  60. package/cjs/utils/string.js +1 -0
  61. package/esm/bff/modules/miniprogram/auth/service.d.ts +46 -0
  62. package/esm/bff/modules/miniprogram/auth/service.mjs +59 -0
  63. package/esm/bff/modules/miniprogram/auth/types.d.ts +133 -0
  64. package/esm/bff/modules/miniprogram/franchisee/service.d.ts +12 -0
  65. package/esm/bff/modules/miniprogram/franchisee/service.mjs +15 -0
  66. package/esm/bff/modules/miniprogram/franchisee/types.d.ts +25 -0
  67. package/esm/bff/modules/pandora/auth/service.d.ts +28 -0
  68. package/esm/bff/modules/pandora/auth/service.mjs +35 -0
  69. package/esm/bff/modules/pandora/auth/types.d.ts +94 -0
  70. package/esm/bff/modules/pandora/auth/types.mjs +1 -0
  71. package/esm/bff/modules/pandora/bd/service.d.ts +47 -0
  72. package/esm/bff/modules/pandora/bd/service.mjs +60 -0
  73. package/esm/bff/modules/pandora/bd/types.d.ts +157 -0
  74. package/esm/bff/modules/pandora/bd/types.mjs +1 -0
  75. package/esm/bff/modules/pandora/bdm/service.d.ts +35 -0
  76. package/esm/bff/modules/pandora/bdm/service.mjs +44 -0
  77. package/esm/bff/modules/pandora/bdm/types.d.ts +104 -0
  78. package/esm/bff/modules/pandora/bdm/types.mjs +1 -0
  79. package/esm/bff/modules/pandora/common/service.d.ts +34 -0
  80. package/esm/bff/modules/pandora/common/service.mjs +43 -0
  81. package/esm/bff/modules/pandora/common/types.d.ts +125 -0
  82. package/esm/bff/modules/pandora/common/types.mjs +1 -0
  83. package/esm/bff/modules/pandora/coupon/service.d.ts +59 -0
  84. package/esm/bff/modules/pandora/coupon/service.mjs +76 -0
  85. package/esm/bff/modules/pandora/coupon/types.d.ts +403 -0
  86. package/esm/bff/modules/pandora/coupon/types.mjs +1 -0
  87. package/esm/bff/modules/pandora/franchisee/service.d.ts +19 -0
  88. package/esm/bff/modules/pandora/franchisee/service.mjs +36 -0
  89. package/esm/bff/modules/pandora/franchisee/types.d.ts +204 -0
  90. package/esm/bff/modules/pandora/franchisee/types.mjs +1 -0
  91. package/esm/bff/modules/pandora/product/types.d.ts +6 -2
  92. package/esm/bff/modules/pandora/productExp/service.d.ts +4 -4
  93. package/esm/bff/modules/pandora/productExp/service.mjs +7 -7
  94. package/esm/bff/modules/pandora/productExp/types.d.ts +31 -16
  95. package/esm/bff/modules/pandora/productLive/service.d.ts +1 -1
  96. package/esm/bff/modules/pandora/productLive/types.d.ts +1 -1
  97. package/esm/bff/modules/pandora/role/service.d.ts +47 -0
  98. package/esm/bff/modules/pandora/role/service.mjs +60 -0
  99. package/esm/bff/modules/pandora/role/types.d.ts +135 -0
  100. package/esm/bff/modules/pandora/role/types.mjs +1 -0
  101. package/esm/bff/modules/pandora/storeClerk/service.d.ts +41 -0
  102. package/esm/bff/modules/pandora/storeClerk/service.mjs +52 -0
  103. package/esm/bff/modules/pandora/storeClerk/types.d.ts +130 -0
  104. package/esm/bff/modules/pandora/storeClerk/types.mjs +1 -0
  105. package/esm/bff/modules/pandora/storeManager/service.d.ts +47 -0
  106. package/esm/bff/modules/pandora/storeManager/service.mjs +60 -0
  107. package/esm/bff/modules/pandora/storeManager/types.d.ts +148 -0
  108. package/esm/bff/modules/pandora/storeManager/types.mjs +1 -0
  109. package/esm/bff/modules/pandora/user/service.d.ts +19 -0
  110. package/esm/bff/modules/pandora/user/service.mjs +36 -0
  111. package/esm/bff/modules/pandora/user/types.d.ts +178 -0
  112. package/esm/bff/modules/pandora/user/types.mjs +1 -0
  113. package/esm/bff/request/strategy.mjs +1 -0
  114. package/esm/enums.d.ts +1 -0
  115. package/esm/enums.mjs +2 -0
  116. package/esm/index.d.ts +50 -6
  117. package/esm/index.mjs +26 -4
  118. package/esm/utils/env.mjs +3 -2
  119. package/esm/utils/http.mjs +1 -1
  120. package/esm/utils/string.mjs +1 -0
  121. package/package.json +9 -5
  122. package/cjs/bff/modules/pandora/orderCore/service.d.ts +0 -23
  123. package/cjs/bff/modules/pandora/orderCore/service.js +0 -35
  124. package/cjs/bff/modules/pandora/orderCore/types.d.ts +0 -15
  125. package/cjs/bff/modules/pandora/orderQuery/service.d.ts +0 -35
  126. package/cjs/bff/modules/pandora/orderQuery/types.d.ts +0 -21
  127. package/esm/bff/modules/pandora/orderCore/service.d.ts +0 -23
  128. package/esm/bff/modules/pandora/orderCore/service.mjs +0 -28
  129. package/esm/bff/modules/pandora/orderCore/types.d.ts +0 -15
  130. package/esm/bff/modules/pandora/orderQuery/service.d.ts +0 -35
  131. package/esm/bff/modules/pandora/orderQuery/service.mjs +0 -44
  132. package/esm/bff/modules/pandora/orderQuery/types.d.ts +0 -21
  133. /package/cjs/bff/modules/{pandora/orderCore → miniprogram/auth}/types.js +0 -0
  134. /package/cjs/bff/modules/{pandora/orderQuery → miniprogram/franchisee}/types.js +0 -0
  135. /package/esm/bff/modules/{pandora/orderCore → miniprogram/auth}/types.mjs +0 -0
  136. /package/esm/bff/modules/{pandora/orderQuery → miniprogram/franchisee}/types.mjs +0 -0
@@ -0,0 +1,178 @@
1
+ import { StandardResponse } from '../../../../types';
2
+ import { PandoraCommonService } from '../common/types';
3
+ export declare namespace PandoraUserService {
4
+ namespace Request {
5
+ /**
6
+ * 创建账号
7
+ */
8
+ interface createAccount {
9
+ phone: string;
10
+ name: string;
11
+ password: string;
12
+ roleId: string;
13
+ storeIds: string[];
14
+ warehouseIds: string[];
15
+ extraRules?: string[];
16
+ operatorRoleId: string;
17
+ }
18
+ /**
19
+ * 更新账号
20
+ */
21
+ interface updateAccount {
22
+ bindId: string;
23
+ name?: string;
24
+ storeIds?: string[];
25
+ warehouseIds?: string[];
26
+ }
27
+ /**
28
+ * 删除账号
29
+ */
30
+ interface deleteAccount {
31
+ bindId: string;
32
+ }
33
+ /**
34
+ * 账号列表查询
35
+ */
36
+ interface accountList {
37
+ name?: string;
38
+ phone?: string;
39
+ roleId?: string;
40
+ pageIndex: number;
41
+ pageSize: number;
42
+ }
43
+ /**
44
+ * 获取用户信息
45
+ */
46
+ interface getUserInfo {
47
+ id: string;
48
+ }
49
+ /**
50
+ * 获取用户角色权限(用于用户管理页面编辑权限回显)
51
+ */
52
+ interface getUserRolePermissions {
53
+ userId: string;
54
+ roleId: string;
55
+ }
56
+ /**
57
+ * 获取用户角色下的门店下拉框选项
58
+ */
59
+ interface getStoreOptions {
60
+ name?: string;
61
+ }
62
+ }
63
+ namespace Response {
64
+ /**
65
+ * 创建账号响应
66
+ */
67
+ interface createAccount {
68
+ userId: string;
69
+ bindId: string;
70
+ }
71
+ /**
72
+ * 更新账号响应
73
+ */
74
+ interface updateAccount {
75
+ success: boolean;
76
+ }
77
+ /**
78
+ * 删除账号响应
79
+ */
80
+ interface deleteAccount {
81
+ success: boolean;
82
+ }
83
+ /**
84
+ * 账号列表项
85
+ */
86
+ interface accountListItem {
87
+ userId: string;
88
+ bindId: string;
89
+ name: string;
90
+ phone: string;
91
+ role: {
92
+ id: string;
93
+ name: string;
94
+ };
95
+ stores: Array<{
96
+ id: string;
97
+ name: string;
98
+ }>;
99
+ warehouses: Array<{
100
+ id: string;
101
+ name: string;
102
+ }>;
103
+ createdAt: number;
104
+ }
105
+ /**
106
+ * 账号列表响应
107
+ */
108
+ interface accountList {
109
+ list: accountListItem[];
110
+ total: number;
111
+ }
112
+ /**
113
+ * 获取用户信息响应
114
+ */
115
+ interface getUserInfo {
116
+ id: string;
117
+ username: string;
118
+ phone: string;
119
+ status: string;
120
+ unionId: string;
121
+ openId: string;
122
+ createdAt: number;
123
+ updatedAt: number;
124
+ }
125
+ /**
126
+ * 根据角色获取用户信息响应(从请求上下文获取 userId 和 roleId)
127
+ */
128
+ interface getUserInfoByRole {
129
+ id: string;
130
+ username: string;
131
+ phone: string;
132
+ status: string;
133
+ hasAllStore: boolean;
134
+ hasAllWarehouse: boolean;
135
+ stores?: Array<{
136
+ id: string;
137
+ name: string;
138
+ }>;
139
+ roles?: Array<{
140
+ id: string;
141
+ name: string;
142
+ }>;
143
+ warehouses?: Array<{
144
+ id: string;
145
+ name: string;
146
+ }>;
147
+ }
148
+ /**
149
+ * 获取用户角色权限响应(用于用户管理页面编辑权限回显)
150
+ * operatorUserId 和 operatorRoleId 从请求上下文获取
151
+ */
152
+ interface getUserRolePermissions {
153
+ rules: PandoraCommonService.Response.RuleNode[];
154
+ }
155
+ /**
156
+ * 获取用户角色下的门店下拉框选项响应
157
+ */
158
+ interface getStoreOptions {
159
+ stores: Array<{
160
+ id: string;
161
+ name: string;
162
+ }>;
163
+ }
164
+ }
165
+ /**
166
+ * User Controller 接口定义
167
+ */
168
+ interface UserController {
169
+ createAccount(request: Request.createAccount): Promise<StandardResponse<Response.createAccount>>;
170
+ updateAccount(request: Request.updateAccount): Promise<StandardResponse<Response.updateAccount>>;
171
+ deleteAccount(request: Request.deleteAccount): Promise<StandardResponse<Response.deleteAccount>>;
172
+ listAccounts(request: Request.accountList): Promise<StandardResponse<Response.accountList>>;
173
+ getUserInfo(request: Request.getUserInfo): Promise<StandardResponse<Response.getUserInfo>>;
174
+ getUserInfoByRole(): Promise<StandardResponse<Response.getUserInfoByRole>>;
175
+ getUserRolePermissions(request: Request.getUserRolePermissions): Promise<StandardResponse<Response.getUserRolePermissions>>;
176
+ getStoreOptions(request: Request.getStoreOptions): Promise<StandardResponse<Response.getStoreOptions>>;
177
+ }
178
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -117,6 +117,7 @@ class MiniProgramRequestStrategy extends BaseRequestStrategy {
117
117
  const requestId = headers['x-request-id'] || 'unknown';
118
118
  try {
119
119
  // 类型守卫,确保 wx 可用
120
+ // @ts-ignore
120
121
  const wxGlobal = typeof wx !== 'undefined' ? wx : null;
121
122
  if (!wxGlobal || !wxGlobal.request) {
122
123
  if (console?.error) {
package/cjs/enums.d.ts CHANGED
@@ -4,3 +4,4 @@
4
4
  */
5
5
  export { ENUM as PRODUCT_SERVICE_ENUM } from '@be-link/ecommerce-product-service-node-sdk/enum';
6
6
  export { ENUM as ROOM_SERVICE_ENUM } from '@be-link/ecommerce-client-backend-service-node-sdk/enum';
7
+ export { ENUM as PROMOTION_SERVICE_ENUM } from '@be-link/ecommerce-promotion-service-node-sdk/enum';
package/cjs/enums.js CHANGED
@@ -4,10 +4,13 @@
4
4
  * 集中管理所有第三方服务 SDK 的枚举和常量
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ROOM_SERVICE_ENUM = exports.PRODUCT_SERVICE_ENUM = void 0;
7
+ exports.PROMOTION_SERVICE_ENUM = exports.ROOM_SERVICE_ENUM = exports.PRODUCT_SERVICE_ENUM = void 0;
8
8
  // 商品服务枚举
9
9
  var enum_1 = require("@be-link/ecommerce-product-service-node-sdk/enum");
10
10
  Object.defineProperty(exports, "PRODUCT_SERVICE_ENUM", { enumerable: true, get: function () { return enum_1.ENUM; } });
11
11
  // 直播间枚举
12
12
  var enum_2 = require("@be-link/ecommerce-client-backend-service-node-sdk/enum");
13
13
  Object.defineProperty(exports, "ROOM_SERVICE_ENUM", { enumerable: true, get: function () { return enum_2.ENUM; } });
14
+ // 优惠券服务枚举
15
+ var enum_3 = require("@be-link/ecommerce-promotion-service-node-sdk/enum");
16
+ Object.defineProperty(exports, "PROMOTION_SERVICE_ENUM", { enumerable: true, get: function () { return enum_3.ENUM; } });
package/cjs/index.d.ts CHANGED
@@ -1,10 +1,21 @@
1
1
  import { PandoraExampleService } from './bff/modules/pandora/example/service';
2
2
  import { MiniProgramDemoService } from './bff/modules/miniprogram/demo/service';
3
+ import { MiniprogramAuthServiceClass } from './bff/modules/miniprogram/auth/service';
4
+ import { PandoraAuthService } from './bff/modules/pandora/auth/service';
5
+ import { PandoraBDService } from './bff/modules/pandora/bd/service';
6
+ import { PandoraBDMService } from './bff/modules/pandora/bdm/service';
7
+ import { PandoraCommonService } from './bff/modules/pandora/common/service';
8
+ import { PandoraRoleService } from './bff/modules/pandora/role/service';
9
+ import { PandoraStoreClerkService } from './bff/modules/pandora/storeClerk/service';
10
+ import { PandoraStoreManagerService } from './bff/modules/pandora/storeManager/service';
11
+ import { PandoraUserService } from './bff/modules/pandora/user/service';
3
12
  import { PandoraProductService } from './bff/modules/pandora/product/service';
4
13
  import { PandoraProductExpService } from './bff/modules/pandora/productExp/service';
5
14
  import { PandoraProductLiveService } from './bff/modules/pandora/productLive/service';
6
- import { PandoraOrderQueryService } from './bff/modules/pandora/orderQuery/service';
7
- import { PandoraOrderCoreService } from './bff/modules/pandora/orderCore/service';
15
+ import { PandoraCouponService } from './bff/modules/pandora/coupon/service';
16
+ import { PandoraRoomService } from './bff/modules/pandora/room/service';
17
+ import { PandoraFranchiseeService } from './bff/modules/pandora/franchisee/service';
18
+ import { MiniprogramFranchiseeService } from './bff/modules/miniprogram/franchisee/service';
8
19
  import { SdkOptions } from './types';
9
20
  /**
10
21
  * Pandora 平台 SDK(管理后台)
@@ -19,11 +30,26 @@ export declare class PandoraSDK {
19
30
  * Pandora 示例服务模块
20
31
  */
21
32
  example: PandoraExampleService;
33
+ auth: PandoraAuthService;
34
+ bd: PandoraBDService;
35
+ bdm: PandoraBDMService;
36
+ common: PandoraCommonService;
37
+ role: PandoraRoleService;
38
+ storeClerk: PandoraStoreClerkService;
39
+ storeManager: PandoraStoreManagerService;
40
+ user: PandoraUserService;
22
41
  product: PandoraProductService;
23
42
  productExp: PandoraProductExpService;
24
43
  productLive: PandoraProductLiveService;
25
- orderQuery: PandoraOrderQueryService;
26
- orderCore: PandoraOrderCoreService;
44
+ coupon: PandoraCouponService;
45
+ /**
46
+ * 直播间模块
47
+ */
48
+ room: PandoraRoomService;
49
+ /**
50
+ * 加盟商模块
51
+ */
52
+ franchisee: PandoraFranchiseeService;
27
53
  /**
28
54
  * 使用配置选项初始化 Pandora SDK
29
55
  * @param options - SDK 配置,包含凭证回调函数
@@ -43,6 +69,14 @@ export declare class MiniProgramSDK {
43
69
  * 小程序 Demo 服务模块
44
70
  */
45
71
  demo: MiniProgramDemoService;
72
+ /**
73
+ * 小程序认证服务模块
74
+ */
75
+ auth: MiniprogramAuthServiceClass;
76
+ /**
77
+ * 加盟商模块
78
+ */
79
+ franchisee: MiniprogramFranchiseeService;
46
80
  /**
47
81
  * 使用配置选项初始化小程序 SDK
48
82
  * @param options - SDK 配置,包含凭证回调函数
@@ -53,10 +87,20 @@ export { SdkError, BizError, SystemError } from './errors';
53
87
  export { SdkOptions, IRequestStrategy, StandardResponse } from './types';
54
88
  export * from './enums';
55
89
  export { Service as MiniProgramDemoTypes } from './bff/modules/miniprogram/demo/types';
90
+ export { MiniprogramAuthService as MiniprogramAuthServiceTypes } from './bff/modules/miniprogram/auth/types';
56
91
  export { Service as PandoraExampleTypes } from './bff/modules/pandora/example/types';
92
+ export { PandoraAuthService as PandoraAuthServiceTypes } from './bff/modules/pandora/auth/types';
93
+ export { PandoraBDService as PandoraBDServiceTypes } from './bff/modules/pandora/bd/types';
94
+ export { PandoraBDMService as PandoraBDMServiceTypes } from './bff/modules/pandora/bdm/types';
95
+ export { PandoraCommonService as PandoraCommonServiceTypes } from './bff/modules/pandora/common/types';
96
+ export { PandoraRoleService as PandoraRoleServiceTypes } from './bff/modules/pandora/role/types';
97
+ export { PandoraStoreClerkService as PandoraStoreClerkServiceTypes } from './bff/modules/pandora/storeClerk/types';
98
+ export { PandoraStoreManagerService as PandoraStoreManagerServiceTypes } from './bff/modules/pandora/storeManager/types';
99
+ export { PandoraUserService as PandoraUserServiceTypes } from './bff/modules/pandora/user/types';
57
100
  export { PandoraProductService as PandoraProductServiceTypes } from './bff/modules/pandora/product/types';
58
101
  export { PandoraProductExpService as PandoraProductExpServiceTypes } from './bff/modules/pandora/productExp/types';
59
102
  export { PandoraProductLiveService as PandoraProductLiveServiceTypes } from './bff/modules/pandora/productLive/types';
60
- export { PandoraOrderQueryService as PandoraOrderQueryServiceTypes } from './bff/modules/pandora/orderQuery/types';
61
- export { PandoraOrderCoreService as PandoraOrderCoreServiceTypes } from './bff/modules/pandora/orderCore/types';
62
103
  export { RoomService as PandoraRoomServiceTypes } from './bff/modules/pandora/room/types';
104
+ export { CouponService as PandoraCouponServiceTypes } from './bff/modules/pandora/coupon/types';
105
+ export { PandoraFranchiseeService as PandoraFranchiseeServiceTypes } from './bff/modules/pandora/franchisee/types';
106
+ export { MiniprogramFranchiseeService as MiniprogramFranchiseeServiceTypes } from './bff/modules/miniprogram/franchisee/types';
package/cjs/index.js CHANGED
@@ -18,11 +18,22 @@ exports.SystemError = exports.BizError = exports.SdkError = exports.MiniProgramS
18
18
  const client_1 = require("./bff/request/client");
19
19
  const service_1 = require("./bff/modules/pandora/example/service");
20
20
  const service_2 = require("./bff/modules/miniprogram/demo/service");
21
- const service_3 = require("./bff/modules/pandora/product/service");
22
- const service_4 = require("./bff/modules/pandora/productExp/service");
23
- const service_5 = require("./bff/modules/pandora/productLive/service");
24
- const service_6 = require("./bff/modules/pandora/orderQuery/service");
25
- const service_7 = require("./bff/modules/pandora/orderCore/service");
21
+ const service_3 = require("./bff/modules/miniprogram/auth/service");
22
+ const service_4 = require("./bff/modules/pandora/auth/service");
23
+ const service_5 = require("./bff/modules/pandora/bd/service");
24
+ const service_6 = require("./bff/modules/pandora/bdm/service");
25
+ const service_7 = require("./bff/modules/pandora/common/service");
26
+ const service_8 = require("./bff/modules/pandora/role/service");
27
+ const service_9 = require("./bff/modules/pandora/storeClerk/service");
28
+ const service_10 = require("./bff/modules/pandora/storeManager/service");
29
+ const service_11 = require("./bff/modules/pandora/user/service");
30
+ const service_12 = require("./bff/modules/pandora/product/service");
31
+ const service_13 = require("./bff/modules/pandora/productExp/service");
32
+ const service_14 = require("./bff/modules/pandora/productLive/service");
33
+ const service_15 = require("./bff/modules/pandora/coupon/service");
34
+ const service_16 = require("./bff/modules/pandora/room/service");
35
+ const service_17 = require("./bff/modules/pandora/franchisee/service");
36
+ const service_18 = require("./bff/modules/miniprogram/franchisee/service");
26
37
  /**
27
38
  * Pandora 平台 SDK(管理后台)
28
39
  * 包含所有 Pandora 平台相关的服务
@@ -37,11 +48,20 @@ class PandoraSDK {
37
48
  this.http = new client_1.HttpClient(options);
38
49
  // 使用 HttpClient 实例化所有 Pandora 服务模块
39
50
  this.example = new service_1.PandoraExampleService(this.http);
40
- this.product = new service_3.PandoraProductService(this.http);
41
- this.productExp = new service_4.PandoraProductExpService(this.http);
42
- this.productLive = new service_5.PandoraProductLiveService(this.http);
43
- this.orderQuery = new service_6.PandoraOrderQueryService(this.http);
44
- this.orderCore = new service_7.PandoraOrderCoreService(this.http);
51
+ this.auth = new service_4.PandoraAuthService(this.http);
52
+ this.bd = new service_5.PandoraBDService(this.http);
53
+ this.bdm = new service_6.PandoraBDMService(this.http);
54
+ this.common = new service_7.PandoraCommonService(this.http);
55
+ this.role = new service_8.PandoraRoleService(this.http);
56
+ this.storeClerk = new service_9.PandoraStoreClerkService(this.http);
57
+ this.storeManager = new service_10.PandoraStoreManagerService(this.http);
58
+ this.user = new service_11.PandoraUserService(this.http);
59
+ this.product = new service_12.PandoraProductService(this.http);
60
+ this.productExp = new service_13.PandoraProductExpService(this.http);
61
+ this.productLive = new service_14.PandoraProductLiveService(this.http);
62
+ this.room = new service_16.PandoraRoomService(this.http);
63
+ this.coupon = new service_15.PandoraCouponService(this.http);
64
+ this.franchisee = new service_17.PandoraFranchiseeService(this.http);
45
65
  }
46
66
  }
47
67
  exports.PandoraSDK = PandoraSDK;
@@ -59,6 +79,8 @@ class MiniProgramSDK {
59
79
  this.http = new client_1.HttpClient(options);
60
80
  // 使用 HttpClient 实例化所有小程序服务模块
61
81
  this.demo = new service_2.MiniProgramDemoService(this.http);
82
+ this.auth = new service_3.MiniprogramAuthServiceClass(this.http);
83
+ this.franchisee = new service_18.MiniprogramFranchiseeService(this.http);
62
84
  }
63
85
  }
64
86
  exports.MiniProgramSDK = MiniProgramSDK;
package/cjs/utils/env.js CHANGED
@@ -9,6 +9,7 @@ exports.getContainerService = getContainerService;
9
9
  * @returns 如果在微信小程序环境中运行则返回 true
10
10
  */
11
11
  function isMiniProgram() {
12
+ // @ts-ignore
12
13
  return typeof wx !== 'undefined' && !!wx.cloud;
13
14
  }
14
15
  /**
@@ -20,8 +21,8 @@ function getContainerHost(environment) {
20
21
  // 生产环境和测试环境使用不同的主机地址
21
22
  // TODO 生产url
22
23
  return environment === 'production'
23
- ? 'http://bxbvjnca.tfs.cwl9ok0a.mk2u3r3l.com:8090' // 生产环境
24
- : 'https://backend-bff-service-196345-5-1304510571.sh.run.tcloudbase.com'; // 测试环境
24
+ ? '' // 生产环境
25
+ : 'https://ecommerce-dev.wejourney.top/b-bff'; // 测试环境
25
26
  }
26
27
  /**
27
28
  * 根据环境获取微信云环境标识符
package/cjs/utils/http.js CHANGED
@@ -31,7 +31,7 @@ async function callApi(url, request) {
31
31
  console.error(`ecommerce-backend-bff-service 异常: ${axiosError.message},requestId: ${requestId}`);
32
32
  console.info('响应信息', data.message);
33
33
  console.error('异常堆栈', JSON.stringify(error.stack));
34
- throw new Error(data.errorType + ' - ' + data.message);
34
+ throw error;
35
35
  }
36
36
  console.error(`ecommerce-backend-bff-service 未知异常: ${axiosError.message}`, error.stack);
37
37
  throw error;
@@ -43,6 +43,7 @@ function generateUUID() {
43
43
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
44
44
  }
45
45
  // 降级方案 2:微信小程序环境(尝试使用 wx.getRandomValues)
46
+ // @ts-ignore
46
47
  if (typeof wx !== 'undefined' && typeof wx.getRandomValues === 'function') {
47
48
  try {
48
49
  const bytes = new Uint8Array(16);
@@ -0,0 +1,46 @@
1
+ import { MiniprogramAuthService as Service } from './types';
2
+ import BaseService from '../../BaseService';
3
+ import type { StandardResponse } from '../../../../types';
4
+ /**
5
+ * MiniprogramAuthService - 小程序认证服务模块
6
+ * 提供小程序认证相关的 API 方法
7
+ * 平台: miniprogram
8
+ */
9
+ export declare class MiniprogramAuthServiceClass extends BaseService implements Service.AuthController {
10
+ protected prefixUrl: string;
11
+ /**
12
+ * 小程序端获取用户菜单权限
13
+ * @returns Promise,解析为标准响应格式
14
+ */
15
+ getUserMenuPermissions(): Promise<StandardResponse<Service.Response.getUserMenuPermissions>>;
16
+ /**
17
+ * 获取微信UnionId
18
+ * @param request - 请求参数
19
+ * @returns Promise,解析为标准响应格式
20
+ */
21
+ getUnionId(request: Service.Request.getUnionId): Promise<StandardResponse<Service.Response.getUnionId>>;
22
+ /**
23
+ * UnionId登录
24
+ * @param request - 请求参数
25
+ * @returns Promise,解析为标准响应格式
26
+ */
27
+ unionIdLogin(request: Service.Request.unionIdLogin): Promise<StandardResponse<Service.Response.unionIdLogin>>;
28
+ /**
29
+ * 获取微信绑定手机号
30
+ * @param request - 请求参数
31
+ * @returns Promise,解析为标准响应格式
32
+ */
33
+ getBindPhone(request: Service.Request.getBindPhone): Promise<StandardResponse<Service.Response.getBindPhone>>;
34
+ /**
35
+ * 绑定手机号到UnionId
36
+ * @param request - 请求参数
37
+ * @returns Promise,解析为标准响应格式
38
+ */
39
+ unionIdBindPhone(request: Service.Request.bindPhoneToUnionId): Promise<StandardResponse<Service.Response.bindPhoneToUnionId>>;
40
+ /**
41
+ * 账号密码登录(新格式)
42
+ * @param request - 请求参数
43
+ * @returns Promise,解析为标准响应格式
44
+ */
45
+ accountLogin(request: Service.Request.accountLogin): Promise<StandardResponse<Service.Response.accountLogin>>;
46
+ }
@@ -0,0 +1,59 @@
1
+ import BaseService from '../../BaseService.mjs';
2
+ /**
3
+ * MiniprogramAuthService - 小程序认证服务模块
4
+ * 提供小程序认证相关的 API 方法
5
+ * 平台: miniprogram
6
+ */
7
+ export class MiniprogramAuthServiceClass extends BaseService {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.prefixUrl = '/miniprogram/auth';
11
+ }
12
+ /**
13
+ * 小程序端获取用户菜单权限
14
+ * @returns Promise,解析为标准响应格式
15
+ */
16
+ getUserMenuPermissions() {
17
+ return this.request(this.getUserMenuPermissions, {});
18
+ }
19
+ /**
20
+ * 获取微信UnionId
21
+ * @param request - 请求参数
22
+ * @returns Promise,解析为标准响应格式
23
+ */
24
+ getUnionId(request) {
25
+ return this.request(this.getUnionId, request);
26
+ }
27
+ /**
28
+ * UnionId登录
29
+ * @param request - 请求参数
30
+ * @returns Promise,解析为标准响应格式
31
+ */
32
+ unionIdLogin(request) {
33
+ return this.request(this.unionIdLogin, request);
34
+ }
35
+ /**
36
+ * 获取微信绑定手机号
37
+ * @param request - 请求参数
38
+ * @returns Promise,解析为标准响应格式
39
+ */
40
+ getBindPhone(request) {
41
+ return this.request(this.getBindPhone, request);
42
+ }
43
+ /**
44
+ * 绑定手机号到UnionId
45
+ * @param request - 请求参数
46
+ * @returns Promise,解析为标准响应格式
47
+ */
48
+ unionIdBindPhone(request) {
49
+ return this.request(this.unionIdBindPhone, request);
50
+ }
51
+ /**
52
+ * 账号密码登录(新格式)
53
+ * @param request - 请求参数
54
+ * @returns Promise,解析为标准响应格式
55
+ */
56
+ accountLogin(request) {
57
+ return this.request(this.accountLogin, request);
58
+ }
59
+ }
@@ -0,0 +1,133 @@
1
+ import { StandardResponse } from '../../../../types';
2
+ /**
3
+ * Miniprogram Auth Module Type Definitions
4
+ * 小程序认证模块类型定义
5
+ */
6
+ export declare namespace MiniprogramAuthService {
7
+ interface RoleItem {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ namespace Request {
12
+ /**
13
+ * 获取微信UnionId请求
14
+ */
15
+ interface getUnionId {
16
+ code: string;
17
+ }
18
+ /**
19
+ * UnionId登录请求
20
+ */
21
+ interface unionIdLogin {
22
+ unionId: string;
23
+ }
24
+ /**
25
+ * 获取微信绑定手机号请求
26
+ */
27
+ interface getBindPhone {
28
+ code: string;
29
+ }
30
+ /**
31
+ * 绑定手机号到UnionId请求
32
+ */
33
+ interface bindPhoneToUnionId {
34
+ openId: string;
35
+ unionId: string;
36
+ phone: string;
37
+ }
38
+ /**
39
+ * 账号密码登录请求(新格式)
40
+ */
41
+ interface accountLogin {
42
+ account: string;
43
+ password: string;
44
+ }
45
+ }
46
+ namespace Response {
47
+ /**
48
+ * 获取用户菜单权限响应
49
+ */
50
+ interface getUserMenuPermissions {
51
+ rules: Array<{
52
+ id: string;
53
+ name: string;
54
+ path: string;
55
+ isShow: number;
56
+ sort: number;
57
+ pid: string;
58
+ type: string;
59
+ icon: string;
60
+ status: string;
61
+ platform: string;
62
+ background: string;
63
+ ruleKey: string;
64
+ }>;
65
+ }
66
+ /**
67
+ * 获取微信UnionId响应
68
+ */
69
+ interface getUnionId {
70
+ openId: string;
71
+ unionId: string;
72
+ token: string;
73
+ }
74
+ /**
75
+ * UnionId登录响应
76
+ */
77
+ interface unionIdLogin {
78
+ code: 0 | 1;
79
+ msg: string;
80
+ token: string;
81
+ roles: RoleItem[];
82
+ }
83
+ type getBindPhone = string;
84
+ /**
85
+ * 绑定手机号到UnionId响应
86
+ */
87
+ interface bindPhoneToUnionId {
88
+ code: 0;
89
+ msg: string;
90
+ token: string;
91
+ roles: RoleItem[];
92
+ }
93
+ /**
94
+ * 账号密码登录响应(新格式)
95
+ */
96
+ interface accountLogin {
97
+ code: 0;
98
+ msg: string;
99
+ token: string;
100
+ roles: RoleItem[];
101
+ }
102
+ }
103
+ /**
104
+ * Miniprogram Auth Controller 接口定义
105
+ * 由 packages/server/src/api/controller/miniprogram/auth.ts 实现
106
+ */
107
+ interface AuthController {
108
+ /**
109
+ * 小程序端获取用户菜单权限
110
+ */
111
+ getUserMenuPermissions(): Promise<StandardResponse<Response.getUserMenuPermissions>>;
112
+ /**
113
+ * 获取微信UnionId
114
+ */
115
+ getUnionId(request: Request.getUnionId): Promise<StandardResponse<Response.getUnionId>>;
116
+ /**
117
+ * UnionId登录
118
+ */
119
+ unionIdLogin(request: Request.unionIdLogin): Promise<StandardResponse<Response.unionIdLogin>>;
120
+ /**
121
+ * 获取微信绑定手机号
122
+ */
123
+ getBindPhone(request: Request.getBindPhone): Promise<StandardResponse<Response.getBindPhone>>;
124
+ /**
125
+ * 绑定手机号到UnionId
126
+ */
127
+ unionIdBindPhone(request: Request.bindPhoneToUnionId): Promise<StandardResponse<Response.bindPhoneToUnionId>>;
128
+ /**
129
+ * 账号密码登录(新格式)
130
+ */
131
+ accountLogin(request: Request.accountLogin): Promise<StandardResponse<Response.accountLogin>>;
132
+ }
133
+ }
@@ -0,0 +1,12 @@
1
+ import { MiniprogramFranchiseeService as Service } from './types';
2
+ import BaseService from '../../BaseService';
3
+ import type { StandardResponse } from '../../../../types';
4
+ /**
5
+ * MiniprogramFranchiseeService - Miniprogram Franchisee 服务模块
6
+ * 提供 Miniprogram Franchisee 相关的 API 方法
7
+ * 平台: miniprogram
8
+ */
9
+ export declare class MiniprogramFranchiseeService extends BaseService implements Service.FranchiseeController {
10
+ protected prefixUrl: string;
11
+ getFranchiseeIdByUserId(request: Service.Request.getFranchiseeIdByUserId): Promise<StandardResponse<Service.Response.getFranchiseeIdByUserId>>;
12
+ }