Browse Source

默认昵称和头像

master
nili 1 year ago
parent
commit
fe7426024a
  1. 16
      game-dao/src/main/java/awesome/group/game/dao/bean/WeGameUser.java

16
game-dao/src/main/java/awesome/group/game/dao/bean/WeGameUser.java

@ -3,6 +3,7 @@ package awesome.group.game.dao.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.springframework.util.StringUtils;
@Data
public class WeGameUser {
@ -19,4 +20,19 @@ public class WeGameUser {
private String unionId;
private String sessionKey;
private Integer score;
public String getNickname() {
if (StringUtils.hasText(nickname)) {
return nickname;
}
int len = openId.length();
return "匿名用户" + openId.substring(len - 6, len);
}
public String getAvatarUrl(){
if (StringUtils.hasText(avatarUrl)) {
return avatarUrl;
}
return "https://thirdwx.qlogo.cn/mmopen/vi_32/SaE2E40RYKicFybiaUzFn6VZ5s8VgrkabnxUFx9JtU23M9lWEU6otWD61sTWc5oWwIS1rYbuSXwZ2LES5FO7qiaog/132";
}
}

Loading…
Cancel
Save