mm_dbs 1.0.1 → 1.0.2
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.
- package/lib/db.js +22 -2
- package/package.json +1 -1
package/lib/db.js
CHANGED
|
@@ -5,7 +5,7 @@ const { string, array, object, file } = require('mm_helper');
|
|
|
5
5
|
|
|
6
6
|
/** 关键词搜索默认SQL模板(用户表关联查询) */
|
|
7
7
|
const KEYWORD_DEFAULT =
|
|
8
|
-
"`user_id` in (SELECT `user_id` FROM `
|
|
8
|
+
"`user_id` in (SELECT `user_id` FROM `sys_user` WHERE `nickname` LIKE '%{0}%' OR `phone` LIKE '%{0}%' OR `wallet_address` LIKE '%{0}%')";
|
|
9
9
|
|
|
10
10
|
/** 关键词搜索默认提示 */
|
|
11
11
|
const KEYWORD_DEFAULT_TIP = '昵称、手机号、钱包地址';
|
|
@@ -970,13 +970,33 @@ Db.prototype._getEventApi = function () {
|
|
|
970
970
|
if (typeof getter === 'function') {
|
|
971
971
|
return getter();
|
|
972
972
|
}
|
|
973
|
+
var admin = this._getHostApiAdmin();
|
|
974
|
+
if (admin) {
|
|
975
|
+
return admin;
|
|
976
|
+
}
|
|
973
977
|
if (!this._event_api_warned) {
|
|
974
978
|
this._event_api_warned = true;
|
|
975
|
-
this.log('warn', '未配置 get_event_api
|
|
979
|
+
this.log('warn', '未配置 get_event_api 且宿主API管理器不可用,API目录判断使用默认路径');
|
|
976
980
|
}
|
|
977
981
|
return null;
|
|
978
982
|
};
|
|
979
983
|
|
|
984
|
+
/**
|
|
985
|
+
* 获取宿主API管理器工厂(未注入 get_event_api 时的回退)
|
|
986
|
+
* @returns {object|null} 支持按作用域取管理器的工厂;宿主不可用时返回null
|
|
987
|
+
* @private
|
|
988
|
+
*/
|
|
989
|
+
Db.prototype._getHostApiAdmin = function () {
|
|
990
|
+
var manager = this.parent;
|
|
991
|
+
var server = manager && typeof manager.getServer === 'function' ? manager.getServer() : null;
|
|
992
|
+
var container = server && server.container;
|
|
993
|
+
if (!container) {
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
var factory = container.get('api_admin');
|
|
997
|
+
return factory && typeof factory.get === 'function' ? factory : null;
|
|
998
|
+
};
|
|
999
|
+
|
|
980
1000
|
/**
|
|
981
1001
|
* 处理配置文件
|
|
982
1002
|
* @param {string} f 文件路径
|