1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package management
- import (
- "context"
- "gd_management/apis"
- "gd_management/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 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)
- 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
- }
|