Commit 77c8f7df by Joneq

修改common函数

parent 01e96f87
Showing with 25 additions and 20 deletions
......@@ -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
getConfig()
logic.GetConfig()
//设置协程数量
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() {
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment