Files
jx-callback/business/model/common.go
2020-05-13 16:32:40 +08:00

48 lines
1.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import "strings"
const (
ImgTypeLocal = 0 // 京西自己用的,不需要上传至平台
ImgTypeMain = 1 // 商品主图
ImgTypeDesc = 2 // 商品描述详情
MimeTypeJpeg = "image/jpeg"
MimeTypePng = "image/png"
MimeTypeGif = "image/gif"
)
var (
ValidMimeTypes = map[string]int{
MimeTypeJpeg: 1,
MimeTypePng: 1,
MimeTypeGif: 1,
}
)
type DataResource struct {
ModelIDCUL
HashCode string `orm:"size(48);unique" json:"hashCode"`
ResourceType string `orm:"size(48)" json:"resourceType"` // 资料的mime type
Name string `orm:"size(48);index" json:"name"`
UseType int8 `json:"useType"` // 图资源使用方式大于0才可能需要上传至平台
MainURL string `orm:"size(512);column(main_url);unique" json:"mainURL"`
QiniuURL string `orm:"size(512);column(qiniu_url);index" json:"qiniuURL"`
EbaiURL string `orm:"size(512);column(ebai_url);index" json:"ebaiURL"`
MtwmURL string `orm:"size(512);column(mtwm_url);index" json:"mtwmURL"`
JdsURL string `orm:"size(512);column(jds_url);index" json:"jdsURL"`
Remark string `orm:"size(1024)" json:"remark"`
}
func GetValidMimeTypeDesc() (desc string) {
strList := []string{}
for k := range ValidMimeTypes {
strList = append(strList, k)
}
return strings.Join(strList, ",")
}