Commit 461010d4 by 王昆

gsb

parent 0271d767
......@@ -25,17 +25,12 @@ class ActionAPI extends APIBase {
} catch (error) {
console.log(error);
}
return result;
}
async handleRequest(action_process, action_type, action_body) {
var opResult = null;
switch (action_type) {
// 测试
case "test":
opResult = await this.accountSve.test(action_body);
break;
// 创建账户
case "accountCreate":
opResult = await this.accountSve.createAccount(action_body);
......@@ -44,6 +39,10 @@ class ActionAPI extends APIBase {
case "accountInfo":
opResult = await this.accountSve.accountInfo(action_body);
break;
// 账户余额查询
case "accountBulkInfo":
opResult = await this.accountSve.accountBulkInfo(action_body);
break;
// 账户充值
case "accountRecharge":
opResult = await this.accountSve.accountRecharge(action_body);
......@@ -58,9 +57,8 @@ class ActionAPI extends APIBase {
case "accountTradePage":
opResult = await this.accountSve.accountTradePage(action_body);
break;
// 账户交易
case "test4":
opResult = await this.accountSve.test(action_body);
case "tradeMapByIds":
opResult = await this.accountSve.tradeMapByIds(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......
......@@ -41,7 +41,7 @@ class AccountDao extends Dao {
if (!ids || ids.length == 0) {
return result;
}
var list = await this.findListByIds(ids, attrs);
var list = await this.listByIds(ids, attrs);
if (!list || list.length == 0) {
return result;
}
......
......@@ -26,7 +26,7 @@ class AccountTradeDao extends Dao {
if (!ids || ids.length == 0) {
return result;
}
var list = await this.findListByIds(ids, attrs);
var list = await this.listByIds(ids, attrs);
if (!list || list.length == 0) {
return result;
}
......
......@@ -11,6 +11,7 @@ class AccountService extends ServiceBase {
async createAccount(params) {
let app_id = this.trim(params.app_id);
let app_data_id = this.trim(params.app_data_id);
let balance = Number(params.balance || 0);
let apps = this.dictionary.getDict("APP", "app_id") || {};
if (!apps[app_id]) {
......@@ -29,7 +30,7 @@ class AccountService extends ServiceBase {
autoIncrement: true,
app_id: app_id,
app_data_id: app_data_id,
balance: 0,
balance: balance,
});
return system.getResultSuccess({account_id: account.id});
}
......@@ -39,6 +40,12 @@ class AccountService extends ServiceBase {
return system.getResultSuccess(account);
}
async accountBulkInfo(params) {
let ids = params.account_ids || [];
let map = await this.dao.mapByIds(ids, params.attrs);
return system.getResultSuccess(map);
}
async accountRecharge(params) {
let p = {trade_type: 2};
p.account_id = params.account_id;
......@@ -160,6 +167,11 @@ class AccountService extends ServiceBase {
async test(params) {
return system.getResultSuccess("test");
}
async tradeMapByIds(params) {
let map = await this.accounttradeDao.mapByIds(params.ids, params.attrs);
return system.getResultSuccess(map);
}
}
module.exports = AccountService;
......
......@@ -4,7 +4,7 @@ class Dictionary {
constructor() {
// 交易字典
this.APP = {
app_id: {"100001": "电子平台", "10000x": "xxxxxxxxxx"},
app_id: {"100001": "电子签约平台-订单账户", "10000x": "xxxxxxxxxx"},
};
this.ACCOUNT_TRADE = {
trade_type: {1: "交易", 2: "充值", 3: "退款"}
......
......@@ -6,7 +6,7 @@ var settings={
db:10,
},
database:{
dbname : "bpo_fee",
dbname : "engine-fee",
user: "write",
password: "write",
config: {
......
......@@ -21,7 +21,7 @@ var settings = {
cacheprefix: "sjb",
usertimeout: 3600, //单位秒
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 3300,
port: process.env.NODE_PORT || 3572,
defaultPassWord: "987456",
paasUrl: function () {
if (this.env == "dev") {
......
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