123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package management
- import (
- "context"
- "gd_auth_check/apis"
- "gd_auth_check/errors"
- "github.com/astaxie/beego/orm"
- )
- func ManagementGetName(ctx context.Context, req *apis.ManagementGetNameReq, reply *apis.ManagementGetNameReply) error {
- o := orm.NewOrm()
- if req.MerchantId != 0 {
- err := o.Raw("select merchant_name from t_gd_merchants where id=?", req.MerchantId).QueryRow(&reply.MerchantName)
- if err != nil {
- return errors.DataBaseError
- }
- }
- if req.ApiId != 0 {
- err := o.Raw("select name from t_gd_api where id=?", req.ApiId).QueryRow(&reply.ApiName)
- if err != nil {
- return errors.DataBaseError
- }
- }
- if req.ProviderApiId != 0 {
- err := o.Raw("select a.thirdpart_api_name,b.id,b.platform_name,a.provider_api_code from t_gd_provider_api as a left join t_gd_provider as b on a.provider_id= b.id where a.id=?", req.ProviderApiId).QueryRow(&reply.ProviderApiName, &reply.ProviderId, &reply.ProviderName, &reply.ProviderApiCode)
- if err != nil {
- return errors.DataBaseError
- }
- }
- if req.H5ServiceId != 0 {
- err := o.Raw("select service_name from t_gd_h5_service where id=?", req.H5ServiceId).QueryRow(&reply.H5ServiceName)
- if err != nil {
- return errors.DataBaseError
- }
- }
- if req.H5ApiId != 0 {
- err := o.Raw("select name from t_gd_h5_api where id=?", req.H5ApiId).QueryRow(&reply.H5ApiName)
- if err != nil {
- return errors.DataBaseError
- }
- }
- return nil
- }
|