Commit af7556cd by huangchengyi

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

parents 1ce40d5f a65f2ecf
......@@ -12,8 +12,7 @@ import (
//计算单一项总的静态分
func SetSumScore(c context.Context) {
com_credits.Id = insertScoreMsg.ComCreditsId
com_credits.StaticCreditScore = CompanyInfo() + AddScore() + EnterPriseCredit() + HistoryBussiness() + PersonalCredit()
com_credits.StaticCreditScore = CompanyInfo()+ AddScore()+ EnterPriseCredit()+ HistoryBussiness() + PersonalCredit()
connect := dao.New()
_,err := connect.UpdateStaticSumScores(c,com_credits)
fmt.Print(err)
......@@ -144,6 +143,7 @@ func SetProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullS
sumScore float64 = 0
joinNum float64 = 0
)
fmt.Print("totalScoreReplace",totalScoreReplace)
//查找出所有不是0的分值
for i :=0;i < len(totalScoreReplace) ; i++ {
......@@ -169,6 +169,9 @@ func SetProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullS
insertScoreMsg.FinalScore = sumScore * weightReplace
}
fmt.Print("insertScoreMsg.FinalScore",insertScoreMsg.FinalScore)
insertScoreMsg.Weight = weightReplace
return insertScoreMsg.FinalScore
......
......@@ -5,16 +5,13 @@ func AddScore()(finalScore float64) {
var(
sumScore float64 = 0
joinNum float64 = 0
)
for _,v :=range companyAddScore{
sumScore += StringTurnFloat64(v["final_score"])
joinNum += 1
}
//经过权重计算之后的总分值
sumScore = sumScore / joinNum
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = sumScore,sumScore,sumScore
insertScoreMsg.Weight = 1
......
package main
import "strconv"
import (
"strconv"
)
var(
c_currentScore float64
......@@ -34,7 +36,7 @@ func CompanyInfo()(finalScore float64) {
func EstablishmentTime() {
establishment_time := StringTurnInt64(companyBasicInfo["establishment_time"])
diffTime := GetTimeStamp() - establishment_time
diffTime := (GetTimeStamp() - establishment_time) / (3600 * 24 * 365)
c_currentScore = GetScore(8,strconv.FormatInt(diffTime,10))
c_totalScore[0]= SetScore(c_currentScore,8)
......
......@@ -31,7 +31,7 @@ func HistoryBussiness()(finalScore float64) {
func CooperationTime() {
first_order_time := StringTurnInt64(basicInfo["first_order_time"])
diffTime := GetTimeStamp() - first_order_time
diffTime := (GetTimeStamp() - first_order_time) / (3600 * 24 * 365)
h_currentScore = GetScore(29,strconv.FormatInt(diffTime,10))
......
......@@ -15,7 +15,7 @@ func (d *dao) GetCompanyModelItemsByProjectid(c context.Context, project_id int6
var (
rows *sql.Rows
)
if rows, err = d.db.Query(c, "select "+ SqlField + " from lie_model_items where project_id = ? and ladder_range_min <= ? and ladder_range_max > ? ",project_id,score,score); err != nil {
if rows, err = d.db.Query(c, "select "+ SqlField + " from lie_model_items where project_id = ? and ladder_range_min <= ? and ladder_range_max >= ? ",project_id,score,score); err != nil {
err = errors.WithStack(err)
return
}
......
package logic
import (
"fmt"
"io/ioutil"
"net/http"
)
const TIANYANCHATOKEN = "ba7fd1d1-8ebd-4d4a-844a-d44d75815ad3"
//公司信息
const NAMEURL = "http://open.api.tianyancha.com/services/open/ic/baseinfoV2/2.0?name="
//法律诉讼
const LAWSUIT = "http://open.api.tianyancha.com/services/open/jr/lawSuit/2.0?pageNum=1&name="
//法人变更次数
const CHANGEINFO = "http://open.api.tianyancha.com/services/open/ic/changeinfo/2.0?pageNum=1&name="
func HttpGet(url string) {
request, _ := http.NewRequest("GET",url,nil)
request.Header.Add("Authorization",TIANYANCHATOKEN)
//get数据并接收http响应
resp,err :=http.DefaultClient.Do(request)
if err!=nil{
fmt.Printf("post data error:%v\n",err)
}else {
fmt.Println("post a data successful.")
respBody,_ :=ioutil.ReadAll(resp.Body)
fmt.Printf("response data:%v\n",string(respBody))
}
defer resp.Body.Close()
}
\ 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