Commit 46601ca6 by huangchengyi

Merge branch 'dev' of http://119.23.72.7/sunlong_v5/kaopu-server into dev

# Conflicts:
#	internal/dao/dao.go
#	logs/info.log
parents 349bc9ab 90dc6642
package main
import "fmt"
//公司信息计算
func CompanyInfo() {
fmt.Print(companyData)
EstablishmentTime()
CompanyNature()
ChangeslegalInFiveYears()
......@@ -17,12 +15,20 @@ func CompanyInfo() {
//成立时间(1分)
func EstablishmentTime() {
setInserScoreHeader(1,1,8)
insertScoreMsg.TotalScore = 5
insertScoreMsg.FinalScore = 5
insertScoreMsg.CurrentScore = 2
insertScoreMsg.Weight = 50
insertScoreMsg.ComCreditsId = 2
socreRecordChan <- insertScoreMsg
}
//公司性质(1分)
func CompanyNature() {
setInserScoreHeader(1,1,9)
}
//5年内法人变更次数(1分)
......
......@@ -3,18 +3,23 @@ package main
import (
"context"
"flag"
"fmt"
"github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/kratos/pkg/log"
"kaopu-server/internal/dao"
"kaopu-server/internal/model"
"kaopu-server/internal/service"
"time"
)
var (
//获取的公司信息
companyData []map[string]interface{}
//插入分值的通道
socreRecord = make(chan model.Scores, 1000)
//插入分值的通道,限制一千,超过等待
socreRecordChan = make(chan model.Scores, 1000)
//分数的数据
insertScoreMsg model.Scores
)
......@@ -24,19 +29,24 @@ func main() {
getConfig()
//声明service层
go insertRecord()
svc := service.New()
ctx := context.Background()
go insertRecord()
//调用服务获取公司信息,然后进行全局赋值
companyData,_ = svc.GetCompanyCresitsList(ctx)
AddScore()
CompanyInfo()
EnterPriseCredit()
HistoryBussiness()
PersonalCredit()
//insertId,err := svc.InsertScores(ctx,insertScoreMsg)
//fmt.Print(err)
//fmt.Print(insertId)
//fmt.Print(companyData)
//EnterPriseCredit()
//HistoryBussiness()
//PersonalCredit()
//AddScore()
//延迟100秒用来执行协程的错误返回
time.Sleep(100000 * time.Millisecond)
}
......@@ -56,12 +66,23 @@ func getConfig() {
//协程增加分值记录
func insertRecord() {
for {
//声明service层
connect := dao.New()
ctx := context.Background()
for {
// 从通道中拿出消息
insertRecord := <-socreRecord
insertScoreMsg := <- socreRecordChan
insertId,err := connect.InsertScores(ctx,insertScoreMsg)
fmt.Print(err)
fmt.Print(insertId)
//插入数据
}
}
//设置插入的分数头
func setInserScoreHeader(_typy,project_pid,project_id int8) {
insertScoreMsg.Type = _typy
insertScoreMsg.ProjectPid = project_pid
insertScoreMsg.ProjectId = project_id
}
\ No newline at end of file
......@@ -12,15 +12,23 @@ import (
xtime "github.com/bilibili/kratos/pkg/time"
)
// Dao dao interface
type Dao interface {
Close()
Ping(ctx context.Context) (err error)
GetUserInfoByUserId(ctx context.Context,user_id int64) (r *model.Users,err error)
GetUserList(ctx context.Context) (r []*model.Users,err error)
GetCompanyCresitsList(ctx context.Context) (r []map[string]interface{},err error)
CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) //计算逾期
}
type (
// Dao dao interface
Dao interface {
Close()
Ping(ctx context.Context) (err error)
GetUserInfoByUserId(ctx context.Context, user_id int64) (r *model.Users, err error)
GetUserList(ctx context.Context) (r []*model.Users, err error)
//---静态开始
GetCompanyCresitsList(ctx context.Context) (r []map[string]interface{}, err error)
InsertScores(ctx context.Context, score model.Scores) (insertId int64, err error)
//---静态结束
CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) //计算逾期
}
)
// dao dao.
type dao struct {
......@@ -31,6 +39,7 @@ type dao struct {
mcExpire int32
}
func checkErr(err error) {
if err != nil {
panic(err)
......
......@@ -4,18 +4,23 @@ import (
"context"
"fmt"
"kaopu-server/internal/model"
"github.com/bilibili/kratos/pkg/log"
)
//增加记录
func (d *dao) insert(ctx context.Context,score *model.Scores) (int64, error) {
func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int64,err error) {
stmt,_:= d.db.Prepare("INSERT INTO chat_list (roomstr, urid,srid) VALUES (?,?,?)")
insertSql := "INSERT INTO `lie_scores` (`type`)VALUES(?)"
var row, err = stmt.Exec(ctx,score.CreateTime,score.CurrentScore)
if err != nil{
fmt.Println("select fail,err:",err)
row,err := d.db.Exec(ctx,insertSql,1)
fmt.Print(11111)
if err != nil {
log.Error("db.DemoExec.Exec(%s) error(%v)", insertSql, err)
return
}
row.LastInsertId()
defer d.db.Close()
return row.LastInsertId()
return
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ type Scores struct {
TotalScore float32 `json:"total_score"`
CurrentScore float32 `json:"current_score"`
Weight float32 `json:"weight"`
FinalScore float64 `json:"final_score"`
FinalScore float32 `json:"final_score"`
ComCreditsId int64 `json:"com_credits_id"`
CreateTime int64 `json:"create_time"`
UpdateTime int64 `json:"update_time"`
......
......@@ -59,11 +59,26 @@ func (s *Service) GetUserList(ctx context.Context) (res []*model.Users, err erro
}
//获取用户列表
//----------静态开始
// 获取公司用户列表
func (s *Service) GetCompanyCresitsList(ctx context.Context) (res []map[string]interface{}, err error) {
//调用DB方法,获取会员数据
res, err = s.dao.GetCompanyCresitsList(ctx)
fmt.Print(err)
return
}
\ No newline at end of file
}
//插入分数记录
func (s *Service) InsertScores(ctx context.Context,score model.Scores) (insertId int64, err error) {
//调用DB方法,获取会员数据
insertId,err = s.dao.InsertScores(ctx,score)
if err != nil {
panic(err.Error()) // proper error handling instead of panic in your app
}
return
}
//----------静态结束
\ No newline at end of file
......@@ -133,4 +133,97 @@
[2019/11/22 14:43:04.310] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:46] caipu-server start
[2019/11/22 14:43:25.337] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:48] caipu-server start
[2019/11/22 14:46:08.195] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:49] caipu-server start
[2019/11/25 13:36:53.543] [INFO] [D:/GO/kaopu-server/cmd/move/main.go:24] caipu-server start
[2019/11/25 10:06:06.845] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] caipu-server start
[2019/11/25 10:08:30.374] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] caipu-server start
[2019/11/25 10:09:29.481] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] caipu-server start
[2019/11/25 10:10:40.606] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] caipu-server start
[2019/11/25 10:17:03.956] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] caipu-server start
[2019/11/25 10:17:41.843] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 11:05:31.260] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:05:57.945] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:06:24.565] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:07:09.298] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:07:32.426] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:07:44.144] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:07:58.406] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:08:09.405] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:08:18.052] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:08:35.048] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:15:58.866] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:16:25.611] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:16:33.485] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:16:42.338] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:19:30.689] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:20:04.876] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:20:53.952] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:21:08.519] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:21:38.955] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:24:09.355] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:24:29.032] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:24:36.357] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:25:37.609] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:27:57.132] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:29:16.271] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:31:26.676] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:31:45.648] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:31:54.107] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:32:08.162] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:32:22.410] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:32:33.503] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:32:40.991] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:32:51.009] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:32:58.812] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:33:25.639] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:33:33.157] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:35:13.300] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:35:36.926] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:37:00.487] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:38:52.623] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:39:11.305] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:39:29.516] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:41:07.845] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:48:00.471] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:49:07.113] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:50:41.784] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 11:51:11.953] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:37:30.454] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:41:50.379] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:42:14.771] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:42:35.434] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:42:50.451] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:44:10.739] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:44:53.373] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:47:14.713] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:47:31.565] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:48:50.246] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:49:12.904] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:51:48.841] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:51:59.804] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 13:55:03.347] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:03:55.439] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:04:33.969] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:04:41.093] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:05:46.375] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:06:01.927] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:07:29.742] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:08:17.441] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:08:47.229] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:08:59.329] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:11:44.858] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:58] caipu-server start
[2019/11/25 14:15:03.769] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:15:33.797] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:16:38.994] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:16:42.909] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:22:06.918] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:25:54.037] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:26:18.766] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:26:57.074] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:27:05.682] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:59] caipu-server start
[2019/11/25 14:28:35.763] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:29:23.430] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:29:38.412] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:29:48.466] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:30:36.747] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:31:31.937] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:41:01.973] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
[2019/11/25 14:41:52.333] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:62] caipu-server start
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