|
@@ -5,6 +5,7 @@ import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
+ "hongze/hongze_cygx/models/company"
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
"strconv"
|
|
|
"time"
|
|
@@ -889,7 +890,7 @@ func YanXuanCompanyApprovalReduce(log models.YanXuanActivityPointsRedis) (err er
|
|
|
}()
|
|
|
comapnyId := log.ComapnyId
|
|
|
|
|
|
- comapny, e := models.GetCompanyById(comapnyId)
|
|
|
+ comapnyDetail, e := models.GetCompanyById(comapnyId)
|
|
|
if e != nil {
|
|
|
err = errors.New("GetCompanyById" + e.Error())
|
|
|
return
|
|
@@ -913,6 +914,28 @@ func YanXuanCompanyApprovalReduce(log models.YanXuanActivityPointsRedis) (err er
|
|
|
if companyReportPermissionDetail == nil {
|
|
|
return // 如果不存在就不做研选扣点处理
|
|
|
}
|
|
|
+
|
|
|
+ //获取最近的一条审批合同信息
|
|
|
+ newCompanyApprovalDetail, e := company.GetCompanyApprovalById(comapnyId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetCompanyApprovalById, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if newCompanyApprovalDetail == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyContractId := newCompanyApprovalDetail.CompanyContractId
|
|
|
+
|
|
|
+ totalYxPerminssion, e := company.GetCompanyContractPermissionCheck(companyContractId, utils.CHART_PERMISSION_ID_YANXUAN)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCompanyContractPermissionCheck, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果最新的审批合同里没有研选的权限,那么就不做处理
|
|
|
+ if totalYxPerminssion == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
var billDetailed float64
|
|
|
var content string
|
|
|
//ExpensiveYx int `description:"权益研选: 0->3w; 1->5w"` 3W3次、5W 15次
|
|
@@ -932,8 +955,8 @@ func YanXuanCompanyApprovalReduce(log models.YanXuanActivityPointsRedis) (err er
|
|
|
item.CreateTime = time.Now()
|
|
|
//item.Mobile = user.Mobile
|
|
|
//item.Email = user.Email
|
|
|
- item.CompanyId = comapny.CompanyId
|
|
|
- item.CompanyName = comapny.CompanyName
|
|
|
+ item.CompanyId = comapnyDetail.CompanyId
|
|
|
+ item.CompanyName = comapnyDetail.CompanyName
|
|
|
//item.RealName = user.RealName
|
|
|
item.BillDetailed = billDetailed
|
|
|
item.RegisterPlatform = log.RegisterPlatform
|
|
@@ -948,8 +971,8 @@ func YanXuanCompanyApprovalReduce(log models.YanXuanActivityPointsRedis) (err er
|
|
|
//更新对应机构的剩余点数
|
|
|
var itemCompanys []*models.CygxActivityPointsCompany
|
|
|
itemCompany := new(models.CygxActivityPointsCompany)
|
|
|
- itemCompany.CompanyId = comapny.CompanyId
|
|
|
- itemCompany.CompanyName = comapny.CompanyName
|
|
|
+ itemCompany.CompanyId = comapnyDetail.CompanyId
|
|
|
+ itemCompany.CompanyName = comapnyDetail.CompanyName
|
|
|
itemCompany.Points = item.Points
|
|
|
itemCompany.CreateTime = time.Now()
|
|
|
itemCompany.ModifyTime = time.Now()
|