points.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package award
  2. import (
  3. "app.yhyue.com/moapp/message/model"
  4. "app.yhyue.com/moapp/message/rpc"
  5. "github.com/gogf/gf/v2/util/gconv"
  6. )
  7. /*// Jy_user_new 产生新用户
  8. func (p *Points) Jy_user_new(msg *model.Message) {
  9. rpc.IntegralHarvest(msg, gcfg.Instance().MustGet(gctx.New(), "docPoints.open.jywx_subscribe_new", nil).Int64(), 1002)
  10. }
  11. // Jywx_subscribe_invite 邀请人
  12. func (p *Points) Jywx_subscribe_invite(msg *model.Message) {
  13. rpc.IntegralHarvest(msg, gcfg.Instance().MustGet(gctx.New(), "docPoints.open.jywx_subscribe_invite", nil).Int64(), 1003)
  14. }
  15. // Jywx_subscribe_invited 被邀请人
  16. func (p *Points) Jywx_subscribe_invited(msg *model.Message) {
  17. rpc.IntegralHarvest(msg, gcfg.Instance().MustGet(gctx.New(), "docPoints.open.jywx_subscribe_invited", nil).Int64(), 1002)
  18. }
  19. var VarPoints = &Points{}
  20. */
  21. type Points struct {
  22. Num, Type int64 //数量,类型
  23. From, Desc string //来源活动,描述
  24. }
  25. const (
  26. AwardPoints = "points"
  27. )
  28. // GivenPoints 积分奖励
  29. func GivenPoints(msg *model.Message, p Points) {
  30. //记录
  31. if err := rpc.IntegralHarvest(msg, p.Num, p.Type); err == nil {
  32. AddAwardRecord(AwardRecord{
  33. UserId: msg.E_userId,
  34. Award: AwardPoints,
  35. Num: gconv.Int(p.Num),
  36. GetWay: p.Desc,
  37. ActivityCode: p.From,
  38. Detail: "",
  39. Date: msg.E_time,
  40. })
  41. }
  42. }