|
@@ -353,6 +353,58 @@ func YanXuanActivityPointsBillActivityEditReduce(log models.YanXuanActivityPoint
|
|
|
if activityPointsBillDetail == nil { //如果是空的就添加
|
|
|
//获取需要添加的流水信息
|
|
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND activity_id = ? AND company_id != ? AND company_id > 0 AND mobile = '' ORDER BY id DESC LIMIT 1 `
|
|
|
+ pars = append(pars, activityId, comapnyId)
|
|
|
+
|
|
|
+ activityPointsBillDetailOld, e := models.GetCygxActivityPointsBillDetailByCondition(condition, pars)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //判断是否有变更过过公司,如果有变更那么就对上一家公司进行返点
|
|
|
+ if activityPointsBillDetailOld != nil {
|
|
|
+ comapnyIdOld := activityPointsBillDetailOld.CompanyId
|
|
|
+ //如果公司进行变更,那么就对原有的公司进行返点处理
|
|
|
+ if comapnyIdOld != comapny.CompanyId {
|
|
|
+ comapnyOld, e := models.GetCompanyById(comapnyIdOld)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCompanyById" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 获取用户所在公司剩余的点
|
|
|
+ companyPointsNumOld, e := models.GetCompanyPoints(comapnyOld.CompanyId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ itemOld := new(models.CygxActivityPointsBill)
|
|
|
+ //item.UserId = user.UserId
|
|
|
+ itemOld.ActivityId = activityId
|
|
|
+ itemOld.CreateTime = time.Now()
|
|
|
+ //item.Mobile = user.Mobile
|
|
|
+ //item.Email = user.Email
|
|
|
+ itemOld.CompanyId = comapnyOld.CompanyId
|
|
|
+ itemOld.CompanyName = comapnyOld.CompanyName
|
|
|
+ //item.RealName = user.RealName
|
|
|
+ itemOld.BillDetailed = activityPointsSetDetail.CompanyPointsNum
|
|
|
+ itemOld.RegisterPlatform = log.RegisterPlatform
|
|
|
+ itemOld.AdminId = log.AdminId
|
|
|
+ itemOld.Source = log.Source
|
|
|
+ itemOld.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
+ itemOld.DoType = 2
|
|
|
+ itemOld.Content = activityInfo.ActivityName + "--取消办会"
|
|
|
+ itemOld.Points = companyPointsNumOld + activityPointsSetDetail.CompanyPointsNum
|
|
|
+ items = append(items, itemOld)
|
|
|
+
|
|
|
+ //更新对应机构的剩余点数
|
|
|
+ itemCompany.CompanyId = comapnyOld.CompanyId
|
|
|
+ itemCompany.Points = item.Points
|
|
|
+ itemCompany.ModifyTime = time.Now()
|
|
|
+ itemCompanys = append(itemCompanys, itemCompany)
|
|
|
+ }
|
|
|
+ }
|
|
|
//item.UserId = user.UserId
|
|
|
item.ActivityId = activityId
|
|
|
item.CreateTime = time.Now()
|
|
@@ -701,7 +753,6 @@ func YanXuanActivityPointsBillSubmitMeetingReduce(log models.YanXuanActivityPoin
|
|
|
item.DoType = 1
|
|
|
item.Content = activityInfo.ActivityName + "--活动到会"
|
|
|
item.Points = mapCompanyPoints[user.CompanyId] - activityPointsSetDetail.CompanyPointsNum
|
|
|
- item.Points = mapCompanyPoints[user.CompanyId]
|
|
|
items = append(items, item)
|
|
|
} else {
|
|
|
//第二次提交改成未到会的,对其进行返点处理
|