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
ca999a81
authored
Dec 05, 2019
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
http://119.23.72.7/sunlong_v5/kaopu-server
into dev
parents
4d408cc2
bae7fedd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
34 deletions
cmd/static/main.go
configs/mysql.toml
go.mod
go.sum
internal/dao/com_credits.go
internal/dao/scores.go
internal/service/service.go
cmd/static/main.go
View file @
ca999a81
...
...
@@ -11,6 +11,7 @@ import (
"strconv"
"sync"
"time"
"github.com/ichunt2019/go-msgserver/utils/rabbitmq"
)
...
...
@@ -37,6 +38,10 @@ var (
runtype
string
)
type
RecvPro
struct
{
}
...
...
@@ -62,8 +67,29 @@ func main() {
insertScoreMsg
.
ComCreditsId
=
StringTurnInt64
(
v
[
"id"
])
GetCompanyRunInfo
(
c
)
SetSumScore
(
c
)
break
}
}
else
{
t
:=
&
RecvPro
{}
queueExchange
:=
&
rabbitmq
.
QueueExchange
{
"fengkong_static_count"
,
"fengkong_static_count"
,
"b_test_rabbit_mq"
,
"direct"
,
"amqp://guest:guest@192.168.2.232:5672/"
,
}
for
{
mq
:=
rabbitmq
.
New
(
queueExchange
)
mq
.
RegisterReceiver
(
t
)
err
:=
mq
.
Start
()
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
time
.
Sleep
(
time
.
Second
)
}
fmt
.
Print
(
"待补充rabbitmq"
)
}
...
...
@@ -76,11 +102,19 @@ func main() {
//// 实现消费者 消费消息失败 自动进入延时尝试 尝试3次之后入库db
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
fmt
.
Println
(
string
(
dataByte
))
//return errors.New("顶顶顶顶")
return
nil
}
//计算单一项总的静态分
func
SetSumScore
(
c
context
.
Context
)
{
com_credits
.
Id
=
insertScoreMsg
.
ComCreditsId
com_credits
.
StaticCreditScore
=
CompanyInfo
()
+
AddScore
()
+
HistoryBussiness
()
+
EnterPriseCredit
()
+
PersonalCredit
()
com_credits
.
StaticCreditScore
=
CompanyInfo
()
+
AddScore
()
+
EnterPriseCredit
()
+
HistoryBussiness
()
+
PersonalCredit
()
connect
:=
dao
.
New
()
connect
.
UpdateStaticSumScores
(
c
,
com_credits
)
}
...
...
@@ -96,8 +130,12 @@ func InsertRecord(c context.Context) {
//插入数据
//if !math.IsNaN(CurrentScore64) && CurrentScore64 != 0 {
//}
//svc.InsertScores(c,insertScoreMsgRecord)
insertId
,
err
:=
svc
.
InsertScores
(
c
,
insertScoreMsgRecord
)
fmt
.
Print
(
err
)
if
err
!=
nil
{
fmt
.
Print
(
err
)
}
//fmt.Print(err)
fmt
.
Print
(
insertId
)
}
defer
wg
.
Done
()
...
...
@@ -166,16 +204,20 @@ func SetProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullS
insertScoreMsg
.
CurrentScore
=
sumScore
//如果
最后金额大于满分,则算为最满分
if
sumScore
>
fullScore
{
insertScoreMsg
.
TotalScore
=
fullScore
//如果
是0则不判断了
if
sumScore
==
0
{
insertScoreMsg
.
TotalScore
,
insertScoreMsg
.
FinalScore
=
0
,
0
}
else
{
insertScoreMsg
.
TotalScore
=
sumScore
}
//经过权重计算之后的总分值
insertScoreMsg
.
FinalScore
=
sumScore
/
joinNum
//如果最后金额大于满分,则算为最满分
if
sumScore
>
fullScore
{
insertScoreMsg
.
TotalScore
=
fullScore
}
else
{
insertScoreMsg
.
TotalScore
=
sumScore
}
//经过权重计算之后的总分值
insertScoreMsg
.
FinalScore
=
sumScore
/
joinNum
}
insertScoreMsg
.
Weight
=
weightReplace
return
insertScoreMsg
.
FinalScore
...
...
configs/mysql.toml
View file @
ca999a81
...
...
@@ -5,9 +5,9 @@
active
=
20
idle
=
10
idleTimeout
=
"4h"
queryTimeout
=
"
2
00ms"
execTimeout
=
"
3
00ms"
tranTimeout
=
"
4
00ms"
queryTimeout
=
"
10
00ms"
execTimeout
=
"
10
00ms"
tranTimeout
=
"
10
00ms"
[Liexin_credit_source]
addr
=
"192.168.2.232:3306"
...
...
@@ -16,6 +16,6 @@
active
=
20
idle
=
10
idleTimeout
=
"4h"
queryTimeout
=
"200ms"
execTimeout
=
"300ms"
tranTimeout
=
"400ms"
\ No newline at end of file
queryTimeout
=
"1000ms"
execTimeout
=
"1000ms"
tranTimeout
=
"1000ms"
\ No newline at end of file
go.mod
View file @
ca999a81
...
...
@@ -4,6 +4,7 @@ go 1.12
require (
github.com/bilibili/kratos v0.3.1
github.com/ichunt2019/go-msgserver v0.0.0-20191204053231-bd327f4f8ff1
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/pkg/errors v0.8.1
)
go.sum
View file @
ca999a81
...
...
@@ -37,7 +37,6 @@ github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ1
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
...
...
@@ -102,7 +101,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ichunt2019/go-msgserver v0.0.0-20191203074423-ea6520d9a4ea h1:GLlx6jezFXZGHhCcdECTC5MAAYPgzB91D5synlgzR+Q=
github.com/ichunt2019/go-msgserver v0.0.0-20191204053231-bd327f4f8ff1 h1:UK7gMV/AS+d3p0wFQLXndXyek3FUIYxUZjPTyx4tZ2g=
github.com/ichunt2019/go-msgserver v0.0.0-20191204053231-bd327f4f8ff1/go.mod h1:fWAvbry0W9nhmkqgT2agwRqYCWlguUJXgy2rgoWOUmA=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
...
...
@@ -117,13 +117,10 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
...
...
@@ -157,7 +154,6 @@ github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/otokaze/mock v0.0.0-20190125081256-8282b7a7c7c3/go.mod h1:pLR8n2aimFxvvDJ6n8JuQWthMGezCYMjuhlaTjPTZf0=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3 h1:e/WwwXpp+h9CtbiwSdDxrgq6ymvrvLH/P+kS+8qq4v8=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3/go.mod h1:EXNdWdQkS+QBi0nb/Xm+sBBuQ1PM7/NIPr1JDzOlt8A=
github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
...
...
@@ -165,7 +161,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
...
...
@@ -211,11 +206,12 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 h1:WhxRHzgeVGETMlmVfqhRn8RIeeNoPr2Czh33I4Zdccw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
...
...
@@ -319,12 +315,10 @@ google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRn
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
...
...
internal/dao/com_credits.go
View file @
ca999a81
...
...
@@ -38,7 +38,7 @@ func (d *dao) UpdateStaticSumScores(ctx context.Context,com_credits model.ComCre
)
execSql
=
"update `lie_com_credits` set `static_credit_score` = ? where id = ? "
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
com_credits
.
Dynam
icCreditScore
,
com_credits
.
Id
)
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
com_credits
.
Stat
icCreditScore
,
com_credits
.
Id
)
if
err
!=
nil
{
log
.
Error
(
"UpdateStaticSumScoresdb.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
...
...
@@ -65,6 +65,8 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
log
.
Error
(
"UpdateMoveSumScoresdb.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
d
.
UpdateComCredits
(
ctx
,
com_credits
)
row
.
RowsAffected
()
defer
d
.
db
.
Close
()
...
...
@@ -101,8 +103,8 @@ func (d *dao)UpdateComCredits(ctx context.Context,com_credits model.ComCredits)(
total_credit_score
:=
logic
.
StringTurnFloat64
(
res
[
"static_credit_score"
])
+
logic
.
StringTurnFloat64
(
res
[
"dynamic_credit_score"
])
grade
,
_
:=
d
.
GetGrade
(
ctx
,
total_credit_score
)
execSql
:=
"update `lie_com_credits` set `
total_credit_score` = ? , `ichunt_hunting_core` = ? , `recom_time_limit` = ? ,`recommended_amount` = ?
where id = ? "
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
total_credit_score
,
grade
[
"grade"
],
grade
[
"recommended_limit"
],
logic
.
StringTurnFloat64
(
grade
[
"recommended_amount"
]),
com_credits
.
Id
)
execSql
:=
"update `lie_com_credits` set `
static_credit_score` = ?,`dynamic_credit_score` = ?, `total_credit_score` = ? , `ichunt_hunting_core` = ? , `recom_time_limit` = ? ,`recommended_amount` = ? ,`status` = 10
where id = ? "
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
logic
.
StringTurnFloat64
(
res
[
"static_credit_score"
]),
logic
.
StringTurnFloat64
(
res
[
"dynamic_credit_score"
]),
total_credit_score
,
grade
[
"grade"
],
grade
[
"recommended_limit"
],
logic
.
StringTurnFloat64
(
grade
[
"recommended_amount"
]),
com_credits
.
Id
)
if
err
!=
nil
{
log
.
Error
(
"UpdateComCreditsdb.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
...
...
@@ -112,12 +114,15 @@ func (d *dao)UpdateComCredits(ctx context.Context,com_credits model.ComCredits)(
return
}
func
(
d
*
dao
)
GetGrade
(
ctx
context
.
Context
,
sumScore
float64
)(
res
map
[
string
]
string
,
err
error
)
{
var
(
rows
*
sql
.
Rows
)
//获取当前条的数据
if
rows
,
err
=
d
.
db
.
Query
(
ctx
,
"select "
+
SqlField
+
" from lie_grade where status = 1 and min_score
>= ? and max_score <
?"
,
sumScore
,
sumScore
);
err
!=
nil
{
if
rows
,
err
=
d
.
db
.
Query
(
ctx
,
"select "
+
SqlField
+
" from lie_grade where status = 1 and min_score
<= ? and max_score >
?"
,
sumScore
,
sumScore
);
err
!=
nil
{
err
=
errors
.
WithStack
(
err
)
return
}
...
...
internal/dao/scores.go
View file @
ca999a81
...
...
@@ -32,8 +32,8 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
}
}
else
{
execSql
=
"update `lie_scores` set `type` = ?, `project_pid` = ?, `project_id` = ?, `total_score` = ?, `current_score` = ?, `weight` = ?, `final_score` = ?, `
com_credits_id` = ?, `
update_time` = ? where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ?"
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
score
.
ComCreditsId
,
time
.
Now
()
.
Unix
(),
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
ComCreditsId
)
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
.
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
{
log
.
Error
(
"updateScoresdb.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
else
{
...
...
internal/service/service.go
View file @
ca999a81
...
...
@@ -131,7 +131,7 @@ func (s *Service) InsertScores(c context.Context,score model.Scores) (res int64,
//调用DB方法,获取会员数据
res
,
err
=
s
.
dao
.
InsertScores
(
c
,
score
)
defer
s
.
dao
.
Close
()
fmt
.
Print
(
err
)
//
fmt.Print(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