1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package user_merchant
- import (
- "gd_management/errors"
- "gd_management/apis"
- "fmt"
- "github.com/astaxie/beego/orm"
- "go.uber.org/zap"
- "golang.org/x/net/context"
- )
- func Info(ctx context.Context, req *apis.GetMerchantInfoReq, reply *apis.GetMerchantInfoReply) error {
- if req.Id <= 0 {
- return errors.ArgsError
- }
- p := apis.TGdMerchants{}
- err := orm.NewOrm().Raw("SELECT * FROM t_gd_merchants WHERE id = ?", req.Id).QueryRow(&p)
- if err != nil {
- l.Error("mysql",
- zap.String("sql", "SELECT * FROM t_gd_merchants WHERE id = ?"),
- zap.String("args", fmt.Sprintf("id:%d", req.Id)),
- zap.String("error", err.Error()))
- return errors.DataBaseError
- }
- reply.AppKey = p.AppKey
- reply.AppSecret = p.AppSecret
- reply.UserId = p.UserId
- reply.MerchantName = p.MerchantName
- reply.SocialCode = p.SocialCode
- reply.Address = p.Address
- reply.ContactName = p.ContactName
- reply.ContactNumber = p.ContactNumber
- reply.MerchantLicense = p.MerchantLicense
- reply.IpWhitelist = p.IpWhitelist
- reply.AuthStatus = p.AuthStatus
- return nil
- }
|