|
@@ -1612,6 +1612,10 @@ func ActivitySpecialCompanyApprovalReduce(log models.YanXuanActivityPointsRedis)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//func init() {
|
|
|
|
+// ActivitySpecialPointsBillSubmitMeetingReduce(93)
|
|
|
|
+//}
|
|
|
|
+
|
|
// 12: 专项调活动提交到会扣点处理
|
|
// 12: 专项调活动提交到会扣点处理
|
|
func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
//func ActivitySpecialPointsBillSubmitMeetingReduce(activityId int) (err error) {
|
|
//func ActivitySpecialPointsBillSubmitMeetingReduce(activityId int) (err error) {
|
|
@@ -1672,17 +1676,6 @@ func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPoin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //return
|
|
|
|
- pars = make([]interface{}, 0)
|
|
|
|
- condition = ` AND company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)`
|
|
|
|
- pars = append(pars, companyIds)
|
|
|
|
- //获取这些公司剩余的点数
|
|
|
|
- conpanyList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
|
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
- err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
pars = make([]interface{}, 0)
|
|
pars = make([]interface{}, 0)
|
|
condition = ` AND activity_id = ? AND table_source = 'activityspecial' AND mobile != '' ORDER BY id DESC `
|
|
condition = ` AND activity_id = ? AND table_source = 'activityspecial' AND mobile != '' ORDER BY id DESC `
|
|
pars = append(pars, activityId)
|
|
pars = append(pars, activityId)
|
|
@@ -1693,11 +1686,28 @@ func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPoin
|
|
return
|
|
return
|
|
}
|
|
}
|
|
mapActivityPointsBill := make(map[string]*models.CygxActivitySpecialTripBill)
|
|
mapActivityPointsBill := make(map[string]*models.CygxActivitySpecialTripBill)
|
|
- for _, v := range activityPointsBillList { //获取这场活动,某个手机号最后一次的扣点记录
|
|
|
|
|
|
+ var itemsOld []*models.CygxActivitySpecialTripBill // 之前扣过点的流水记录
|
|
|
|
+ for _, v := range activityPointsBillList { //获取这场活动,某个手机号最后一次的扣点记录
|
|
if mapActivityPointsBill[v.Mobile] == nil {
|
|
if mapActivityPointsBill[v.Mobile] == nil {
|
|
mapActivityPointsBill[v.Mobile] = v
|
|
mapActivityPointsBill[v.Mobile] = v
|
|
|
|
+ if v.BillDetailed < 0 {
|
|
|
|
+ itemsOld = append(itemsOld, v)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ companyIds = append(companyIds, v.CompanyId)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //return
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
|
+ condition = ` AND company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)`
|
|
|
|
+ pars = append(pars, companyIds)
|
|
|
|
+ //获取这些公司剩余的点数
|
|
|
|
+ conpanyList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err: " + e.Error())
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+
|
|
//return
|
|
//return
|
|
for _, v := range conpanyList {
|
|
for _, v := range conpanyList {
|
|
if v.CompanyId != 0 {
|
|
if v.CompanyId != 0 {
|
|
@@ -1708,7 +1718,9 @@ func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPoin
|
|
//return
|
|
//return
|
|
var items []*models.CygxActivitySpecialTripBill
|
|
var items []*models.CygxActivitySpecialTripBill
|
|
var itemCompanys []*models.CygxActivitySpecialPermissionPoints
|
|
var itemCompanys []*models.CygxActivitySpecialPermissionPoints
|
|
|
|
+ mapMeetUserId := make(map[int]bool)
|
|
for _, user := range signUpDetailList {
|
|
for _, user := range signUpDetailList {
|
|
|
|
+ mapMeetUserId[user.UserId] = true
|
|
item := new(models.CygxActivitySpecialTripBill)
|
|
item := new(models.CygxActivitySpecialTripBill)
|
|
item.ActivityId = activityId
|
|
item.ActivityId = activityId
|
|
item.CreateTime = time.Now()
|
|
item.CreateTime = time.Now()
|
|
@@ -1742,29 +1754,70 @@ func ActivitySpecialPointsBillSubmitMeetingReduce(log models.YanXuanActivityPoin
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
mapCompanyPoints[user.CompanyId] = points
|
|
mapCompanyPoints[user.CompanyId] = points
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- ////第二次提交改成未到会的,对其进行返点处理
|
|
|
|
- if mapActivityPointsBill[user.Mobile] != nil && mapActivityPointsBill[user.Mobile].BillDetailed < 0 {
|
|
|
|
- fmt.Println("取消到会了")
|
|
|
|
- points := mapCompanyPoints[user.CompanyId] + 1
|
|
|
|
- item.BillDetailed = 1
|
|
|
|
- item.DoType = 2
|
|
|
|
- item.Content = activityInfo.ResearchTheme + "--活动取消到会"
|
|
|
|
- //item.Points =points
|
|
|
|
- item.Total = fmt.Sprint(points, "次")
|
|
|
|
- item.TableSource = utils.CYGX_OBJ_ACTIVITYSPECIAL
|
|
|
|
- items = append(items, item)
|
|
|
|
-
|
|
|
|
- //更新对应机构的剩余点数
|
|
|
|
- itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
|
- itemCompany.CompanyId = user.CompanyId
|
|
|
|
- itemCompany.Points = points
|
|
|
|
- itemCompany.ModifyTime = time.Now()
|
|
|
|
- itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
- mapCompanyPoints[user.CompanyId] = points
|
|
|
|
|
|
+ }
|
|
|
|
+ //else {
|
|
|
|
+ // ////第二次提交改成未到会的,对其进行返点处理
|
|
|
|
+ // if mapActivityPointsBill[user.Mobile] != nil && mapActivityPointsBill[user.Mobile].BillDetailed < 0 {
|
|
|
|
+ // fmt.Println("取消到会了")
|
|
|
|
+ // points := mapCompanyPoints[user.CompanyId] + 1
|
|
|
|
+ // item.BillDetailed = 1
|
|
|
|
+ // item.DoType = 2
|
|
|
|
+ // item.Content = activityInfo.ResearchTheme + "--活动取消到会"
|
|
|
|
+ // //item.Points =points
|
|
|
|
+ // item.Total = fmt.Sprint(points, "次")
|
|
|
|
+ // item.TableSource = utils.CYGX_OBJ_ACTIVITYSPECIAL
|
|
|
|
+ // items = append(items, item)
|
|
|
|
+ //
|
|
|
|
+ // //更新对应机构的剩余点数
|
|
|
|
+ // itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
|
+ // itemCompany.CompanyId = user.CompanyId
|
|
|
|
+ // itemCompany.Points = points
|
|
|
|
+ // itemCompany.ModifyTime = time.Now()
|
|
|
|
+ // itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+ // mapCompanyPoints[user.CompanyId] = points
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if len(itemsOld) > 0 {
|
|
|
|
+ for _, user := range signUpDetailList {
|
|
|
|
+ if mapMeetUserId[user.UserId] {
|
|
|
|
+ continue
|
|
}
|
|
}
|
|
|
|
+ item := new(models.CygxActivitySpecialTripBill)
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ item.UserId = user.UserId
|
|
|
|
+ item.Mobile = user.Mobile
|
|
|
|
+ item.Email = user.Email
|
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
|
+ item.RealName = user.RealName
|
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
+ item.AdminId = log.AdminId
|
|
|
|
+ item.Source = log.Source
|
|
|
|
+ item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ item.ChartPermissionName = activityInfo.ChartPermissionName
|
|
|
|
+
|
|
|
|
+ points := mapCompanyPoints[user.CompanyId] + 1
|
|
|
|
+ item.BillDetailed = 1
|
|
|
|
+ item.DoType = 2
|
|
|
|
+ item.Content = activityInfo.ResearchTheme + "--活动取消到会"
|
|
|
|
+ //item.Points =points
|
|
|
|
+ item.Total = fmt.Sprint(points, "次")
|
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ACTIVITYSPECIAL
|
|
|
|
+ items = append(items, item)
|
|
|
|
+
|
|
|
|
+ //更新对应机构的剩余点数
|
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
|
+ itemCompany.CompanyId = user.CompanyId
|
|
|
|
+ itemCompany.Points = points
|
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+ mapCompanyPoints[user.CompanyId] = points
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
e = models.AddCygxActivitySpecialTripBillMulti(items, itemCompanys)
|
|
e = models.AddCygxActivitySpecialTripBillMulti(items, itemCompanys)
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
err = errors.New("AddCygxActivitySpecialTripBillMulti, Err: " + e.Error())
|
|
err = errors.New("AddCygxActivitySpecialTripBillMulti, Err: " + e.Error())
|