Commit 6545a04e by Joneq

修改defer的位置

parent f04f6aa4
...@@ -49,7 +49,6 @@ func (d *dao) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (res m ...@@ -49,7 +49,6 @@ func (d *dao) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (res m
func (d *dao)UpdateCompanyBaseInfoForTyc(c context.Context,updateInfo map[string]string) (res int64) { func (d *dao)UpdateCompanyBaseInfoForTyc(c context.Context,updateInfo map[string]string) (res int64) {
var( var(
execSql string execSql string
rows *sql.Rows
) )
execSql = "update `lie_com_basicinfos` set `customer_property` = ?, `establishment_time` = ?, `five_legal_change` = ?, `registered_capital` = ?, `social_security_participants` = ?, `two_years_no_lawsuit` = ? , `tyc_select_num` = ? , `tianyancha_json` = ? where com_credits_id = ? " execSql = "update `lie_com_basicinfos` set `customer_property` = ?, `establishment_time` = ?, `five_legal_change` = ?, `registered_capital` = ?, `social_security_participants` = ?, `two_years_no_lawsuit` = ? , `tyc_select_num` = ? , `tianyancha_json` = ? where com_credits_id = ? "
row,err := d.db.Exec(c,execSql,updateInfo["customer_property"],updateInfo["establishment_time"],updateInfo["five_legal_change"],updateInfo["registered_capital"],updateInfo["social_security_participants"],updateInfo["two_years_no_lawsuit"],updateInfo["tyc_select_num"],updateInfo["tianyancha_json"],updateInfo["com_credits_id"]) row,err := d.db.Exec(c,execSql,updateInfo["customer_property"],updateInfo["establishment_time"],updateInfo["five_legal_change"],updateInfo["registered_capital"],updateInfo["social_security_participants"],updateInfo["two_years_no_lawsuit"],updateInfo["tyc_select_num"],updateInfo["tianyancha_json"],updateInfo["com_credits_id"])
...@@ -57,7 +56,6 @@ func (d *dao)UpdateCompanyBaseInfoForTyc(c context.Context,updateInfo map[string ...@@ -57,7 +56,6 @@ func (d *dao)UpdateCompanyBaseInfoForTyc(c context.Context,updateInfo map[string
log.Error("updateScoresdb.DemoExec.Exec(%s) error(%v)", execSql, err) log.Error("updateScoresdb.DemoExec.Exec(%s) error(%v)", execSql, err)
} }
defer rows.Close()
affectNum,err := row.RowsAffected() affectNum,err := row.RowsAffected()
......
...@@ -82,13 +82,14 @@ func (d *dao)UpdateComCredits(ctx context.Context,com_credits model.ComCredits)( ...@@ -82,13 +82,14 @@ func (d *dao)UpdateComCredits(ctx context.Context,com_credits model.ComCredits)(
return return
} }
defer rows.Close()
if err != nil{ if err != nil{
fmt.Println("select fail,err:",err) fmt.Println("select fail,err:",err)
return return
} }
defer rows.Close()
twoMap,err := GetAllParam(rows) twoMap,err := GetAllParam(rows)
......
...@@ -33,9 +33,6 @@ func (d *dao) GetCompanyModelItemsByProjectid(c context.Context, project_id int6 ...@@ -33,9 +33,6 @@ func (d *dao) GetCompanyModelItemsByProjectid(c context.Context, project_id int6
res = v res = v
break break
} }
defer d.db.Close()
fmt.Print(res)
return return
} }
......
...@@ -32,7 +32,6 @@ func (d *dao) GetModelTopsetByProjectId(c context.Context, projectId int64) (res ...@@ -32,7 +32,6 @@ func (d *dao) GetModelTopsetByProjectId(c context.Context, projectId int64) (res
res = v res = v
break break
} }
defer d.db.Close()
return return
} }
...@@ -24,6 +24,7 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int ...@@ -24,6 +24,7 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
fmt.Print("save list fail") fmt.Print("save list fail")
} }
if exitId == 0 { if exitId == 0 {
execSql = "INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)" execSql = "INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
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()) 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())
......
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