fix
This commit is contained in:
parent
6e89f318fd
commit
dd13dcbf0d
|
@ -27,6 +27,11 @@ func (s *FsShoppingCartModel) Create(ctx context.Context, data *FsShoppingCart)
|
||||||
return s.db.WithContext(ctx).Create(&data).Error
|
return s.db.WithContext(ctx).Create(&data).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
func (s *FsShoppingCartModel) Delete(ctx context.Context, id, userId int64) error {
|
||||||
|
return s.db.WithContext(ctx).Where("user_id = ? and id = ?", userId, id).Delete(&FsShoppingCart{}).Error
|
||||||
|
}
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
func (s *FsShoppingCartModel) Update(ctx context.Context, id, userId int64, data *FsShoppingCart) error {
|
func (s *FsShoppingCartModel) Update(ctx context.Context, id, userId int64, data *FsShoppingCart) error {
|
||||||
return s.db.WithContext(ctx).Where("user_id = ? and id = ?", userId, id).Updates(&data).Error
|
return s.db.WithContext(ctx).Where("user_id = ? and id = ?", userId, id).Updates(&data).Error
|
||||||
|
|
|
@ -31,7 +31,7 @@ func NewGetCanteenDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||||
// 获取餐厅详情
|
// 获取餐厅详情
|
||||||
func (l *GetCanteenDetailLogic) GetCanteenDetail(req *types.GetCanteenDetailReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetCanteenDetailLogic) GetCanteenDetail(req *types.GetCanteenDetailReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
//获取餐厅类型数据
|
//获取餐厅类型数据
|
||||||
canteenTypeModel := gmodel.NewFsCanteenTypeModel(l.svcCtx.MysqlConn)
|
canteenTypeModel := gmodel.NewFsCanteenTypeModel(l.svcCtx.MysqlConn)
|
||||||
|
|
|
@ -32,7 +32,7 @@ func NewSaveCanteenTypeProductLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
||||||
// 保存餐厅类型的关联产品
|
// 保存餐厅类型的关联产品
|
||||||
func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCanteenTypeProductReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCanteenTypeProductReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
if len(req.ProductList) == 0 {
|
if len(req.ProductList) == 0 {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "product list can`t be empty")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "product list can`t be empty")
|
||||||
|
|
|
@ -29,7 +29,7 @@ func NewGetQrCodeSetListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||||
// 获取二维码配置列表
|
// 获取二维码配置列表
|
||||||
func (l *GetQrCodeSetListLogic) GetQrCodeSetList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetQrCodeSetListLogic) GetQrCodeSetList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
qrCodeModel := gmodel.NewFsQrcodeSetModel(l.svcCtx.MysqlConn)
|
qrCodeModel := gmodel.NewFsQrcodeSetModel(l.svcCtx.MysqlConn)
|
||||||
qrCodeList, err := qrCodeModel.GetAll(l.ctx)
|
qrCodeList, err := qrCodeModel.GetAll(l.ctx)
|
||||||
|
|
|
@ -29,7 +29,7 @@ func NewGetStandardLogoListLogic(ctx context.Context, svcCtx *svc2.ServiceContex
|
||||||
// 获取标准logo列表
|
// 获取标准logo列表
|
||||||
func (l *GetStandardLogoListLogic) GetStandardLogoList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetStandardLogoListLogic) GetStandardLogoList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
standardLogoModel := gmodel.NewFsStandardLogoModel(l.svcCtx.MysqlConn)
|
standardLogoModel := gmodel.NewFsStandardLogoModel(l.svcCtx.MysqlConn)
|
||||||
logoList, err := standardLogoModel.GetAll(l.ctx)
|
logoList, err := standardLogoModel.GetAll(l.ctx)
|
||||||
|
|
|
@ -30,7 +30,7 @@ func NewGetMapLibraryListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||||
|
|
||||||
func (l *GetMapLibraryListLogic) GetMapLibraryList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetMapLibraryListLogic) GetMapLibraryList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
mapLibraryModel := gmodel.NewFsMapLibraryModel(l.svcCtx.MysqlConn)
|
mapLibraryModel := gmodel.NewFsMapLibraryModel(l.svcCtx.MysqlConn)
|
||||||
mapLibraryList, err := mapLibraryModel.GetAllEnabledList(l.ctx)
|
mapLibraryList, err := mapLibraryModel.GetAllEnabledList(l.ctx)
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (l *SaveMapLibraryLogic) BeforeLogic(w http.ResponseWriter, r *http.Request
|
||||||
|
|
||||||
func (l *SaveMapLibraryLogic) SaveMapLibrary(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *SaveMapLibraryLogic) SaveMapLibrary(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(l.bodyData) == 0 {
|
if len(l.bodyData) == 0 {
|
||||||
|
|
|
@ -31,7 +31,7 @@ func NewGetLastProductDesignLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
||||||
|
|
||||||
func (l *GetLastProductDesignLogic) GetLastProductDesign(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetLastProductDesignLogic) GetLastProductDesign(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if !userinfo.IsUser() {
|
if !userinfo.IsUser() {
|
||||||
return resp.SetStatusAddMessage(basic.CodeUnAuth, "please login")
|
return resp.SetStatusAddMessage(basic.CodeUnAuth, "please sign in")
|
||||||
}
|
}
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
user, err := l.svcCtx.AllModels.FsUser.FindUserById(l.ctx, userinfo.UserId)
|
user, err := l.svcCtx.AllModels.FsUser.FindUserById(l.ctx, userinfo.UserId)
|
||||||
|
|
|
@ -31,7 +31,7 @@ func NewGetProductDesignLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||||
|
|
||||||
func (l *GetProductDesignLogic) GetProductDesign(req *types.GetProductDesignReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetProductDesignLogic) GetProductDesign(req *types.GetProductDesignReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in first")
|
||||||
}
|
}
|
||||||
if req.Sn == "" {
|
if req.Sn == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "param sn is required")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "param sn is required")
|
||||||
|
|
|
@ -35,7 +35,7 @@ func NewGetSizeByProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||||
// 获取分类下的产品以及尺寸
|
// 获取分类下的产品以及尺寸
|
||||||
func (l *GetSizeByProductLogic) GetSizeByProduct(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetSizeByProductLogic) GetSizeByProduct(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in first")
|
||||||
}
|
}
|
||||||
//获取所有网站目录
|
//获取所有网站目录
|
||||||
tagsModel := gmodel.NewFsTagsModel(l.svcCtx.MysqlConn)
|
tagsModel := gmodel.NewFsTagsModel(l.svcCtx.MysqlConn)
|
||||||
|
|
|
@ -30,7 +30,7 @@ func NewGetSuccessRecommandLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
||||||
// 获取推荐的产品列表
|
// 获取推荐的产品列表
|
||||||
func (l *GetSuccessRecommandLogic) GetSuccessRecommand(req *types.GetSuccessRecommandReq, userInfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *GetSuccessRecommandLogic) GetSuccessRecommand(req *types.GetSuccessRecommandReq, userInfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userInfo.GetIdType() != auth.IDTYPE_User {
|
if userInfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in first")
|
||||||
}
|
}
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
userModel := gmodel.NewFsUserModel(l.svcCtx.MysqlConn)
|
userModel := gmodel.NewFsUserModel(l.svcCtx.MysqlConn)
|
||||||
|
|
|
@ -47,7 +47,7 @@ func NewSaveDesignLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveDe
|
||||||
|
|
||||||
func (l *SaveDesignLogic) SaveDesign(req *types.SaveDesignReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *SaveDesignLogic) SaveDesign(req *types.SaveDesignReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in first")
|
||||||
}
|
}
|
||||||
//查询是否是加密的(不太合理)
|
//查询是否是加密的(不太合理)
|
||||||
encryptWebsetting, err := l.svcCtx.AllModels.FsWebSet.FindValueByKey(l.ctx, "is_encrypt")
|
encryptWebsetting, err := l.svcCtx.AllModels.FsWebSet.FindValueByKey(l.ctx, "is_encrypt")
|
||||||
|
|
|
@ -31,9 +31,14 @@ func NewDeleteCartLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *DeleteCartLogic) DeleteCart(req *types.DeleteCartReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *DeleteCartLogic) DeleteCart(req *types.DeleteCartReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
if !userinfo.IsUser() {
|
||||||
// userinfo 传入值时, 一定不为null
|
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in")
|
||||||
|
}
|
||||||
|
//删除购物车
|
||||||
|
if err := l.svcCtx.AllModels.FsShoppingCart.Delete(l.ctx, userinfo.UserId, req.Id); err != nil {
|
||||||
|
logx.Error(err)
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to delete shopping cart")
|
||||||
|
}
|
||||||
return resp.SetStatus(basic.CodeOK)
|
return resp.SetStatus(basic.CodeOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ func NewUploadQrcodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Uplo
|
||||||
|
|
||||||
func (l *UploadQrcodeLogic) UploadQrcode(req *types.UploadQrcodeReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *UploadQrcodeLogic) UploadQrcode(req *types.UploadQrcodeReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please sign in first")
|
||||||
}
|
}
|
||||||
if req.Url == "" {
|
if req.Url == "" {
|
||||||
resp.SetStatus(basic.CodeApiErr, "param url is empty")
|
resp.SetStatus(basic.CodeApiErr, "param url is empty")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user