package overseas_custom import ( "context" "fmt" "hongze/hongze_task/models/overseas_custom" "hongze/hongze_task/utils" ) // 修改英文客户路演统计 func FixEnglishCompanyRoadShowTotal(cont context.Context) (err error) { obj := new(overseas_custom.Custom) list, err := obj.GetRsCompanyTotal() if err != nil { fmt.Println("GetRsCompanyTotal Err:" + err.Error()) return err } companyList, err := obj.GetEnglishCompanyAll() if err != nil { fmt.Println("GetEnglishCompanyAll Err:" + err.Error()) return err } companyMap := make(map[int]int) for _, v := range companyList { companyMap[v.CompanyId] = v.RoadShowTotal } for _, v := range list { if v.Total > 0 { if val, ok := companyMap[v.CompanyId]; ok { if val != v.Total { err = obj.UpdateEnglishCompanyRoadShowTotal(v.CompanyId, v.Total) if err != nil { fmt.Println("UpdateEnglishCompanyRoadShowTotal Err:" + err.Error()) return err } } } } } return nil } // 修改英文客户路演统计 func FixEnglishCompanyLastViewTime(cont context.Context) (err error) { obj := new(overseas_custom.Custom) list, err := obj.GetEnglishCompanyLastViewTime() if err != nil { fmt.Println("GetEnglishCompanyLastViewTime Err:" + err.Error()) return err } for _, v := range list { if v.LastViewTime != "" { err = obj.UpdateEnglishCompanyLastViewTime(v.CompanyId, v.LastViewTime) if err != nil { fmt.Println("UpdateEnglishCompanyLastViewTime Err:" + err.Error()) return err } } } return nil } // 修改英文客户路演统计 func FixCompanyOverseasStatus(cont context.Context) (err error) { obj := new(overseas_custom.Custom) list, err := obj.GetOverseasCompany() if err != nil { fmt.Println("FixCompanyOverseasStatus Err:" + err.Error()) return err } for _, v := range list { if v.CompanyId > utils.EnCompanyIdStep { v.CompanyId = v.CompanyId - utils.EnCompanyIdStep if v.CompanyStatus != "" { err = obj.UpdateEnglishCompanyOverseasStatus(v.CompanyId, v.CompanyStatus) if err != nil { fmt.Println("UpdateEnglishCompanyOverseasStatusErr:" + err.Error()) return err } } } else { if v.CompanyStatus != "" { err = obj.UpdateCompanyOverseasStatus(v.CompanyId, v.CompanyStatus) if err != nil { fmt.Println("UpdateCompanyOverseasStatus:" + err.Error()) return err } } } } return nil }