Commit de532279 by 王昆

gsb

parent 63a48587
......@@ -4,6 +4,7 @@ class MerchantCtl extends CtlBase {
constructor() {
super();
this.merchantSve = system.getObject("service.saas.merchantSve");
this.merchantuserSve = system.getObject("service.uc.merchantuserSve");
}
async dics(params, pobj2, req) {
......@@ -68,5 +69,31 @@ class MerchantCtl extends CtlBase {
}
}
async userInfo(params, pobj2, req) {
try {
return await this.merchantuserSve.info(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async userSave(params, pobj2, req) {
try {
return await this.merchantuserSve.save(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async userPage(params, pobj2, req) {
try {
let rs = await this.merchantuserSve.page(params);
await this.merchantSve.setMerchant(rs.data.rows);
return rs;
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = MerchantCtl;
\ No newline at end of file
......@@ -111,5 +111,24 @@ class MerchantService extends ServiceBase {
}
}
async setMerchant(rows) {
if (!rows || rows.length == 0) {
return;
}
let ids = [];
for(let row of rows) {
if(row.saas_merchant_id) {
ids.push(row.saas_merchant_id);
}
}
let map = await this.mapByIds({ids: ids, attrs: "id, name, short_name"}) || {};
map = map.data || {};
for(let row of rows) {
row.merchant = map[row.saas_merchant_id] || {};
}
}
}
module.exports = MerchantService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
class MerchantuserService extends ServiceBase {
constructor() {
super();
}
async save(params) {
try {
return await this.callms("uc", "merchantSave", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async info(params) {
try {
return await this.callms("uc", "merchantInfo", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async enabled(params) {
try {
return await this.callms("uc", "merchantEnabled", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async page(params) {
try {
return await this.callms("uc", "merchantPage", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async mapByIds(params) {
try {
return await this.callms("uc", "merchantMapByIds", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = MerchantuserService;
\ No newline at end of file
......@@ -5,6 +5,8 @@
1. [详情](#info)
1. [签约](#sign)
1. [签约列表](#signPage)
1. [商户账户](#userPage)
1. [账户编辑](#save)
## **<a name="dics"> 字典</a>**
......@@ -339,4 +341,128 @@
"data":
}
```
## **<a name="userPage"> 商户账户</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/userPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "10",
"saas_merchant_id": "", // 商户id
"realName": "李四", // 姓名
"ucname": "" // 账号
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 1,
"rows": [
{
"id": "", // 账户id
"saas_merchant_id": "", // 商户id
"ucname": "", // 账号
"mobile": "", // 手机号
"realName": "", // 姓名
"password": "", // 密码
"isEnabled": "", // 是否启用 0否 1是
"created_at": "", // 创建时间
// 商户信息
"merchant": {
"name": "", // 商户名称
"short_name": "", // 简称
}
}
]
},
"requestid": "a4c7b5ce853d45cda37fbd93c7360353"
}
```
## **<a name="userInfo"> 账号信息</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/userInfo]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": 39, // 账号id
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data":{
"id": "", // 账户id
"saas_merchant_id": "", // 商户id
"ucname": "", // 账号
"mobile": "", // 手机号
"realName": "", // 姓名
"password": "", // 密码
"isEnabled": "", // 是否启用 0否 1是
"created_at": "", // 创建时间
// 商户信息
"merchant": {
"name": "", // 商户名称
"short_name": "", // 简称
}
},
"requestid": "a4c7b5ce853d45cda37fbd93c7360353"
}
```
## **<a name="userSave"> 账号编辑</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/userSave]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": 39, // 账号id 0添加 其他修改
"saas_merchant_id": "1124761", // 商户id
"realName": "李四", // 姓名
"ucname": "lisi", // 账号
"mobile": "13555555555", // 手机号
"password": "78438f14c7c", // 密码
"isEnabled": 1
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {...},
"requestid": "a4c7b5ce853d45cda37fbd93c7360353"
}
```
\ No newline at end of file
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