user_merchant_info.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package user_merchant
  4. import (
  5. "gd_management/errors"
  6. "gd_management/apis"
  7. "fmt"
  8. "github.com/astaxie/beego/orm"
  9. "go.uber.org/zap"
  10. "golang.org/x/net/context"
  11. )
  12. func Info(ctx context.Context, req *apis.GetMerchantInfoReq, reply *apis.GetMerchantInfoReply) error {
  13. if req.Id <= 0 {
  14. return errors.ArgsError
  15. }
  16. p := apis.TGdMerchants{}
  17. err := orm.NewOrm().Raw("SELECT * FROM t_gd_merchants WHERE id = ?", req.Id).QueryRow(&p)
  18. if err != nil {
  19. l.Error("mysql",
  20. zap.String("sql", "SELECT * FROM t_gd_merchants WHERE id = ?"),
  21. zap.String("args", fmt.Sprintf("id:%d", req.Id)),
  22. zap.String("error", err.Error()))
  23. return errors.DataBaseError
  24. }
  25. reply.AppKey = p.AppKey
  26. reply.AppSecret = p.AppSecret
  27. reply.UserId = p.UserId
  28. reply.MerchantName = p.MerchantName
  29. reply.SocialCode = p.SocialCode
  30. reply.Address = p.Address
  31. reply.ContactName = p.ContactName
  32. reply.ContactNumber = p.ContactNumber
  33. reply.MerchantLicense = p.MerchantLicense
  34. reply.IpWhitelist = p.IpWhitelist
  35. reply.AuthStatus = p.AuthStatus
  36. return nil
  37. }