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
6b0b50c3
Commit
6b0b50c3
authored
Jun 06, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
15dc7119
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
0 deletions
+61
-0
bpo-web/app/base/db/dao.base.js
+25
-0
bpo-web/app/base/db/impl/lduserDao.js
+6
-0
bpo-web/app/base/db/impl/lduserbankDao.js
+14
-0
bpo-web/app/base/service/impl/lduserSve.js
+9
-0
bpo-web/app/base/service/impl/lduserbankSve.js
+7
-0
bpo-web/app/base/wxapplet/impl/ldApplet.js
+0
-0
No files found.
bpo-web/app/base/db/dao.base.js
View file @
6b0b50c3
...
@@ -186,6 +186,31 @@ class Dao{
...
@@ -186,6 +186,31 @@ class Dao{
}
}
return
this
.
db
.
query
(
sql
,
tmpParas
);
return
this
.
db
.
query
(
sql
,
tmpParas
);
}
}
async
customUpdate
(
sql
,
paras
,
t
)
{
var
tmpParas
=
null
;
if
(
t
&&
t
!=
'undefined'
)
{
if
(
paras
==
null
||
paras
==
'undefined'
)
{
tmpParas
=
{
type
:
this
.
db
.
QueryTypes
.
UPDATE
};
tmpParas
.
transaction
=
t
;
}
else
{
tmpParas
=
{
replacements
:
paras
,
type
:
this
.
db
.
QueryTypes
.
UPDATE
};
tmpParas
.
transaction
=
t
;
}
}
else
{
tmpParas
=
paras
==
null
||
paras
==
'undefined'
?
{
type
:
this
.
db
.
QueryTypes
.
UPDATE
}
:
{
replacements
:
paras
,
type
:
this
.
db
.
QueryTypes
.
UPDATE
};
}
return
this
.
db
.
query
(
sql
,
tmpParas
);
}
async
findCount
(
whereObj
=
null
){
async
findCount
(
whereObj
=
null
){
return
this
.
model
.
count
(
whereObj
,
{
logging
:
false
}).
then
(
c
=>
{
return
this
.
model
.
count
(
whereObj
,
{
logging
:
false
}).
then
(
c
=>
{
return
c
;
return
c
;
...
...
bpo-web/app/base/db/impl/lduserDao.js
View file @
6b0b50c3
...
@@ -5,6 +5,12 @@ class LDUserDao extends Dao {
...
@@ -5,6 +5,12 @@ class LDUserDao extends Dao {
constructor
()
{
constructor
()
{
super
(
Dao
.
getModelName
(
LDUserDao
));
super
(
Dao
.
getModelName
(
LDUserDao
));
}
}
async
updateBalance
(
id
,
amt
)
{
let
sql
=
`UPDATE
${
this
.
model
.
tableName
}
SET p_user_balance = p_user_balance + :amt WHERE id = :id AND p_user_balance + :amt >= 0`
;
let
rs
=
await
this
.
customUpdate
(
sql
,
{
id
:
id
,
amt
:
amt
});
return
rs
;
}
}
}
module
.
exports
=
LDUserDao
;
module
.
exports
=
LDUserDao
;
bpo-web/app/base/db/impl/lduserbankDao.js
View file @
6b0b50c3
...
@@ -5,6 +5,20 @@ class LDUserBankDao extends Dao {
...
@@ -5,6 +5,20 @@ class LDUserBankDao extends Dao {
constructor
()
{
constructor
()
{
super
(
Dao
.
getModelName
(
LDUserBankDao
));
super
(
Dao
.
getModelName
(
LDUserBankDao
));
}
}
async
listByCondition
(
params
)
{
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
params
.
attrs
||
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE 1 = 1"
);
if
(
params
.
user_id
)
{
sql
.
push
(
"AND user_id = :user_id"
);
}
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
}
}
module
.
exports
=
LDUserBankDao
;
module
.
exports
=
LDUserBankDao
;
bpo-web/app/base/service/impl/lduserSve.js
View file @
6b0b50c3
...
@@ -10,12 +10,20 @@ class LDUserService extends ServiceBase {
...
@@ -10,12 +10,20 @@ class LDUserService extends ServiceBase {
async
loginH5
(
params
)
{
async
loginH5
(
params
)
{
let
p_id
=
params
.
p_id
;
let
p_id
=
params
.
p_id
;
let
p_user_id
=
params
.
p_user_id
;
let
p_user_id
=
params
.
p_user_id
;
let
p_user_balance
=
system
.
y2f
(
params
.
p_user_balance
);
let
user
=
await
this
.
dao
.
findOne
({
p_id
:
p_id
,
p_user_id
:
p_user_id
});
let
user
=
await
this
.
dao
.
findOne
({
p_id
:
p_id
,
p_user_id
:
p_user_id
});
if
(
!
user
)
{
if
(
!
user
)
{
user
=
await
this
.
dao
.
create
(
params
);
user
=
await
this
.
dao
.
create
(
params
);
}
else
{
user
.
p_user_balance
=
p_user_balance
;
user
.
save
();
}
}
return
user
;
return
user
;
}
}
async
updateBalance
(
id
,
balance
)
{
return
await
this
.
dao
.
updateBalance
(
id
,
balance
);
}
}
}
module
.
exports
=
LDUserService
;
module
.
exports
=
LDUserService
;
\ No newline at end of file
bpo-web/app/base/service/impl/lduserbankSve.js
View file @
6b0b50c3
...
@@ -6,6 +6,12 @@ class LDUserBankService extends ServiceBase {
...
@@ -6,6 +6,12 @@ class LDUserBankService extends ServiceBase {
constructor
()
{
constructor
()
{
super
(
ServiceBase
.
getDaoName
(
LDUserBankService
));
super
(
ServiceBase
.
getDaoName
(
LDUserBankService
));
}
}
async
listByCondition
(
params
)
{
let
rs
=
await
this
.
dao
.
listByCondition
(
params
);
return
rs
;
}
}
}
module
.
exports
=
LDUserBankService
;
module
.
exports
=
LDUserBankService
;
\ No newline at end of file
bpo-web/app/base/wxapplet/impl/ldApplet.js
View file @
6b0b50c3
This diff is collapsed.
Click to expand it.
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