user_state.go 962 B

123456789101112131415161718192021222324252627282930313233
  1. package user_merchant
  2. import (
  3. "context"
  4. "gd_management/apis"
  5. "gd_management/common.in/utils"
  6. "gd_management/impl/pubsub"
  7. "github.com/astaxie/beego/orm"
  8. "go.uber.org/zap"
  9. )
  10. func ManagementSetUserMerchantAuthState(ctx context.Context, req *apis.ManagementSetUserMerchantAuthStateReq, reply *apis.ManagementSetUserMerchantAuthStateReply) (err error) {
  11. o := orm.NewOrm()
  12. _, err = o.Raw("update t_gd_merchants set auth_status=? where id=?", req.State, req.MerchantId).Exec()
  13. if err != nil {
  14. l.Error("func",
  15. zap.String("call", "ManagementSetUserMerchantAuthState"),
  16. zap.String("args", utils.MarshalJsonString(req)),
  17. zap.String("error", err.Error()))
  18. }
  19. tab := apis.TGdMerchants{}
  20. o.QueryTable("t_gd_merchants").Filter("id", req.MerchantId).One(&tab)
  21. utils.RedisSet("t_gd_merchants", tab.AppKey, tab)
  22. if err := pubsub.PublishMerchantNotify(tab.AppKey); err != nil {
  23. return err
  24. }
  25. l.Debug(utils.MarshalJsonString(req, reply))
  26. return
  27. }