12345678910111213141516171819202122232425262728293031323334353637 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package accounting
- import (
- "context"
- "gd_management/apis"
- "gd_management/common.in/utils"
- "gd_management/errors"
- "github.com/astaxie/beego/orm"
- "go.uber.org/zap"
- )
- func MerchantDataApiPriceList(ctx context.Context, req *apis.MerchantDataApiPriceListReq, reply *apis.MerchantDataApiPriceListReply) error {
- if req.MerchantId == 0 {
- return errors.ArgsError
- }
- o := orm.NewOrm()
- _, err := o.Raw("select t1.id as merchant_data_api_id,t1.unit_price,t1.merchant_id,t1.alias,t3.data_api_name as merchant_data_api_name from t_gd_merchant_data_api as t1 left join t_gd_data_api_query_type as t2 on t1.query_type_id=t2.id left join t_gd_data_api as t3 on t3.id=t2.data_api_id where t1.merchant_id=?", req.MerchantId).QueryRows(&reply.List)
- if err != nil {
- l.Error("func",
- zap.String("call", "MerchantDataApiPriceList"),
- zap.String("args", utils.MarshalJsonString(req)),
- zap.String("error", err.Error()))
- return errors.DataBaseError
- }
- for index, _ := range reply.List {
- if reply.List[index].Alias != "" {
- reply.List[index].MerchantDataApiName = reply.List[index].Alias
- }
- }
- // select t1.id,t1.unit_price,t1.merchant_id,t1.alias,t3.data_api_name from t_gd_merchant_data_api as t1 left join t_gd_data_api_query_type as t2 on t1.query_type_id=t2.id left join t_gd_data_api as t3 on t3.id=t2.data_api_id
- return nil
- }
|