fix DataResource.ResoureType为ResourceType
This commit is contained in:
@@ -314,7 +314,7 @@ func UploadImg4Vendors(ctx *jxcontext.Context, isAsync, isContinueWhenError bool
|
|||||||
case 1: // 从SkuName添加缺失的图片至DataResource
|
case 1: // 从SkuName添加缺失的图片至DataResource
|
||||||
_, err = dao.ExecuteSQL(db, `
|
_, err = dao.ExecuteSQL(db, `
|
||||||
INSERT INTO data_resource(created_at, updated_at, last_operator, hash_code,
|
INSERT INTO data_resource(created_at, updated_at, last_operator, hash_code,
|
||||||
resoure_type, name, main_url, ebai_url, qiniu_url, is_vendor)
|
resource_type, name, main_url, ebai_url, qiniu_url, is_vendor)
|
||||||
SELECT t1.created_at, t1.created_at, t1.last_operator, t1.img_hash_code,
|
SELECT t1.created_at, t1.created_at, t1.last_operator, t1.img_hash_code,
|
||||||
CASE
|
CASE
|
||||||
WHEN INSTR(t1.img, ".jpg") > 0 OR INSTR(t1.img, ".jpeg") > 0 THEN
|
WHEN INSTR(t1.img, ".jpg") > 0 OR INSTR(t1.img, ".jpeg") > 0 THEN
|
||||||
@@ -325,7 +325,7 @@ func UploadImg4Vendors(ctx *jxcontext.Context, isAsync, isContinueWhenError bool
|
|||||||
'image/gif'
|
'image/gif'
|
||||||
ELSE
|
ELSE
|
||||||
''
|
''
|
||||||
END resoure_type
|
END resource_type
|
||||||
, t1.name, img, img_ebai, IF(INSTR(t1.img, "image.jxc4.com") > 0, t1.img, '') qiniu_url, 1
|
, t1.name, img, img_ebai, IF(INSTR(t1.img, "image.jxc4.com") > 0, t1.img, '') qiniu_url, 1
|
||||||
FROM sku_name t1
|
FROM sku_name t1
|
||||||
JOIN (
|
JOIN (
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
|
|||||||
return nil, fmt.Errorf("MIME type:%s非法", mimeType)
|
return nil, fmt.Errorf("MIME type:%s非法", mimeType)
|
||||||
}
|
}
|
||||||
dataRes = &model.DataResource{
|
dataRes = &model.DataResource{
|
||||||
Name: name,
|
Name: name,
|
||||||
HashCode: hashCode,
|
HashCode: hashCode,
|
||||||
ResoureType: mimeType,
|
ResourceType: mimeType,
|
||||||
MainURL: resourceURL,
|
MainURL: resourceURL,
|
||||||
IsVendor: int8(utils.Bool2Int(isUpload2Vendor)),
|
IsVendor: int8(utils.Bool2Int(isUpload2Vendor)),
|
||||||
}
|
}
|
||||||
|
|
||||||
vendorID := jxutils.GuessDataResourceVendor(resourceURL)
|
vendorID := jxutils.GuessDataResourceVendor(resourceURL)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ var (
|
|||||||
ValidMimeTypes = map[string][]string{
|
ValidMimeTypes = map[string][]string{
|
||||||
"image/jpeg": []string{"jpeg", "jpg"},
|
"image/jpeg": []string{"jpeg", "jpg"},
|
||||||
"image/png": []string{"png"},
|
"image/png": []string{"png"},
|
||||||
"image/gif": []string{"gif"},
|
// "image/gif": []string{"gif"}, // 美团不支持GIF
|
||||||
|
|
||||||
"video/mpeg": []string{"mpeg", "mpg"},
|
"video/mpeg": []string{"mpeg", "mpg"},
|
||||||
"video/mp4": []string{"mp4", "m4v"},
|
"video/mp4": []string{"mp4", "m4v"},
|
||||||
@@ -16,9 +16,9 @@ type DataResource struct {
|
|||||||
|
|
||||||
HashCode string `orm:"size(48);unique" json:"hashCode"`
|
HashCode string `orm:"size(48);unique" json:"hashCode"`
|
||||||
|
|
||||||
ResoureType string `orm:"size(48)" json:"resoureType"` // 资料的mime type
|
ResourceType string `orm:"size(48)" json:"resourceType"` // 资料的mime type
|
||||||
Name string `orm:"size(48);index" json:"name"`
|
Name string `orm:"size(48);index" json:"name"`
|
||||||
IsVendor int8 `json:"isVendor"` // 是否是平台需要的(平台需要才会上传到平台)
|
IsVendor int8 `json:"isVendor"` // 是否是平台需要的(平台需要才会上传到平台)
|
||||||
|
|
||||||
MainURL string `orm:"size(512);column(main_url);unique" json:"mainURL"`
|
MainURL string `orm:"size(512);column(main_url);unique" json:"mainURL"`
|
||||||
QiniuURL string `orm:"size(512);column(qiniu_url);index" json:"qiniuURL"`
|
QiniuURL string `orm:"size(512);column(qiniu_url);index" json:"qiniuURL"`
|
||||||
|
|||||||
Reference in New Issue
Block a user