package service import ( "fmt" "strconv" log "github.com/sirupsen/logrus" "kpt.xdmy/apiserver/model" "kpt.xdmy/pkg/util" ) func Eas() { sid, err := util.EASWebServiceLogin("http://192.168.61.23:6888") if err != nil { panic(err) } fmt.Println(sid) } func (s *Service) EasBatch() { // log.Infof("%v", setting.ServerSetting) nch = make(chan error, 10) p := make([]model.Parts, 0, 0) if e := s.d.DB.Where("msg <>''").Find(&p, &model.Parts{Statue: 1, Issync: 0}).Error; e != nil { panic(e) } for _, v := range p { if v.Unit == "" { continue } go GoEas(strconv.Itoa(v.ID)) if e := <-nch; e != nil { log.Errorf("EasBatch() :%v", e) } } } func GoEas(id string) { e := util.EASBillSync(5, id, "1") nch <- e }