ziwen 1 年之前
父节点
当前提交
a46da91c37
共有 1 个文件被更改,包括 17 次插入15 次删除
  1. 17 15
      controller/contract/register.go

+ 17 - 15
controller/contract/register.go

@@ -1262,21 +1262,23 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
 			resp.FailMsg("获取到款数据失败", "获取到款数据失败, Err: "+err.Error(), c)
 			return
 		}
-		sellerItem := sellerMap[newInvoice[0].SellerId]
-		if sellerItem == nil {
-			resp.Fail("销售信息异常", c)
-			return
-		}
-		invoiceItem.SellerId = sellerItem.SellerId
-		invoiceItem.SellerName = sellerItem.SellerName
-		invoiceItem.SellerGroupId = sellerItem.GroupId
-		invoiceItem.SellerGroupName = sellerItem.GroupName
-		invoiceItem.SellerTeamId = sellerItem.TeamId
-		invoiceItem.SellerTeamName = sellerItem.TeamName
-		e = invoiceItem.Update([]string{"SellerId","SellerName","SellerGroupId","SellerGroupName","SellerTeamId","SellerTeamName"})
-		if e != nil {
-			resp.FailMsg("更新到款销售失败", "更新到款销售失败, Err: "+e.Error(), c)
-			return
+		if err == nil {
+			sellerItem := sellerMap[newInvoice[0].SellerId]
+			if sellerItem == nil {
+				resp.Fail("销售信息异常", c)
+				return
+			}
+			invoiceItem.SellerId = sellerItem.SellerId
+			invoiceItem.SellerName = sellerItem.SellerName
+			invoiceItem.SellerGroupId = sellerItem.GroupId
+			invoiceItem.SellerGroupName = sellerItem.GroupName
+			invoiceItem.SellerTeamId = sellerItem.TeamId
+			invoiceItem.SellerTeamName = sellerItem.TeamName
+			e = invoiceItem.Update([]string{"SellerId","SellerName","SellerGroupId","SellerGroupName","SellerTeamId","SellerTeamName"})
+			if e != nil {
+				resp.FailMsg("更新到款销售失败", "更新到款销售失败, Err: "+e.Error(), c)
+				return
+			}
 		}
 	}