Selaa lähdekoodia

新增回收页面,修改档口内容

jin 6 kuukautta sitten
vanhempi
commit
abc99cd2e7
31 muutettua tiedostoa jossa 2438 lisäystä ja 35 poistoa
  1. 5 0
      ruoyi-admin/src/main/resources/application.yml
  2. 7 1
      ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
  3. 12 1
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  4. 15 4
      ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
  5. 284 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WxUser.java
  6. 193 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginWxUser.java
  7. 24 6
      ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java
  8. 1 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  9. 104 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxCreditController.java
  10. 104 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxRechargeController.java
  11. 105 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxUserController.java
  12. 19 8
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecContent.java
  13. 99 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxCredit.java
  14. 125 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxRecharge.java
  15. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxCreditMapper.java
  16. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxRechargeMapper.java
  17. 72 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxUserMapper.java
  18. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxCreditService.java
  19. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxRechargeService.java
  20. 70 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxUserService.java
  21. 93 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxCreditServiceImpl.java
  22. 93 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxRechargeServiceImpl.java
  23. 101 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxUserServiceImpl.java
  24. 42 12
      ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java
  25. 75 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WxLoginService.java
  26. 201 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WxTokenService.java
  27. 6 1
      ruoyi-system/src/main/resources/mapper/system/RecContentMapper.xml
  28. 81 0
      ruoyi-system/src/main/resources/mapper/system/WxCreditMapper.xml
  29. 83 0
      ruoyi-system/src/main/resources/mapper/system/WxRechargeMapper.xml
  30. 144 0
      ruoyi-system/src/main/resources/mapper/system/WxUserMapper.xml
  31. 36 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxLoginController.java

+ 5 - 0
ruoyi-admin/src/main/resources/application.yml

@@ -97,6 +97,7 @@ token:
   secret: abcdefghijklmnopqrstuvwxyz
   # 令牌有效期(默认30分钟)
   expireTime: 30
+  salt: recovery
 
 # MyBatis配置
 mybatis:
@@ -140,3 +141,7 @@ ftp_ip:  47.117.168.244
 ftp_user: 13167331622_cc
 ftp_pass: Ck14bzrjEPNHGMyy
 ftp_port: 21
+
+wx:
+  appid: wx5e6011e2a62d0ffb
+  secret: 98a513002257f43102a1d0ccf5a5eb8e

+ 7 - 1
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java

@@ -2,7 +2,7 @@ package com.ruoyi.common.constant;
 
 /**
  * 缓存的key 常量
- * 
+ *
  * @author ruoyi
  */
 public class CacheConstants
@@ -12,6 +12,11 @@ public class CacheConstants
      */
     public static final String LOGIN_TOKEN_KEY = "login_tokens:";
 
+    /**
+     * 微信用户 redis key
+     */
+    public static final String WX_LOGIN_TOKEN_KEY = "login_wx_user_tokens:";
+
     /**
      * 验证码 redis key
      */
@@ -41,4 +46,5 @@ public class CacheConstants
      * 登录账户密码错误次数 redis key
      */
     public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
+
 }

+ 12 - 1
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -5,7 +5,7 @@ import io.jsonwebtoken.Claims;
 
 /**
  * 通用常量信息
- * 
+ *
  * @author ruoyi
  */
 public class Constants
@@ -110,6 +110,11 @@ public class Constants
      */
     public static final String LOGIN_USER_KEY = "login_user_key";
 
+    /**
+     * 微信用户令牌前缀
+     */
+    public static final String WX_LOGIN_TOKEN_KEY = "login_wx_user_key";
+
     /**
      * 用户ID
      */
@@ -170,4 +175,10 @@ public class Constants
      */
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
             "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
+
+
+    /**
+     * 微信接口前缀
+     */
+    public static final String WX_URI = "/wx/";
 }

+ 15 - 4
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java

@@ -3,6 +3,8 @@ package com.ruoyi.common.core.controller;
 import java.beans.PropertyEditorSupport;
 import java.util.Date;
 import java.util.List;
+
+import com.ruoyi.common.core.domain.model.LoginWxUser;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.WebDataBinder;
@@ -23,7 +25,7 @@ import com.ruoyi.common.utils.sql.SqlUtil;
 
 /**
  * web层通用数据处理
- * 
+ *
  * @author ruoyi
  */
 public class BaseController
@@ -113,7 +115,7 @@ public class BaseController
     {
         return AjaxResult.success(message);
     }
-    
+
     /**
      * 返回成功消息
      */
@@ -140,7 +142,7 @@ public class BaseController
 
     /**
      * 响应返回结果
-     * 
+     *
      * @param rows 影响行数
      * @return 操作结果
      */
@@ -151,7 +153,7 @@ public class BaseController
 
     /**
      * 响应返回结果
-     * 
+     *
      * @param result 结果
      * @return 操作结果
      */
@@ -199,4 +201,13 @@ public class BaseController
     {
         return getLoginUser().getUsername();
     }
+
+    /**
+     * 获取WX用户缓存信息
+     */
+    public LoginWxUser getLoginAppUser()
+    {
+        return SecurityUtils.getLoginWxUser();
+    }
+
 }

+ 284 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WxUser.java

@@ -0,0 +1,284 @@
+package com.ruoyi.common.core.domain.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 用户对象 wx_user
+ *
+ * @author jin
+ * @date 2024-12-01
+ */
+public class WxUser extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 用户名称 */
+    @Excel(name = "用户名称")
+    private String username;
+
+    /** 用户密码 */
+    @Excel(name = "用户密码")
+    private String password;
+
+    /** 性别:0 未知, 1男, 1 女 */
+    @Excel(name = "性别:0 未知, 1男, 1 女")
+    private Long gender;
+
+    /** 生日 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date birthday;
+
+    /** 最近一次登录时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "最近一次登录时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date lastLoginTime;
+
+    /** 最近一次登录IP地址 */
+    @Excel(name = "最近一次登录IP地址")
+    private String lastLoginIp;
+
+    /** 用户层级 0 普通用户,1 VIP用户 */
+    @Excel(name = "用户层级 0 普通用户,1 VIP用户")
+    private Long userLevel;
+
+    /** 用户昵称或网络名称 */
+    @Excel(name = "用户昵称或网络名称")
+    private String nickname;
+
+    /** 用户手机号码 */
+    @Excel(name = "用户手机号码")
+    private String mobile;
+
+    /** 用户头像图片 */
+    @Excel(name = "用户头像图片")
+    private String avatar;
+
+    /** 微信登录openid */
+    @Excel(name = "微信登录openid")
+    private String wxOpenid;
+
+    /** 0 可用, 1 禁用, 2 注销 */
+    @Excel(name = "0 可用, 1 禁用, 2 注销")
+    private Long status;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date addTime;
+
+    /** 逻辑删除 */
+    @Excel(name = "逻辑删除")
+    private Integer deleted;
+
+    /** 积分 */
+    @Excel(name = "积分")
+    private Long points;
+
+    /** 会员开始充值时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "会员开始充值时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date vipStartTime;
+
+    /** 会员结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "会员结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date vipEndTime;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setUsername(String username)
+    {
+        this.username = username;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+    public void setPassword(String password)
+    {
+        this.password = password;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+    public void setGender(Long gender)
+    {
+        this.gender = gender;
+    }
+
+    public Long getGender()
+    {
+        return gender;
+    }
+    public void setBirthday(Date birthday)
+    {
+        this.birthday = birthday;
+    }
+
+    public Date getBirthday()
+    {
+        return birthday;
+    }
+    public void setLastLoginTime(Date lastLoginTime)
+    {
+        this.lastLoginTime = lastLoginTime;
+    }
+
+    public Date getLastLoginTime()
+    {
+        return lastLoginTime;
+    }
+    public void setLastLoginIp(String lastLoginIp)
+    {
+        this.lastLoginIp = lastLoginIp;
+    }
+
+    public String getLastLoginIp()
+    {
+        return lastLoginIp;
+    }
+    public void setUserLevel(Long userLevel)
+    {
+        this.userLevel = userLevel;
+    }
+
+    public Long getUserLevel()
+    {
+        return userLevel;
+    }
+    public void setNickname(String nickname)
+    {
+        this.nickname = nickname;
+    }
+
+    public String getNickname()
+    {
+        return nickname;
+    }
+    public void setMobile(String mobile)
+    {
+        this.mobile = mobile;
+    }
+
+    public String getMobile()
+    {
+        return mobile;
+    }
+    public void setAvatar(String avatar)
+    {
+        this.avatar = avatar;
+    }
+
+    public String getAvatar()
+    {
+        return avatar;
+    }
+    public void setWxOpenid(String weixinOpenid)
+    {
+        this.wxOpenid = wxOpenid;
+    }
+
+    public String getWxOpenid()
+    {
+        return wxOpenid;
+    }
+    public void setStatus(Long status)
+    {
+        this.status = status;
+    }
+
+    public Long getStatus()
+    {
+        return status;
+    }
+    public void setAddTime(Date addTime)
+    {
+        this.addTime = addTime;
+    }
+
+    public Date getAddTime()
+    {
+        return addTime;
+    }
+    public void setDeleted(Integer deleted)
+    {
+        this.deleted = deleted;
+    }
+
+    public Integer getDeleted()
+    {
+        return deleted;
+    }
+    public void setPoints(Long points)
+    {
+        this.points = points;
+    }
+
+    public Long getPoints()
+    {
+        return points;
+    }
+    public void setVipStartTime(Date vipStartTime)
+    {
+        this.vipStartTime = vipStartTime;
+    }
+
+    public Date getVipStartTime()
+    {
+        return vipStartTime;
+    }
+    public void setVipEndTime(Date vipEndTime)
+    {
+        this.vipEndTime = vipEndTime;
+    }
+
+    public Date getVipEndTime()
+    {
+        return vipEndTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("username", getUsername())
+            .append("password", getPassword())
+            .append("gender", getGender())
+            .append("birthday", getBirthday())
+            .append("lastLoginTime", getLastLoginTime())
+            .append("lastLoginIp", getLastLoginIp())
+            .append("userLevel", getUserLevel())
+            .append("nickname", getNickname())
+            .append("mobile", getMobile())
+            .append("avatar", getAvatar())
+            .append("wxOpenid", getWxOpenid())
+            .append("status", getStatus())
+            .append("addTime", getAddTime())
+            .append("updateTime", getUpdateTime())
+            .append("deleted", getDeleted())
+            .append("points", getPoints())
+            .append("vipStartTime", getVipStartTime())
+            .append("vipEndTime", getVipEndTime())
+            .toString();
+    }
+}

+ 193 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginWxUser.java

@@ -0,0 +1,193 @@
+package com.ruoyi.common.core.domain.model;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.ruoyi.common.core.domain.entity.WxUser;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.util.Collection;
+
+public class LoginWxUser implements UserDetails {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 用户唯一标识
+     */
+    private String token;
+
+    /**
+     * 登录时间
+     */
+    private Long loginTime;
+
+    /**
+     * 过期时间
+     */
+    private Long expireTime;
+
+    /**
+     * 登录IP地址
+     */
+    private String ipaddr;
+
+    /**
+     * 登录地点
+     */
+    private String loginLocation;
+
+    /**
+     * 浏览器类型
+     */
+    private String browser;
+
+    /**
+     * 操作系统
+     */
+    private String os;
+
+    /**
+     * 用户信息
+     */
+    private WxUser wxUser;
+
+    public LoginWxUser() {
+    }
+
+    public LoginWxUser(WxUser wxUser) {
+        this.wxUser = wxUser;
+    }
+
+    public LoginWxUser(Long userId, WxUser wxUser) {
+        this.userId = userId;
+        this.wxUser = wxUser;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    public Long getLoginTime() {
+        return loginTime;
+    }
+
+    public void setLoginTime(Long loginTime) {
+        this.loginTime = loginTime;
+    }
+
+    public Long getExpireTime() {
+        return expireTime;
+    }
+
+    public void setExpireTime(Long expireTime) {
+        this.expireTime = expireTime;
+    }
+
+    public String getIpaddr() {
+        return ipaddr;
+    }
+
+    public void setIpaddr(String ipaddr) {
+        this.ipaddr = ipaddr;
+    }
+
+    public String getLoginLocation() {
+        return loginLocation;
+    }
+
+    public void setLoginLocation(String loginLocation) {
+        this.loginLocation = loginLocation;
+    }
+
+    public String getBrowser() {
+        return browser;
+    }
+
+    public void setBrowser(String browser) {
+        this.browser = browser;
+    }
+
+    public String getOs() {
+        return os;
+    }
+
+    public void setOs(String os) {
+        this.os = os;
+    }
+
+    public WxUser getWxUser() {
+        return wxUser;
+    }
+
+    public void setWxUser(WxUser wxUser) {
+        this.wxUser = wxUser;
+    }
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return null;
+    }
+
+    @Override
+    @JSONField(serialize = false)
+    public String getPassword() {
+        return wxUser.getPassword();
+    }
+
+    @Override
+    public String getUsername() {
+        return wxUser.getUsername();
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return true;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return true;
+    }
+
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer("LoginWxUser{");
+        sb.append("userId=").append(userId);
+        sb.append(", token='").append(token).append('\'');
+        sb.append(", loginTime=").append(loginTime);
+        sb.append(", expireTime=").append(expireTime);
+        sb.append(", ipaddr='").append(ipaddr).append('\'');
+        sb.append(", loginLocation='").append(loginLocation).append('\'');
+        sb.append(", browser='").append(browser).append('\'');
+        sb.append(", os='").append(os).append('\'');
+        sb.append(", wxUser=").append(wxUser);
+        sb.append('}');
+        return sb.toString();
+    }
+}

+ 24 - 6
ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java

@@ -3,6 +3,8 @@ package com.ruoyi.common.utils;
 import java.util.Collection;
 import java.util.List;
 import java.util.stream.Collectors;
+
+import com.ruoyi.common.core.domain.model.LoginWxUser;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -15,7 +17,7 @@ import com.ruoyi.common.exception.ServiceException;
 
 /**
  * 安全服务工具类
- * 
+ *
  * @author ruoyi
  */
 public class SecurityUtils
@@ -81,6 +83,22 @@ public class SecurityUtils
         }
     }
 
+    /**
+     * 获取APP用户
+     **/
+    public static LoginWxUser getLoginWxUser()
+    {
+        try
+        {
+            return (LoginWxUser) getAuthentication().getPrincipal();
+        }
+        catch (Exception e)
+        {
+            throw new ServiceException("获取WX用户信息异常", HttpStatus.UNAUTHORIZED);
+        }
+    }
+
+
     /**
      * 获取Authentication
      */
@@ -116,7 +134,7 @@ public class SecurityUtils
 
     /**
      * 是否为管理员
-     * 
+     *
      * @param userId 用户ID
      * @return 结果
      */
@@ -127,7 +145,7 @@ public class SecurityUtils
 
     /**
      * 验证用户是否具备某权限
-     * 
+     *
      * @param permission 权限字符串
      * @return 用户是否具备某权限
      */
@@ -138,7 +156,7 @@ public class SecurityUtils
 
     /**
      * 判断是否包含权限
-     * 
+     *
      * @param authorities 权限列表
      * @param permission 权限字符串
      * @return 用户是否具备某权限
@@ -151,7 +169,7 @@ public class SecurityUtils
 
     /**
      * 验证用户是否拥有某个角色
-     * 
+     *
      * @param role 角色标识
      * @return 用户是否具备某角色
      */
@@ -164,7 +182,7 @@ public class SecurityUtils
 
     /**
      * 判断是否包含角色
-     * 
+     *
      * @param roles 角色列表
      * @param role 角色
      * @return 用户是否具备某角色权限

+ 1 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -108,11 +108,10 @@ public class SecurityConfig {
                 .authorizeHttpRequests((requests) -> {
                     permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll());
                     // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                    requests.requestMatchers("/login", "/register", "/captchaImage", "/common/**").permitAll()
+                    requests.requestMatchers("/login", "/wx/login","/register", "/captchaImage", "/common/**").permitAll()
                             // 静态资源,可匿名访问
                             .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
                             .requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()
-                            .requestMatchers("/wx/**").anonymous()
                             // 除上面外的所有请求全部需要鉴权认证
                             .anyRequest().authenticated();
                 })

+ 104 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxCreditController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.framework.recovery.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.recovery.domain.WxCredit;
+import com.ruoyi.framework.recovery.service.IWxCreditService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 积分明细Controller
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+@RestController
+@RequestMapping("/recovery/credit")
+public class WxCreditController extends BaseController
+{
+    @Autowired
+    private IWxCreditService wxCreditService;
+
+    /**
+     * 查询积分明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:credit:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(WxCredit wxCredit)
+    {
+        startPage();
+        List<WxCredit> list = wxCreditService.selectWxCreditList(wxCredit);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出积分明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:credit:export')")
+    @Log(title = "积分明细", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, WxCredit wxCredit)
+    {
+        List<WxCredit> list = wxCreditService.selectWxCreditList(wxCredit);
+        ExcelUtil<WxCredit> util = new ExcelUtil<WxCredit>(WxCredit.class);
+        util.exportExcel(response, list, "积分明细数据");
+    }
+
+    /**
+     * 获取积分明细详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:credit:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(wxCreditService.selectWxCreditById(id));
+    }
+
+    /**
+     * 新增积分明细
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:credit:add')")
+    @Log(title = "积分明细", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody WxCredit wxCredit)
+    {
+        return toAjax(wxCreditService.insertWxCredit(wxCredit));
+    }
+
+    /**
+     * 修改积分明细
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:credit:edit')")
+    @Log(title = "积分明细", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody WxCredit wxCredit)
+    {
+        return toAjax(wxCreditService.updateWxCredit(wxCredit));
+    }
+
+    /**
+     * 删除积分明细
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:credit:remove')")
+    @Log(title = "积分明细", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(wxCreditService.deleteWxCreditByIds(ids));
+    }
+}

+ 104 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxRechargeController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.framework.recovery.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.recovery.domain.WxRecharge;
+import com.ruoyi.framework.recovery.service.IWxRechargeService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 充值Controller
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+@RestController
+@RequestMapping("/recovery/recharge")
+public class WxRechargeController extends BaseController
+{
+    @Autowired
+    private IWxRechargeService wxRechargeService;
+
+    /**
+     * 查询充值列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:recharge:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(WxRecharge wxRecharge)
+    {
+        startPage();
+        List<WxRecharge> list = wxRechargeService.selectWxRechargeList(wxRecharge);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出充值列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:recharge:export')")
+    @Log(title = "充值", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, WxRecharge wxRecharge)
+    {
+        List<WxRecharge> list = wxRechargeService.selectWxRechargeList(wxRecharge);
+        ExcelUtil<WxRecharge> util = new ExcelUtil<WxRecharge>(WxRecharge.class);
+        util.exportExcel(response, list, "充值数据");
+    }
+
+    /**
+     * 获取充值详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:recharge:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(wxRechargeService.selectWxRechargeById(id));
+    }
+
+    /**
+     * 新增充值
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:recharge:add')")
+    @Log(title = "充值", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody WxRecharge wxRecharge)
+    {
+        return toAjax(wxRechargeService.insertWxRecharge(wxRecharge));
+    }
+
+    /**
+     * 修改充值
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:recharge:edit')")
+    @Log(title = "充值", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody WxRecharge wxRecharge)
+    {
+        return toAjax(wxRechargeService.updateWxRecharge(wxRecharge));
+    }
+
+    /**
+     * 删除充值
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:recharge:remove')")
+    @Log(title = "充值", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(wxRechargeService.deleteWxRechargeByIds(ids));
+    }
+}

+ 105 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxUserController.java

@@ -0,0 +1,105 @@
+package com.ruoyi.framework.recovery.controller;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.entity.WxUser;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.recovery.service.IWxUserService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 用户Controller
+ *
+ * @author jin
+ * @date 2024-12-01
+ */
+@RestController
+@RequestMapping("/recovery/user")
+public class WxUserController extends BaseController
+{
+    @Autowired
+    private IWxUserService wxUserService;
+
+    /**
+     * 查询用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:user:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(WxUser wxUser)
+    {
+        startPage();
+        List<WxUser> list = wxUserService.selectWxUserList(wxUser);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:user:export')")
+    @Log(title = "用户", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, WxUser wxUser)
+    {
+        List<WxUser> list = wxUserService.selectWxUserList(wxUser);
+        ExcelUtil<WxUser> util = new ExcelUtil<WxUser>(WxUser.class);
+        util.exportExcel(response, list, "用户数据");
+    }
+
+    /**
+     * 获取用户详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:user:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(wxUserService.selectWxUserById(id));
+    }
+
+    /**
+     * 新增用户
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:user:add')")
+    @Log(title = "用户", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody WxUser wxUser)
+    {
+        return toAjax(wxUserService.insertWxUser(wxUser));
+    }
+
+    /**
+     * 修改用户
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:user:edit')")
+    @Log(title = "用户", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody WxUser wxUser)
+    {
+        return toAjax(wxUserService.updateWxUser(wxUser));
+    }
+
+    /**
+     * 删除用户
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:user:remove')")
+    @Log(title = "用户", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(wxUserService.deleteWxUserByIds(ids));
+    }
+}

+ 19 - 8
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecContent.java

@@ -24,6 +24,9 @@ public class RecContent extends BaseEntity
     @Excel(name = "评论内容")
     private String content;
 
+    @Excel(name = "点赞数")
+    private Long thumbs;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@@ -71,15 +74,23 @@ public class RecContent extends BaseEntity
         return updateDate;
     }
 
+    public Long getThumbs() {
+        return thumbs;
+    }
+
+    public void setThumbs(Long thumbs) {
+        this.thumbs = thumbs;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("content", getContent())
-            .append("createBy", getCreateBy())
-            .append("createDate", getCreateDate())
-            .append("updateBy", getUpdateBy())
-            .append("updateDate", getUpdateDate())
-            .toString();
+        final StringBuffer sb = new StringBuffer("RecContent{");
+        sb.append("id=").append(id);
+        sb.append(", content='").append(content).append('\'');
+        sb.append(", thumbs=").append(thumbs);
+        sb.append(", createDate=").append(createDate);
+        sb.append(", updateDate=").append(updateDate);
+        sb.append('}');
+        return sb.toString();
     }
 }

+ 99 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxCredit.java

@@ -0,0 +1,99 @@
+package com.ruoyi.framework.recovery.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 积分明细对象 wx_credit
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+public class WxCredit extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 积分id */
+    private Long id;
+
+    /** 积分类型 */
+    @Excel(name = "积分类型")
+    private String creditType;
+
+    /** 积分数 */
+    @Excel(name = "积分数")
+    private Long creditNum;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date createDate;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date updateDate;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setCreditType(String creditType) 
+    {
+        this.creditType = creditType;
+    }
+
+    public String getCreditType() 
+    {
+        return creditType;
+    }
+    public void setCreditNum(Long creditNum) 
+    {
+        this.creditNum = creditNum;
+    }
+
+    public Long getCreditNum() 
+    {
+        return creditNum;
+    }
+    public void setCreateDate(Date createDate) 
+    {
+        this.createDate = createDate;
+    }
+
+    public Date getCreateDate() 
+    {
+        return createDate;
+    }
+    public void setUpdateDate(Date updateDate) 
+    {
+        this.updateDate = updateDate;
+    }
+
+    public Date getUpdateDate() 
+    {
+        return updateDate;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("creditType", getCreditType())
+            .append("creditNum", getCreditNum())
+            .append("createBy", getCreateBy())
+            .append("createDate", getCreateDate())
+            .append("updateBy", getUpdateBy())
+            .append("updateDate", getUpdateDate())
+            .toString();
+    }
+}

+ 125 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxRecharge.java

@@ -0,0 +1,125 @@
+package com.ruoyi.framework.recovery.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 充值对象 wx_recharge
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+public class WxRecharge extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 充值id */
+    private Long id;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /** 用户名 */
+    @Excel(name = "用户名")
+    private String userName;
+
+    /** 充值金额 */
+    @Excel(name = "充值金额")
+    private BigDecimal price;
+
+    /** 使用积分 */
+    @Excel(name = "使用积分")
+    private Long points;
+
+    /** 充值时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "充值时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date payTime;
+
+    /** 删除标记:-1删除,1正常 */
+    @Excel(name = "删除标记:-1删除,1正常")
+    private String isDel;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setUserId(Long userId) 
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId() 
+    {
+        return userId;
+    }
+    public void setUserName(String userName) 
+    {
+        this.userName = userName;
+    }
+
+    public String getUserName() 
+    {
+        return userName;
+    }
+    public void setPrice(BigDecimal price) 
+    {
+        this.price = price;
+    }
+
+    public BigDecimal getPrice() 
+    {
+        return price;
+    }
+    public void setPoints(Long points) 
+    {
+        this.points = points;
+    }
+
+    public Long getPoints() 
+    {
+        return points;
+    }
+    public void setPayTime(Date payTime) 
+    {
+        this.payTime = payTime;
+    }
+
+    public Date getPayTime() 
+    {
+        return payTime;
+    }
+    public void setIsDel(String isDel) 
+    {
+        this.isDel = isDel;
+    }
+
+    public String getIsDel() 
+    {
+        return isDel;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("userId", getUserId())
+            .append("userName", getUserName())
+            .append("price", getPrice())
+            .append("points", getPoints())
+            .append("payTime", getPayTime())
+            .append("isDel", getIsDel())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxCreditMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxCredit;
+
+/**
+ * 积分明细Mapper接口
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+public interface WxCreditMapper 
+{
+    /**
+     * 查询积分明细
+     * 
+     * @param id 积分明细主键
+     * @return 积分明细
+     */
+    public WxCredit selectWxCreditById(Long id);
+
+    /**
+     * 查询积分明细列表
+     * 
+     * @param wxCredit 积分明细
+     * @return 积分明细集合
+     */
+    public List<WxCredit> selectWxCreditList(WxCredit wxCredit);
+
+    /**
+     * 新增积分明细
+     * 
+     * @param wxCredit 积分明细
+     * @return 结果
+     */
+    public int insertWxCredit(WxCredit wxCredit);
+
+    /**
+     * 修改积分明细
+     * 
+     * @param wxCredit 积分明细
+     * @return 结果
+     */
+    public int updateWxCredit(WxCredit wxCredit);
+
+    /**
+     * 删除积分明细
+     * 
+     * @param id 积分明细主键
+     * @return 结果
+     */
+    public int deleteWxCreditById(Long id);
+
+    /**
+     * 批量删除积分明细
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteWxCreditByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxRechargeMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxRecharge;
+
+/**
+ * 充值Mapper接口
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+public interface WxRechargeMapper 
+{
+    /**
+     * 查询充值
+     * 
+     * @param id 充值主键
+     * @return 充值
+     */
+    public WxRecharge selectWxRechargeById(Long id);
+
+    /**
+     * 查询充值列表
+     * 
+     * @param wxRecharge 充值
+     * @return 充值集合
+     */
+    public List<WxRecharge> selectWxRechargeList(WxRecharge wxRecharge);
+
+    /**
+     * 新增充值
+     * 
+     * @param wxRecharge 充值
+     * @return 结果
+     */
+    public int insertWxRecharge(WxRecharge wxRecharge);
+
+    /**
+     * 修改充值
+     * 
+     * @param wxRecharge 充值
+     * @return 结果
+     */
+    public int updateWxRecharge(WxRecharge wxRecharge);
+
+    /**
+     * 删除充值
+     * 
+     * @param id 充值主键
+     * @return 结果
+     */
+    public int deleteWxRechargeById(Long id);
+
+    /**
+     * 批量删除充值
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteWxRechargeByIds(Long[] ids);
+}

+ 72 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxUserMapper.java

@@ -0,0 +1,72 @@
+package com.ruoyi.framework.recovery.mapper;
+
+import com.ruoyi.common.core.domain.entity.WxUser;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 用户Mapper接口
+ *
+ * @author jin
+ * @date 2024-12-01
+ */
+public interface WxUserMapper
+{
+    /**
+     * 查询用户
+     *
+     * @param id 用户主键
+     * @return 用户
+     */
+    public WxUser selectWxUserById(Long id);
+
+    /**
+     * 查询用户列表
+     *
+     * @param wxUser 用户
+     * @return 用户集合
+     */
+    public List<WxUser> selectWxUserList(WxUser wxUser);
+
+    /**
+     * 新增用户
+     *
+     * @param wxUser 用户
+     * @return 结果
+     */
+    public int insertWxUser(WxUser wxUser);
+
+    /**
+     * 修改用户
+     *
+     * @param wxUser 用户
+     * @return 结果
+     */
+    public int updateWxUser(WxUser wxUser);
+
+    /**
+     * 删除用户
+     *
+     * @param id 用户主键
+     * @return 结果
+     */
+    public int deleteWxUserById(Long id);
+
+    /**
+     * 批量删除用户
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteWxUserByIds(Long[] ids);
+
+    /**
+     * 根据用户名查询
+     *
+     * @param openid 用户名
+     * @return 结果
+     */
+    WxUser selectWxUserByOpenid(@Param("openid") String openid);
+
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxCreditService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.service;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxCredit;
+
+/**
+ * 积分明细Service接口
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+public interface IWxCreditService 
+{
+    /**
+     * 查询积分明细
+     * 
+     * @param id 积分明细主键
+     * @return 积分明细
+     */
+    public WxCredit selectWxCreditById(Long id);
+
+    /**
+     * 查询积分明细列表
+     * 
+     * @param wxCredit 积分明细
+     * @return 积分明细集合
+     */
+    public List<WxCredit> selectWxCreditList(WxCredit wxCredit);
+
+    /**
+     * 新增积分明细
+     * 
+     * @param wxCredit 积分明细
+     * @return 结果
+     */
+    public int insertWxCredit(WxCredit wxCredit);
+
+    /**
+     * 修改积分明细
+     * 
+     * @param wxCredit 积分明细
+     * @return 结果
+     */
+    public int updateWxCredit(WxCredit wxCredit);
+
+    /**
+     * 批量删除积分明细
+     * 
+     * @param ids 需要删除的积分明细主键集合
+     * @return 结果
+     */
+    public int deleteWxCreditByIds(Long[] ids);
+
+    /**
+     * 删除积分明细信息
+     * 
+     * @param id 积分明细主键
+     * @return 结果
+     */
+    public int deleteWxCreditById(Long id);
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxRechargeService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.service;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxRecharge;
+
+/**
+ * 充值Service接口
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+public interface IWxRechargeService 
+{
+    /**
+     * 查询充值
+     * 
+     * @param id 充值主键
+     * @return 充值
+     */
+    public WxRecharge selectWxRechargeById(Long id);
+
+    /**
+     * 查询充值列表
+     * 
+     * @param wxRecharge 充值
+     * @return 充值集合
+     */
+    public List<WxRecharge> selectWxRechargeList(WxRecharge wxRecharge);
+
+    /**
+     * 新增充值
+     * 
+     * @param wxRecharge 充值
+     * @return 结果
+     */
+    public int insertWxRecharge(WxRecharge wxRecharge);
+
+    /**
+     * 修改充值
+     * 
+     * @param wxRecharge 充值
+     * @return 结果
+     */
+    public int updateWxRecharge(WxRecharge wxRecharge);
+
+    /**
+     * 批量删除充值
+     * 
+     * @param ids 需要删除的充值主键集合
+     * @return 结果
+     */
+    public int deleteWxRechargeByIds(Long[] ids);
+
+    /**
+     * 删除充值信息
+     * 
+     * @param id 充值主键
+     * @return 结果
+     */
+    public int deleteWxRechargeById(Long id);
+}

+ 70 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxUserService.java

@@ -0,0 +1,70 @@
+package com.ruoyi.framework.recovery.service;
+
+import com.ruoyi.common.core.domain.entity.WxUser;
+
+import java.util.List;
+
+/**
+ * 用户Service接口
+ *
+ * @author jin
+ * @date 2024-12-01
+ */
+public interface IWxUserService
+{
+    /**
+     * 查询用户
+     *
+     * @param id 用户主键
+     * @return 用户
+     */
+    public WxUser selectWxUserById(Long id);
+
+    /**
+     * 查询用户列表
+     *
+     * @param wxUser 用户
+     * @return 用户集合
+     */
+    public List<WxUser> selectWxUserList(WxUser wxUser);
+
+    /**
+     * 新增用户
+     *
+     * @param wxUser 用户
+     * @return 结果
+     */
+    public int insertWxUser(WxUser wxUser);
+
+    /**
+     * 修改用户
+     *
+     * @param wxUser 用户
+     * @return 结果
+     */
+    public int updateWxUser(WxUser wxUser);
+
+    /**
+     * 批量删除用户
+     *
+     * @param ids 需要删除的用户主键集合
+     * @return 结果
+     */
+    public int deleteWxUserByIds(Long[] ids);
+
+    /**
+     * 删除用户信息
+     *
+     * @param id 用户主键
+     * @return 结果
+     */
+    public int deleteWxUserById(Long id);
+
+    /**
+     * 根据openid查询登录用户
+     *
+     * @param openid openid
+     * @return 用户信息
+     */
+    WxUser selectWxUSerByOpenid(String openid);
+}

+ 93 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxCreditServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.framework.recovery.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.framework.recovery.mapper.WxCreditMapper;
+import com.ruoyi.framework.recovery.domain.WxCredit;
+import com.ruoyi.framework.recovery.service.IWxCreditService;
+
+/**
+ * 积分明细Service业务层处理
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+@Service
+public class WxCreditServiceImpl implements IWxCreditService 
+{
+    @Autowired
+    private WxCreditMapper wxCreditMapper;
+
+    /**
+     * 查询积分明细
+     * 
+     * @param id 积分明细主键
+     * @return 积分明细
+     */
+    @Override
+    public WxCredit selectWxCreditById(Long id)
+    {
+        return wxCreditMapper.selectWxCreditById(id);
+    }
+
+    /**
+     * 查询积分明细列表
+     * 
+     * @param wxCredit 积分明细
+     * @return 积分明细
+     */
+    @Override
+    public List<WxCredit> selectWxCreditList(WxCredit wxCredit)
+    {
+        return wxCreditMapper.selectWxCreditList(wxCredit);
+    }
+
+    /**
+     * 新增积分明细
+     * 
+     * @param wxCredit 积分明细
+     * @return 结果
+     */
+    @Override
+    public int insertWxCredit(WxCredit wxCredit)
+    {
+        return wxCreditMapper.insertWxCredit(wxCredit);
+    }
+
+    /**
+     * 修改积分明细
+     * 
+     * @param wxCredit 积分明细
+     * @return 结果
+     */
+    @Override
+    public int updateWxCredit(WxCredit wxCredit)
+    {
+        return wxCreditMapper.updateWxCredit(wxCredit);
+    }
+
+    /**
+     * 批量删除积分明细
+     * 
+     * @param ids 需要删除的积分明细主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxCreditByIds(Long[] ids)
+    {
+        return wxCreditMapper.deleteWxCreditByIds(ids);
+    }
+
+    /**
+     * 删除积分明细信息
+     * 
+     * @param id 积分明细主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxCreditById(Long id)
+    {
+        return wxCreditMapper.deleteWxCreditById(id);
+    }
+}

+ 93 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxRechargeServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.framework.recovery.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.framework.recovery.mapper.WxRechargeMapper;
+import com.ruoyi.framework.recovery.domain.WxRecharge;
+import com.ruoyi.framework.recovery.service.IWxRechargeService;
+
+/**
+ * 充值Service业务层处理
+ * 
+ * @author jin
+ * @date 2024-12-01
+ */
+@Service
+public class WxRechargeServiceImpl implements IWxRechargeService 
+{
+    @Autowired
+    private WxRechargeMapper wxRechargeMapper;
+
+    /**
+     * 查询充值
+     * 
+     * @param id 充值主键
+     * @return 充值
+     */
+    @Override
+    public WxRecharge selectWxRechargeById(Long id)
+    {
+        return wxRechargeMapper.selectWxRechargeById(id);
+    }
+
+    /**
+     * 查询充值列表
+     * 
+     * @param wxRecharge 充值
+     * @return 充值
+     */
+    @Override
+    public List<WxRecharge> selectWxRechargeList(WxRecharge wxRecharge)
+    {
+        return wxRechargeMapper.selectWxRechargeList(wxRecharge);
+    }
+
+    /**
+     * 新增充值
+     * 
+     * @param wxRecharge 充值
+     * @return 结果
+     */
+    @Override
+    public int insertWxRecharge(WxRecharge wxRecharge)
+    {
+        return wxRechargeMapper.insertWxRecharge(wxRecharge);
+    }
+
+    /**
+     * 修改充值
+     * 
+     * @param wxRecharge 充值
+     * @return 结果
+     */
+    @Override
+    public int updateWxRecharge(WxRecharge wxRecharge)
+    {
+        return wxRechargeMapper.updateWxRecharge(wxRecharge);
+    }
+
+    /**
+     * 批量删除充值
+     * 
+     * @param ids 需要删除的充值主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxRechargeByIds(Long[] ids)
+    {
+        return wxRechargeMapper.deleteWxRechargeByIds(ids);
+    }
+
+    /**
+     * 删除充值信息
+     * 
+     * @param id 充值主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxRechargeById(Long id)
+    {
+        return wxRechargeMapper.deleteWxRechargeById(id);
+    }
+}

+ 101 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxUserServiceImpl.java

@@ -0,0 +1,101 @@
+package com.ruoyi.framework.recovery.service.impl;
+
+import com.ruoyi.common.core.domain.entity.WxUser;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.framework.recovery.mapper.WxUserMapper;
+import com.ruoyi.framework.recovery.service.IWxUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 用户Service业务层处理
+ *
+ * @author jin
+ * @date 2024-12-01
+ */
+@Service
+public class WxUserServiceImpl implements IWxUserService
+{
+    @Autowired
+    private WxUserMapper wxUserMapper;
+
+    /**
+     * 查询用户
+     *
+     * @param id 用户主键
+     * @return 用户
+     */
+    @Override
+    public WxUser selectWxUserById(Long id)
+    {
+        return wxUserMapper.selectWxUserById(id);
+    }
+
+    /**
+     * 查询用户列表
+     *
+     * @param wxUser 用户
+     * @return 用户
+     */
+    @Override
+    public List<WxUser> selectWxUserList(WxUser wxUser)
+    {
+        return wxUserMapper.selectWxUserList(wxUser);
+    }
+
+    /**
+     * 新增用户
+     *
+     * @param wxUser 用户
+     * @return 结果
+     */
+    @Override
+    public int insertWxUser(WxUser wxUser)
+    {
+        return wxUserMapper.insertWxUser(wxUser);
+    }
+
+    /**
+     * 修改用户
+     *
+     * @param wxUser 用户
+     * @return 结果
+     */
+    @Override
+    public int updateWxUser(WxUser wxUser)
+    {
+        wxUser.setUpdateTime(DateUtils.getNowDate());
+        return wxUserMapper.updateWxUser(wxUser);
+    }
+
+    /**
+     * 批量删除用户
+     *
+     * @param ids 需要删除的用户主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxUserByIds(Long[] ids)
+    {
+        return wxUserMapper.deleteWxUserByIds(ids);
+    }
+
+    /**
+     * 删除用户信息
+     *
+     * @param id 用户主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxUserById(Long id)
+    {
+        return wxUserMapper.deleteWxUserById(id);
+    }
+
+    @Override
+    public WxUser selectWxUSerByOpenid(String openid) {
+        return wxUserMapper.selectWxUserByOpenid(openid);
+    }
+}

+ 42 - 12
ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java

@@ -1,12 +1,19 @@
 package com.ruoyi.framework.security.filter;
 
 import java.io.IOException;
+import java.util.Collection;
+
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.core.domain.model.LoginWxUser;
+import com.ruoyi.framework.web.service.WxTokenService;
 import jakarta.servlet.FilterChain;
 import jakarta.servlet.ServletException;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
 import org.springframework.stereotype.Component;
@@ -18,27 +25,50 @@ import com.ruoyi.framework.web.service.TokenService;
 
 /**
  * token过滤器 验证token有效性
- * 
+ *
  * @author ruoyi
  */
 @Component
-public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
-{
+@Slf4j
+public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private WxTokenService wxTokenService;
+
     @Override
     protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
-            throws ServletException, IOException
-    {
-        LoginUser loginUser = tokenService.getLoginUser(request);
-        if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
-        {
-            tokenService.verifyToken(loginUser);
-            UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
-            authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
-            SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+            throws ServletException, IOException {
+        // 微信端访问
+        if (request.getRequestURI().contains(Constants.WX_URI)) {
+            log.info("微信端请求访问请求:{}", request.getRequestURI());
+            LoginWxUser loginWxUser = wxTokenService.getLoginAppUser(request);
+            if (StringUtils.isNotNull(loginWxUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
+                wxTokenService.verifyToken(loginWxUser);
+                auth(loginWxUser, loginWxUser.getAuthorities(), request);
+            }
+        } else {
+            log.info("后台服务访问请求:{}", request.getRequestURI());
+            LoginUser loginUser = tokenService.getLoginUser(request);
+            if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
+                tokenService.verifyToken(loginUser);
+                auth(loginUser, loginUser.getAuthorities(), request);
+            }
         }
         chain.doFilter(request, response);
     }
+
+    /**
+     * 验证token
+     *
+     * @param obj         登录信息
+     * @param authorities 已授予的权限集合
+     * @param request     网络请求
+     */
+    private void auth(Object obj, Collection<? extends GrantedAuthority> authorities, HttpServletRequest request) {
+        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(obj, null, authorities);
+        authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
+        SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+    }
 }

+ 75 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WxLoginService.java

@@ -0,0 +1,75 @@
+package com.ruoyi.framework.web.service;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.common.core.domain.entity.WxUser;
+import com.ruoyi.common.core.domain.model.LoginWxUser;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.common.utils.ip.IpUtils;
+import com.ruoyi.framework.recovery.service.IWxUserService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class WxLoginService {
+    @Autowired
+    private WxTokenService wxTokenService;
+
+    @Autowired
+    IWxUserService wxUserService;
+
+    @Value("${wx.appid}")
+    private String appid;
+
+    @Value("${wx.secret}")
+    private String secret;
+
+    /**
+     * 小程序登录
+     *
+     * @param code
+     * @return
+     */
+    public String minLogin(String code) {
+        //1根据code执行小程序登录获取 openId
+        String url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code";
+        String replaceUrl = url.replace("{0}", appid).replace("{1}", secret).replace("{2}", code);
+        System.out.println(replaceUrl);
+        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.sendGet(replaceUrl));
+        if (jsonObject.get("errcode") != null) {
+            throw new ServiceException(String.format("获取微信授权信息失败,错误编码:%s,错误信息:%s", String.valueOf(jsonObject.get("errcode")), (String) jsonObject.get("errmsg")));
+        }
+        //2根据openId判断用户是否存在 不存在自动注册 openId对应数据库表user_name
+        WxUser wxUser = wxUserService.selectWxUSerByOpenid(String.valueOf(jsonObject.get("openid")));
+        if (wxUser == null) {
+            wxUser = new WxUser();
+            wxUser.setWxOpenid(String.valueOf(jsonObject.get("openid")));
+            wxUser.setUsername(String.valueOf(jsonObject.get("openid")));
+            wxUser.setGender(1L);
+            wxUser.setStatus(0L);
+            wxUserService.insertWxUser(wxUser);
+            wxUser = wxUserService.selectWxUSerByOpenid(String.valueOf(jsonObject.get("openid")));
+        }
+        //3生成token
+        LoginWxUser loginWxUser = new LoginWxUser(wxUser.getId(), wxUser);
+        recordLoginInfo(loginWxUser.getUserId());
+        return wxTokenService.createAppToken(loginWxUser);
+    }
+
+    /**
+     * 记录登录信息
+     *
+     * @param userId 用户ID
+     */
+    private void recordLoginInfo(Long userId) {
+        WxUser appUser = new WxUser();
+        appUser.setId(userId);
+        appUser.setLastLoginIp(IpUtils.getIpAddr());
+        appUser.setLastLoginTime(DateUtils.getNowDate());
+        wxUserService.updateWxUser(appUser);
+    }
+}

+ 201 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WxTokenService.java

@@ -0,0 +1,201 @@
+package com.ruoyi.framework.web.service;
+
+import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.core.domain.model.LoginWxUser;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.ip.AddressUtils;
+import com.ruoyi.common.utils.ip.IpUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import eu.bitwalker.useragentutils.UserAgent;
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+@Component
+public class WxTokenService {
+    // 令牌自定义标识
+    @Value("${token.header}")
+    private String header;
+
+    // 令牌秘钥
+    @Value("${token.secret}")
+    private String secret;
+
+    // 令牌有效期(默认30分钟)
+    @Value("${token.expireTime}")
+    private int expireTime;
+
+    protected static final long MILLIS_SECOND = 1000;
+
+    protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
+
+    private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L;
+
+    @Resource
+    private RedisCache redisCache;
+
+    /**
+     * 获取用户身份信息
+     *
+     * @return 用户信息
+     */
+    public LoginWxUser getLoginAppUser(HttpServletRequest request) {
+        // 获取请求携带的令牌
+        String token = getToken(request);
+        if (StringUtils.isNotEmpty(token)) {
+            try {
+                Claims claims = parseToken(token);
+                // 解析对应的权限以及用户信息
+                String uuid = (String) claims.get(Constants.WX_LOGIN_TOKEN_KEY);
+                String userKey = getTokenKey(uuid);
+                LoginWxUser loginAppUser = redisCache.getCacheObject(userKey);
+                return loginAppUser;
+            } catch (Exception e) {
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 设置用户身份信息
+     */
+    public void setLoginAppUser(LoginWxUser loginAppUser) {
+        if (StringUtils.isNotNull(loginAppUser) && StringUtils.isNotEmpty(loginAppUser.getToken())) {
+            refreshToken(loginAppUser);
+        }
+    }
+
+    /**
+     * 删除用户身份信息
+     */
+    public void delLoginAppUser(String token) {
+        if (StringUtils.isNotEmpty(token)) {
+            String userKey = getTokenKey(token);
+            redisCache.deleteObject(userKey);
+        }
+    }
+
+    /**
+     * 创建令牌
+     *
+     * @param loginAppUser 用户信息
+     * @return 令牌
+     */
+    public String createAppToken(LoginWxUser loginAppUser) {
+        String token = IdUtils.fastUUID();
+        loginAppUser.setToken(token);
+        setUserAgent(loginAppUser);
+        refreshToken(loginAppUser);
+
+        Map<String, Object> claims = new HashMap<>();
+        claims.put(Constants.WX_LOGIN_TOKEN_KEY, token);
+        return createToken(claims);
+    }
+
+    /**
+     * 验证令牌有效期,相差不足20分钟,自动刷新缓存
+     *
+     * @param loginAppUser
+     * @return 令牌
+     */
+    public void verifyToken(LoginWxUser loginAppUser) {
+        long expireTime = loginAppUser.getExpireTime();
+        long currentTime = System.currentTimeMillis();
+        if (expireTime - currentTime <= MILLIS_MINUTE_TEN) {
+            refreshToken(loginAppUser);
+        }
+    }
+
+    /**
+     * 刷新令牌有效期
+     *
+     * @param loginAppUser 登录信息
+     */
+    public void refreshToken(LoginWxUser loginAppUser) {
+        loginAppUser.setLoginTime(System.currentTimeMillis());
+        loginAppUser.setExpireTime(loginAppUser.getLoginTime() + expireTime * MILLIS_MINUTE);
+        // 根据uuid将loginUser缓存
+        String userKey = getTokenKey(loginAppUser.getToken());
+        redisCache.setCacheObject(userKey, loginAppUser, expireTime, TimeUnit.MINUTES);
+    }
+
+    /**
+     * 设置用户代理信息
+     *
+     * @param loginAppUser 登录信息
+     */
+    public void setUserAgent(LoginWxUser loginAppUser) {
+        UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
+        String ip = IpUtils.getIpAddr();
+        loginAppUser.setIpaddr(ip);
+        loginAppUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip));
+        loginAppUser.setBrowser(userAgent.getBrowser().getName());
+        loginAppUser.setOs(userAgent.getOperatingSystem().getName());
+    }
+
+    /**
+     * 从数据声明生成令牌
+     *
+     * @param claims 数据声明
+     * @return 令牌
+     */
+    private String createToken(Map<String, Object> claims) {
+        String token = Jwts.builder()
+                .setClaims(claims)
+                .signWith(SignatureAlgorithm.HS512, secret).compact();
+        return token;
+    }
+
+    /**
+     * 从令牌中获取数据声明
+     *
+     * @param token 令牌
+     * @return 数据声明
+     */
+    private Claims parseToken(String token) {
+        return Jwts.parser()
+                .setSigningKey(secret)
+                .parseClaimsJws(token)
+                .getBody();
+    }
+
+    /**
+     * 从令牌中获取用户名
+     *
+     * @param token 令牌
+     * @return 用户名
+     */
+    public String getUsernameFromToken(String token) {
+        Claims claims = parseToken(token);
+        return claims.getSubject();
+    }
+
+    /**
+     * 获取请求token
+     *
+     * @param request
+     * @return token
+     */
+    private String getToken(HttpServletRequest request) {
+        String token = request.getHeader(header);
+        if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) {
+            token = token.replace(Constants.TOKEN_PREFIX, "");
+        }
+        return token;
+    }
+
+    private String getTokenKey(String uuid) {
+        return CacheConstants.WX_LOGIN_TOKEN_KEY + uuid;
+    }
+}

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/RecContentMapper.xml

@@ -11,10 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createDate"    column="create_date"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateDate"    column="update_date"    />
+        <result property="thumbs"    column="thumbs"    />
     </resultMap>
 
     <sql id="selectRecContentVo">
-        select id, content, create_by, create_date, update_by, update_date from rec_content
+        select id, content, create_by, create_date, update_by, update_date, thumbs from rec_content
     </sql>
 
     <select id="selectRecContentList" parameterType="RecContent" resultMap="RecContentResult">
@@ -23,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="content != null  and content != ''"> and content = #{content}</if>
             <if test="createDate != null "> and create_date = #{createDate}</if>
             <if test="updateDate != null "> and update_date = #{updateDate}</if>
+            <if test="thumbs != null "> and thumbs = #{thumbs}</if>
         </where>
     </select>
 
@@ -40,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createDate != null">create_date,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateDate != null">update_date,</if>
+            <if test="thumbs != null">thumbs,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -48,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createDate != null">#{createDate},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateDate != null">#{updateDate},</if>
+            <if test="thumbs != null">#{thumbs},</if>
          </trim>
     </insert>
 
@@ -59,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createDate != null">create_date = #{createDate},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateDate != null">update_date = #{updateDate},</if>
+            <if test="thumbs != null">thumbs = #{thumbs},</if>
         </trim>
         where id = #{id}
     </update>

+ 81 - 0
ruoyi-system/src/main/resources/mapper/system/WxCreditMapper.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.framework.recovery.mapper.WxCreditMapper">
+    
+    <resultMap type="WxCredit" id="WxCreditResult">
+        <result property="id"    column="id"    />
+        <result property="creditType"    column="credit_type"    />
+        <result property="creditNum"    column="credit_num"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createDate"    column="create_date"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateDate"    column="update_date"    />
+    </resultMap>
+
+    <sql id="selectWxCreditVo">
+        select id, credit_type, credit_num, create_by, create_date, update_by, update_date from wx_credit
+    </sql>
+
+    <select id="selectWxCreditList" parameterType="WxCredit" resultMap="WxCreditResult">
+        <include refid="selectWxCreditVo"/>
+        <where>  
+            <if test="creditType != null  and creditType != ''"> and credit_type = #{creditType}</if>
+            <if test="creditNum != null "> and credit_num = #{creditNum}</if>
+            <if test="createDate != null "> and create_date = #{createDate}</if>
+            <if test="updateDate != null "> and update_date = #{updateDate}</if>
+        </where>
+    </select>
+    
+    <select id="selectWxCreditById" parameterType="Long" resultMap="WxCreditResult">
+        <include refid="selectWxCreditVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertWxCredit" parameterType="WxCredit">
+        insert into wx_credit
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="creditType != null">credit_type,</if>
+            <if test="creditNum != null">credit_num,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createDate != null">create_date,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateDate != null">update_date,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="creditType != null">#{creditType},</if>
+            <if test="creditNum != null">#{creditNum},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createDate != null">#{createDate},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateDate != null">#{updateDate},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWxCredit" parameterType="WxCredit">
+        update wx_credit
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="creditType != null">credit_type = #{creditType},</if>
+            <if test="creditNum != null">credit_num = #{creditNum},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createDate != null">create_date = #{createDate},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateDate != null">update_date = #{updateDate},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWxCreditById" parameterType="Long">
+        delete from wx_credit where id = #{id}
+    </delete>
+
+    <delete id="deleteWxCreditByIds" parameterType="String">
+        delete from wx_credit where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 83 - 0
ruoyi-system/src/main/resources/mapper/system/WxRechargeMapper.xml

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.framework.recovery.mapper.WxRechargeMapper">
+    
+    <resultMap type="WxRecharge" id="WxRechargeResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="userName"    column="user_name"    />
+        <result property="price"    column="price"    />
+        <result property="points"    column="points"    />
+        <result property="payTime"    column="pay_time"    />
+        <result property="isDel"    column="is_del"    />
+    </resultMap>
+
+    <sql id="selectWxRechargeVo">
+        select id, user_id, user_name, price, points, pay_time, is_del from wx_recharge
+    </sql>
+
+    <select id="selectWxRechargeList" parameterType="WxRecharge" resultMap="WxRechargeResult">
+        <include refid="selectWxRechargeVo"/>
+        <where>  
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="price != null "> and price = #{price}</if>
+            <if test="points != null "> and points = #{points}</if>
+            <if test="payTime != null "> and pay_time = #{payTime}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    
+    <select id="selectWxRechargeById" parameterType="Long" resultMap="WxRechargeResult">
+        <include refid="selectWxRechargeVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertWxRecharge" parameterType="WxRecharge">
+        insert into wx_recharge
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="userName != null">user_name,</if>
+            <if test="price != null">price,</if>
+            <if test="points != null">points,</if>
+            <if test="payTime != null">pay_time,</if>
+            <if test="isDel != null">is_del,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="userName != null">#{userName},</if>
+            <if test="price != null">#{price},</if>
+            <if test="points != null">#{points},</if>
+            <if test="payTime != null">#{payTime},</if>
+            <if test="isDel != null">#{isDel},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWxRecharge" parameterType="WxRecharge">
+        update wx_recharge
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="userName != null">user_name = #{userName},</if>
+            <if test="price != null">price = #{price},</if>
+            <if test="points != null">points = #{points},</if>
+            <if test="payTime != null">pay_time = #{payTime},</if>
+            <if test="isDel != null">is_del = #{isDel},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWxRechargeById" parameterType="Long">
+        delete from wx_recharge where id = #{id}
+    </delete>
+
+    <delete id="deleteWxRechargeByIds" parameterType="String">
+        delete from wx_recharge where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 144 - 0
ruoyi-system/src/main/resources/mapper/system/WxUserMapper.xml

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.framework.recovery.mapper.WxUserMapper">
+
+    <resultMap type="WxUser" id="WxUserResult">
+        <result property="id"    column="id"    />
+        <result property="username"    column="username"    />
+        <result property="password"    column="password"    />
+        <result property="gender"    column="gender"    />
+        <result property="birthday"    column="birthday"    />
+        <result property="lastLoginTime"    column="last_login_time"    />
+        <result property="lastLoginIp"    column="last_login_ip"    />
+        <result property="userLevel"    column="user_level"    />
+        <result property="nickname"    column="nickname"    />
+        <result property="mobile"    column="mobile"    />
+        <result property="avatar"    column="avatar"    />
+        <result property="wxOpenid"    column="wx_openid"    />
+        <result property="status"    column="status"    />
+        <result property="addTime"    column="add_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="deleted"    column="deleted"    />
+        <result property="points"    column="points"    />
+        <result property="vipStartTime"    column="vip_start_time"    />
+        <result property="vipEndTime"    column="vip_end_time"    />
+    </resultMap>
+
+    <sql id="selectWxUserVo">
+        select id, username, password, gender, birthday, last_login_time, last_login_ip, user_level, nickname, mobile, avatar, wx_openid, status, add_time, update_time, deleted, points, vip_start_time, vip_end_time from wx_user
+    </sql>
+
+    <select id="selectWxUserList" parameterType="WxUser" resultMap="WxUserResult">
+        <include refid="selectWxUserVo"/>
+        <where>
+            <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
+            <if test="password != null  and password != ''"> and password = #{password}</if>
+            <if test="gender != null "> and gender = #{gender}</if>
+            <if test="birthday != null "> and birthday = #{birthday}</if>
+            <if test="lastLoginTime != null "> and last_login_time = #{lastLoginTime}</if>
+            <if test="lastLoginIp != null  and lastLoginIp != ''"> and last_login_ip = #{lastLoginIp}</if>
+            <if test="userLevel != null "> and user_level = #{userLevel}</if>
+            <if test="nickname != null  and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
+            <if test="mobile != null  and mobile != ''"> and mobile = #{mobile}</if>
+            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
+            <if test="wxOpenid != null  and wxOpenid != ''"> and wx_openid = #{wxOpenid}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="addTime != null "> and add_time = #{addTime}</if>
+            <if test="deleted != null "> and deleted = #{deleted}</if>
+            <if test="points != null "> and points = #{points}</if>
+            <if test="vipStartTime != null "> and vip_start_time = #{vipStartTime}</if>
+            <if test="vipEndTime != null "> and vip_end_time = #{vipEndTime}</if>
+        </where>
+    </select>
+
+    <select id="selectWxUserById" parameterType="Long" resultMap="WxUserResult">
+        <include refid="selectWxUserVo"/>
+        where id = #{id}
+    </select>
+    <select id="selectWxUserByOpenid" resultType="com.ruoyi.common.core.domain.entity.WxUser">
+        <include refid="selectWxUserVo" />
+            where wx_openid = #{openid} and status = 0
+    </select>
+
+    <insert id="insertWxUser" parameterType="WxUser" useGeneratedKeys="true" keyProperty="id">
+        insert into wx_user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="username != null and username != ''">username,</if>
+            <if test="password != null and password != ''">password,</if>
+            <if test="gender != null">gender,</if>
+            <if test="birthday != null">birthday,</if>
+            <if test="lastLoginTime != null">last_login_time,</if>
+            <if test="lastLoginIp != null and lastLoginIp != ''">last_login_ip,</if>
+            <if test="userLevel != null">user_level,</if>
+            <if test="nickname != null and nickname != ''">nickname,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="avatar != null and avatar != ''">avatar,</if>
+            <if test="wxOpenid != null and wxOpenid != ''">wx_openid,</if>
+            <if test="status != null">status,</if>
+            <if test="addTime != null">add_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="deleted != null">deleted,</if>
+            <if test="points != null">points,</if>
+            <if test="vipStartTime != null">vip_start_time,</if>
+            <if test="vipEndTime != null">vip_end_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="username != null and username != ''">#{username},</if>
+            <if test="password != null and password != ''">#{password},</if>
+            <if test="gender != null">#{gender},</if>
+            <if test="birthday != null">#{birthday},</if>
+            <if test="lastLoginTime != null">#{lastLoginTime},</if>
+            <if test="lastLoginIp != null and lastLoginIp != ''">#{lastLoginIp},</if>
+            <if test="userLevel != null">#{userLevel},</if>
+            <if test="nickname != null and nickname != ''">#{nickname},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="avatar != null and avatar != ''">#{avatar},</if>
+            <if test="wxOpenid != null and wxOpenid != ''">#{wxOpenid},</if>
+            <if test="status != null">#{status},</if>
+            <if test="addTime != null">#{addTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="deleted != null">#{deleted},</if>
+            <if test="points != null">#{points},</if>
+            <if test="vipStartTime != null">#{vipStartTime},</if>
+            <if test="vipEndTime != null">#{vipEndTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWxUser" parameterType="WxUser">
+        update wx_user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="username != null and username != ''">username = #{username},</if>
+            <if test="password != null and password != ''">password = #{password},</if>
+            <if test="gender != null">gender = #{gender},</if>
+            <if test="birthday != null">birthday = #{birthday},</if>
+            <if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
+            <if test="lastLoginIp != null and lastLoginIp != ''">last_login_ip = #{lastLoginIp},</if>
+            <if test="userLevel != null">user_level = #{userLevel},</if>
+            <if test="nickname != null and nickname != ''">nickname = #{nickname},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
+            <if test="wxOpenid != null and wxOpenid != ''">wx_openid = #{wxOpenid},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="addTime != null">add_time = #{addTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="deleted != null">deleted = #{deleted},</if>
+            <if test="points != null">points = #{points},</if>
+            <if test="vipStartTime != null">vip_start_time = #{vipStartTime},</if>
+            <if test="vipEndTime != null">vip_end_time = #{vipEndTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWxUserById" parameterType="Long">
+        delete from wx_user where id = #{id}
+    </delete>
+
+    <delete id="deleteWxUserByIds" parameterType="String">
+        delete from wx_user where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 36 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxLoginController.java

@@ -0,0 +1,36 @@
+package com.ruoyi.wx.web.controller;
+
+
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.web.service.WxLoginService;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 登录服务
+ */
+@Tag(name = "登录服务")
+@RestController
+@RequestMapping("/wx")
+@Slf4j
+public class WxLoginController {
+    @Autowired
+    private WxLoginService wxLoginService;
+
+    @ApiOperation("微信小程序登录")
+    @GetMapping("/login")
+    public AjaxResult minLogin(String code){
+        AjaxResult ajax = AjaxResult.success();
+        // 生成令牌
+        String token = wxLoginService.minLogin(code);
+        ajax.put(Constants.TOKEN, token);
+        return ajax;
+    }
+
+}