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,
......@@ -77,46 +88,46 @@ module.exports = (db, DataTypes) => {
defaultValue: false
}
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_user',
validate: {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_user',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
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,54 +26,61 @@ 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,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_company',
validate: {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'p_company',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
......@@ -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