Commit 46934cb4 by 王勇飞

pp

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