Authored by 张帅

Merge branch 'hotfix-publish-190305' into test6.8.7

# Conflicts:
#	grass/src/main/java/com/yohobuy/platform/grass/service/impl/GrassArticleServiceImpl.java
... ... @@ -151,16 +151,20 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
if(StringUtils.isNotEmpty( req.getArticleSkns())){
int orderby = 0;
List<GrassArticleProduct> sknList = Lists.newArrayList();
for (String skn: skns) {
GrassArticleProduct grassArticleSkn = new GrassArticleProduct();
grassArticleSkn.setArticleId(article.getId());
grassArticleSkn.setProductSkn(Integer.valueOf(skn));
grassArticleSkn.setCreateTime(now);
grassArticleSkn.setOrderBy(orderby);
grassArticleSkn.setProductSource(req.getSknType());
orderby++;
sknList.add(grassArticleSkn);
if(skns != null){
Integer sknType = Optional.ofNullable(req.getSknType()).orElse(1);
for (String skn: skns) {
GrassArticleProduct grassArticleSkn = new GrassArticleProduct();
grassArticleSkn.setArticleId(article.getId());
grassArticleSkn.setProductSkn(Integer.valueOf(skn));
grassArticleSkn.setCreateTime(now);
grassArticleSkn.setOrderBy(orderby);
grassArticleSkn.setProductSource(sknType);
orderby++;
sknList.add(grassArticleSkn);
}
}
if(CollectionUtils.isNotEmpty(sknList)){
grassArticleProductDao.insertArticleSkns(sknList);
}
... ...
... ... @@ -316,6 +316,35 @@
bucket: "grassImg"
},
onBeforeSubmit: function () {
var oobj = $(this).find("input[type='file']");
var files = oobj[0].files;
for(var i=0; i<files.length;i++){
var obj = files[i];
if(obj!=null && obj!=''){
debugger
if(obj.name.substring(obj.name.lastIndexOf(".")).toLowerCase() == '.png'){
$.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;});
return false;
}
if(obj.type.toLowerCase() == 'image/png'){
$.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;});
return false;
}
}
}
var imageCount = 0;
$("input[name='url']").each(function(j,item){
debugger
var url = item.value;
if(url != ''){
imageCount++;
}
});
if(imageCount +files.length > 9 ){
$.messager.alert("提示","最多上传九张图片", "info");
return false;
}
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
... ... @@ -327,6 +356,8 @@
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
initimg(1,1);
$(this).remove();
$.messager.alert("错误",data.message);
return "";
}
... ... @@ -406,17 +437,17 @@
// if(num >9){
// return
// }
var imageCount = 0;
$("input[name='url']").each(function(j,item){
debugger
var url = item.value;
if(url != ''){
imageCount++;
}
});
if(imageCount > 8 ){
return;
}
// var imageCount = 0;
// $("input[name='url']").each(function(j,item){
// debugger
// var url = item.value;
// if(url != ''){
// imageCount++;
// }
// });
// if(imageCount > 8 ){
// return;
// }
$("#imageUpload"+num).imageUpload({
width: 171,
height: 120,
... ... @@ -427,6 +458,36 @@
bucket: "grassImg"
},
onBeforeSubmit: function () {
var oobj = $(this).find("input[type='file']");
var files = oobj[0].files;
for(var i=0; i<files.length;i++){
var obj = files[i];
if(obj!=null && obj!=''){
debugger
if(obj.name.substring(obj.name.lastIndexOf(".")).toLowerCase() == 'png'){
$.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;});
return false;
}
if(obj.type.toLowerCase() == 'image/png'){
$.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;});
return false;
}
}
}
var imageCount = 0;
$("input[name='url']").each(function(j,item){
debugger
var url = item.value;
if(url != ''){
imageCount++;
}
});
if(imageCount +files.length > 9 ){
$.messager.alert("提示","最多上传九张图片", "info");
return false;
}
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
... ... @@ -438,6 +499,8 @@
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
initimg(num,1);
$(this).remove();
$.messager.alert("错误",data.message);
return "";
}
... ...