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
e2fdfef5
Commit
e2fdfef5
authored
Jul 01, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
66a97040
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
65 deletions
+44
-65
esign-sve-merchant/app/base/db/impl/account/accountDao.js
+42
-43
esign-sve-merchant/app/base/db/impl/merchant/merchantDao.js
+1
-21
esign-sve-merchant/app/base/service/impl/merchant/merchantSve.js
+1
-1
No files found.
esign-sve-merchant/app/base/db/impl/account/accountDao.js
View file @
e2fdfef5
...
@@ -2,55 +2,54 @@ const system = require("../../../system");
...
@@ -2,55 +2,54 @@ const system = require("../../../system");
const
Dao
=
require
(
"../../dao.base"
);
const
Dao
=
require
(
"../../dao.base"
);
class
AccountDao
extends
Dao
{
class
AccountDao
extends
Dao
{
constructor
()
{
constructor
()
{
super
(
Dao
.
getModelName
(
AccountDao
));
super
(
Dao
.
getModelName
(
AccountDao
));
}
async
incrementBalance
(
id
,
balance
,
t
)
{
let
sql
=
[];
sql
.
push
(
"UPDATE"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"SET"
);
sql
.
push
(
"balance = balance + :balance"
);
sql
.
push
(
"WHERE id = :id AND balance + :balance >= 0"
);
let
res
=
await
this
.
customUpdate
(
sql
.
join
(
" "
),
{
id
:
id
,
balance
:
balance
},
t
);
console
.
log
(
res
);
if
(
res
.
length
<
2
)
{
return
0
;
}
}
return
res
[
1
]
||
0
;
}
async
listByIds
(
ids
,
attrs
)
{
async
incrementBalance
(
id
,
balance
,
t
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
let
sql
=
[];
return
[];
sql
.
push
(
"UPDATE"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"SET"
);
sql
.
push
(
"balance = balance + :balance"
);
sql
.
push
(
"WHERE id = :id AND balance + :balance >= 0"
);
let
res
=
await
this
.
customUpdate
(
sql
.
join
(
" "
),
{
id
:
id
,
balance
:
balance
},
t
);
console
.
log
(
res
);
if
(
res
.
length
<
2
)
{
return
0
;
}
return
res
[
1
]
||
0
;
}
}
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
attrs
||
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
})
||
[];
}
async
mapByIds
(
ids
,
attrs
)
{
async
listByIds
(
ids
,
attrs
)
{
var
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
return
result
;
}
}
var
sql
=
[];
var
list
=
await
this
.
findListByIds
(
ids
,
attrs
);
sql
.
push
(
"SELECT"
);
if
(
!
list
||
list
.
length
==
0
)
{
sql
.
push
(
attrs
||
"*"
);
return
result
;
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
})
||
[];
}
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
async
mapByIds
(
ids
,
attrs
)
{
var
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
var
list
=
await
this
.
listByIds
(
ids
,
attrs
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
}
...
...
esign-sve-merchant/app/base/db/impl/merchant/merchantDao.js
View file @
e2fdfef5
...
@@ -11,13 +11,11 @@ class MerchantDao extends Dao {
...
@@ -11,13 +11,11 @@ class MerchantDao extends Dao {
return
list
||
[];
return
list
||
[];
}
}
async
findMapByIds
(
ids
,
attrs
)
{
async
findMapByIds
(
ids
,
attrs
)
{
var
result
=
[]
;
var
result
=
{}
;
if
(
!
ids
||
ids
.
length
==
0
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
return
result
;
}
}
attrs
=
attrs
||
"*"
;
attrs
=
attrs
||
"*"
;
var
sql
=
"SELECT "
+
attrs
+
" FROM e_merchant where id IN (:ids) "
;
var
sql
=
"SELECT "
+
attrs
+
" FROM e_merchant where id IN (:ids) "
;
var
list
=
await
this
.
customQuery
(
sql
,
{
ids
:
ids
});
var
list
=
await
this
.
customQuery
(
sql
,
{
ids
:
ids
});
...
@@ -31,24 +29,6 @@ class MerchantDao extends Dao {
...
@@ -31,24 +29,6 @@ class MerchantDao extends Dao {
return
result
;
return
result
;
}
}
async
findMapInIds
(
ids
,
attrs
)
{
var
result
=
[];
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
attrs
=
attrs
||
"*"
;
var
sql
=
"SELECT "
+
attrs
+
" FROM e_merchant where id IN (:ids) "
;
var
list
=
await
this
.
customQuery
(
sql
,
{
ids
:
ids
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
return
list
;
}
}
}
module
.
exports
=
MerchantDao
;
module
.
exports
=
MerchantDao
;
esign-sve-merchant/app/base/service/impl/merchant/merchantSve.js
View file @
e2fdfef5
...
@@ -126,7 +126,7 @@ class MerchantService extends ServiceBase {
...
@@ -126,7 +126,7 @@ class MerchantService extends ServiceBase {
if
(
params
.
merchantIds
.
length
==
0
)
{
if
(
params
.
merchantIds
.
length
==
0
)
{
return
system
.
getResultFail
(
-
1
,
"请提供商户ID"
);
return
system
.
getResultFail
(
-
1
,
"请提供商户ID"
);
}
}
var
merchantMap
=
await
this
.
dao
.
findMap
In
Ids
(
params
.
merchantIds
);
var
merchantMap
=
await
this
.
dao
.
findMap
By
Ids
(
params
.
merchantIds
);
return
system
.
getResultSuccess
(
merchantMap
);
return
system
.
getResultSuccess
(
merchantMap
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
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