captchaAnti.go 773 B

1234567891011121314151617181920212223242526
  1. package dao
  2. import (
  3. "context"
  4. "go-common/library/log"
  5. "strconv"
  6. )
  7. // PubMessage pub to databus struct
  8. type PubMessage struct {
  9. RoomId int64 `json:"room_id"`
  10. Uid int64 `json:"uid"`
  11. Ip string `json:"ip"`
  12. Action int `json:"action"` // 1create 2verify
  13. ReqType int64 `json:"req_type"` // request captcha type 0image 1geetest
  14. ResType int64 `json:"res_type"` // response captcha type 0image 1geetest
  15. ResCode int64 `json:"res_code"` // 0success 1 failed
  16. }
  17. // Pub databus publish
  18. func (d *Dao) Pub(ctx context.Context, message PubMessage) (err error) {
  19. if err = d.captchaAnti.Send(ctx, strconv.FormatInt(message.Uid, 10), message); err != nil {
  20. log.Error("[XCaptcha][DataBus] call for publish error, err:%v, msg:%v", err, message)
  21. }
  22. return
  23. }