完成一些测试
This commit is contained in:
parent
dfc411b9c6
commit
51a33052d9
16
.vscode/launch.json
vendored
16
.vscode/launch.json
vendored
@ -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$"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -9,14 +9,14 @@ import (
|
|||||||
|
|
||||||
// FsGetTypeCanteenType GetType返回前端的结构
|
// FsGetTypeCanteenType GetType返回前端的结构
|
||||||
type FsGetTypeCanteenType struct {
|
type FsGetTypeCanteenType struct {
|
||||||
Id int64 `db:"id" json:"key"` // ID
|
Id int64 `gorm:"id" json:"key"` // ID
|
||||||
Name string `db:"name" json:"name"` // 餐厅名字
|
Name string `gorm:"name" json:"name"` // 餐厅名字
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 使用model的属性做你想做的
|
// TODO: 使用model的属性做你想做的
|
||||||
|
|
||||||
func (c *FsCanteenTypeModel) FindGetType(ctx context.Context, id int64) (resp []*FsGetTypeCanteenType, err error) {
|
func (c *FsCanteenTypeModel) FindAllGetType(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
|
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) {
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,49 @@ import (
|
|||||||
|
|
||||||
// TODO: 使用model的属性做你想做的
|
// TODO: 使用model的属性做你想做的
|
||||||
|
|
||||||
func (u *FsUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp *FsUser, err error) {
|
type UserBasicInfoForSave struct {
|
||||||
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`email` = ?", emailname).First(resp).Error
|
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
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *FsUserModel) FindUserById(ctx context.Context, Id int64) (resp *FsUser, err 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
|
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", Id, 0).First(&resp).Error
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *FsUserModel) UpdateUserBasicInfoById(ctx context.Context, Id int64, user *FsUser) (resp *FsUser, err error) {
|
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 = ?", user.Id, 0, 1).Updates(user).Error
|
|
||||||
return resp, err
|
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
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ func (l *UserGetTypeLogic) UserGetType(req *types.Request, userinfo *auth.UserIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
// 返回值必须调用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 {
|
if err != nil {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return resp.SetStatus(basic.CodeOK, "success", data)
|
return resp.SetStatus(basic.CodeOK, data)
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,29 @@ func (l *UserSaveBasicInfoLogic) UserSaveBasicInfo(req *types.RequestBasicInfoFo
|
|||||||
}
|
}
|
||||||
|
|
||||||
m := gmodel.NewFsUserModel(l.svcCtx.MysqlConn)
|
m := gmodel.NewFsUserModel(l.svcCtx.MysqlConn)
|
||||||
user, err := m.FindUserById(l.ctx, userinfo.UserId)
|
err := m.UpdateUserBasicInfoById(l.ctx, userinfo.UserId, &gmodel.UserBasicInfoForSave{
|
||||||
if err == gmodel.ErrRecordNotFound {
|
FirstName: req.FirstName,
|
||||||
return resp.SetStatus(basic.CodeUserIdNotFoundErr)
|
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)
|
return resp.SetStatus(basic.CodeOK)
|
||||||
|
@ -14,6 +14,7 @@ type RequestBasicInfoForm struct {
|
|||||||
Company string `form:"company,optional" db:"company"` // 公司名称
|
Company string `form:"company,optional" db:"company"` // 公司名称
|
||||||
Mobile string `form:"mobile,optional" db:"mobile"` // 手机号码
|
Mobile string `form:"mobile,optional" db:"mobile"` // 手机号码
|
||||||
Email string `form:"email" db:"email"` // 邮箱
|
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"` // 订单状态改变时是否接收邮件
|
IsOrderStatusEmail int64 `form:"is_order_status_email,optional" db:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
||||||
IsEmailAdvertisement int64 `form:"is_email_advertisement,optional" db:"is_email_advertisement"` // 是否接收邮件广告
|
IsEmailAdvertisement int64 `form:"is_email_advertisement,optional" db:"is_email_advertisement"` // 是否接收邮件广告
|
||||||
IsOrderStatusPhone int64 `form:"is_order_status_phone,optional" db:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
IsOrderStatusPhone int64 `form:"is_order_status_phone,optional" db:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
||||||
@ -37,15 +38,15 @@ type DataGuest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DataUserBasicInfo struct {
|
type DataUserBasicInfo struct {
|
||||||
Type int64 `db:"type"` // 1普通餐厅 2连锁餐厅
|
Type int64 `json:"type"` // 1普通餐厅 2连锁餐厅
|
||||||
IsOrderStatusEmail bool `db:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
IsOrderStatusEmail bool `json:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
||||||
IsEmailAdvertisement bool `db:"is_email_advertisement"` // 是否接收邮件广告
|
IsEmailAdvertisement bool `json:"is_email_advertisement"` // 是否接收邮件广告
|
||||||
IsOrderStatusPhone bool `db:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
IsOrderStatusPhone bool `json:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
||||||
IsPhoneAdvertisement bool `db:"is_phone_advertisement"` // 是否接收短信广告
|
IsPhoneAdvertisement bool `json:"is_phone_advertisement"` // 是否接收短信广告
|
||||||
IsOpenRender bool `db:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
IsOpenRender bool `json:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
||||||
IsThousandFace bool `db:"is_thousand_face"` // 是否已经存在千人千面(1:存在,0:不存在)
|
IsThousandFace bool `json:"is_thousand_face"` // 是否已经存在千人千面(1:存在,0:不存在)
|
||||||
IsLowRendering bool `db:"is_low_rendering"` // 是否开启低渲染模型渲染
|
IsLowRendering bool `json:"is_low_rendering"` // 是否开启低渲染模型渲染
|
||||||
IsRemoveBg bool `db:"is_remove_bg"` // 用户上传logo是否去除背景
|
IsRemoveBg bool `json:"is_remove_bg"` // 用户上传logo是否去除背景
|
||||||
}
|
}
|
||||||
|
|
||||||
type DataGetType struct {
|
type DataGetType struct {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package logic_test
|
package logic_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"fusenapi/server/home-user-auth/internal/config"
|
"fusenapi/server/home-user-auth/internal/config"
|
||||||
"fusenapi/server/home-user-auth/internal/handler"
|
"fusenapi/server/home-user-auth/internal/handler"
|
||||||
@ -13,7 +12,7 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/rest"
|
"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 cnf config.Config
|
||||||
var gserver *rest.Server
|
var gserver *rest.Server
|
||||||
|
|
||||||
@ -22,9 +21,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetTestServer() *rest.Server {
|
func GetTestServer() *rest.Server {
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
conf.MustLoad(*testConfigFile, &cnf)
|
conf.MustLoad(testConfigFile, &cnf)
|
||||||
|
|
||||||
server := rest.MustNewServer(cnf.RestConf)
|
server := rest.MustNewServer(cnf.RestConf)
|
||||||
defer server.Stop()
|
defer server.Stop()
|
||||||
|
@ -1 +1,129 @@
|
|||||||
package logic_test
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
59
server/home-user-auth/test/usergettypelogic_test.go
Normal file
59
server/home-user-auth/test/usergettypelogic_test.go
Normal file
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -41,19 +41,19 @@ service home-user-auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RequestBasicInfoForm {
|
type RequestBasicInfoForm {
|
||||||
FirstName string `form:"first_name,optional" db:"first_name"` // FirstName
|
FirstName string `form:"first_name,optional" db:"first_name"` // FirstName
|
||||||
LastName string `form:"last_name,optional" db:"last_name"` // LastName
|
LastName string `form:"last_name,optional" db:"last_name"` // LastName
|
||||||
Company string `form:"company,optional" db:"company"` // 公司名称
|
Company string `form:"company,optional" db:"company"` // 公司名称
|
||||||
Mobile string `form:"mobile,optional" db:"mobile"` // 手机号码
|
Mobile string `form:"mobile,optional" db:"mobile"` // 手机号码
|
||||||
Email string `form:"email" db:"email"` // 邮箱
|
Email string `form:"email" db:"email"` // 邮箱
|
||||||
// Status int64 `form:"status,optional" db:"status"` // 1正常 0不正常
|
Type int64 `form:"type,optional" db:"type"` // 1正常 0不正常
|
||||||
IsOrderStatusEmail int64 `form:"is_order_status_email,optional" db:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
IsOrderStatusEmail int64 `form:"is_order_status_email,optional" db:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
||||||
IsEmailAdvertisement int64 `form:"is_email_advertisement,optional" db:"is_email_advertisement"` // 是否接收邮件广告
|
IsEmailAdvertisement int64 `form:"is_email_advertisement,optional" db:"is_email_advertisement"` // 是否接收邮件广告
|
||||||
IsOrderStatusPhone int64 `form:"is_order_status_phone,optional" db:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
IsOrderStatusPhone int64 `form:"is_order_status_phone,optional" db:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
||||||
IsPhoneAdvertisement int64 `form:"is_phone_advertisement,optional" db:"is_phone_advertisement"` // 是否接收短信广告
|
IsPhoneAdvertisement int64 `form:"is_phone_advertisement,optional" db:"is_phone_advertisement"` // 是否接收短信广告
|
||||||
IsOpenRender int64 `form:"is_open_render,optional" db:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
IsOpenRender int64 `form:"is_open_render,optional" db:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
||||||
IsLowRendering int64 `form:"is_low_rendering,optional" db:"is_low_rendering"` // 是否开启低渲染模型渲染
|
IsLowRendering int64 `form:"is_low_rendering,optional" db:"is_low_rendering"` // 是否开启低渲染模型渲染
|
||||||
IsRemoveBg int64 `form:"is_remove_bg,optional" db:"is_remove_bg"` // 用户上传logo是否去除背景
|
IsRemoveBg int64 `form:"is_remove_bg,optional" db:"is_remove_bg"` // 用户上传logo是否去除背景
|
||||||
|
|
||||||
// NewPassword string `form:"new_password,optional" db:"new_password"` // new_password 如果存在新密码
|
// NewPassword string `form:"new_password,optional" db:"new_password"` // new_password 如果存在新密码
|
||||||
}
|
}
|
||||||
@ -76,20 +76,17 @@ type DataGuest {
|
|||||||
|
|
||||||
// UserBasicInfoHandler 返回data结构
|
// UserBasicInfoHandler 返回data结构
|
||||||
type DataUserBasicInfo {
|
type DataUserBasicInfo {
|
||||||
Type int64 `db:"type"` // 1普通餐厅 2连锁餐厅
|
Type int64 `json:"type"` // 1普通餐厅 2连锁餐厅
|
||||||
IsOrderStatusEmail bool `db:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
IsOrderStatusEmail bool `json:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
||||||
IsEmailAdvertisement bool `db:"is_email_advertisement"` // 是否接收邮件广告
|
IsEmailAdvertisement bool `json:"is_email_advertisement"` // 是否接收邮件广告
|
||||||
IsOrderStatusPhone bool `db:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
IsOrderStatusPhone bool `json:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
||||||
IsPhoneAdvertisement bool `db:"is_phone_advertisement"` // 是否接收短信广告
|
IsPhoneAdvertisement bool `json:"is_phone_advertisement"` // 是否接收短信广告
|
||||||
IsOpenRender bool `db:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
IsOpenRender bool `json:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
||||||
IsThousandFace bool `db:"is_thousand_face"` // 是否已经存在千人千面(1:存在,0:不存在)
|
IsThousandFace bool `json:"is_thousand_face"` // 是否已经存在千人千面(1:存在,0:不存在)
|
||||||
IsLowRendering bool `db:"is_low_rendering"` // 是否开启低渲染模型渲染
|
IsLowRendering bool `json:"is_low_rendering"` // 是否开启低渲染模型渲染
|
||||||
IsRemoveBg bool `db:"is_remove_bg"` // 用户上传logo是否去除背景
|
IsRemoveBg bool `json:"is_remove_bg"` // 用户上传logo是否去除背景
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /user/get-type reponse.data 结构
|
// /user/get-type reponse.data 结构
|
||||||
type DataGetType {
|
type DataGetType {
|
||||||
Id int64 `db:"id" json:"key"` // ID
|
Id int64 `db:"id" json:"key"` // ID
|
||||||
|
@ -14,7 +14,7 @@ var (
|
|||||||
CodeUnAuth = &StatusResponse{401, "unauthorized"} // 未授权
|
CodeUnAuth = &StatusResponse{401, "unauthorized"} // 未授权
|
||||||
|
|
||||||
CodeEmailNotFoundErr = &StatusResponse{5050, "the email was not found"} // email 不存在
|
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"} // 密码错误
|
CodePasswordErr = &StatusResponse{5052, "invalid password"} // 密码错误
|
||||||
|
|
||||||
CodeGuestDupErr = &StatusResponse{5010, "the user is already a guest user and does not need to apply again"} // 用户已经是guest用户不需要重复申请 错误
|
CodeGuestDupErr = &StatusResponse{5010, "the user is already a guest user and does not need to apply again"} // 用户已经是guest用户不需要重复申请 错误
|
||||||
|
Loading…
x
Reference in New Issue
Block a user