完成单元测试

This commit is contained in:
eson
2023-06-19 15:52:14 +08:00
parent 19d325fb77
commit 4e8d0f3ceb
9 changed files with 259 additions and 92 deletions

View File

@@ -42,12 +42,12 @@ func (l *UserBasicInfoLogic) UserBasicInfo(req *types.Request, userinfo *auth.Us
return resp.SetStatus(basic.CodeOK, types.DataUserBasicInfo{
Type: *user.Type,
IsOrderStatusEmail: *user.IsOrderStatusEmail > 0,
IsEmailAdvertisement: *user.IsEmailAdvertisement > 0,
IsOrderStatusPhone: *user.IsOrderStatusPhone > 0,
IsPhoneAdvertisement: *user.IsPhoneAdvertisement > 0,
IsOpenRender: *user.IsOpenRender > 0,
IsLowRendering: *user.IsLowRendering > 0,
IsRemoveBg: *user.IsRemoveBg > 0,
IsOrderStatusEmail: *user.IsOrderStatusEmail,
IsEmailAdvertisement: *user.IsEmailAdvertisement,
IsOrderStatusPhone: *user.IsOrderStatusPhone,
IsPhoneAdvertisement: *user.IsPhoneAdvertisement,
IsOpenRender: *user.IsOpenRender,
IsLowRendering: *user.IsLowRendering,
IsRemoveBg: *user.IsRemoveBg,
})
}

View File

@@ -31,7 +31,7 @@ func (l *UserFontsLogic) UserFonts(req *types.Request, userinfo *auth.UserInfo)
data, err := gmodel.NewFsFontModel(l.svcCtx.MysqlConn).FindAllOrderSortByDesc(l.ctx)
if err != gorm.ErrRecordNotFound && err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeOK, data)
return resp.SetStatus(basic.CodeOK)
}
return resp.SetStatus(basic.CodeOK)
return resp.SetStatus(basic.CodeOK, data)
}

View File

@@ -9,19 +9,19 @@ type Request struct {
}
type RequestBasicInfoForm struct {
FirstName string `form:"first_name,optional" db:"first_name"` // FirstName
LastName string `form:"last_name,optional" db:"last_name"` // LastName
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"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement int64 `form:"is_phone_advertisement,optional" db:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender int64 `form:"is_open_render,optional" db:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsLowRendering int64 `form:"is_low_rendering,optional" db:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg int64 `form:"is_remove_bg,optional" db:"is_remove_bg"` // 用户上传logo是否去除背景
FirstName string `json:"first_name"` // FirstName
LastName string `json:"last_name"` // LastName
Company string `json:"company"` // 公司名称
Mobile string `json:"mobile"` // 手机号码
Email string `json:"email"` // 邮箱
Type int64 `json:"type"` // 1正常 0不正常
IsOrderStatusEmail int64 `json:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement int64 `json:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone int64 `json:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement int64 `json:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender int64 `json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsLowRendering int64 `json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg int64 `json:"is_remove_bg"` // 用户上传logo是否去除背景
}
type RequestUserLogin struct {
@@ -39,19 +39,19 @@ type DataGuest struct {
type DataUserBasicInfo struct {
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是否去除背景
IsOrderStatusEmail int64 `json:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement int64 `json:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone int64 `json:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement int64 `json:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender int64 `json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace int64 `json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering int64 `json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg int64 `json:"is_remove_bg"` // 用户上传logo是否去除背景
}
type DataGetType struct {
Id int64 `db:"id" json:"key"` // ID
Name string `db:"name" json:"name"` // 餐厅名字
Id int64 `json:"key"` // ID
Name string `json:"name"` // 餐厅名字
}
type KeyName struct {
@@ -77,18 +77,18 @@ type DataStatusConfig struct {
}
type DataAddressList struct {
Id int64 `db:"id"`
UserId int64 `db:"user_id"` // 用户ID
Name string `db:"name"` // 地址名称
FirstName string `db:"first_name"` // FirstName
LastName string `db:"last_name"` // LastName
Mobile string `db:"mobile"` // 手机号码
Street string `db:"street"` // 街道
Suite string `db:"suite"` // 房号
City string `db:"city"` // 城市
State string `db:"state"` // 州名
ZipCode string `db:"zip_code"` // 邮编
IsDefault int64 `db:"is_default"` // 1默认地址0非默认地址
Id int64 `json:"id"`
UserId int64 `json:"user_id"` // 用户ID
Name string `json:"name"` // 地址名称
FirstName string `json:"first_name"` // FirstName
LastName string `json:"last_name"` // LastName
Mobile string `json:"mobile"` // 手机号码
Street string `json:"street"` // 街道
Suite string `json:"suite"` // 房号
City string `json:"city"` // 城市
State string `json:"state"` // 州名
ZipCode string `json:"zip_code"` // 邮编
IsDefault int64 `json:"is_default"` // 1默认地址0非默认地址
}
type Response struct {