1、新增后台面板
2、查询页改三要素 3、佣金冻结
This commit is contained in:
		
							
								
								
									
										58
									
								
								app/main/api/internal/logic/user/detaillogic.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								app/main/api/internal/logic/user/detaillogic.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| package user | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"qnc-server/app/user/cmd/api/internal/svc" | ||||
| 	"qnc-server/app/user/cmd/api/internal/types" | ||||
| 	"qnc-server/app/user/model" | ||||
| 	"qnc-server/common/ctxdata" | ||||
| 	"qnc-server/common/xerr" | ||||
| 	"qnc-server/pkg/lzkit/crypto" | ||||
|  | ||||
| 	"github.com/jinzhu/copier" | ||||
| 	"github.com/pkg/errors" | ||||
|  | ||||
| 	"github.com/zeromicro/go-zero/core/logx" | ||||
| ) | ||||
|  | ||||
| type DetailLogic struct { | ||||
| 	logx.Logger | ||||
| 	ctx    context.Context | ||||
| 	svcCtx *svc.ServiceContext | ||||
| } | ||||
|  | ||||
| func NewDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DetailLogic { | ||||
| 	return &DetailLogic{ | ||||
| 		Logger: logx.WithContext(ctx), | ||||
| 		ctx:    ctx, | ||||
| 		svcCtx: svcCtx, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (l *DetailLogic) Detail() (resp *types.UserInfoResp, err error) { | ||||
| 	userID, err := ctxdata.GetUidFromCtx(l.ctx) | ||||
| 	if err != nil { | ||||
| 		return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "用户信息, %v", err) | ||||
| 	} | ||||
| 	user, err := l.svcCtx.UserModel.FindOne(l.ctx, userID) | ||||
| 	if err != nil { | ||||
| 		if errors.Is(err, model.ErrNotFound) { | ||||
| 			return nil, errors.Wrapf(xerr.NewErrCode(xerr.USER_NOT_FOUND), "用户信息, 用户不存在, %v", err) | ||||
| 		} | ||||
| 		return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "用户信息, 数据库查询用户信息失败, %v", err) | ||||
| 	} | ||||
| 	var userInfo types.User | ||||
| 	err = copier.Copy(&userInfo, user) | ||||
| 	if err != nil { | ||||
| 		return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "用户信息, 用户信息结构体复制失败, %v", err) | ||||
| 	} | ||||
| 	if user.Mobile.Valid { | ||||
| 		userInfo.Mobile, err = crypto.DecryptMobile(user.Mobile.String, l.svcCtx.Config.Encrypt.SecretKey) | ||||
| 		if err != nil { | ||||
| 			return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "用户信息, 解密手机号失败, %v", err) | ||||
| 		} | ||||
| 	} | ||||
| 	return &types.UserInfoResp{ | ||||
| 		UserInfo: userInfo, | ||||
| 	}, nil | ||||
| } | ||||
		Reference in New Issue
	
	Block a user