完成一些测试

This commit is contained in:
eson
2023-06-15 17:51:06 +08:00
parent dfc411b9c6
commit 51a33052d9
11 changed files with 290 additions and 71 deletions

View File

@@ -33,10 +33,10 @@ func (l *UserGetTypeLogic) UserGetType(req *types.Request, userinfo *auth.UserIn
}
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
data, err := gmodel.NewFsCanteenTypeModel(l.svcCtx.MysqlConn).FindGetType(l.ctx, userinfo.UserId)
data, err := gmodel.NewFsCanteenTypeModel(l.svcCtx.MysqlConn).FindAllGetType(l.ctx, userinfo.UserId)
if err != nil {
logx.Error(err)
return
}
return resp.SetStatus(basic.CodeOK, "success", data)
return resp.SetStatus(basic.CodeOK, data)
}

View File

@@ -33,9 +33,29 @@ func (l *UserSaveBasicInfoLogic) UserSaveBasicInfo(req *types.RequestBasicInfoFo
}
m := gmodel.NewFsUserModel(l.svcCtx.MysqlConn)
user, err := m.FindUserById(l.ctx, userinfo.UserId)
if err == gmodel.ErrRecordNotFound {
return resp.SetStatus(basic.CodeUserIdNotFoundErr)
err := m.UpdateUserBasicInfoById(l.ctx, userinfo.UserId, &gmodel.UserBasicInfoForSave{
FirstName: req.FirstName,
LastName: req.LastName,
Mobile: req.Mobile,
Company: req.Company,
IsOrderStatusEmail: req.IsOrderStatusEmail,
IsEmailAdvertisement: req.IsEmailAdvertisement,
IsOrderStatusPhone: req.IsOrderStatusPhone,
IsPhoneAdvertisement: req.IsPhoneAdvertisement,
Type: req.Type,
IsOpenRender: req.IsOpenRender,
IsLowRendering: req.IsLowRendering,
IsRemoveBg: req.IsRemoveBg,
})
if err != nil {
logx.Error(err)
switch err {
case gmodel.ErrRecordNotFound:
return resp.SetStatus(basic.CodeUserIdNotFoundErr)
default:
return resp.SetStatusWithMessage(basic.CodeUpdateErr, err.Error())
}
}
return resp.SetStatus(basic.CodeOK)

View File

@@ -14,6 +14,7 @@ type RequestBasicInfoForm struct {
Company string `form:"company,optional" db:"company"` // 公司名称
Mobile string `form:"mobile,optional" db:"mobile"` // 手机号码
Email string `form:"email" db:"email"` // 邮箱
Type int64 `form:"type,optional" db:"type"` // 1正常 0不正常
IsOrderStatusEmail int64 `form:"is_order_status_email,optional" db:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement int64 `form:"is_email_advertisement,optional" db:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone int64 `form:"is_order_status_phone,optional" db:"is_order_status_phone"` // 订单状态改变是是否接收电话
@@ -37,15 +38,15 @@ type DataGuest struct {
}
type DataUserBasicInfo struct {
Type int64 `db:"type"` // 1普通餐厅 2连锁餐厅
IsOrderStatusEmail bool `db:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement bool `db:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone bool `db:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement bool `db:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender bool `db:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace bool `db:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering bool `db:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg bool `db:"is_remove_bg"` // 用户上传logo是否去除背景
Type int64 `json:"type"` // 1普通餐厅 2连锁餐厅
IsOrderStatusEmail bool `json:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement bool `json:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone bool `json:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement bool `json:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender bool `json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace bool `json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering bool `json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg bool `json:"is_remove_bg"` // 用户上传logo是否去除背景
}
type DataGetType struct {