h5_service_api_list.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package h5
  2. import (
  3. "context"
  4. "gd_management/errors"
  5. "gd_management/apis"
  6. "gd_management/common.in/utils"
  7. // "fmt"
  8. "github.com/astaxie/beego/orm"
  9. "go.uber.org/zap"
  10. )
  11. func serviceGetH5Api(req *apis.ManagementH5ServiceGetH5ApiListReq, reply *apis.ManagementH5ServiceGetH5ApiListReply) error {
  12. o := orm.NewOrm()
  13. sql := "select id, name, host, router, is_enable, create_time, update_time from t_gd_h5_api where id in(select h5_api_id from t_gd_h5_service_api_relation where h5_service_id=? )"
  14. _, err := o.Raw(sql, req.H5ServiceId).QueryRows(&reply.H5ApiList)
  15. if err != nil {
  16. if err == orm.ErrNoRows {
  17. return nil
  18. }
  19. return errors.DataBaseError
  20. }
  21. return nil
  22. }
  23. func ManagementH5ServiceGetH5ApiList(ctx context.Context, req *apis.ManagementH5ServiceGetH5ApiListReq, reply *apis.ManagementH5ServiceGetH5ApiListReply) (err error) {
  24. err = serviceGetH5Api(req, reply)
  25. if err != nil {
  26. l.Error("func",
  27. zap.String("call", "ManagementH5ServiceGetH5ApiList"),
  28. zap.String("args", utils.MarshalJsonString(req)),
  29. zap.String("error", err.Error()))
  30. }
  31. l.Debug(utils.MarshalJsonString(req, reply))
  32. return
  33. }