Commit 42544b26 by 王昆

gsb

parent 876fe197
...@@ -9,12 +9,17 @@ class MerchantUserCtl extends CtlBase { ...@@ -9,12 +9,17 @@ class MerchantUserCtl extends CtlBase {
constructor() { constructor() {
super(); super();
this.merchantSve = system.getObject("service.merchant.merchantSve"); this.merchantSve = system.getObject("service.merchant.merchantSve");
this.userSve = system.getObject("service.uc.userSve");
} }
async merchantOfList(params, pobj2, req) { async merchantOfList(params, pobj2, req) {
try { try {
return await this.merchantSve.merchantOfList(params); let res = await this.merchantSve.merchantOfList(params);
if (res.data && res.data.rows) {
await this.userSve.setRowsUser(res.data.rows, "bd_id", "bd");
}
return res;
} catch (error) { } catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`); return system.getResult(null, `系统错误 错误信息 ${error}`);
} }
...@@ -22,8 +27,12 @@ class MerchantUserCtl extends CtlBase { ...@@ -22,8 +27,12 @@ class MerchantUserCtl extends CtlBase {
async merchantOfInfo(params, pobj2, req) { async merchantOfInfo(params, pobj2, req) {
try { try {
params.merchant_id = req.body.merchant_id; params.id = params.merchant_id;
return await this.merchantSve.merchantOfInfo(params); let res = await this.merchantSve.merchantOfInfo(params);
if (res.data) {
await this.userSve.setRowsUser([res.data], "bd_id", "bd");
}
return res;
} catch (error) { } catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`); return system.getResult(null, `系统错误 错误信息 ${error}`);
} }
......
...@@ -56,12 +56,36 @@ class UserService extends ServiceBase { ...@@ -56,12 +56,36 @@ class UserService extends ServiceBase {
async mapByIds(params) { async mapByIds(params) {
try { try {
return await this.callms("sve_uc", "userMapByIds", params); let res = await this.callms("sve_uc", "userMapByIds", params);
if (res.status == 0) {
return res.data;
}
return {};
} catch (error) { } catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`); return system.getResult(null, `系统错误 错误信息 ${error}`);
} }
} }
async setRowsUser(rows, field, objectField) {
objectField = objectField || "user";
if (!rows || rows.length == 0 || !field) {
return;
}
let ids = [];
for (let item of rows) {
let id = Number(item[field] || 0);
if(!id) {
continue;
}
ids.push(id);
}
let map = await this.mapByIds({ids: ids});
for (let item of rows) {
item[objectField] = map[item[field]] || {};
}
}
async userDic(params) { async userDic(params) {
try { try {
return await this.callms("sve_uc", "userDic", params); return await this.callms("sve_uc", "userDic", params);
......
...@@ -197,7 +197,7 @@ class System { ...@@ -197,7 +197,7 @@ class System {
engine_sign: local + ":3574" + path, engine_sign: local + ":3574" + path,
// 用户服务 // 用户服务
sve_uc: local + ":3651" + path, sve_uc: dev + ":3651" + path,
// 商户服务 // 商户服务
sve_merchant: dev + ":3652" + path, sve_merchant: dev + ":3652" + path,
// 订单服务 // 订单服务
......
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