From 51a33052d97988ed6592b714753e5e00bce736ca Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 15 Jun 2023 17:51:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=80=E4=BA=9B=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 16 --- model/gmodel/fs_canteen_type_logic.go | 8 +- model/gmodel/fs_user_logic.go | 46 ++++++- .../internal/logic/usergettypelogic.go | 4 +- .../internal/logic/usersavebasicinfologic.go | 26 +++- server/home-user-auth/internal/types/types.go | 19 +-- server/home-user-auth/test/basic.go | 6 +- .../test/userbasicinfologic_test.go | 128 ++++++++++++++++++ .../test/usergettypelogic_test.go | 59 ++++++++ server_api/home-user-auth.api | 47 +++---- utils/basic/basic.go | 2 +- 11 files changed, 290 insertions(+), 71 deletions(-) delete mode 100644 .vscode/launch.json create mode 100644 server/home-user-auth/test/usergettypelogic_test.go diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index d742b2b3..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch Package", - "type": "go", - "request": "launch", - "mode": "test", - "program": "${workspaceFolder}/server/home-user-auth", - "args": ["-test.run", "^TestMain$"] - } - ] -} \ No newline at end of file diff --git a/model/gmodel/fs_canteen_type_logic.go b/model/gmodel/fs_canteen_type_logic.go index 071f0149..4a338b2b 100644 --- a/model/gmodel/fs_canteen_type_logic.go +++ b/model/gmodel/fs_canteen_type_logic.go @@ -9,14 +9,14 @@ import ( // FsGetTypeCanteenType GetType返回前端的结构 type FsGetTypeCanteenType struct { - Id int64 `db:"id" json:"key"` // ID - Name string `db:"name" json:"name"` // 餐厅名字 + Id int64 `gorm:"id" json:"key"` // ID + Name string `gorm:"name" json:"name"` // 餐厅名字 } // TODO: 使用model的属性做你想做的 -func (c *FsCanteenTypeModel) FindGetType(ctx context.Context, id int64) (resp []*FsGetTypeCanteenType, err error) { - err = c.db.WithContext(ctx).Model(&FsGetTypeCanteenType{}).Select("id,name").Order("sort desc").Where("`id` = ? and `status` = ? ", id, 1).Find(&resp).Error +func (c *FsCanteenTypeModel) FindAllGetType(ctx context.Context, id int64) (resp []*FsGetTypeCanteenType, err error) { + err = c.db.WithContext(ctx).Model(&FsCanteenType{}).Select("id,name").Order("sort desc").Where("`status` = ?", 1).Find(&resp).Error if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return resp, err } diff --git a/model/gmodel/fs_user_logic.go b/model/gmodel/fs_user_logic.go index 5e1711ca..de3dccf2 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -6,17 +6,49 @@ import ( // TODO: 使用model的属性做你想做的 -func (u *FsUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp *FsUser, err error) { - err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`email` = ?", emailname).First(resp).Error +type UserBasicInfoForSave struct { + ID uint `gorm:"primary_key" json:"id"` + FirstName string `gorm:"" json:"first_name"` + LastName string `gorm:"" json:"last_name"` + Mobile string `gorm:"" json:"mobile"` + Company string `gorm:"" json:"company"` + IsOrderStatusEmail int64 `gorm:"" json:"is_order_status_email"` + IsEmailAdvertisement int64 `gorm:"" json:"is_email_advertisement"` + IsOrderStatusPhone int64 `gorm:"" json:"is_order_status_phone"` + IsPhoneAdvertisement int64 `gorm:"" json:"is_phone_advertisement"` + Type int64 `gorm:"" json:"type"` + IsOpenRender int64 `gorm:"" json:"is_open_render"` + IsLowRendering int64 `gorm:"" json:"is_low_rendering"` + IsRemoveBg int64 `gorm:"" json:"is_remove_bg"` +} + +func (u *FsUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp FsUser, err error) { + err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`email` = ?", emailname).First(&resp).Error return resp, err } -func (u *FsUserModel) FindUserById(ctx context.Context, Id int64) (resp *FsUser, err error) { - err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", Id, 0).First(resp).Error +func (u *FsUserModel) FindUserById(ctx context.Context, Id int64) (resp FsUser, err error) { + err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", Id, 0).First(&resp).Error return resp, err } -func (u *FsUserModel) UpdateUserBasicInfoById(ctx context.Context, Id int64, user *FsUser) (resp *FsUser, err error) { - err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ? and status = ?", user.Id, 0, 1).Updates(user).Error - return resp, err +func (u *FsUserModel) UpdateUserBasicInfoById(ctx context.Context, Id int64, user *UserBasicInfoForSave) (err error) { + + err = u.db.WithContext(ctx).Model(&FsUser{}). + Where("`id` = ? and is_del = ? and status = ?", Id, 0, 1). + Updates(map[string]interface{}{ + "first_name": user.FirstName, + "last_name": user.LastName, + "mobile": user.Mobile, + "company": user.Company, + "is_order_status_email": user.IsOrderStatusEmail, + "is_email_advertisement": user.IsEmailAdvertisement, + "is_order_status_phone": user.IsOrderStatusPhone, + "is_phone_advertisement": user.IsPhoneAdvertisement, + "type": user.Type, + "is_open_render": user.IsOpenRender, + "is_low_rendering": user.IsLowRendering, + "is_remove_bg": user.IsRemoveBg, + }).Error + return err } diff --git a/server/home-user-auth/internal/logic/usergettypelogic.go b/server/home-user-auth/internal/logic/usergettypelogic.go index 1c540677..6a894952 100644 --- a/server/home-user-auth/internal/logic/usergettypelogic.go +++ b/server/home-user-auth/internal/logic/usergettypelogic.go @@ -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) } diff --git a/server/home-user-auth/internal/logic/usersavebasicinfologic.go b/server/home-user-auth/internal/logic/usersavebasicinfologic.go index 16b0191a..5f16dcff 100644 --- a/server/home-user-auth/internal/logic/usersavebasicinfologic.go +++ b/server/home-user-auth/internal/logic/usersavebasicinfologic.go @@ -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) diff --git a/server/home-user-auth/internal/types/types.go b/server/home-user-auth/internal/types/types.go index 1f8bcb89..fab02937 100644 --- a/server/home-user-auth/internal/types/types.go +++ b/server/home-user-auth/internal/types/types.go @@ -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 { diff --git a/server/home-user-auth/test/basic.go b/server/home-user-auth/test/basic.go index 8bb63b10..df6df130 100644 --- a/server/home-user-auth/test/basic.go +++ b/server/home-user-auth/test/basic.go @@ -1,7 +1,6 @@ package logic_test import ( - "flag" "fmt" "fusenapi/server/home-user-auth/internal/config" "fusenapi/server/home-user-auth/internal/handler" @@ -13,7 +12,7 @@ import ( "github.com/zeromicro/go-zero/rest" ) -var testConfigFile = flag.String("f", "../etc/home-user-auth.yaml", "the config file") +var testConfigFile = "../etc/home-user-auth.yaml" var cnf config.Config var gserver *rest.Server @@ -22,9 +21,8 @@ func init() { } func GetTestServer() *rest.Server { - flag.Parse() - conf.MustLoad(*testConfigFile, &cnf) + conf.MustLoad(testConfigFile, &cnf) server := rest.MustNewServer(cnf.RestConf) defer server.Stop() diff --git a/server/home-user-auth/test/userbasicinfologic_test.go b/server/home-user-auth/test/userbasicinfologic_test.go index b7c27715..b0ebe60b 100644 --- a/server/home-user-auth/test/userbasicinfologic_test.go +++ b/server/home-user-auth/test/userbasicinfologic_test.go @@ -1 +1,129 @@ package logic_test + +import ( + "fmt" + "testing" + + "github.com/474420502/requests" + "github.com/tidwall/gjson" +) + +func TestCaseBasicInfoLogic(t *testing.T) { + var err error + var resp *requests.Response + var result gjson.Result + + // 获取 session,并携带 JWT token + ses := GetSesssionWithJwtToken(t, gserver) + + // 向服务器发送 GET 请求,获取用户基本信息 + resp, err = ses.Get(fmt.Sprintf("http://%s:%d/user/basic-info", cnf.Host, cnf.Port)).TestInServer(gserver) + if err != nil { + t.Error(err) + } + + // 检查返回值中的 code 字段是否存在,并且值是否为 200 + result = resp.Json().Get("code") + if !result.Exists() { + t.Error("code is not exists") + } + if result.Int() != 200 { + t.Error("code != 200") + } + + // 检查返回值中的 msg 字段是否存在,并且值是否为 "success" + result = resp.Json().Get("msg") + if !result.Exists() { + t.Error("msg is not exists") + } + if result.String() != "success" { + t.Error(result.String()) + } + + // 检查返回值中的 data 字段是否存在 + result = resp.Json().Get("data") + if !result.Exists() { + t.Error("data is not exists") + } + + // 检查返回值中的 type 字段是否存在,并且值是否为 0 + result = resp.Json().Get("data.type") + if !result.Exists() { + t.Error("type is not exists") + } + if result.Int() != 0 { + t.Error("type != 0") + } + + // 检查返回值中的 is_order_status_email 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_order_status_email") + if !result.Exists() { + t.Error("is_order_status_email is not exists") + } + if result.Bool() != false { + t.Error("is_order_status_email != false") + } + + // 检查返回值中的 is_email_advertisement 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_email_advertisement") + if !result.Exists() { + t.Error("is_email_advertisement is not exists") + } + if result.Bool() != false { + t.Error("is_email_advertisement != false") + } + + // 检查返回值中的 is_order_status_phone 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_order_status_phone") + if !result.Exists() { + t.Error("is_order_status_phone is not exists") + } + if result.Bool() != false { + t.Error("is_order_status_phone != false") + } + + // 检查返回值中的 is_phone_advertisement 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_phone_advertisement") + if !result.Exists() { + t.Error("is_phone_advertisement is not exists") + } + if result.Bool() != false { + t.Error("is_phone_advertisement != false") + } + + // 检查返回值中的 is_open_render 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_open_render") + if !result.Exists() { + t.Error("is_open_render is not exists") + } + if result.Bool() != false { + t.Error("is_open_render != false") + } + + // 检查返回值中的 is_thousand_face 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_thousand_face") + if !result.Exists() { + t.Error("is_thousand_face is not exists") + } + if result.Bool() != false { + t.Error("is_thousand_face != false") + } + + // 检查返回值中的 is_low_rendering 字段是否存在,并且值是否为 false + result = resp.Json().Get("data.is_low_rendering") + if !result.Exists() { + t.Error("is_low_rendering is not exists") + } + if result.Bool() != false { + t.Error("is_low_rendering != false") + } + + // 检查返回值中的 is_remove_bg 字段是否存在,并且值是否为 true + result = resp.Json().Get("data.is_remove_bg") + if !result.Exists() { + t.Error("is_remove_bg is not exists") + } + if result.Bool() != true { + t.Error("is_remove_bg != true") + } +} diff --git a/server/home-user-auth/test/usergettypelogic_test.go b/server/home-user-auth/test/usergettypelogic_test.go new file mode 100644 index 00000000..0db4962c --- /dev/null +++ b/server/home-user-auth/test/usergettypelogic_test.go @@ -0,0 +1,59 @@ +package logic_test + +import ( + "fmt" + "testing" + + "github.com/474420502/requests" + "github.com/tidwall/gjson" +) + +func TestCaseGetTypeLogic(t *testing.T) { + var err error + var resp *requests.Response + var result gjson.Result + + // 获取 session,并携带 JWT token + ses := GetSesssionWithJwtToken(t, gserver) + + // 向服务器发送 GET 请求,获取用户类型信息 + resp, err = ses.Get(fmt.Sprintf("http://%s:%d/user/get-type", cnf.Host, cnf.Port)).TestInServer(gserver) + if err != nil { + t.Error(err) + } + + // 使用 gjson 解析返回的 json 数据 + result = gjson.Parse(resp.ContentString()) + + // 检查返回值中的 code 字段是否存在,并且值是否为 200 + code := result.Get("code").Int() + if code != 200 { + t.Errorf("Invalid code value: %d", code) + } + + // 检查返回值中的 msg 字段是否存在,并且值是否为 "success" + msg := result.Get("msg").String() + if msg != "success" { + t.Errorf(`Invalid msg value: "%s"`, msg) + } + + // 检查返回值中的 data 字段是否存在,并且值是否为数组类型 + dataArray := result.Get("data").Array() + if len(dataArray) == 0 { + t.Error("Empty data field") + } + + // 遍历每个元素,检查其 key 和 name 字段是否存在,并且值是否符合预期 + for i, item := range dataArray { + key := item.Get("key").Int() + name := item.Get("name").String() + + if key != int64(i+1) { + t.Errorf("Unexpected key value at index %d: %d", i, key) + } + + if len(name) == 0 { + t.Errorf("Missing name value at index %d", i) + } + } +} diff --git a/server_api/home-user-auth.api b/server_api/home-user-auth.api index 012cf9fe..adede496 100644 --- a/server_api/home-user-auth.api +++ b/server_api/home-user-auth.api @@ -41,19 +41,19 @@ service home-user-auth { } type RequestBasicInfoForm { - 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"` // 邮箱 - // Status int64 `form:"status,optional" db:"status"` // 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 `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是否去除背景 // NewPassword string `form:"new_password,optional" db:"new_password"` // new_password 如果存在新密码 } @@ -76,20 +76,17 @@ type DataGuest { // UserBasicInfoHandler 返回data结构 type DataUserBasicInfo { - 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是否去除背景 } - - - // /user/get-type reponse.data 结构 type DataGetType { Id int64 `db:"id" json:"key"` // ID diff --git a/utils/basic/basic.go b/utils/basic/basic.go index d744b800..9a6de9d3 100644 --- a/utils/basic/basic.go +++ b/utils/basic/basic.go @@ -14,7 +14,7 @@ var ( CodeUnAuth = &StatusResponse{401, "unauthorized"} // 未授权 CodeEmailNotFoundErr = &StatusResponse{5050, "the email was not found"} // email 不存在 - CodeUserIdNotFoundErr = &StatusResponse{5051, "the user was not found"} // email 不存在 + CodeUserIdNotFoundErr = &StatusResponse{5051, "the user was not found"} // userid 不存在 CodePasswordErr = &StatusResponse{5052, "invalid password"} // 密码错误 CodeGuestDupErr = &StatusResponse{5010, "the user is already a guest user and does not need to apply again"} // 用户已经是guest用户不需要重复申请 错误