37 lines
1013 B
Go
37 lines
1013 B
Go
|
package logic
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/pkg/errors"
|
||
|
"trasfer_middleware/pkg/xerr"
|
||
|
|
||
|
"github.com/jinzhu/copier"
|
||
|
"github.com/zeromicro/go-zero/core/logx"
|
||
|
"trasfer_middleware/cmd/rpc/internal/svc"
|
||
|
"trasfer_middleware/cmd/rpc/pb/transfer"
|
||
|
)
|
||
|
|
||
|
type GetResellerByAppIdLogic struct {
|
||
|
ctx context.Context
|
||
|
svcCtx *svc.ServiceContext
|
||
|
logx.Logger
|
||
|
}
|
||
|
|
||
|
func NewGetResellerByAppIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetResellerByAppIdLogic {
|
||
|
return &GetResellerByAppIdLogic{
|
||
|
ctx: ctx,
|
||
|
svcCtx: svcCtx,
|
||
|
Logger: logx.WithContext(ctx),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (l *GetResellerByAppIdLogic) GetResellerByAppId(in *transfer.GetResellerByAppIdReq) (*transfer.GetResellerByAppIdRes, error) {
|
||
|
var res transfer.GetResellerByAppIdRes
|
||
|
reseller, err := l.svcCtx.DbReseller.ResellerMerchant.FindOneByAppId(l.ctx, in.AppId)
|
||
|
if err != nil {
|
||
|
return nil, errors.Wrapf(xerr.NewErrMsg(l.ctx, "未找到分销商信息"), "temp in : %+v", err, in.AppId)
|
||
|
}
|
||
|
_ = copier.Copy(&res, &reseller)
|
||
|
return &res, nil
|
||
|
}
|