|
@@ -91,6 +91,7 @@ func PlanAllocBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
return nil, errors.New("未找到单据信息")
|
|
|
}
|
|
|
|
|
|
+ var wg sync.WaitGroup
|
|
|
for _, tId := range typeBillIds {
|
|
|
var err error
|
|
|
billType := ""
|
|
@@ -112,17 +113,17 @@ func PlanAllocBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
_, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: true, SendTime: time.Now()})
|
|
|
}
|
|
|
|
|
|
- if err != nil {
|
|
|
+ if err == nil {
|
|
|
// 给供应商发送通知短信
|
|
|
smsInfo, err := genSupplierSmsTemp(billId, billType, apictx)
|
|
|
- fmt.Println(err)
|
|
|
- if err != nil {
|
|
|
- err = SendSmsNotify(smsInfo.Phone, &SupplierSmsReq{smsInfo.Product, smsInfo.SerialNumber})
|
|
|
- fmt.Println(err)
|
|
|
- log.Error(err)
|
|
|
+ fmt.Println(smsInfo)
|
|
|
+ if err == nil {
|
|
|
+ wg.Add(1)
|
|
|
+ go SendSmsNotify(smsInfo.Phone, &SupplierSmsReq{smsInfo.Product, smsInfo.SerialNumber}, &wg)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ wg.Wait()
|
|
|
|
|
|
return true, nil
|
|
|
|