用户模块--logo列表完善

This commit is contained in:
Hiven 2023-08-03 14:50:07 +08:00
parent bf84286ebb
commit ddb93bae41

View File

@ -41,7 +41,6 @@ func NewUserLogoListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *User
func (l *UserLogoListLogic) UserLogoList(req *types.UserLogoListReq, userinfo *auth.UserInfo) (resp *basic.Response) { func (l *UserLogoListLogic) UserLogoList(req *types.UserLogoListReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null // userinfo 传入值时, 一定不为null
// 定义用户ID // 定义用户ID
var userId int64 var userId int64
var guestId int64 var guestId int64
@ -56,14 +55,15 @@ func (l *UserLogoListLogic) UserLogoList(req *types.UserLogoListReq, userinfo *a
} }
userMaterialModel := gmodel.NewFsUserMaterialModel(l.svcCtx.MysqlConn) userMaterialModel := gmodel.NewFsUserMaterialModel(l.svcCtx.MysqlConn)
userMaterialRSB := userMaterialModel.RowSelectBuilder(nil).Where("module = ?", "logo").Where("user_id = ?", userId).Where("guest_id = ?", guestId).Order("id desc") userMaterialRSB := userMaterialModel.RowSelectBuilder(nil).
Where("module = ?", "logo").Where("user_id = ?", userId).Where("guest_id = ?", guestId).Order("id desc")
list, err := userMaterialModel.FindAll(l.ctx, userMaterialRSB, nil, "") list, err := userMaterialModel.FindAll(l.ctx, userMaterialRSB, nil, "")
if err != nil { if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "order not found") return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "data not found")
} }
logx.Error(err) logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get order info") return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get data list")
} }
return resp.SetStatus(basic.CodeOK, []interface{}{ return resp.SetStatus(basic.CodeOK, []interface{}{
list, list,