feat:新增商户列表/保存用户信息

This commit is contained in:
Hiven
2023-08-14 14:40:50 +08:00
parent 9b0a18fcd8
commit 57e635c26c
22 changed files with 665 additions and 7 deletions

View File

@@ -0,0 +1,53 @@
package logic
import (
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/base/internal/svc"
"fusenapi/server/base/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type MerchantCategoryListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMerchantCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MerchantCategoryListLogic {
return &MerchantCategoryListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *MerchantCategoryListLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *MerchantCategoryListLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }
func (l *MerchantCategoryListLogic) MerchantCategoryList(req *types.MerchantCategoryListReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
fsMerchantCategoryModel := gmodel.NewFsMerchantCategoryModel(l.svcCtx.MysqlConn)
BuilderDB := fsMerchantCategoryModel.BuilderDB(l.ctx, nil).Model(&gmodel.FsMerchantCategory{})
resourceInfo, err := fsMerchantCategoryModel.FindAll(BuilderDB, nil, "sort desc")
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeDbSqlErr, "MerchantCategoryList error system failed")
}
// 返回成功
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"list": resourceInfo,
})
}