api 模板的修改
This commit is contained in:
@@ -1,9 +1,30 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
package types
|
||||
|
||||
import (
|
||||
"fusenapi/utils/basic"
|
||||
)
|
||||
|
||||
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"` // 邮箱
|
||||
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是否去除背景
|
||||
NewPassword string `form:"new_password,optional" db:"new_password"` // new_password 如果存在新密码
|
||||
}
|
||||
|
||||
type RequestUserLogin struct {
|
||||
Name string `form:"name"`
|
||||
Password string `form:"pwd"`
|
||||
@@ -57,3 +78,49 @@ type Auth struct {
|
||||
AccessSecret string `json:"AccessSecret"`
|
||||
AccessExpire int `json:"AccessExpire"`
|
||||
}
|
||||
|
||||
// Set 设置Response的Code和Message值
|
||||
func (resp *Response) Set(Code int, Message string) {
|
||||
resp.Code = Code
|
||||
resp.Message = Message
|
||||
}
|
||||
|
||||
// Set 设置整个Response
|
||||
func (resp *Response) SetWithData(Code int, Message string, Data interface{}) {
|
||||
resp.Code = Code
|
||||
resp.Message = Message
|
||||
resp.Data = Data
|
||||
}
|
||||
|
||||
// SetMessage 设置Response的Message
|
||||
func (resp *Response) SetMessage(msg string) {
|
||||
resp.Message = msg
|
||||
}
|
||||
|
||||
// SetWithData 设置Data
|
||||
func (resp *Response) SetData(Data interface{}) {
|
||||
resp.Data = Data
|
||||
}
|
||||
|
||||
// SetWithData 设置Response的Code和Message值 带Data入参数
|
||||
func (resp *Response) SetCode(Code int) {
|
||||
resp.Code = Code
|
||||
}
|
||||
|
||||
// SetStatus 设置默认StatusResponse(内部自定义) 默认msg, 可以带data, data只使用一个参数
|
||||
func (resp *Response) SetStatus(sr *basic.StatusResponse, data ...interface{}) {
|
||||
resp.Code = sr.Code
|
||||
resp.Message = sr.Message
|
||||
if len(data) == 1 {
|
||||
resp.Data = data[0]
|
||||
}
|
||||
}
|
||||
|
||||
// SetStatusWithMessage 设置默认StatusResponse(内部自定义) 非默认msg, 可以带data, data只使用一个参数
|
||||
func (resp *Response) SetStatusWithMessage(sr *basic.StatusResponse, msg string, data ...interface{}) {
|
||||
resp.Code = sr.Code
|
||||
resp.Message = msg
|
||||
if len(data) == 1 {
|
||||
resp.Data = data[0]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user