Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into feature/auth
This commit is contained in:
@@ -2,6 +2,7 @@ package basic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"fusenapi/shared"
|
||||
"fusenapi/utils/auth"
|
||||
"net/http"
|
||||
|
||||
26
utils/validate/user_info.go
Normal file
26
utils/validate/user_info.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package validate
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type MerchantCategory struct {
|
||||
CategoryId int64 `json:"category_id"`
|
||||
}
|
||||
|
||||
func Validate(module *string, metadata *string) (interface{}, error) {
|
||||
if *module == "merchant_category" {
|
||||
var merchantCategory MerchantCategory
|
||||
err := json.Unmarshal([]byte(*metadata), &merchantCategory)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
if merchantCategory.CategoryId == 0 {
|
||||
return nil, errors.New("merchant_category.category_id is required")
|
||||
}
|
||||
return merchantCategory, nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
@@ -16,12 +16,12 @@ type RenderData struct {
|
||||
ProductId int64 `json:"product_id"` //产品id
|
||||
UserMaterialId int64 `json:"user_material_id"` //用户素材id
|
||||
Logo string `json:"logo"` //log资源地址(websocket连接建立再赋值)
|
||||
Website string `json:"website"` //网站
|
||||
/*Website string `json:"website"` //网站
|
||||
Slogan string `json:"slogan"` //slogan
|
||||
Address string `json:"address"` //地址
|
||||
Phone string `json:"phone"` //电话
|
||||
UserId int64 `json:"user_id"` //用户id(websocket连接建立再赋值)
|
||||
GuestId int64 `json:"guest_id"` //游客id(websocket连接建立再赋值)
|
||||
Phone string `json:"phone"` //电话*/
|
||||
UserId int64 `json:"user_id"` //用户id(websocket连接建立再赋值)
|
||||
GuestId int64 `json:"guest_id"` //游客id(websocket连接建立再赋值)
|
||||
}
|
||||
|
||||
// websocket发送渲染完的数据
|
||||
|
||||
Reference in New Issue
Block a user