|
@@ -167,15 +167,15 @@ func YanXuanActivityPointsBillReduce() (err error) {
|
|
|
go YanXuanActivityPointsBillSubmitMeetingReduce(log)
|
|
|
fmt.Println("5:活动到会研选扣点处理。")
|
|
|
case 6:
|
|
|
- go YanXuanCompanyApprovalReduce(log)
|
|
|
+ //go YanXuanCompanyApprovalReduce(log)
|
|
|
fmt.Println("6:研选审批通过的时候研选扣点更新。")
|
|
|
break
|
|
|
case 7:
|
|
|
- go YanXuanCompanyCompanyTryOutReduce(log)
|
|
|
+ //go YanXuanCompanyCompanyTryOutReduce(log)
|
|
|
fmt.Println("7:正式专试用定时任务更新研选扣点。")
|
|
|
break
|
|
|
case 8:
|
|
|
- go YanXuanActivityVivoPointsBillSignupReduce(log)
|
|
|
+ //go YanXuanActivityVivoPointsBillSignupReduce(log)
|
|
|
fmt.Println("8:播放研选扣点音视频。")
|
|
|
break
|
|
|
default:
|
|
@@ -343,7 +343,7 @@ func YanXuanActivityPointsBillSignupCancelReduce(log models.YanXuanActivityPoint
|
|
|
//查询最新的一条针对这个用户的扣点记录
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- condition += ` AND activity_id = ? AND user_id = ? AND bill_detailed < 0 ORDER BY id DESC LIMIT 1 `
|
|
|
+ condition += ` AND activity_id = ? AND user_id = ? AND table_source = 'activity' AND bill_detailed < 0 ORDER BY id DESC LIMIT 1 `
|
|
|
pars = append(pars, activityId, userId)
|
|
|
activityPointsBillDetail, e := models.GetCygxActivitySpecialTripBillByCondition(condition, pars)
|
|
|
if e != nil {
|
|
@@ -434,17 +434,17 @@ func YanXuanActivityPointsBillActivityEditReduce(log models.YanXuanActivityPoint
|
|
|
//查询最新的一条针对这个公司的扣点记录
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- condition += ` AND activity_id = ? AND company_id = ? AND mobile = '' AND bill_detailed < 0 ORDER BY id DESC LIMIT 1 `
|
|
|
+ condition += ` AND activity_id = ? AND company_id = ? AND mobile = '' AND table_source = 'activity' AND bill_detailed < 0 ORDER BY id DESC LIMIT 1 `
|
|
|
pars = append(pars, activityId, comapnyId)
|
|
|
- activityPointsBillDetail, e := models.GetCygxActivityPointsBillDetailByCondition(condition, pars)
|
|
|
+ activityPointsBillDetail, e := models.GetCygxActivitySpecialTripBillByCondition(condition, pars)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- var items []*models.CygxActivityPointsBill
|
|
|
- item := new(models.CygxActivityPointsBill)
|
|
|
- var itemCompanys []*models.CygxActivityPointsCompany
|
|
|
- itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
+ var items []*models.CygxActivitySpecialTripBill
|
|
|
+ item := new(models.CygxActivitySpecialTripBill)
|
|
|
+ var itemCompanys []*models.CygxActivitySpecialPermissionPoints
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
|
|
|
if activityPointsBillDetail == nil { //如果是空的就添加
|
|
|
//获取需要添加的流水信息
|
|
@@ -463,17 +463,19 @@ func YanXuanActivityPointsBillActivityEditReduce(log models.YanXuanActivityPoint
|
|
|
item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
item.DoType = 1
|
|
|
item.Content = activityInfo.ActivityName + "--办会"
|
|
|
- item.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
+ //item.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
+ item.Total = fmt.Sprint(companyPointsNum-activityPointsSetDetail.CompanyPointsNum, "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ACTIVITY
|
|
|
items = append(items, item)
|
|
|
|
|
|
//更新对应机构的剩余点数
|
|
|
itemCompany.CompanyId = comapny.CompanyId
|
|
|
- itemCompany.Points = item.Points
|
|
|
+ itemCompany.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
itemCompany.ModifyTime = time.Now()
|
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- e = models.AddCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
+ e = models.AddCygxActivitySpecialTripBillMulti(items, itemCompanys)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("AddCygxActivityPointsBillMulti, Err: " + e.Error())
|
|
|
+ err = errors.New("AddCygxActivitySpecialTripBillMulti, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
@@ -481,17 +483,17 @@ func YanXuanActivityPointsBillActivityEditReduce(log models.YanXuanActivityPoint
|
|
|
if activityPointsSetDetail.CompanyPointsNum != -activityPointsBillDetail.BillDetailed {
|
|
|
item.Id = activityPointsBillDetail.Id
|
|
|
item.BillDetailed = -activityPointsSetDetail.CompanyPointsNum
|
|
|
- item.Points = companyPointsNum - activityPointsBillDetail.BillDetailed - activityPointsSetDetail.CompanyPointsNum
|
|
|
+ item.Total = fmt.Sprint(companyPointsNum-activityPointsBillDetail.BillDetailed-activityPointsSetDetail.CompanyPointsNum, "次")
|
|
|
items = append(items, item)
|
|
|
|
|
|
//更新对应机构的剩余点数
|
|
|
itemCompany.CompanyId = comapny.CompanyId
|
|
|
- itemCompany.Points = item.Points
|
|
|
+ itemCompany.Points = companyPointsNum - activityPointsBillDetail.BillDetailed - activityPointsSetDetail.CompanyPointsNum
|
|
|
itemCompany.ModifyTime = time.Now()
|
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- e = models.UpdateCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
+ e = models.AddCygxActivitySpecialTripBillMulti(items, itemCompanys)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("UpdateCygxActivityPointsBillMulti, Err: " + e.Error())
|
|
|
+ err = errors.New("AddCygxActivitySpecialTripBillMulti, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -533,9 +535,9 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
}
|
|
|
|
|
|
comapnyId := activityPointsSetDetail.CompanyId
|
|
|
- var items []*models.CygxActivityPointsBill
|
|
|
+ var items []*models.CygxActivitySpecialTripBill
|
|
|
|
|
|
- var itemCompanys []*models.CygxActivityPointsCompany
|
|
|
+ var itemCompanys []*models.CygxActivitySpecialPermissionPoints
|
|
|
mapCompanyPoints := make(map[int]float64) //一组公司的剩余点数
|
|
|
if publishStatus == 1 {
|
|
|
fmt.Println("//活动发布")
|
|
@@ -551,7 +553,7 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- item := new(models.CygxActivityPointsBill)
|
|
|
+ item := new(models.CygxActivitySpecialTripBill)
|
|
|
item.ActivityId = activityId
|
|
|
item.CreateTime = time.Now()
|
|
|
//item.Mobile = user.Mobile
|
|
@@ -566,16 +568,18 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
item.DoType = 1
|
|
|
item.Content = activityInfo.ActivityName + "--办会"
|
|
|
- item.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
+ //item.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
+ item.Total = fmt.Sprint(companyPointsNum-activityPointsSetDetail.CompanyPointsNum, "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ACTIVITY
|
|
|
items = append(items, item)
|
|
|
|
|
|
//更新对应机构的剩余点数
|
|
|
- itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
itemCompany.CompanyId = comapny.CompanyId
|
|
|
- itemCompany.Points = item.Points
|
|
|
+ itemCompany.Points = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
itemCompany.ModifyTime = time.Now()
|
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- mapCompanyPoints[comapnyId] = item.Points
|
|
|
+ mapCompanyPoints[comapnyId] = companyPointsNum - activityPointsSetDetail.CompanyPointsNum
|
|
|
}
|
|
|
|
|
|
if activityPointsSetDetail.UserPointsNum > 0 && activityPointsSetDetail.PointsType == 1 {
|
|
@@ -613,7 +617,7 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
}
|
|
|
|
|
|
for _, user := range listSignup {
|
|
|
- item := new(models.CygxActivityPointsBill)
|
|
|
+ item := new(models.CygxActivitySpecialTripBill)
|
|
|
item.ActivityId = activityId
|
|
|
item.CreateTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
@@ -630,16 +634,18 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
item.DoType = 1
|
|
|
item.Content = activityInfo.ActivityName + "--发布活动"
|
|
|
mapCompanyPoints[user.CompanyId] -= activityPointsSetDetail.UserPointsNum //通过map处理机构剩余点数
|
|
|
- item.Points = mapCompanyPoints[user.CompanyId]
|
|
|
+ //item.Points = mapCompanyPoints[user.CompanyId]
|
|
|
+ item.Total = fmt.Sprint(mapCompanyPoints[user.CompanyId], "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ACTIVITY
|
|
|
items = append(items, item)
|
|
|
|
|
|
//更新对应机构的剩余点数
|
|
|
- itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
itemCompany.CompanyId = user.CompanyId
|
|
|
- itemCompany.Points = item.Points
|
|
|
+ itemCompany.Points = mapCompanyPoints[user.CompanyId]
|
|
|
itemCompany.ModifyTime = time.Now()
|
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- mapCompanyPoints[user.CompanyId] = item.Points
|
|
|
+ mapCompanyPoints[user.CompanyId] = mapCompanyPoints[user.CompanyId]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -660,7 +666,7 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
err = errors.New("GetCompanyPoints, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- item := new(models.CygxActivityPointsBill)
|
|
|
+ item := new(models.CygxActivitySpecialTripBill)
|
|
|
item.ActivityId = activityId
|
|
|
item.CreateTime = time.Now()
|
|
|
//item.Mobile = user.Mobile
|
|
@@ -675,15 +681,17 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
item.ChartPermissionId = activityInfo.ChartPermissionId
|
|
|
item.DoType = 2
|
|
|
item.Content = activityInfo.ActivityName + "--取消办会"
|
|
|
- item.Points = companyPointsNum + activityPointsSetDetail.CompanyPointsNum
|
|
|
+ //item.Points = companyPointsNum + activityPointsSetDetail.CompanyPointsNum
|
|
|
+ item.Total = fmt.Sprint(companyPointsNum+activityPointsSetDetail.CompanyPointsNum, "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ACTIVITY
|
|
|
items = append(items, item)
|
|
|
//更新对应机构的剩余点数
|
|
|
- itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
itemCompany.CompanyId = comapny.CompanyId
|
|
|
- itemCompany.Points = item.Points
|
|
|
+ itemCompany.Points = companyPointsNum + activityPointsSetDetail.CompanyPointsNum
|
|
|
itemCompany.ModifyTime = time.Now()
|
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- mapCompanyPoints[comapnyId] = item.Points
|
|
|
+ mapCompanyPoints[comapnyId] = companyPointsNum + activityPointsSetDetail.CompanyPointsNum
|
|
|
}
|
|
|
|
|
|
if activityPointsSetDetail.UserPointsNum > 0 && activityPointsSetDetail.PointsType == 1 {
|
|
@@ -738,7 +746,7 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
if !mapUserBill[user.UserId] {
|
|
|
continue // 如果用户的扣点记录不存在,那么就不进行返点处理
|
|
|
}
|
|
|
- item := new(models.CygxActivityPointsBill)
|
|
|
+ item := new(models.CygxActivitySpecialTripBill)
|
|
|
item.ActivityId = activityId
|
|
|
item.CreateTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
@@ -755,23 +763,27 @@ func YanXuanActivityPointsBillActivityPublishAndCancelReduce(log models.YanXuanA
|
|
|
item.DoType = 2
|
|
|
item.Content = activityInfo.ActivityName + "--取消活动"
|
|
|
mapCompanyPoints[user.CompanyId] += activityPointsSetDetail.UserPointsNum //通过map处理机构剩余点数
|
|
|
- item.Points = mapCompanyPoints[user.CompanyId]
|
|
|
+ //item.Points = mapCompanyPoints[user.CompanyId]
|
|
|
+
|
|
|
+ item.Total = fmt.Sprint(mapCompanyPoints[user.CompanyId], "次")
|
|
|
+ item.TableSource = utils.CYGX_OBJ_ACTIVITY
|
|
|
+
|
|
|
items = append(items, item)
|
|
|
|
|
|
//更新对应机构的剩余点数
|
|
|
- itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
+ itemCompany := new(models.CygxActivitySpecialPermissionPoints)
|
|
|
itemCompany.CompanyId = user.CompanyId
|
|
|
- itemCompany.Points = item.Points
|
|
|
+ itemCompany.Points = mapCompanyPoints[user.CompanyId]
|
|
|
itemCompany.ModifyTime = time.Now()
|
|
|
itemCompanys = append(itemCompanys, itemCompany)
|
|
|
- mapCompanyPoints[user.CompanyId] = item.Points
|
|
|
+ //mapCompanyPoints[user.CompanyId] = item.Points
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- e = models.AddCygxActivityPointsBillMulti(items, itemCompanys)
|
|
|
+ e = models.AddCygxActivitySpecialTripBillMulti(items, itemCompanys)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("AddCygxActivityPointsBillMulti, Err: " + e.Error())
|
|
|
+ err = errors.New("AddCygxActivitySpecialTripBillMulti, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
return
|