management_get_secret.go 557 B

123456789101112131415161718192021222324
  1. package provider
  2. import (
  3. "context"
  4. "gd_management/apis"
  5. "gd_management/errors"
  6. "github.com/astaxie/beego/orm"
  7. )
  8. func ManagementGetSecret(ctx context.Context, req *apis.ManagementGetSecretReq, reply *apis.ManagementGetSecretReply) error {
  9. o := orm.NewOrm()
  10. if req.AppKey == "" {
  11. return errors.ArgsError
  12. }
  13. err := o.Raw("select app_secret from t_gd_merchants where app_key=?", req.AppKey).QueryRow(&reply.AppSecret)
  14. if err != nil {
  15. if err == orm.ErrNoRows {
  16. return errors.DataBaseNoRecord
  17. }
  18. return errors.DataBaseError
  19. }
  20. return nil
  21. }