123456789101112131415161718192021222324252627282930 |
- package provider
- import (
- "context"
- "gd_management/apis"
- "gd_management/errors"
- "fmt"
- "gd_management/common.in/utils"
- "github.com/astaxie/beego/orm"
- "go.uber.org/zap"
- )
- func ManagementGetAllProviderApi(ctx context.Context, req *apis.ManagementGetAllProviderApiReq, reply *apis.ManagementGetAllProviderApiReply) error {
- o := orm.NewOrm()
- sql := "select t1.id,thirdpart_host,thirdpart_api_name,thirdpart_api_router,thirdpart_api_method,platform_name, provider_api_code from t_gd_provider_api as t1 left join t_gd_provider as t2 on t1.provider_id = t2.id"
- if req.ProviderId > 0 {
- sql = fmt.Sprintf("%s where t2.id=%d", sql, req.ProviderId)
- }
- _, err := o.Raw(sql).QueryRows(&reply.ProviderApiBaseInfoList)
- if err != nil && err != orm.ErrNoRows {
- l.Error("mysql",
- zap.String("sql", "select t_gd_provider_api"),
- zap.String("fields", utils.MarshalJsonString(req)),
- zap.String("error", err.Error()))
- return errors.DataBaseError
- }
- return nil
- }
|