|
@@ -1,49 +1,52 @@
|
|
|
package services
|
|
|
|
|
|
import (
|
|
|
- "errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_clpt/models"
|
|
|
"hongze/hongze_clpt/utils"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
//func init() {
|
|
|
// GetActivityPointsAll()
|
|
|
//}
|
|
|
|
|
|
-// GetActivityPointsAll 获取所有带有扣点的活动
|
|
|
-func GetActivityPointsAll() (listxActivity []*models.CygxActivity, err error) {
|
|
|
+// 用户报名添加到处理研选扣点
|
|
|
+func YanXuanActivityPointsBillSignupAdd(activityId, uid int) (err error) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
- go utils.SendAlarmMsg("获取所有带有扣点的活动失败"+err.Error(), 2)
|
|
|
+ msg := fmt.Sprint("activityId:", activityId, "userId:", uid)
|
|
|
+ go utils.SendAlarmMsg("用户报名添加到处理研选扣点,写入Redis队列消息失败:"+err.Error()+msg, 2)
|
|
|
}
|
|
|
}()
|
|
|
- var condition string
|
|
|
- var pars []interface{}
|
|
|
- listxActivity = make([]*models.CygxActivity, 0)
|
|
|
- list, e := models.GetCygxActivityPointsSetList(condition, pars, 0, 0)
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetCygxActivityPointsSetList,Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- var activityIds []int
|
|
|
- for _, v := range list {
|
|
|
- activityIds = append(activityIds, v.ActivityId)
|
|
|
+ //SourceType int `description:"1:报名、 2:取消报名、3:活动编辑、4:活动发布,取消发布、5:活动到会。"`
|
|
|
+ log := &models.YanXuanActivityPointsRedis{UserId: uid, ActivityId: activityId, SourceType: 1, RegisterPlatform: utils.REGISTER_PLATFORM, Source: 1, 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())
|
|
|
+ }
|
|
|
}
|
|
|
- lenArr := len(activityIds)
|
|
|
- if lenArr == 0 {
|
|
|
- return
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 用户取消报名添加到处理研选扣点
|
|
|
+func YanXuanActivityPointsBillSignupCancel(activityId, uid int) (err error) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ msg := fmt.Sprint("activityId:", activityId, "userId:", uid)
|
|
|
+ go utils.SendAlarmMsg("用户取消报名添加到处理研选扣点,写入Redis队列消息失败:"+err.Error()+msg, 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ //SourceType int `description:"1:报名、 2:取消报名、3:活动编辑、4:活动发布,取消发布、5:活动到会。"`
|
|
|
+ log := &models.YanXuanActivityPointsRedis{UserId: uid, ActivityId: activityId, SourceType: 2, RegisterPlatform: utils.REGISTER_PLATFORM, Source: 1, 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())
|
|
|
+ }
|
|
|
}
|
|
|
- //condition = ` AND art.activity_id IN (` + utils.GetOrmInReplace(lenArr) + `)`
|
|
|
- //pars = append(pars, activityIds)
|
|
|
- //listxActivity, e = models.GetCygxActivityList(condition, pars, 0, lenArr)
|
|
|
- //if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- // err = errors.New("GetCygxActivityList,Err: " + e.Error())
|
|
|
- // return
|
|
|
- //}
|
|
|
- //for _, v := range listxActivity {
|
|
|
- // fmt.Println(v)
|
|
|
- //}
|
|
|
return
|
|
|
}
|