Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
9fa056e8
Commit
9fa056e8
authored
Jun 30, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
4be6526d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
28 deletions
+53
-28
esign-sve-merchant/app/base/api/impl/op/action.js
+10
-0
esign-sve-merchant/app/base/db/impl/merchant/merchantaccountDao.js
+5
-5
esign-sve-merchant/app/base/service/impl/merchant/merchantaccountSve.js
+22
-5
esign-sve-merchant/app/base/service/impl/merchant/merchanttradeSve.js
+14
-15
esign-sve-merchant/app/config/settings.js
+2
-3
No files found.
esign-sve-merchant/app/base/api/impl/op/action.js
View file @
9fa056e8
...
...
@@ -104,6 +104,16 @@ class ActionAPI extends APIBase {
case
"merchanttradesOfListAll"
:
opResult
=
await
this
.
merchanttradeSve
.
merchanttradesOfListAll
(
action_body
);
break
;
//商户余额
//余额
case
"accountbalance"
:
opResult
=
await
this
.
merchantaccountSve
.
accountbalance
(
action_body
);
break
;
//可用余额
case
"accountusablebalance"
:
opResult
=
await
this
.
merchantaccountSve
.
accountusablebalance
(
action_body
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
esign-sve-merchant/app/base/db/impl/merchant/merchantaccountDao.js
View file @
9fa056e8
...
...
@@ -6,14 +6,14 @@ class MerchantaccountDao extends Dao {
}
async
addtomerchantrmb
(
params
){
async
addtomerchantrmb
(
params
)
{
var
sql
=
[];
sql
.
push
(
"UPDATE"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"SET balance_amount = balance_amount
+ : amount
"
);
sql
.
push
(
"
AND available_amount = available_amount + :available_
amount"
);
sql
.
push
(
"WHERE merchant_id = :merchant_id"
)
return
await
this
.
custom
Query
(
sql
.
join
(
" "
),
params
);
sql
.
push
(
"SET balance_amount = balance_amount
+ :amount,
"
);
sql
.
push
(
"
available_amount = available_amount + :
amount"
);
sql
.
push
(
"WHERE merchant_id = :merchant_id"
)
;
return
await
this
.
custom
Update
(
sql
.
join
(
" "
),
params
);
}
}
...
...
esign-sve-merchant/app/base/service/impl/merchant/merchantaccountSve.js
View file @
9fa056e8
...
...
@@ -5,12 +5,29 @@ class MerchantaccountService extends ServiceBase {
super
(
"merchant"
,
ServiceBase
.
getDaoName
(
MerchantaccountService
));
}
async
addtomerchantrmb
(
merchant_id
,
amount
){
var
params
=
{
merchant_id
:
merchant_id
,
amount
:
amount
async
addtomerchantrmb
(
merchant_id
,
amount
)
{
return
await
this
.
dao
.
addtomerchantrmb
({
merchant_id
:
merchant_id
,
amount
:
amount
})
}
async
accountbalance
(
params
)
{
try
{
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
async
accountusablebalance
(
params
)
{
try
{
}
catch
(
e
)
{
console
.
log
(
e
);
}
return
this
.
dao
.
addtomerchantrmb
(
params
)
}
}
...
...
esign-sve-merchant/app/base/service/impl/merchant/merchanttradeSve.js
View file @
9fa056e8
...
...
@@ -75,6 +75,7 @@ class MerchanttradeService extends ServiceBase {
}
async
auditMerchanttrade
(
params
)
{
try
{
if
(
!
params
.
id
)
{
return
system
.
getResultFail
(
-
1
,
"请提供ID"
);
...
...
@@ -85,21 +86,19 @@ class MerchanttradeService extends ServiceBase {
if
(
params
.
audit_status
==
2
&&
!
params
.
audit_remark
)
{
return
system
.
getResultFail
(
-
1
,
"请输入失败原因"
);
}
var
rtn
=
await
this
.
dao
.
update
(
params
);
var
trades
=
await
this
.
dao
.
findById
(
params
.
id
);
var
account
=
await
this
.
merchantaccountSve
.
findOne
({
merchant_id
:
trades
.
merchant_id
});
if
(
account
&&
params
.
audit_status
==
1
)
{
this
.
merchantaccountSve
.
addtomerchantrmb
(
trades
.
merchant_id
,
trades
.
amount
);
}
else
{
await
this
.
merchantaccountSve
.
create
({
merchant_id
:
trades
.
merchant_id
,
balance_amount
:
trades
.
amount
,
available_amount
:
trades
.
amount
});
if
(
params
.
audit_status
==
1
)
{
var
trades
=
await
this
.
dao
.
findById
(
params
.
id
);
var
account
=
await
this
.
merchantaccountSve
.
findOne
({
merchant_id
:
trades
.
merchant_id
});
if
(
account
)
{
await
this
.
merchantaccountSve
.
addtomerchantrmb
(
trades
.
merchant_id
,
trades
.
amount
);
}
else
{
await
this
.
merchantaccountSve
.
create
({
merchant_id
:
trades
.
merchant_id
,
balance_amount
:
trades
.
amount
,
available_amount
:
trades
.
amount
});
}
}
return
system
.
getResultSuccess
(
rtn
);
}
catch
(
e
)
{
...
...
@@ -130,7 +129,7 @@ class MerchanttradeService extends ServiceBase {
var
page
=
await
this
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
,
attributes
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"
trade_time
"
],
null
);
this
.
handleDate
(
row
,
[
"
created_at"
,
"trade_time"
,
"updated_at
"
],
null
);
}
}
return
system
.
getResultSuccess
(
page
);
...
...
esign-sve-merchant/app/config/settings.js
View file @
9fa056e8
...
...
@@ -21,7 +21,7 @@ var settings = {
cacheprefix
:
"sjb"
,
usertimeout
:
3600
,
//单位秒
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
3
303
,
port
:
process
.
env
.
NODE_PORT
||
3
652
,
defaultPassWord
:
"987456"
,
paasUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
...
...
@@ -120,4 +120,4 @@ var settings = {
}
}
};
module
.
exports
=
settings
;
\ No newline at end of file
module
.
exports
=
settings
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment