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
77c8f7df
authored
Nov 29, 2019
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改common函数
parent
01e96f87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
20 deletions
cmd/static/main.go
internal/logic/common.go
cmd/static/main.go
View file @
77c8f7df
...
...
@@ -4,9 +4,8 @@ import (
"context"
"flag"
"fmt"
"github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/kratos/pkg/log"
"kaopu-server/internal/dao"
"kaopu-server/internal/logic"
"kaopu-server/internal/model"
"kaopu-server/internal/service"
"strconv"
...
...
@@ -42,13 +41,12 @@ var (
func
main
()
{
//获取config
g
etConfig
()
logic
.
G
etConfig
()
//设置协程数量
wg
.
Add
(
1
)
flag
.
StringVar
(
&
runtype
,
"runtype"
,
"one"
,
"default config path"
)
go
insertRecord
()
svc
:=
service
.
New
()
c
:=
context
.
Background
()
...
...
@@ -74,23 +72,7 @@ func main() {
}
//获取配置参数
func
getConfig
()
{
//获取输入参数
flag
.
Parse
()
if
err
:=
paladin
.
Init
();
err
!=
nil
{
panic
(
err
)
}
//初始化日志目录
setLog
(
"kaopuserver start"
,
0
)
}
func
setLog
(
k
string
,
v
interface
{}){
//初始化日志目录
log
.
Init
(
&
log
.
Config
{
Dir
:
"logs"
})
defer
log
.
Close
()
log
.
Info
(
k
,
v
)
}
//计算单一项总的静态分
func
setSumScore
()
{
...
...
internal/logic/common.go
View file @
77c8f7df
...
...
@@ -10,7 +10,10 @@ import (
"encoding/csv"
"encoding/hex"
"encoding/json"
"flag"
"fmt"
"github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/kratos/pkg/log"
"hash/crc32"
"html"
"io"
...
...
@@ -2234,3 +2237,22 @@ func Ternary(condition bool, trueVal, falseVal interface{}) interface{} {
}
return
falseVal
}
//获取配置参数
func
GetConfig
()
{
//获取输入参数
flag
.
Parse
()
if
err
:=
paladin
.
Init
();
err
!=
nil
{
panic
(
err
)
}
//初始化日志目录
setLog
(
"kaopuserver start"
,
0
)
}
func
setLog
(
k
string
,
v
interface
{}){
//初始化日志目录
log
.
Init
(
&
log
.
Config
{
Dir
:
"logs"
})
defer
log
.
Close
()
log
.
Info
(
k
,
v
)
}
\ No newline at end of file
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