Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
kaopu-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cc237398
authored
Jan 02, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改静态分值
parent
b3ba55bc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
0 deletions
internal/dao/dao.go
internal/dao/scores.go
internal/service/service.go
internal/dao/dao.go
View file @
cc237398
...
...
@@ -28,6 +28,7 @@ type (
//---静态开始
GetCompanyCresitsList
(
ctx
context
.
Context
)
(
r
[]
map
[
string
]
string
,
err
error
)
InsertScores
(
ctx
context
.
Context
,
score
model
.
Scores
)
(
insertId
int64
,
err
error
)
InsertBankStaticScores
(
ctx
context
.
Context
,
score
model
.
Scores
)
(
insertId
int64
,
err
error
)
GetCompanyBaseInfoByCid
(
c
context
.
Context
,
companyId
int64
)
(
r
map
[
string
]
string
,
err
error
)
GetCompanyScoreFieldsByCid
(
c
context
.
Context
,
companyId
int64
)
(
r
map
[
string
]
string
,
err
error
)
GetBasicInfoByCid
(
c
context
.
Context
,
erpCompanyCode
string
)
(
r
map
[
string
]
string
,
err
error
)
...
...
internal/dao/scores.go
View file @
cc237398
...
...
@@ -58,6 +58,56 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
return
}
//修改静态银行的分数
func
(
d
*
dao
)
InsertBankStaticScores
(
ctx
context
.
Context
,
score
model
.
Scores
)
(
insertId
int64
,
err
error
)
{
var
(
exitId
int64
execSql
string
affectNum
int64
rows
*
sql
.
Rows
)
rows
,
err
=
d
.
db_bank
.
Query
(
ctx
,
"select id from lie_scores where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ? limit 0,1"
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
ComCreditsId
)
defer
rows
.
Close
()
logic
.
CheckErr
(
err
)
twoMap
,
err
:=
GetAllParam
(
rows
)
exitId
=
0
for
_
,
v
:=
range
twoMap
{
exitId
=
logic
.
StringTurnInt64
(
v
[
"id"
])
break
}
if
exitId
==
0
{
execSql
=
"INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
row
,
err
:=
d
.
db_bank
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
score
.
ComCreditsId
,
time
.
Now
()
.
Unix
())
if
err
!=
nil
{
logic
.
CheckErr
(
err
)
}
else
{
affectNum
,
_
=
row
.
LastInsertId
()
}
}
else
{
execSql
=
"update `lie_scores` set `type` = ?, `project_pid` = ?, `project_id` = ?, `total_score` = ?, `current_score` = ?, `weight` = ?, `final_score` = ?, `update_time` = ? where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ?"
row
,
err
:=
d
.
db_bank
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
time
.
Now
()
.
Unix
(),
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
ComCreditsId
)
if
err
!=
nil
{
logic
.
CheckErr
(
err
)
}
else
{
affectNum
,
_
=
row
.
RowsAffected
()
}
}
insertId
=
affectNum
return
}
//增加或者修改记录(动态模型专用)
func
(
d
*
dao
)
InsertScores2
(
ctx
context
.
Context
,
score
model
.
Scores
,
month_six_zi
int64
)
(
insertId
int64
,
err
error
)
{
...
...
internal/service/service.go
View file @
cc237398
...
...
@@ -150,6 +150,7 @@ func (s *Service) InsertScores(c context.Context,score model.Scores) (res int64,
//调用DB方法,获取会员数据
res
,
err
=
s
.
dao
.
InsertScores
(
c
,
score
)
res
,
err
=
s
.
dao
.
InsertBankStaticScores
(
c
,
score
)
logic
.
CheckErr
(
err
)
return
}
...
...
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