Commit 4be04550 by zhaoxiqing

gsb

parent a0d524fa
...@@ -11,9 +11,10 @@ class TestApi { ...@@ -11,9 +11,10 @@ class TestApi {
constructor() { constructor() {
this.utilesignbaoSve = System.getObject("service.utilesignbaoSve"); this.utilesignbaoSve = System.getObject("service.utilesignbaoSve");
this.dkcontractSve = System.getObject("service.dkcontractSve"); this.dkcontractSve = System.getObject("service.dkcontractSve");
this.offlinecompanySve = System.getObject("service.offlinecompanySve")
} }
async testaes(obj) { async testaes(obj) {
let str = '{"channel_id": "11111", "platform_channel_id": "1asdqqwdwqdwqdwqddqdwq", "channel_merchant_id": "9", "origin_merchant_id": "xxxx", "data_id": "1209403539471060994"}'; let str = '{"channel_id": "11111", "platform_channel_id": "1asdqqwdwqdwqdwqddqdwq", "channel_merchant_id": "9", "origin_merchant_id": "xxxx", "data_id": "1209403539471060994"}';
console.log(`字符串: ${str}`); console.log(`字符串: ${str}`);
...@@ -93,14 +94,14 @@ class TestApi { ...@@ -93,14 +94,14 @@ class TestApi {
if (!sheets || sheets.length == 0) { if (!sheets || sheets.length == 0) {
return result; return result;
} }
var sheet = sheets[0]; var sheet = sheets[0];
if (!sheet || !sheet.data || sheet.data.length == 0) { if (!sheet || !sheet.data || sheet.data.length == 0) {
return result; return result;
} }
var rows = sheet.data; var rows = sheet.data;
for (var idx in rows) { for (var idx in rows) {
var cells = rows[idx]; var cells = rows[idx];
if (!cells || cells.length < 3) { if (!cells || cells.length < 3) {
...@@ -140,5 +141,11 @@ class TestApi { ...@@ -140,5 +141,11 @@ class TestApi {
} }
return uuid.join(''); return uuid.join('');
} }
async updatecreate (obj){
var ss = await this.offlinecompanySve.updateCreate(obj);
return ss;
}
} }
module.exports = TestApi; module.exports = TestApi;
\ No newline at end of file
const system=require("../../system");
const Dao=require("../dao.base");
class OfflinecompanyDao extends Dao{
constructor(){
super(Dao.getModelName(OfflinecompanyDao));
}
}
module.exports=OfflinecompanyDao;
const system=require("../../system");
const settings=require("../../../config/settings");
const uiconfig=system.getUiConfig2(settings.wxconfig.appId);
module.exports = (db, DataTypes) => {
return db.define("offlinecompany", {
company_name : DataTypes.STRING,
contact_man : DataTypes.STRING,
contact_mobile : DataTypes.STRING,
contact_email : DataTypes.STRING,
contact_addr : DataTypes.STRING,
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'c_offline_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}]
// }
]
});
}
const system=require("../../system");
const ServiceBase=require("../sve.base");
var settings=require("../../../config/settings");
class OfflinecompanyService extends ServiceBase{
constructor(){
super(ServiceBase.getDaoName(OfflinecompanyService));
}
async updateCreate(params){
var offlinecompany = await this.dao.findOne({company_name : params.company_name});
if(null != offlinecompany){
// params.id = offlinecompany.id;
// var saveId = await this.dao.update(params);
offlinecompany.contact_man = params.contact_man;
offlinecompany.contact_mobile = params.contact_mobile;
offlinecompany.contact_email = params.contact_email;
offlinecompany.contact_addr = params.contact_addr;
var updates = await offlinecompany.save();
if(updates.id > 0){
return updates;
}
return system.getErrResult2("修改失败");
}
var saves = await this.dao.create(params);
if(saves.id > 0){
return saves;
}
return system.getErrResult2("保存失败");
}
}
module.exports=OfflinecompanyService;
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