Commit 46934cb4 by 王勇飞

pp

parent 770ccfd2
......@@ -20,7 +20,18 @@ module.exports = (db, DataTypes) => {
allowNull: true,
values: Object.keys(appconfig.pdict.sex),
},
mobile: DataTypes.STRING,
// mobile: DataTypes.STRING,
mobile: {
type: DataTypes.STRING,
allowNull: true,
set(value) {
this.setDataValue('mobile', system.encryptStr(value));
},
get() {
const resValue = system.decryptStr(this.getDataValue('mobile'));
return resValue ? resValue : null;
}
},
mail: {
type: DataTypes.STRING,
allowNull: true,
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig=system.getSysConfig();
const appconfig = system.getSysConfig();
module.exports = (db, DataTypes) => {
return db.define("company", {
code:{//存放简码
code: {//存放简码
type: DataTypes.STRING,
allowNull: true,
},
......@@ -26,13 +26,20 @@ module.exports = (db, DataTypes) => {
phone: {
type: DataTypes.STRING,
allowNull: true,
set(value) {
this.setDataValue('phone', system.encryptStr(value));
},
get() {
const resValue = system.decryptStr(this.getDataValue('phone'));
return resValue ? resValue : null;
}
},
licenseUrl: {
type: DataTypes.STRING,
allowNull: true,
},
orgJson: DataTypes.TEXT,//功能清
appids:DataTypes.STRING,
appids: DataTypes.STRING,
}, {
paranoid: true,//假的删除
underscored: true,
......
......@@ -60,7 +60,7 @@ class TxHandler {
params.salesmanOpcode = salesmanInfo.opath;
params.salesmanId = salesmanInfo.userId;
params.clerkName = salesmanInfo.userName;
params.clerkPhone = salesmanInfo.mobile;
params.clerkPhone = system.encryptStr(salesmanInfo.mobile);
params.servicerCode = salesmanInfo.compId
}
var rtn = await rc.execPost3({ "d": params }, requrl);
......
......@@ -304,7 +304,7 @@ class System {
*/
static encryptStr(opStr) {
if (!opStr) {
return "opStr is empty";
return "";
}
let keyHex = cryptoJS.enc.Utf8.parse(settings.encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(settings.encrypt_secret.substring(0, 8));
......@@ -317,7 +317,7 @@ class System {
*/
static decryptStr(opStr) {
if (!opStr) {
return "opStr is empty";
return "";
}
let keyHex = cryptoJS.enc.Utf8.parse(settings.encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(settings.encrypt_secret.substring(0, 8));
......
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