mirror of
https://gitee.com/gz-yami/mall4j.git
synced 2026-03-22 09:17:16 +08:00
更新优化提示,优化分类图片返回
This commit is contained in:
@@ -13,6 +13,8 @@ package com.yami.shop.bean.model;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -25,7 +27,7 @@ import java.util.List;
|
||||
@Data
|
||||
@TableName("tz_category")
|
||||
public class Category implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 类目ID
|
||||
*
|
||||
@@ -38,7 +40,7 @@ public class Category implements Serializable {
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
|
||||
/**
|
||||
* 父节点
|
||||
*/
|
||||
@@ -57,6 +59,7 @@ public class Category implements Serializable {
|
||||
/**
|
||||
* 类目的显示图片
|
||||
*/
|
||||
@JsonSerialize(using = ImgJsonSerializer.class)
|
||||
private String pic;
|
||||
|
||||
/**
|
||||
@@ -83,13 +86,13 @@ public class Category implements Serializable {
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private List<Long> brandIds;
|
||||
|
||||
|
||||
/**
|
||||
* 参数id
|
||||
*/
|
||||
@@ -101,19 +104,19 @@ public class Category implements Serializable {
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private List<Brand> brands;
|
||||
|
||||
|
||||
/**
|
||||
* 参数列表
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private List<ProdProp> prodProps;
|
||||
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private List<Product> products;
|
||||
|
||||
|
||||
@TableField(exist=false)
|
||||
private List<Category> categories;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author lanhai
|
||||
@@ -42,13 +44,21 @@ public class ImgJsonSerializer extends JsonSerializer<String> {
|
||||
String[] imgs = value.split(StrUtil.COMMA);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String resourceUrl = "";
|
||||
String rule="^((http[s]{0,1})://)";
|
||||
Pattern pattern= Pattern.compile(rule);
|
||||
if (Objects.equals(imgUploadUtil.getUploadType(), 2)) {
|
||||
resourceUrl = qiniu.getResourcesUrl();
|
||||
} else if (Objects.equals(imgUploadUtil.getUploadType(), 1)) {
|
||||
resourceUrl = imgUploadUtil.getResourceUrl();
|
||||
}
|
||||
for (String img : imgs) {
|
||||
sb.append(resourceUrl).append(img).append(StrUtil.COMMA);
|
||||
Matcher matcher = pattern.matcher(img);
|
||||
//若图片以http或https开头,直接返回
|
||||
if (matcher.find()){
|
||||
sb.append(img).append(StrUtil.COMMA);
|
||||
}else {
|
||||
sb.append(resourceUrl).append(img).append(StrUtil.COMMA);
|
||||
}
|
||||
}
|
||||
sb.deleteCharAt(sb.length()-1);
|
||||
gen.writeString(sb.toString());
|
||||
|
||||
@@ -155,7 +155,7 @@ public class TokenStore {
|
||||
public TokenInfoVO storeAndGetVo(UserInfoInTokenBO userInfoInToken) {
|
||||
if (!userInfoInToken.getEnabled()){
|
||||
// 用户已禁用,请联系客服
|
||||
throw new YamiShopBindException("yami.user.disabled");
|
||||
throw new YamiShopBindException("用户已禁用,请联系客服");
|
||||
}
|
||||
TokenInfoBO tokenInfoBO = storeAccessSaToken(userInfoInToken);
|
||||
// 数据封装返回
|
||||
|
||||
Reference in New Issue
Block a user