Commit 8d123705 by 宋毅

tj

parent 083c850b
......@@ -4,6 +4,7 @@ class AccessAuthAPI extends APIBase {
constructor() {
super();
this.opPlatformUtils = system.getObject("util.businessManager.opPlatformUtils");
this.appmobilemsgSve = system.getObject("service.dbapp.appmobilemsgSve");
}
async getTokenByHosts(pobj, qobj, req) {
......@@ -15,7 +16,20 @@ class AccessAuthAPI extends APIBase {
if (!pobj.actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !");
}
var result = await this.opPlatformUtils.fetchDefaultVCode(pobj.actionBody.mobile, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
var itemResult = await this.appmobilemsgSve.getItemByUappId(pobj);
var result = system.getResult(null, "get msg error");
if (itemResult.status != 0) {
result = await this.opPlatformUtils.fetchDefaultVCode(pobj.actionBody.mobile, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
return result;
}
var param = {
mobile: pobj.actionBody.mobile,
tmplCode: itemResult.data.tmpl_code,
signName: itemResult.data.sign_name,
accessKeyId: itemResult.data.access_key_id,
accessKeySecret: itemResult.data.access_key_secret
}
result = await this.fetchOtherVCode(param, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
return result;
}
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class AppMobileMsgDao extends Dao {
constructor() {
super(Dao.getModelName(AppMobileMsgDao));
}
async getItemByUAppId(uapp_id) {
return this.model.findOne({
where: {
uapp_id: uapp_id
},
raw: true
});
}
}
module.exports = AppMobileMsgDao;
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("appmobilemsg", {
uapp_id: DataTypes.STRING(50),
tmpl_code: DataTypes.STRING(64), //短信模板code
sign_name: DataTypes.STRING(64), //短信签名
access_key_id: DataTypes.STRING(64),//短信秘钥key
is_enabled: { //状态 0禁用 1启用
type: DataTypes.BOOLEAN,
defaultValue: true,
},
access_key_secret: DataTypes.STRING(255), //短信秘钥
notes: DataTypes.STRING(255),
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
tableName: 'p_app_mobilemsg',
validate: {
},
indexes: [
]
});
}
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class AppMobileMsgService extends ServiceBase {
constructor() {
super("dbapp", ServiceBase.getDaoName(AppMobileMsgService));
}
async getItemByUappId(pobj) {
var item = await this.dao.getItemByUAppId(pobj.appInfo.uapp_id);
if (!item) {
return system.getResult(null, "Data is empty!");
}
return system.getResultSuccess(item);
}
}
module.exports = AppMobileMsgService;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment