ziwen 1 year ago
parent
commit
646b37aa1d
1 changed files with 19 additions and 19 deletions
  1. 19 19
      controllers/activity_special.go

+ 19 - 19
controllers/activity_special.go

@@ -261,25 +261,6 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 			itemBill.BillDetailed = -1 // 流水减一
 			itemBill.RegisterPlatform = 1
 			itemBill.ChartPermissionId = activityInfo.ChartPermissionId
-			userType, tripRemaining, mapChartName, err := services.GetChartPermissionSpecialSurplusByCompany(user.CompanyId)
-			if err != nil {
-				br.Msg = "获取专项调研剩余次数失败"
-				br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
-				return
-			}
-			if userType == 2 {
-				tripRemaining = tripRemaining-1
-				itemBill.Total = strconv.Itoa(tripRemaining) + "次"
-			} else {
-				for k, num := range mapChartName {
-					if activityInfo.ChartPermissionName == k {
-						num = num- 1
-					}
-					itemBill.Total += k + strconv.Itoa(num) + "次+"
-				}
-				itemBill.Total = strings.TrimRight(itemBill.Total, "+")
-			}
-
 
 			var itemMeeting = new(models.CygxActivitySpecialMeetingDetail)
 			itemMeeting.UserId = user.UserId
@@ -354,6 +335,25 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 					itemBill.BillDetailed = 0 //48小时之内,取消报名之后二次报名,不扣除流水记录
 				}
 			}
+			userType, tripRemaining, mapChartName, err := services.GetChartPermissionSpecialSurplusByCompany(user.CompanyId)
+			if err != nil {
+				br.Msg = "获取专项调研剩余次数失败"
+				br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+				return
+			}
+			if userType == 2 {
+				tripRemaining = tripRemaining-itemBill.BillDetailed
+				itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+			} else {
+				for k, num := range mapChartName {
+					if activityInfo.ChartPermissionName == k {
+						num = num- itemBill.BillDetailed
+					}
+					itemBill.Total += k + strconv.Itoa(num) + "次+"
+				}
+				itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+			}
+
 			//添加流水记录
 			err = models.AddCygxActivitySpecialTripBill(itemBill)
 			if err != nil {