Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into feature/auth

This commit is contained in:
eson
2023-08-16 10:22:12 +08:00
38 changed files with 982 additions and 277 deletions

View File

@@ -2,6 +2,7 @@ package basic
import (
"errors"
"fusenapi/shared"
"fusenapi/utils/auth"
"net/http"

View 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
}

View File

@@ -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发送渲染完的数据