@pisell/pisellos 2.2.93 → 2.2.94

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 (69) hide show
  1. package/dist/core/index.d.ts +0 -1
  2. package/dist/core/index.js +0 -7
  3. package/dist/modules/Customer/index.d.ts +0 -1
  4. package/dist/modules/Customer/index.js +12 -28
  5. package/dist/plugins/app-types/app/app.d.ts +1 -0
  6. package/dist/server/index.d.ts +55 -5
  7. package/dist/server/index.js +832 -236
  8. package/dist/server/modules/index.d.ts +6 -0
  9. package/dist/server/modules/index.js +7 -0
  10. package/dist/server/modules/order/index.d.ts +87 -0
  11. package/dist/server/modules/order/index.js +916 -0
  12. package/dist/server/modules/order/types.d.ts +530 -0
  13. package/dist/server/modules/order/types.js +141 -0
  14. package/dist/server/modules/order/utils/filterBookings.d.ts +6 -0
  15. package/dist/server/modules/order/utils/filterBookings.js +350 -0
  16. package/dist/server/modules/order/utils/filterOrders.d.ts +15 -0
  17. package/dist/server/modules/order/utils/filterOrders.js +226 -0
  18. package/dist/server/modules/products/index.d.ts +24 -19
  19. package/dist/server/modules/products/index.js +600 -429
  20. package/dist/server/modules/products/types.d.ts +0 -1
  21. package/dist/server/modules/resource/index.d.ts +88 -0
  22. package/dist/server/modules/resource/index.js +1202 -0
  23. package/dist/server/modules/resource/types.d.ts +121 -0
  24. package/dist/server/modules/resource/types.js +47 -0
  25. package/dist/server/utils/product.d.ts +0 -4
  26. package/dist/server/utils/product.js +0 -34
  27. package/dist/solution/BookingTicket/index.d.ts +1 -1
  28. package/dist/solution/Sales/index.d.ts +96 -0
  29. package/dist/solution/Sales/index.js +510 -0
  30. package/dist/solution/Sales/types.d.ts +65 -0
  31. package/dist/solution/Sales/types.js +26 -0
  32. package/dist/solution/index.d.ts +1 -0
  33. package/dist/solution/index.js +2 -1
  34. package/dist/types/index.d.ts +0 -2
  35. package/lib/core/index.d.ts +0 -1
  36. package/lib/core/index.js +0 -4
  37. package/lib/modules/Customer/index.d.ts +0 -1
  38. package/lib/modules/Customer/index.js +6 -21
  39. package/lib/plugins/app-types/app/app.d.ts +1 -0
  40. package/lib/server/index.d.ts +55 -5
  41. package/lib/server/index.js +350 -28
  42. package/lib/server/modules/index.d.ts +6 -0
  43. package/lib/server/modules/index.js +16 -2
  44. package/lib/server/modules/order/index.d.ts +87 -0
  45. package/lib/server/modules/order/index.js +543 -0
  46. package/lib/server/modules/order/types.d.ts +530 -0
  47. package/lib/server/modules/order/types.js +34 -0
  48. package/lib/server/modules/order/utils/filterBookings.d.ts +6 -0
  49. package/lib/server/modules/order/utils/filterBookings.js +320 -0
  50. package/lib/server/modules/order/utils/filterOrders.d.ts +15 -0
  51. package/lib/server/modules/order/utils/filterOrders.js +197 -0
  52. package/lib/server/modules/products/index.d.ts +24 -19
  53. package/lib/server/modules/products/index.js +150 -151
  54. package/lib/server/modules/products/types.d.ts +0 -1
  55. package/lib/server/modules/resource/index.d.ts +88 -0
  56. package/lib/server/modules/resource/index.js +571 -0
  57. package/lib/server/modules/resource/types.d.ts +121 -0
  58. package/lib/server/modules/resource/types.js +35 -0
  59. package/lib/server/utils/product.d.ts +0 -4
  60. package/lib/server/utils/product.js +0 -27
  61. package/lib/solution/BookingTicket/index.d.ts +1 -1
  62. package/lib/solution/Sales/index.d.ts +96 -0
  63. package/lib/solution/Sales/index.js +358 -0
  64. package/lib/solution/Sales/types.d.ts +65 -0
  65. package/lib/solution/Sales/types.js +35 -0
  66. package/lib/solution/index.d.ts +1 -0
  67. package/lib/solution/index.js +3 -1
  68. package/lib/types/index.d.ts +0 -2
  69. package/package.json +1 -1
@@ -29,7 +29,6 @@ declare class PisellOSCore implements PisellCore {
29
29
  getModuleExports<T = any>(name: string): T | null;
30
30
  hasModule(name: string): boolean;
31
31
  destroy(): Promise<void>;
32
- setContext(ctx: Partial<BusinessContext>): void;
33
32
  /**
34
33
  * 验证上下文参数
35
34
  */
@@ -403,13 +403,6 @@ var PisellOSCore = /*#__PURE__*/function () {
403
403
  }
404
404
  return destroy;
405
405
  }()
406
- }, {
407
- key: "setContext",
408
- value: function setContext(ctx) {
409
- this.context = _objectSpread(_objectSpread({}, this.context), ctx);
410
- this.log("\u4E0A\u4E0B\u6587\u5DF2\u66F4\u65B0: ".concat(JSON.stringify(Object.keys(ctx))));
411
- }
412
-
413
406
  /**
414
407
  * 验证上下文参数
415
408
  */
@@ -9,7 +9,6 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
9
9
  private cacheId;
10
10
  private openCache;
11
11
  private fatherModule;
12
- private otherParams;
13
12
  constructor(name?: string, version?: string);
14
13
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
14
  /**
@@ -56,7 +56,6 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
56
56
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
57
57
  _defineProperty(_assertThisInitialized(_this), "openCache", false);
58
58
  _defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
59
- _defineProperty(_assertThisInitialized(_this), "otherParams", {});
60
59
  return _this;
61
60
  }
62
61
  _createClass(CustomerModule, [{
@@ -71,7 +70,6 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
71
70
  this.core = core;
72
71
  this.store = options === null || options === void 0 ? void 0 : options.store;
73
72
  this.request = this.core.getPlugin('request');
74
- this.otherParams = (options === null || options === void 0 ? void 0 : options.otherParams) || {};
75
73
 
76
74
  // 初始化状态
77
75
  if (Array.isArray(options === null || options === void 0 || (_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.customerList)) {
@@ -114,7 +112,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
114
112
  if (options !== null && options !== void 0 && (_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
115
113
  this.fatherModule = options.otherParams.fatherModule;
116
114
  }
117
- case 14:
115
+ case 13:
118
116
  case "end":
119
117
  return _context.stop();
120
118
  }
@@ -134,7 +132,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
134
132
  key: "fetchCustomerListData",
135
133
  value: (function () {
136
134
  var _fetchCustomerListData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
137
- var _this$otherParams, _res$data, _this$otherParams2, _customerList2, _res$data2;
135
+ var _res$data, _res$data2;
138
136
  var params,
139
137
  url,
140
138
  _params$skip,
@@ -142,21 +140,16 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
142
140
  _params$num,
143
141
  num,
144
142
  search,
145
- _otherParams,
143
+ otherParams,
146
144
  queryParams,
147
145
  res,
148
- _customerList,
149
- _customerList3,
150
146
  _args2 = arguments;
151
147
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
152
148
  while (1) switch (_context2.prev = _context2.next) {
153
149
  case 0:
154
150
  params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
155
- url = '/customer/select-list'; // 如果是加盟子店铺,则使用加盟商的客户列表接口
156
- if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.isFranchisee) {
157
- url = '/franchisee/customer/select-list';
158
- }
159
- _params$skip = params.skip, skip = _params$skip === void 0 ? 1 : _params$skip, _params$num = params.num, num = _params$num === void 0 ? DEFAULT_PAGE_SIZE : _params$num, search = params.search, _otherParams = _objectWithoutProperties(params, _excluded);
151
+ url = '/customer/select-list';
152
+ _params$skip = params.skip, skip = _params$skip === void 0 ? 1 : _params$skip, _params$num = params.num, num = _params$num === void 0 ? DEFAULT_PAGE_SIZE : _params$num, search = params.search, otherParams = _objectWithoutProperties(params, _excluded);
160
153
  queryParams = _objectSpread(_objectSpread({
161
154
  skip: skip,
162
155
  num: num,
@@ -166,38 +159,29 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
166
159
  search_wallet_pass_flag: 1
167
160
  }, search && {
168
161
  search: search
169
- }), _otherParams);
170
- _context2.next = 7;
162
+ }), otherParams);
163
+ _context2.next = 6;
171
164
  return this.request.get(url, queryParams, {
172
165
  cache: {
173
166
  mode: RequestModeENUM.REMOTE_LOCAL,
174
167
  type: "memory"
175
168
  }
176
169
  });
177
- case 7:
170
+ case 6:
178
171
  res = _context2.sent;
179
172
  if (!((res === null || res === void 0 ? void 0 : res.code) !== 200)) {
180
- _context2.next = 10;
173
+ _context2.next = 9;
181
174
  break;
182
175
  }
183
176
  throw new Error(res === null || res === void 0 ? void 0 : res.message);
184
- case 10:
185
- // 如果是加盟子店铺,查询的接口返回的数据都是总店的客户数据,需要加上标识
186
- _customerList = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
187
- if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.isFranchisee && ((_customerList2 = _customerList) === null || _customerList2 === void 0 ? void 0 : _customerList2.length) > 0) {
188
- _customerList = (_customerList3 = _customerList) === null || _customerList3 === void 0 ? void 0 : _customerList3.map(function (item) {
189
- return _objectSpread(_objectSpread({}, item || {}), {}, {
190
- is_franchisor_customer: 1 // 标识是总店的客户
191
- });
192
- });
193
- }
177
+ case 9:
194
178
  return _context2.abrupt("return", {
195
- customerList: _customerList,
179
+ customerList: (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [],
196
180
  total: (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.count) || 0,
197
181
  page: skip,
198
182
  pageSize: num
199
183
  });
200
- case 13:
184
+ case 10:
201
185
  case "end":
202
186
  return _context2.stop();
203
187
  }
@@ -63,6 +63,7 @@ declare class App {
63
63
  pubsub: import("../pubsub").PubSub;
64
64
  tasksManager: TasksManager;
65
65
  dbManager: IndexDBManager | null;
66
+ sqlite: any;
66
67
  constants: {
67
68
  channel: string;
68
69
  [key: string]: string;
@@ -2,8 +2,10 @@ import { ProductsModule } from './modules/products';
2
2
  import { MenuModule } from './modules/menu';
3
3
  import { QuotationModule } from './modules/quotation';
4
4
  import { ScheduleModuleEx } from './modules/schedule';
5
+ import { ResourceModule } from './modules/resource';
5
6
  import { PisellCore, ServerModuleConfig, InitializeServerOptions } from '../types';
6
7
  import type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryConfig, RequestSetting } from './types';
8
+ import { OrderModule } from './modules/order';
7
9
  export type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryConfig, };
8
10
  /**
9
11
  * Server 类
@@ -17,8 +19,12 @@ declare class Server {
17
19
  menu?: MenuModule;
18
20
  quotation?: QuotationModule;
19
21
  schedule?: ScheduleModuleEx;
22
+ resource?: ResourceModule;
23
+ order?: OrderModule;
20
24
  router: Router;
21
25
  private productQuerySubscribers;
26
+ private orderQuerySubscribers;
27
+ private bookingQuerySubscribers;
22
28
  private moduleRegistry;
23
29
  constructor(core: PisellCore);
24
30
  /**
@@ -151,21 +157,65 @@ declare class Server {
151
157
  * 取消商品查询订阅(HTTP 路由入口)
152
158
  */
153
159
  private handleUnsubscribeProductQuery;
160
+ /**
161
+ * 处理订单列表查询
162
+ * 存储订阅者信息,本地计算结果;数据变更时通过 callback 推送
163
+ */
164
+ private handleOrderList;
165
+ /**
166
+ * 取消订单列表查询订阅(HTTP 路由入口)
167
+ */
168
+ private handleUnsubscribeOrderQuery;
169
+ /**
170
+ * 判断预约查询的 es_start_datetime_between 起始日期是否为今天
171
+ */
172
+ private isBookingQueryForToday;
173
+ /**
174
+ * 非今天的预约查询:通过真实 API 获取数据,再做 flattenOrdersToBookings 拆分
175
+ */
176
+ private fetchBookingListFromAPI;
177
+ /**
178
+ * 处理预约列表查询
179
+ * 今天:注册订阅者 + 本地数据筛选;非今天:清理订阅者 + 走真实 API
180
+ */
181
+ private handleBookingList;
182
+ /**
183
+ * 处理资源列表查询
184
+ * 转发到资源模块去
185
+ */
186
+ private handleResourceList;
187
+ /**
188
+ * 取消预约列表查询订阅(HTTP 路由入口)
189
+ */
190
+ private handleUnsubscribeBookingQuery;
191
+ /**
192
+ * 订单列表本地计算(编排 Order 模块)
193
+ * filter 逻辑暂为 mock,仅记录参数
194
+ */
195
+ private computeOrderQueryResult;
196
+ /**
197
+ * 预约列表本地计算(编排 Order 模块)
198
+ * 从订单中展开 bookings,再按条件筛选 + 分页
199
+ */
200
+ private computeBookingQueryResult;
154
201
  /**
155
202
  * 商品查询的核心计算逻辑(编排 Products、Menu、Schedule 模块)
156
203
  * 供 handleProductQuery 首次返回及 pubsub 变更推送复用
157
- * @param context 查询上下文
158
- * @param options 可选参数
159
- * @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
160
204
  */
161
205
  private computeProductQueryResult;
162
206
  /**
163
207
  * 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
164
208
  * 由 ProductsModule 的 onProductsSyncCompleted 事件触发
165
- * @param options 可选参数
166
- * @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
167
209
  */
168
210
  private recomputeAndNotifyProductQuery;
211
+ /**
212
+ * 订单数据变更后,遍历订阅者重新计算并通过 callback 推送
213
+ */
214
+ private recomputeAndNotifyOrderQuery;
215
+ /**
216
+ * 预约数据变更后,遍历订阅者重新计算并通过 callback 推送
217
+ */
218
+ private recomputeAndNotifyBookingQuery;
169
219
  /**
170
220
  * 根据餐牌配置过滤商品
171
221
  * @param products 所有商品列表