package user_merchant import ( "context" "gd_management/apis" "gd_management/common.in/utils" "gd_management/errors" "fmt" "github.com/astaxie/beego/orm" //"go.uber.org/zap" ) func ManagementGetUserMerchantName(ctx context.Context, req *apis.ManagementGetUserMerchantNameReq, reply *apis.ManagementGetUserMerchantNameReply) (err error) { appKeys := "" for _, v := range req.AppKeys { if appKeys == "" { appKeys = fmt.Sprintf("\"%s\"", v) } else { appKeys = fmt.Sprintf("%s,\"%s\"", appKeys, v) } } sql := "select a.app_key, a.merchant_name, b.name as user_name from t_gd_merchants as a inner join t_gd_user as b on a.user_id = b.id where a.app_key in(" + appKeys + ")" o := orm.NewOrm() _, err = o.Raw(sql).QueryRows(&reply.Infos) if err != nil { return errors.DataBaseError } l.Debug(utils.MarshalJsonString(req, reply)) return }