|
@@ -115,11 +115,18 @@ func YanXuanActivityPointsBillReduce() (err error) {
|
|
break
|
|
break
|
|
case 4:
|
|
case 4:
|
|
go YanXuanActivityPointsBillActivityPublishAndCancelReduce(log)
|
|
go YanXuanActivityPointsBillActivityPublishAndCancelReduce(log)
|
|
- fmt.Println("4:活动发布,取消发布")
|
|
|
|
|
|
+ fmt.Println("4:活动发布、取消发布")
|
|
break
|
|
break
|
|
case 5:
|
|
case 5:
|
|
- //go ActivitySpecialUserLabelLogReduce(log)
|
|
|
|
- fmt.Println("5:活动到会。")
|
|
|
|
|
|
+ //go YanXuanActivityPointsBillActivityCancelReduce(log)
|
|
|
|
+ fmt.Println("5:活动取消发布。")
|
|
|
|
+ case 6:
|
|
|
|
+ go YanXuanCompanyApprovalReduce(log)
|
|
|
|
+ fmt.Println("6:研选审批通过的时候研选扣点更新。")
|
|
|
|
+ break
|
|
|
|
+ case 7:
|
|
|
|
+ go YanXuanCompanyCompanyTryOutReduce(log)
|
|
|
|
+ fmt.Println("7:正式专试用定时任务更新研选扣点。")
|
|
break
|
|
break
|
|
default:
|
|
default:
|
|
fmt.Println(string(b))
|
|
fmt.Println(string(b))
|
|
@@ -393,16 +400,17 @@ func YanXuanActivityPointsBillActivityEditReduce(log models.YanXuanActivityPoint
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// 4:活动发布以及取消发布
|
|
|
|
|
|
+// 4:活动发布取消发布
|
|
func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
fmt.Println(err)
|
|
- go utils.SendAlarmMsg("用户报名活动扣点,处理Redis队列消息失败:"+err.Error()+fmt.Sprint("ActivityId", log.ActivityId, "userId", log.UserId), 2)
|
|
|
|
|
|
+ go utils.SendAlarmMsg("活动发布扣点,处理Redis队列消息失败:"+err.Error()+fmt.Sprint("ActivityId", log.ActivityId, "userId", log.UserId), 2)
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
|
|
|
|
activityId := log.ActivityId
|
|
activityId := log.ActivityId
|
|
|
|
+ publishStatus := log.PublishStatus
|
|
//comapnyId := log.ComapnyId
|
|
//comapnyId := log.ComapnyId
|
|
|
|
|
|
//获取活动是否扣点以及扣点规则明细
|
|
//获取活动是否扣点以及扣点规则明细
|
|
@@ -418,91 +426,309 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
return // 如果不是办会人,即扣点的这种形式,那么就不做任何处理
|
|
return // 如果不是办会人,即扣点的这种形式,那么就不做任何处理
|
|
}
|
|
}
|
|
|
|
|
|
- activityInfo, e := models.GetAddActivityInfoById(activityId)
|
|
|
|
|
|
+ activityInfo, e := models.GetAddActivityInfoByActivityId(activityId)
|
|
if e != nil {
|
|
if e != nil {
|
|
- err = errors.New("GetAddActivityInfoById" + e.Error())
|
|
|
|
|
|
+ err = errors.New("GetAddActivityInfoByActivityId" + e.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if activityInfo.PublishStatus == 0 {
|
|
|
|
- return // 未发布的活动不做处理
|
|
|
|
|
|
+
|
|
|
|
+ comapnyId := activityPointsSetDetail.CompanyId
|
|
|
|
+ var items []*models.CygxActivityPointsBill
|
|
|
|
+
|
|
|
|
+ var itemCompanys []*models.CygxActivityPointsCompany
|
|
|
|
+
|
|
|
|
+ if publishStatus == 1 {
|
|
|
|
+ fmt.Println("//活动发布")
|
|
|
|
+ if comapnyId > 0 {
|
|
|
|
+ comapny, e := models.GetCompanyById(comapnyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ err = errors.New("GetCompanyById" + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 获取用户所在公司剩余的点
|
|
|
|
+ companyPointsNum, e := models.GetCompanyPoints(comapny.CompanyId)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item := new(models.CygxActivityPointsBill)
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ //item.Mobile = user.Mobile
|
|
|
|
+ //item.Email = user.Email
|
|
|
|
+ item.CompanyId = comapny.CompanyId
|
|
|
|
+ item.CompanyName = comapny.CompanyName
|
|
|
|
+ //item.RealName = user.RealName
|
|
|
|
+ item.BillDetailed = -activityPointsSetDetail.CompanyPointsNum
|
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
+ item.AdminId = log.AdminId
|
|
|
|
+ item.Source = log.Source
|
|
|
|
+ item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ item.DoType = 1
|
|
|
|
+ item.Content = activityInfo.ActivityName + "--办会"
|
|
|
|
+ item.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
|
+ items = append(items, item)
|
|
|
|
+
|
|
|
|
+ //更新对应机构的剩余点数
|
|
|
|
+ itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
|
+ itemCompany.CompanyId = comapny.CompanyId
|
|
|
|
+ itemCompany.Points = item.Points
|
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ fmt.Println("//活动取消发布")
|
|
|
|
+ //活动取消发布
|
|
|
|
+ mapCompanyPoints := make(map[int]float64) //一组公司的剩余点数
|
|
|
|
+ if comapnyId > 0 {
|
|
|
|
+ comapny, e := models.GetCompanyById(comapnyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ err = errors.New("GetCompanyById" + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 获取用户所在公司剩余的点
|
|
|
|
+ companyPointsNum, e := models.GetCompanyPoints(comapny.CompanyId)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item := new(models.CygxActivityPointsBill)
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ //item.Mobile = user.Mobile
|
|
|
|
+ //item.Email = user.Email
|
|
|
|
+ item.CompanyId = comapny.CompanyId
|
|
|
|
+ item.CompanyName = comapny.CompanyName
|
|
|
|
+ //item.RealName = user.RealName
|
|
|
|
+ item.BillDetailed = activityPointsSetDetail.CompanyPointsNum
|
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
+ item.AdminId = log.AdminId
|
|
|
|
+ item.Source = log.Source
|
|
|
|
+ item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ item.DoType = 2
|
|
|
|
+ item.Content = activityInfo.ActivityName + "--取消办会"
|
|
|
|
+ item.Points = companyPointsNum + activityPointsSetDetail.CompanyPointsNum
|
|
|
|
+ items = append(items, item)
|
|
|
|
+ //更新对应机构的剩余点数
|
|
|
|
+ itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
|
+ itemCompany.CompanyId = comapny.CompanyId
|
|
|
|
+ itemCompany.Points = item.Points
|
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+ mapCompanyPoints[comapnyId] = item.Points
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if activityPointsSetDetail.UserPointsNum > 0 && activityPointsSetDetail.PointsType == 1 {
|
|
|
|
+ //如果扣点形式选的是报名即扣点,那么就对已经报名的用户所在机构进行返点
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ condition = ` AND do_fail_type = 0 AND activity_id = ?`
|
|
|
|
+ pars = append(pars, activityId)
|
|
|
|
+
|
|
|
|
+ listSignup, e := models.GetActivitySignupList(condition, pars)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("GetActivitySignupList, Err: " + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var companyIds []int
|
|
|
|
+ if len(listSignup) > 0 {
|
|
|
|
+ for _, v := range listSignup {
|
|
|
|
+ companyIds = append(companyIds, v.CompanyId)
|
|
|
|
+ }
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
|
+ condition = ` AND company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)`
|
|
|
|
+ pars = append(pars, companyIds)
|
|
|
|
+
|
|
|
|
+ //获取这些公司剩余的点数
|
|
|
|
+ conpanyList, e := models.GetCygxActivityPointsCompanyList(condition, pars)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("GetCygxActivityPointsCompanyList, Err: " + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, v := range conpanyList {
|
|
|
|
+ if mapCompanyPoints[comapnyId] != 0 {
|
|
|
|
+ mapCompanyPoints[comapnyId] = v.Points
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, user := range listSignup {
|
|
|
|
+ item := new(models.CygxActivityPointsBill)
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ item.Mobile = user.Mobile
|
|
|
|
+ item.Email = user.Email
|
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
|
+ item.RealName = user.RealName
|
|
|
|
+ item.BillDetailed = activityPointsSetDetail.UserPointsNum
|
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
+ item.AdminId = log.AdminId
|
|
|
|
+ item.Source = log.Source
|
|
|
|
+ item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ item.DoType = 2
|
|
|
|
+ item.Content = activityInfo.ActivityName + "--取消活动"
|
|
|
|
+ mapCompanyPoints[comapnyId] += activityPointsSetDetail.UserPointsNum //通过map处理机构剩余点数
|
|
|
|
+ item.Points = mapCompanyPoints[comapnyId]
|
|
|
|
+ items = append(items, item)
|
|
|
|
+
|
|
|
|
+ //更新对应机构的剩余点数
|
|
|
|
+ itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
|
+ itemCompany.CompanyId = user.CompanyId
|
|
|
|
+ itemCompany.Points = item.Points
|
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+ mapCompanyPoints[comapnyId] = item.Points
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ e = models.AddCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("AddCygxActivityPointsBillMulti, Err: " + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 6:研选审批通过的时候研选扣点更新
|
|
|
|
+func YanXuanCompanyApprovalReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
|
|
+ defer func() {
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ go utils.SendAlarmMsg("研选审批通过的时候研选扣点更新,处理Redis队列消息失败:"+err.Error()+fmt.Sprint(log), 2)
|
|
|
|
+ }
|
|
|
|
+ }()
|
|
|
|
+ comapnyId := log.ComapnyId
|
|
|
|
+
|
|
comapny, e := models.GetCompanyById(comapnyId)
|
|
comapny, e := models.GetCompanyById(comapnyId)
|
|
if e != nil {
|
|
if e != nil {
|
|
err = errors.New("GetCompanyById" + e.Error())
|
|
err = errors.New("GetCompanyById" + e.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 获取用户所在公司剩余的点
|
|
|
|
- companyPointsNum, e := models.GetCompanyPoints(comapny.CompanyId)
|
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
- err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
|
|
|
+ total, e := models.GetCygxActivityPointsCompanyCountByCompanyId(comapnyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ err = errors.New("GetCygxActivityPointsCompanyCountByCompanyId, Err: " + e.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- //查询最新的一条针对这个公司的扣点记录
|
|
|
|
|
|
+ //查询研选的权限状态
|
|
var condition string
|
|
var condition string
|
|
var pars []interface{}
|
|
var pars []interface{}
|
|
- condition += ` AND activity_id = ? AND company_id = ? AND user_id = 0 ORDER BY id DESC LIMIT 1 `
|
|
|
|
- pars = append(pars, activityId)
|
|
|
|
- activityPointsBillDetail, e := models.GetCygxActivityPointsBillDetailByCondition(condition, pars)
|
|
|
|
|
|
+ condition += " AND company_id = ? AND status = ? AND chart_permission_id = ? ORDER BY company_report_permission_id DESC LIMIT 1 "
|
|
|
|
+ pars = append(pars, comapnyId, "正式", utils.CHART_PERMISSION_ID_YANXUAN)
|
|
|
|
+ companyReportPermissionDetail, e := models.GetCompanyReportPermissionDetailByCondition(condition, pars)
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if companyReportPermissionDetail == nil {
|
|
|
|
+ return // 如果不存在就不做研选扣点处理
|
|
|
|
+ }
|
|
|
|
+ var billDetailed float64
|
|
|
|
+ var content string
|
|
|
|
+ //ExpensiveYx int `description:"权益研选: 0-3w; 1-5w"` 3W3次、5W 15次
|
|
|
|
+ if companyReportPermissionDetail.ExpensiveYx == 1 {
|
|
|
|
+ billDetailed = 15
|
|
|
|
+ content = "买方研选plus转正"
|
|
|
|
+ } else {
|
|
|
|
+ billDetailed = 3
|
|
|
|
+ content = "买方研选转正"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取需要添加的流水信息
|
|
var items []*models.CygxActivityPointsBill
|
|
var items []*models.CygxActivityPointsBill
|
|
item := new(models.CygxActivityPointsBill)
|
|
item := new(models.CygxActivityPointsBill)
|
|
|
|
+ //item.UserId = user.UserId
|
|
|
|
+ //item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ //item.Mobile = user.Mobile
|
|
|
|
+ //item.Email = user.Email
|
|
|
|
+ item.CompanyId = comapny.CompanyId
|
|
|
|
+ item.CompanyName = comapny.CompanyName
|
|
|
|
+ //item.RealName = user.RealName
|
|
|
|
+ item.BillDetailed = billDetailed
|
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
+ item.AdminId = log.AdminId
|
|
|
|
+ item.Source = log.Source
|
|
|
|
+ //item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ item.DoType = 2
|
|
|
|
+ item.Content = content
|
|
|
|
+ item.Points = billDetailed
|
|
|
|
+ items = append(items, item)
|
|
|
|
+
|
|
|
|
+ //更新对应机构的剩余点数
|
|
var itemCompanys []*models.CygxActivityPointsCompany
|
|
var itemCompanys []*models.CygxActivityPointsCompany
|
|
itemCompany := new(models.CygxActivityPointsCompany)
|
|
itemCompany := new(models.CygxActivityPointsCompany)
|
|
- if activityPointsBillDetail == nil { //如果是空的就添加
|
|
|
|
- //获取需要添加的流水信息
|
|
|
|
|
|
+ itemCompany.CompanyId = comapny.CompanyId
|
|
|
|
+ itemCompany.Points = item.Points
|
|
|
|
+ itemCompany.CreateTime = time.Now()
|
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+ //判断是否存在记录,如果有就一个新增一个修改,如果没有就同时新增
|
|
|
|
+ if total == 0 {
|
|
|
|
+ err = models.AddCygxActivityPointsBillAndCompanyMulti(items, itemCompanys)
|
|
|
|
+ } else {
|
|
|
|
+ err = models.AddCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
|
+ }
|
|
|
|
|
|
- //item.UserId = user.UserId
|
|
|
|
- item.ActivityId = activityId
|
|
|
|
- item.CreateTime = time.Now()
|
|
|
|
- //item.Mobile = user.Mobile
|
|
|
|
- //item.Email = user.Email
|
|
|
|
- item.CompanyId = comapny.CompanyId
|
|
|
|
- item.CompanyName = comapny.CompanyName
|
|
|
|
- //item.RealName = user.RealName
|
|
|
|
- item.BillDetailed = -activityPointsSetDetail.CompanyPointsNum
|
|
|
|
- item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
- item.AdminId = log.AdminId
|
|
|
|
- item.Source = log.Source
|
|
|
|
- item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
- item.DoType = 1
|
|
|
|
- item.Content = activityInfo.ActivityName + "--办会"
|
|
|
|
- item.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
|
- items = append(items, item)
|
|
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
|
|
- //更新对应机构的剩余点数
|
|
|
|
- itemCompany.CompanyId = comapny.CompanyId
|
|
|
|
- itemCompany.Points = item.Points
|
|
|
|
- itemCompany.ModifyTime = time.Now()
|
|
|
|
- itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
- e = models.AddCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
- err = errors.New("AddCygxActivityPointsBillMulti, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
|
|
+// 7:正式专试用定时任务更新研选扣点
|
|
|
|
+func YanXuanCompanyCompanyTryOutReduce(log models.YanXuanActivityPointsRedis) (err error) {
|
|
|
|
+ defer func() {
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ go utils.SendAlarmMsg("正式专试用定时任务更新研选扣点更新,处理Redis队列消息失败:"+err.Error()+fmt.Sprint(log), 2)
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- //如果存在就进行对比修改
|
|
|
|
- if activityPointsSetDetail.CompanyPointsNum != activityPointsBillDetail.BillDetailed {
|
|
|
|
- item.Id = activityPointsBillDetail.Id
|
|
|
|
- item.BillDetailed = -activityPointsSetDetail.CompanyPointsNum
|
|
|
|
- item.Points = companyPointsNum - activityPointsBillDetail.BillDetailed - activityPointsSetDetail.CompanyPointsNum
|
|
|
|
- items = append(items, item)
|
|
|
|
|
|
+ }()
|
|
|
|
+ comapnyId := log.ComapnyId
|
|
|
|
|
|
- //更新对应机构的剩余点数
|
|
|
|
- itemCompany.CompanyId = comapny.CompanyId
|
|
|
|
- itemCompany.Points = item.Points
|
|
|
|
- itemCompany.ModifyTime = time.Now()
|
|
|
|
- itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
- e = models.UpdateCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
- err = errors.New("UpdateCygxActivityPointsBillMulti, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ comapny, e := models.GetCompanyById(comapnyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ err = errors.New("GetCompanyById" + e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 获取用户所在公司剩余的点
|
|
|
|
+ companyPointsNum, e := models.GetCompanyPoints(comapnyId)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //获取需要添加的流水信息
|
|
|
|
+ var items []*models.CygxActivityPointsBill
|
|
|
|
+ item := new(models.CygxActivityPointsBill)
|
|
|
|
+ //item.UserId = user.UserId
|
|
|
|
+ //item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ //item.Mobile = user.Mobile
|
|
|
|
+ //item.Email = user.Email
|
|
|
|
+ item.CompanyId = comapny.CompanyId
|
|
|
|
+ item.CompanyName = comapny.CompanyName
|
|
|
|
+ //item.RealName = user.RealName
|
|
|
|
+ item.BillDetailed = -companyPointsNum
|
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
|
+ item.AdminId = log.AdminId
|
|
|
|
+ item.Source = log.Source
|
|
|
|
+ //item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
|
+ item.DoType = 2
|
|
|
|
+ item.Content = "到期清零"
|
|
|
|
+ item.Points = 0
|
|
|
|
+ items = append(items, item)
|
|
|
|
+
|
|
|
|
+ //更新对应机构的剩余点数
|
|
|
|
+ var itemCompanys []*models.CygxActivityPointsCompany
|
|
|
|
+ itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
|
+ itemCompany.CompanyId = comapny.CompanyId
|
|
|
|
+ itemCompany.Points = 0
|
|
|
|
+ itemCompany.CreateTime = time.Now()
|
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
|
+
|
|
|
|
+ err = models.AddCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
|
+
|
|
return
|
|
return
|
|
}
|
|
}
|