Skip to content

Commit

Permalink
更新优化提示,优化分类图片返回
Browse files Browse the repository at this point in the history
  • Loading branch information
OURSIL committed Apr 23, 2024
1 parent 37bffbd commit d7efa6b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
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;
Expand All @@ -25,7 +27,7 @@
@Data
@TableName("tz_category")
public class Category implements Serializable {

/**
* 类目ID
*
Expand All @@ -38,7 +40,7 @@ public class Category implements Serializable {
* 店铺id
*/
private Long shopId;

/**
* 父节点
*/
Expand All @@ -57,6 +59,7 @@ public class Category implements Serializable {
/**
* 类目的显示图片
*/
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;

/**
Expand All @@ -83,13 +86,13 @@ public class Category implements Serializable {
* 更新时间
*/
private Date updateTime;

/**
* 品牌id
*/
@TableField(exist=false)
private List<Long> brandIds;

/**
* 参数id
*/
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import java.io.IOException;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* @author lanhai
Expand All @@ -42,13 +44,21 @@ public void serialize(String value, JsonGenerator gen, SerializerProvider serial
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void deleteAllToken(String sysType, String userId) {
public TokenInfoVO storeAndGetVo(UserInfoInTokenBO userInfoInToken) {
if (!userInfoInToken.getEnabled()){
// 用户已禁用,请联系客服
throw new YamiShopBindException("yami.user.disabled");
throw new YamiShopBindException("用户已禁用,请联系客服");
}
TokenInfoBO tokenInfoBO = storeAccessSaToken(userInfoInToken);
// 数据封装返回
Expand Down

0 comments on commit d7efa6b

Please sign in to comment.