package cygx import ( "errors" "fmt" "hongze/hongze_task/models" "hongze/hongze_task/models/data_manage" "hongze/hongze_task/services/alarm_msg" "hongze/hongze_task/utils" "time" ) type YanXuanActivityPointsRedis struct { UserId int `description:"用户ID"` ComapnyId int `description:"公司ID"` ActivityId int `description:"活动ID"` PublishStatus int `description:"发布状态 1已发布,0未发布"` SourceType int `description:"1:报名、 2:取消报名、3:活动编辑、4:活动发布,取消发布、5:活动到会、6 研选审批通过的时候研选扣点更新。"` AdminId int `description:"管理员、销售ID"` Source int `description:" 来源,1客户端,2后台添加, 3开发人员手动添加、4定时任务"` RegisterPlatform int `description:"来源 1小程序,2:网页"` CreateTime time.Time `description:"创建时间"` } //func init(){ // log := &YanXuanActivityPointsRedis{ComapnyId: 16, SourceType: 7, Source: 4, CreateTime: time.Now()} // if utils.Re == nil { // err := utils.Rc.LPush(utils.CYGX_YANXUAN_POINTS_KEY, log) // if err != nil { // fmt.Println("YanXuanActivityPointsRedis LPush Err:" + err.Error()) // } // } //} // 6 研选审批通过的时候研选扣点更新 func YanXuanCompanyApproval(comapnyId int) (err error) { defer func() { if err != nil { fmt.Println(err) msg := fmt.Sprint("comapnyId:", comapnyId) go alarm_msg.SendAlarmMsg("研选审批通过的时候研选扣点更新,写入Redis队列消息失败:"+err.Error()+msg, 2) } }() //SourceType int `description:"1:报名、 2:取消报名、3:活动编辑、4:活动发布,取消发布、5:活动到会。6 研选审批通过的时候研选扣点更新。7,正式专试用定时任务更新"` log := &YanXuanActivityPointsRedis{ComapnyId: comapnyId, SourceType: 6, Source: 2, CreateTime: time.Now()} if utils.Re == nil { err := utils.Rc.LPush(utils.CYGX_YANXUAN_POINTS_KEY, log) if err != nil { fmt.Println("YanXuanActivityPointsRedis LPush Err:" + err.Error()) } } return } // 7 正式专试用定时任务更新研选扣点 func YanXuanCompanyCompanyTryOut(comapnyId int) (err error) { defer func() { if err != nil { fmt.Println(err) msg := fmt.Sprint("comapnyId:", comapnyId) go alarm_msg.SendAlarmMsg("正式专试用定时任务更新研选扣点,写入Redis队列消息失败:"+err.Error()+msg, 2) } }() //SourceType int `description:"1:报名、 2:取消报名、3:活动编辑、4:活动发布,取消发布、5:活动到会。6 研选审批通过的时候研选扣点更新。7,正式专试用定时任务更新"` log := &YanXuanActivityPointsRedis{ComapnyId: comapnyId, SourceType: 7, Source: 4, CreateTime: time.Now()} if utils.Re == nil { err := utils.Rc.LPush(utils.CYGX_YANXUAN_POINTS_KEY, log) if err != nil { fmt.Println("YanXuanActivityPointsRedis LPush Err:" + err.Error()) } } return } // 审批通过的时候专项调研次数更新 func ActivitySpecialCompanyApproval(companyId int) (err error) { comapny, e := models.GetCompanyById(companyId) if e != nil { err = errors.New("GetCompanyById err:" + e.Error()) return } userType, packageType, _, _, _ := GetUserType(companyId) itemBill := new(data_manage.CygxActivitySpecialTripBill) itemBill.CreateTime = time.Now() itemBill.CompanyId = companyId itemBill.CompanyName = comapny.CompanyName itemBill.Source = 2 itemBill.DoType = 2 itemBill.Way = 3 itemBill.Content = "套餐转正" if userType == 2{ packageTypeMap := map[int]int{1: 16, 2: 10} totalTrip := packageTypeMap[packageType] itemBill.BillDetailed = totalTrip } else { itemBill.BillDetailed = 5 } err = data_manage.AddCygxActivitySpecialTripBill(itemBill) if err != nil { return } return }