|
@@ -49,6 +49,7 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
|
}
|
|
|
roleTypeCode := AdminUser.RoleTypeCode
|
|
|
var items []*cygx.CygxActivitySpecialTrip
|
|
|
+ var itemsRedis []*cygx.CygxActivitySpecialTrip
|
|
|
var itemsBill []*cygx.CygxActivitySpecialTripBill
|
|
|
var itemsMeet []*cygx.CygxActivitySpecialMeetingDetail
|
|
|
activityIds := req.ActivityIds
|
|
@@ -64,6 +65,16 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
|
uids += strconv.Itoa(v.UserId) + ","
|
|
|
}
|
|
|
uids = strings.TrimRight(uids, ",")
|
|
|
+
|
|
|
+ if roleTypeCode != utils.ROLE_TYPE_CODE_ADMIN {
|
|
|
+ err = cygxService.CheckSpecialActivityPointsByUserIds(uids, len(activityIdList))
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, v := range uidList {
|
|
|
uid := v.UserId
|
|
|
wxUser, userErr := models.GetWxUserByUserId(uid)
|
|
@@ -82,7 +93,7 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
|
}
|
|
|
limitPeopleNum := activityInfo.LimitPeopleNum
|
|
|
if limitPeopleNum > 0 {
|
|
|
- if AdminUser.RoleTypeCode != "admin" {
|
|
|
+ if AdminUser.RoleTypeCode != utils.ROLE_TYPE_CODE_ADMIN {
|
|
|
havePower, err := cygxService.GetSpecialDetailUserPower(wxUser, activityInfo)
|
|
|
if err != nil {
|
|
|
br.Msg = "用户权限校验失败!"
|
|
@@ -129,46 +140,38 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
|
br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if totalAll > 0 {
|
|
|
- continue
|
|
|
- }
|
|
|
|
|
|
- if totalAll == 0 {
|
|
|
- item := new(cygx.CygxActivitySpecialTrip)
|
|
|
- item.UserId = infoUser.UserId
|
|
|
- item.RealName = infoUser.RealName
|
|
|
- item.SellerName = infoUser.SellerName
|
|
|
- item.ActivityId = activityId
|
|
|
- item.CreateTime = time.Now()
|
|
|
- item.Mobile = infoUser.Mobile
|
|
|
- item.Email = infoUser.Email
|
|
|
- item.CompanyId = infoUser.CompanyId
|
|
|
- item.CompanyName = infoUser.CompanyName
|
|
|
- item.AdminId = AdminUser.AdminId
|
|
|
- item.Source = 2
|
|
|
-
|
|
|
- if infoUser.OutboundMobile != "" {
|
|
|
- item.OutboundMobile = infoUser.OutboundMobile
|
|
|
- if infoUser.OutboundCountryCode == "" {
|
|
|
- item.CountryCode = "86"
|
|
|
- } else {
|
|
|
- item.CountryCode = infoUser.OutboundCountryCode
|
|
|
- }
|
|
|
+ item := new(cygx.CygxActivitySpecialTrip)
|
|
|
+ item.UserId = infoUser.UserId
|
|
|
+ item.RealName = infoUser.RealName
|
|
|
+ item.SellerName = infoUser.SellerName
|
|
|
+ item.ActivityId = activityId
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.Mobile = infoUser.Mobile
|
|
|
+ item.Email = infoUser.Email
|
|
|
+ item.CompanyId = infoUser.CompanyId
|
|
|
+ item.CompanyName = infoUser.CompanyName
|
|
|
+ item.AdminId = AdminUser.AdminId
|
|
|
+ item.Source = 2
|
|
|
+
|
|
|
+ if infoUser.OutboundMobile != "" {
|
|
|
+ item.OutboundMobile = infoUser.OutboundMobile
|
|
|
+ if infoUser.OutboundCountryCode == "" {
|
|
|
+ item.CountryCode = "86"
|
|
|
} else {
|
|
|
- item.OutboundMobile = infoUser.Mobile
|
|
|
- if infoUser.CountryCode == "" {
|
|
|
- item.CountryCode = "86"
|
|
|
- } else {
|
|
|
- item.CountryCode = infoUser.CountryCode
|
|
|
- }
|
|
|
+ item.CountryCode = infoUser.OutboundCountryCode
|
|
|
}
|
|
|
- items = append(items, item)
|
|
|
- err = cygxService.DeductTripRemainingtimesByUser(infoUser, activityInfo, roleTypeCode)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ } else {
|
|
|
+ item.OutboundMobile = infoUser.Mobile
|
|
|
+ if infoUser.CountryCode == "" {
|
|
|
+ item.CountryCode = "86"
|
|
|
+ } else {
|
|
|
+ item.CountryCode = infoUser.CountryCode
|
|
|
}
|
|
|
+ }
|
|
|
+ itemsRedis = append(itemsRedis, item)
|
|
|
+ if totalAll == 0 {
|
|
|
+ items = append(items, item)
|
|
|
} else {
|
|
|
err = cygx.UpdateSpecialTrip(1, 0, uid, activityId)
|
|
|
if err != nil {
|
|
@@ -197,9 +200,9 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
|
|
|
br.ErrMsg = "新增用户失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if len(items) > 0 {
|
|
|
+ if len(itemsRedis) > 0 {
|
|
|
|
|
|
- for _, v := range items {
|
|
|
+ for _, v := range itemsRedis {
|
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
cygxService.SpecialActivityPointsBillSignupAddSpecial(v.ActivityId, v.UserId, AdminUser.AdminId)
|
|
|
}
|
|
@@ -480,57 +483,11 @@ func (this *ActivitySpecialTripCoAntroller) TripCancel() {
|
|
|
br.ErrMsg = "操作失败,Err:" + errInfo.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- infoUser, err := cygx.GetUserAndCompanyNameList(userId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
|
|
|
|
|
|
var isValid int
|
|
|
if time.Now().Add(+time.Hour * 48).After(resultTime) {
|
|
|
isValid = 1
|
|
|
-
|
|
|
- } else {
|
|
|
- err = cygxService.RebateTripRemainingtimesByUser(infoUser, activityInfo)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "操作失败,RebateTripRemainingtimesByUserErr:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
}
|
|
|
err = cygx.ActivitySpecialTripCancel(isValid, activityId, userId)
|
|
|
if err != nil {
|
|
@@ -538,37 +495,6 @@ func (this *ActivitySpecialTripCoAntroller) TripCancel() {
|
|
|
br.ErrMsg = "修改失败 Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
go cygxService.ActivityPointsBillSignupCancelSpecial(activityId, userId, sysUser.AdminId)
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
@@ -800,12 +726,12 @@ func (this *ActivitySpecialTripCoAntroller) MeetingDo() {
|
|
|
return
|
|
|
}
|
|
|
if userType == 2 {
|
|
|
- tripRemaining += itemBill.BillDetailed
|
|
|
+
|
|
|
itemBill.Total = strconv.Itoa(tripRemaining) + "次"
|
|
|
} else {
|
|
|
for k, num := range mapChartName {
|
|
|
if activityInfo.ChartPermissionName == k {
|
|
|
- num += itemBill.BillDetailed
|
|
|
+
|
|
|
}
|
|
|
itemBill.Total += k + strconv.Itoa(num) + "次+"
|
|
|
}
|