midway-fatcms 0.0.1-beta.31 → 0.0.1-beta.34

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.
@@ -185,5 +185,7 @@ exports.default = (appInfo) => {
185
185
  fatcmsScheduleService: true,
186
186
  // Excel导出文件的临时目录
187
187
  fatcmsExportExcelTmpFilePath: (0, path_1.join)((0, os_1.tmpdir)(), 'fatcms-export-excel'),
188
+ // 在某些场景下,只有一个workbench code。如果启用了此配置,则不再根据域名配置识别Workbench.
189
+ fatcmsTargetWorkbenchCode: null
188
190
  };
189
191
  };
@@ -69,7 +69,7 @@ class CrudProServiceBase {
69
69
  sqlCfgModel.executeSql = mssql;
70
70
  }
71
71
  const connection = await this.getTxConnectionBySqlCfg(sqlCfgModel);
72
- return await connection.query(sql, values);
72
+ return await connection.query(sqlCfgModel.executeSql, values);
73
73
  }
74
74
  getContextCfg() {
75
75
  return this.getExecuteContext().getContextCfg();
@@ -5,6 +5,7 @@ import { IScheduleService } from '../interface';
5
5
  export declare class WorkbenchService extends BaseService implements IScheduleService {
6
6
  ctx: Context;
7
7
  private curdProService;
8
+ private fatcmsTargetWorkbenchCode;
8
9
  clearCache(): void;
9
10
  runBySchedule(): Promise<void>;
10
11
  /**
@@ -134,6 +134,11 @@ let WorkbenchService = class WorkbenchService extends BaseService_1.BaseService
134
134
  if (asyncTaskWorkbenchCode && typeof asyncTaskWorkbenchCode === 'string') {
135
135
  return await this.getWorkbenchInfoByCode(asyncTaskWorkbenchCode);
136
136
  }
137
+ // 只有一个workbench的场景。对于后台系统。不需要配置域名的场景。
138
+ const fatcmsTargetWorkbenchCode = this.fatcmsTargetWorkbenchCode;
139
+ if (typeof fatcmsTargetWorkbenchCode === "string" && fatcmsTargetWorkbenchCode.length > 3) {
140
+ return await this.getWorkbenchInfoByCode(fatcmsTargetWorkbenchCode);
141
+ }
137
142
  //正式环境: 根据域名获取站点配置
138
143
  const host = this.getCurrentHost();
139
144
  const workbenchInfo = await this.getWorkbenchInfoByHost(host);
@@ -196,6 +201,10 @@ __decorate([
196
201
  (0, core_1.Inject)(),
197
202
  __metadata("design:type", CurdProService_1.CurdProService)
198
203
  ], WorkbenchService.prototype, "curdProService", void 0);
204
+ __decorate([
205
+ (0, core_1.Config)('fatcmsTargetWorkbenchCode'),
206
+ __metadata("design:type", String)
207
+ ], WorkbenchService.prototype, "fatcmsTargetWorkbenchCode", void 0);
199
208
  WorkbenchService = __decorate([
200
209
  (0, core_1.Provide)()
201
210
  ], WorkbenchService);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midway-fatcms",
3
- "version": "0.0.1-beta.31",
3
+ "version": "0.0.1-beta.34",
4
4
  "description": "This is a midway component sample",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",