feat: 添加用户登录授权和金币消耗功能
后端: - 创建UserInfo实体类和数据库表 - 创建UserInfoRepository和UserInfoService - 创建UserController处理用户登录、信息更新等API 前端: - 创建登录授权页面(auth.vue) - 创建金币检查工具函数(coinUtils.js) - 更新api.js添加用户API - 更新测算页面(bazi.vue, ziwei.vue)添加金币检查逻辑 - 更新我的账号页面显示用户信息 - 更新个人信息与权限使用记录页面 功能: - 首次使用需要授权登录 - 自动生成随机用户名和用户ID - 每次测算消耗1金币 - 金币不足时弹出提示 - 会员用户无需消耗金币
This commit is contained in:
1 parent
15ee012d76
commit
b05650860e
12 files changed
+1051
-633
No files matched your search
@@ -0,0 +1,92 @@
|
||||
package xuan.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "user_info")
|
||||
public class UserInfo {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false, unique = true, length = 64)
|
||||
private String openId;
|
||||
|
||||
@Column(length = 50)
|
||||
private String nickname;
|
||||
|
||||
@Column(length = 255)
|
||||
private String avatarUrl;
|
||||
|
||||
@Column(length = 50)
|
||||
private String username;
|
||||
|
||||
@Column(length = 20)
|
||||
private String userId;
|
||||
|
||||
@Column(length = 20)
|
||||
private String phone;
|
||||
|
||||
private Integer vipLevel;
|
||||
|
||||
private Integer coins;
|
||||
|
||||
private Integer streakDays;
|
||||
|
||||
@Column(nullable = false, updatable = false)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@PrePersist
|
||||
protected void onCreate() {
|
||||
createTime = LocalDateTime.now();
|
||||
updateTime = createTime;
|
||||
vipLevel = 0;
|
||||
coins = 10;
|
||||
streakDays = 0;
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
protected void onUpdate() {
|
||||
updateTime = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
|
||||
public String getOpenId() { return openId; }
|
||||
public void setOpenId(String openId) { this.openId = openId; }
|
||||
|
||||
public String getNickname() { return nickname; }
|
||||
public void setNickname(String nickname) { this.nickname = nickname; }
|
||||
|
||||
public String getAvatarUrl() { return avatarUrl; }
|
||||
public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; }
|
||||
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
|
||||
public String getUserId() { return userId; }
|
||||
public void setUserId(String userId) { this.userId = userId; }
|
||||
|
||||
public String getPhone() { return phone; }
|
||||
public void setPhone(String phone) { this.phone = phone; }
|
||||
|
||||
public Integer getVipLevel() { return vipLevel; }
|
||||
public void setVipLevel(Integer vipLevel) { this.vipLevel = vipLevel; }
|
||||
|
||||
public Integer getCoins() { return coins; }
|
||||
public void setCoins(Integer coins) { this.coins = coins; }
|
||||
|
||||
public Integer getStreakDays() { return streakDays; }
|
||||
public void setStreakDays(Integer streakDays) { this.streakDays = streakDays; }
|
||||
|
||||
public LocalDateTime getCreateTime() { return createTime; }
|
||||
public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
|
||||
|
||||
public LocalDateTime getUpdateTime() { return updateTime; }
|
||||
public void setUpdateTime(LocalDateTime updateTime) { this.updateTime = updateTime; }
|
||||
}
|
||||
Reference in new issue
Block a user