lijilei %!s(int64=3) %!d(string=hai) anos
pai
achega
06e294b71d

+ 150 - 147
book-dao/src/main/resources/mapper/polar/UserSilentMapper.xml

@@ -1,157 +1,160 @@
 <?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.book.dao.polardb.mapper.UserSilentMapper">
-  <resultMap id="BaseResultMap" type="com.book.dao.polardb.pojo.UserSilent">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="user_id" jdbcType="BIGINT" property="userId" />
-    <result column="channel_id" jdbcType="INTEGER" property="channelId" />
-    <result column="openid" jdbcType="VARCHAR" property="openid" />
-    <result column="tri_channel_id" jdbcType="INTEGER" property="triChannelId" />
-    <result column="tri_openid" jdbcType="VARCHAR" property="triOpenid" />
-    <result column="tri_appid" jdbcType="VARCHAR" property="triAppid" />
-    <result column="updatetime" jdbcType="INTEGER" property="updatetime" />
-    <result column="createtime" jdbcType="INTEGER" property="createtime" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    id, user_id, channel_id, openid, tri_channel_id, tri_openid, tri_appid, updatetime, 
+    <resultMap id="BaseResultMap" type="com.book.dao.polardb.pojo.UserSilent">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="user_id" jdbcType="BIGINT" property="userId"/>
+        <result column="channel_id" jdbcType="INTEGER" property="channelId"/>
+        <result column="openid" jdbcType="VARCHAR" property="openid"/>
+        <result column="tri_channel_id" jdbcType="INTEGER" property="triChannelId"/>
+        <result column="tri_openid" jdbcType="VARCHAR" property="triOpenid"/>
+        <result column="tri_appid" jdbcType="VARCHAR" property="triAppid"/>
+        <result column="updatetime" jdbcType="INTEGER" property="updatetime"/>
+        <result column="createtime" jdbcType="INTEGER" property="createtime"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id, user_id, channel_id, openid, tri_channel_id, tri_openid, tri_appid, updatetime,
     createtime
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from user_silent
-    where id = #{id,jdbcType=BIGINT}
-  </select>
+    </sql>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from user_silent
+        where id = #{id,jdbcType=BIGINT}
+    </select>
     <select id="selectByUserSlient" resultType="com.book.dao.polardb.pojo.UserSilent">
-      select * from user_silent
-      <trim prefix="WHERE" prefixOverrides="AND | OR">
-        <if test="user_id!=null and user_id!=''">
-          and user_id != #{user_id}
-        </if>
-        <if test="channel_id!=null and channel_id!=''">
-          and channel_id != #{channel_id}
-        </if>
-        <if test="openid!=null and openid!=0">
-          and openid != #{openid}
-        </if>
-        <if test="tri_appid!=null and tri_appid!=0">
-          and tri_appid != #{tri_appid}
-        </if>
-        <if test="tri_openid!=null and tri_openid!=0">
-          and tri_openid != #{tri_openid}
-        </if>
-
+        select * from user_silent
+        <trim prefix="WHERE" prefixOverrides="AND | OR">
+            <if test="userId!=null and userId!=''">
+                and user_id = #{userId}
+            </if>
+            <if test="channelId!=null and channelId!=''">
+                and channel_id = #{channelId}
+            </if>
+            <if test="openid!=null and openid!=''">
+                and openid = #{openid}
+            </if>
+            <if test="triOpenid!=null and triOpenid!=''">
+                and tri_openid = #{triOpenid}
+            </if>
+            <if test="triAppid!=null and triAppid!=''">
+                and tri_appid = #{triAppid}
+            </if>
 
-      </trim>
 
+        </trim>
+        limit 1
     </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    delete from user_silent
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.dao.polardb.pojo.UserSilent" useGeneratedKeys="true">
-    insert into user_silent (user_id, channel_id, openid, 
-      tri_channel_id, tri_openid, tri_appid, 
-      updatetime, createtime)
-    values (#{userId,jdbcType=BIGINT}, #{channelId,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, 
-      #{triChannelId,jdbcType=INTEGER}, #{triOpenid,jdbcType=VARCHAR}, #{triAppid,jdbcType=VARCHAR}, 
-      #{updatetime,jdbcType=INTEGER}, #{createtime,jdbcType=INTEGER})
-  </insert>
-  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.dao.polardb.pojo.UserSilent" useGeneratedKeys="true">
-    insert into user_silent
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="userId != null">
-        user_id,
-      </if>
-      <if test="channelId != null">
-        channel_id,
-      </if>
-      <if test="openid != null">
-        openid,
-      </if>
-      <if test="triChannelId != null">
-        tri_channel_id,
-      </if>
-      <if test="triOpenid != null">
-        tri_openid,
-      </if>
-      <if test="triAppid != null">
-        tri_appid,
-      </if>
-      <if test="updatetime != null">
-        updatetime,
-      </if>
-      <if test="createtime != null">
-        createtime,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="userId != null">
-        #{userId,jdbcType=BIGINT},
-      </if>
-      <if test="channelId != null">
-        #{channelId,jdbcType=INTEGER},
-      </if>
-      <if test="openid != null">
-        #{openid,jdbcType=VARCHAR},
-      </if>
-      <if test="triChannelId != null">
-        #{triChannelId,jdbcType=INTEGER},
-      </if>
-      <if test="triOpenid != null">
-        #{triOpenid,jdbcType=VARCHAR},
-      </if>
-      <if test="triAppid != null">
-        #{triAppid,jdbcType=VARCHAR},
-      </if>
-      <if test="updatetime != null">
-        #{updatetime,jdbcType=INTEGER},
-      </if>
-      <if test="createtime != null">
-        #{createtime,jdbcType=INTEGER},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.book.dao.polardb.pojo.UserSilent">
-    update user_silent
-    <set>
-      <if test="userId != null">
-        user_id = #{userId,jdbcType=BIGINT},
-      </if>
-      <if test="channelId != null">
-        channel_id = #{channelId,jdbcType=INTEGER},
-      </if>
-      <if test="openid != null">
-        openid = #{openid,jdbcType=VARCHAR},
-      </if>
-      <if test="triChannelId != null">
-        tri_channel_id = #{triChannelId,jdbcType=INTEGER},
-      </if>
-      <if test="triOpenid != null">
-        tri_openid = #{triOpenid,jdbcType=VARCHAR},
-      </if>
-      <if test="triAppid != null">
-        tri_appid = #{triAppid,jdbcType=VARCHAR},
-      </if>
-      <if test="updatetime != null">
-        updatetime = #{updatetime,jdbcType=INTEGER},
-      </if>
-      <if test="createtime != null">
-        createtime = #{createtime,jdbcType=INTEGER},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.book.dao.polardb.pojo.UserSilent">
-    update user_silent
-    set user_id = #{userId,jdbcType=BIGINT},
-      channel_id = #{channelId,jdbcType=INTEGER},
-      openid = #{openid,jdbcType=VARCHAR},
-      tri_channel_id = #{triChannelId,jdbcType=INTEGER},
-      tri_openid = #{triOpenid,jdbcType=VARCHAR},
-      tri_appid = #{triAppid,jdbcType=VARCHAR},
-      updatetime = #{updatetime,jdbcType=INTEGER},
-      createtime = #{createtime,jdbcType=INTEGER}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+        delete
+        from user_silent
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.dao.polardb.pojo.UserSilent"
+            useGeneratedKeys="true">
+        insert into user_silent (user_id, channel_id, openid,
+                                 tri_channel_id, tri_openid, tri_appid,
+                                 updatetime, createtime)
+        values (#{userId,jdbcType=BIGINT}, #{channelId,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR},
+                #{triChannelId,jdbcType=INTEGER}, #{triOpenid,jdbcType=VARCHAR}, #{triAppid,jdbcType=VARCHAR},
+                #{updatetime,jdbcType=INTEGER}, #{createtime,jdbcType=INTEGER})
+    </insert>
+    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.dao.polardb.pojo.UserSilent"
+            useGeneratedKeys="true">
+        insert into user_silent
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userId != null">
+                user_id,
+            </if>
+            <if test="channelId != null">
+                channel_id,
+            </if>
+            <if test="openid != null">
+                openid,
+            </if>
+            <if test="triChannelId != null">
+                tri_channel_id,
+            </if>
+            <if test="triOpenid != null">
+                tri_openid,
+            </if>
+            <if test="triAppid != null">
+                tri_appid,
+            </if>
+            <if test="updatetime != null">
+                updatetime,
+            </if>
+            <if test="createtime != null">
+                createtime,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userId != null">
+                #{userId,jdbcType=BIGINT},
+            </if>
+            <if test="channelId != null">
+                #{channelId,jdbcType=INTEGER},
+            </if>
+            <if test="openid != null">
+                #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="triChannelId != null">
+                #{triChannelId,jdbcType=INTEGER},
+            </if>
+            <if test="triOpenid != null">
+                #{triOpenid,jdbcType=VARCHAR},
+            </if>
+            <if test="triAppid != null">
+                #{triAppid,jdbcType=VARCHAR},
+            </if>
+            <if test="updatetime != null">
+                #{updatetime,jdbcType=INTEGER},
+            </if>
+            <if test="createtime != null">
+                #{createtime,jdbcType=INTEGER},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.book.dao.polardb.pojo.UserSilent">
+        update user_silent
+        <set>
+            <if test="userId != null">
+                user_id = #{userId,jdbcType=BIGINT},
+            </if>
+            <if test="channelId != null">
+                channel_id = #{channelId,jdbcType=INTEGER},
+            </if>
+            <if test="openid != null">
+                openid = #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="triChannelId != null">
+                tri_channel_id = #{triChannelId,jdbcType=INTEGER},
+            </if>
+            <if test="triOpenid != null">
+                tri_openid = #{triOpenid,jdbcType=VARCHAR},
+            </if>
+            <if test="triAppid != null">
+                tri_appid = #{triAppid,jdbcType=VARCHAR},
+            </if>
+            <if test="updatetime != null">
+                updatetime = #{updatetime,jdbcType=INTEGER},
+            </if>
+            <if test="createtime != null">
+                createtime = #{createtime,jdbcType=INTEGER},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.book.dao.polardb.pojo.UserSilent">
+        update user_silent
+        set user_id        = #{userId,jdbcType=BIGINT},
+            channel_id     = #{channelId,jdbcType=INTEGER},
+            openid         = #{openid,jdbcType=VARCHAR},
+            tri_channel_id = #{triChannelId,jdbcType=INTEGER},
+            tri_openid     = #{triOpenid,jdbcType=VARCHAR},
+            tri_appid      = #{triAppid,jdbcType=VARCHAR},
+            updatetime     = #{updatetime,jdbcType=INTEGER},
+            createtime     = #{createtime,jdbcType=INTEGER}
+        where id = #{id,jdbcType=BIGINT}
+    </update>
 </mapper>

+ 2 - 2
book-push/src/main/java/com/book/push/cons/UrlCons.java

@@ -10,8 +10,8 @@ package com.book.push.cons;
 public class UrlCons {
 
     public static final String OAUTH2_REDIRECT_URL_LOGIN = SchemeCons.default_scheme_prefix + "://" + "%s/wx/redirect/login";
-    public static final String OAUTH2_REDIRECT_URL_SLIENT = SchemeCons.default_scheme_prefix + "://" + "%s.%s/wx/redirect/{appid}/slient";
-    public static final String FRONT_URL = SchemeCons.default_scheme_prefix + "://" + "%s.%s/home.html#/%s?channelId=%d&userId=%s";
+    public static final String OAUTH2_REDIRECT_URL_SLIENT = SchemeCons.default_scheme_prefix + "://" + "%s/wx/redirect/slient";
+    public static final String FRONT_URL = SchemeCons.default_scheme_prefix + "://" + "%s.%s/%s?channelId=%d&userId=%s";
     public static final String URL_PARAMS = "channelId=%d&userId=%s";
     public static final String MODEL_BOOK = "readDetail";
 

+ 20 - 9
book-push/src/main/java/com/book/push/controller/BookIndexController.java

@@ -19,6 +19,7 @@ import me.chanjar.weixin.common.api.WxConsts;
 import me.chanjar.weixin.open.api.WxOpenService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,7 +31,7 @@ import javax.servlet.http.HttpServletRequest;
  * @author
  */
 @Slf4j
-@RestController
+@Controller
 @RequestMapping("/login")
 public class BookIndexController {
     @Autowired
@@ -51,20 +52,31 @@ public class BookIndexController {
 
 //    @GetMapping("/{state}")
 //    public String BookMain(HttpServletRequest request, @PathVariable String state) {
+
     @GetMapping()
     public String BookMain(HttpServletRequest request) {
 
-        StringBuffer url = request.getRequestURL();
-        String contextUrl = url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
+    /*    StringBuffer url = request.getRequestURL();
+        String contextUrl = url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();*/
+     String   contextUrl = request.getServerName();
+//        contextUrl = "mp.esalary.com.cn";
+        log.debug(contextUrl);
         String[] split = contextUrl.split("\\.");
         String appid = split[0];
         if (debug) {
-            appid = "wx75b8899af31a7c93";
+            appid = "wxe1271417b2ff5b1c";
+        }else {
+
+
+
         }
-        String referer = request.getHeader("referer");
-        String state = Md5Util.md5(referer);
+        String state ="center";
         if (appid == null || !appid.startsWith("wx")) {
-
+            String referer = request.getHeader("referer");
+            if (referer==null){
+                referer = "http://book.api.esalary.com.cn/";
+            }
+             state = Md5Util.md5(referer);
 
 
             redisService.set(state, referer, 60);
@@ -79,7 +91,6 @@ public class BookIndexController {
             }
 
         }
-
         AdminConfig adminConfig = adminConfigService.selectByAppid(appid);
         String redirect_url = String.format(UrlCons.OAUTH2_REDIRECT_URL_LOGIN, contextUrl);
 
@@ -90,7 +101,7 @@ public class BookIndexController {
                 .buildAuthorizationUrl(redirect_url, WxConsts.OAuth2Scope.SNSAPI_BASE, state + "_" + adminConfig.getAdminId());
         // 静默授权
 
-
+        log.info("跳转:"+auto2Url);
         return "redirect:" + auto2Url;
 
 

+ 47 - 26
book-push/src/main/java/com/book/push/controller/WxRedirectController.java

@@ -13,6 +13,7 @@ import com.book.push.service.dao.OpHostService;
 import com.book.push.service.dao.UserService;
 import com.book.push.service.redis.RedisService;
 import com.book.push.service.wx.WxThirdPartService;
+import com.book.push.utils.JsonUtils;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.common.api.WxConsts;
@@ -21,6 +22,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.mp.bean.result.WxMpUser;
 import me.chanjar.weixin.open.api.WxOpenMpService;
 import me.chanjar.weixin.open.api.WxOpenService;
+import org.apache.ibatis.annotations.Param;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -66,7 +68,7 @@ public class WxRedirectController {
      * @return
      */
     @RequestMapping("/login")
-    public String login(@PathVariable String appid, @RequestParam String code, @RequestParam String state, ModelMap map) {
+    public String login(@RequestParam String appid, @RequestParam String code, @RequestParam String state, ModelMap map) {
 
         String[] s = state.split("_");
         if (s.length != 2) {
@@ -106,31 +108,17 @@ public class WxRedirectController {
                         .userInfo(openId, null);
 
                 user = userService.createUserByWxUser(wxMpUser, channelId);
+                user = userService.selectByOpenId(wxMpUser.getOpenId());
 
             }
-            if (userSlientExist(user, null, defaultAdminConfig.getAppid())) {
+            boolean twoLogin = false;
+            if (twoLogin){
+
+                return twologin(appid, page, channelId, adminConfig, ophost, userAdminId, defaultAdminId, defaultAdminConfig, openId, user);
+            }else {
                 String frontUrl = getFrontUrl(adminConfig.getAppid(), ophost, page, userAdminId, String.valueOf(user.getId()));
+                log.info("跳转:" + frontUrl);
                 return "redirect:" + frontUrl;
-            } else {
-                if (defaultAdminId.equals(channelId)) {
-                    //保存静默授权
-                    saveUserSlitent(user, openId, appid);
-                    String frontUrl = getFrontUrl(adminConfig.getAppid(), ophost, page, userAdminId, String.valueOf(user.getId()));
-                    return "redirect:" + frontUrl;
-                } else {
-                    Integer platformId = defaultAdminConfig.getPlatformId();
-                    String redirect_url = UrlCons.OAUTH2_REDIRECT_URL_SLIENT.replace("{appid}", defaultAdminConfig.getAppid());
-                    Ophost menuHost = opHostService.selectById(defaultAdminConfig.getMenuophostId());
-                    redirect_url = String.format(redirect_url, appid, menuHost.getHost());
-
-                    wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
-                    String auto2Url = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(defaultAdminConfig.getAppid()).getOAuth2Service()
-                            .buildAuthorizationUrl(redirect_url, WxConsts.OAuth2Scope.SNSAPI_BASE, page + "_" + user.getId());
-
-                    return "redirect:" + auto2Url;
-                }
-
-
             }
         } catch (WxErrorException e) {
 //            logger.error(e.getMessage());
@@ -142,6 +130,35 @@ public class WxRedirectController {
 
     }
 
+    private String twologin(String appid, String page, Integer channelId, AdminConfig adminConfig, Ophost ophost, Integer userAdminId, Integer defaultAdminId, AdminConfig defaultAdminConfig, String openId, User user) {
+        WxOpenService wxOpenService;
+        if (userSlientExist(user, null, defaultAdminConfig.getAppid())) {
+            String frontUrl = getFrontUrl(adminConfig.getAppid(), ophost, page, userAdminId, String.valueOf(user.getId()));
+            log.info("跳转:" + frontUrl);
+            return "redirect:" + frontUrl;
+        } else {
+            if (defaultAdminId.equals(channelId)) {
+                //保存静默授权
+                saveUserSlitent(user, openId, appid);
+                String frontUrl = getFrontUrl(adminConfig.getAppid(), ophost, page, userAdminId, String.valueOf(user.getId()));
+                log.info("跳转:" + frontUrl);
+                return "redirect:" + frontUrl;
+            } else {
+                Integer platformId = defaultAdminConfig.getPlatformId();
+                Ophost menuHost = opHostService.selectById(defaultAdminConfig.getOphostId());
+                String redirect_url = String.format(UrlCons.OAUTH2_REDIRECT_URL_SLIENT, menuHost.getHost());
+
+                wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
+                String auto2Url = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(defaultAdminConfig.getAppid()).getOAuth2Service()
+                        .buildAuthorizationUrl(redirect_url, WxConsts.OAuth2Scope.SNSAPI_BASE, page + "_" + user.getId());
+                log.info("跳转:" + auto2Url);
+                return "redirect:" + auto2Url;
+            }
+
+
+        }
+    }
+
     @RequestMapping("/slient")
     public String slient(@PathVariable String appid, @RequestParam String code, @RequestParam String state, ModelMap map) {
         String[] s = state.split("_");
@@ -182,12 +199,14 @@ public class WxRedirectController {
     }
 
     private void saveUserSlitent(User user, String openId, String appid) {
+        log.debug(JsonUtils.toJsonStr(user));
         UserSilent userSilent = new UserSilent();
         userSilent.setUserId(user.getId());
         userSilent.setChannelId(user.getChannelId());
         userSilent.setOpenid(user.getOpenid());
         userSilent.setTriAppid(appid);
         userSilent.setTriOpenid(openId);
+        log.debug(JsonUtils.toJsonStr(userSilent));
         userSilentService.insert(userSilent);
     }
 
@@ -198,6 +217,7 @@ public class WxRedirectController {
         userSilent.setOpenid(user.getOpenid());
         userSilent.setTriAppid(appid);
         userSilent.setTriOpenid(openId);
+        log.debug(JsonUtils.toJsonStr(userSilent));
         UserSilent result = userSilentService.selectByUserSlient(userSilent);
         return result != null;
 
@@ -207,13 +227,14 @@ public class WxRedirectController {
     private String getFrontUrl(String appid, Ophost ophost, String state, Integer userAdminId, String userId) {
 
         String s = redisService.get(state);
-        if (s!=null && s.startsWith("http")){
+
+        if (s != null && s.startsWith("http")) {
             String sp = s.contains("?") ? "&" : "?";
             s = String.format(s + sp + UrlCons.URL_PARAMS, userAdminId, userId);
-            return  s;
-        }else {
+            return s;
+        } else {
             String host = ophost.getHost();
-            String frontUrl = String.format(UrlCons.FRONT_URL,appid,host, state, userAdminId, userId);
+            String frontUrl = String.format(UrlCons.FRONT_URL, appid, host, state, userAdminId, userId);
             return frontUrl;
         }
 

+ 1 - 0
book-push/src/main/java/com/book/push/service/dao/impl/UserServiceImpl.java

@@ -62,6 +62,7 @@ public class UserServiceImpl implements UserService {
         user.setSubscribeTime(Integer.valueOf(String.valueOf(System.currentTimeMillis() / 1000)));
         user.setOperateTime(user.getSubscribeTime());
 //        user.setRegisterIp(wxMpUser.geti);
+        user.setSubscriptionExtend("1");
         user.setProvince(wxMpUser.getProvince());
         user.setCreatetime(Integer.valueOf(String.valueOf(System.currentTimeMillis() / 1000)));
         user.setChannelId(channel_id);

+ 1 - 1
book-push/src/main/resources/application-dev.yml

@@ -2,7 +2,7 @@ server:
   port: 18089
 
 book:
-  debug: false
+  debug: true
   redis:
     host: r-bp1fhw9pqpgtfnu638pd.redis.rds.aliyuncs.com
     port: 6379

+ 1 - 1
book-push/src/main/resources/application-pro.yml

@@ -2,7 +2,7 @@ server:
   port: 18089
 
 book:
-  debug: false
+  debug: true
   redis:
     host: r-bp1fhw9pqpgtfnu638.redis.rds.aliyuncs.com
     port: 6379

+ 1 - 1
book-push/src/main/resources/log4j2.xml

@@ -57,7 +57,7 @@
         <!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
         <logger name="org.springframework" level="INFO"/>
         <logger name="org.mybatis" level="INFO"/>
-        <root level="INFO" includeLocation="true">
+        <root level="all" includeLocation="true">
             <appender-ref ref="Console"/>
             <appender-ref ref="RollingFileInfo"/>
             <appender-ref ref="RollingFileWarn"/>

+ 4 - 1
book-server/src/main/java/com/book/server/service/impl/WxPayServiceImpl.java

@@ -7,6 +7,7 @@ import com.book.dao.cps.pojo.*;
 import com.book.dao.utils.DateUtils;
 import com.book.server.config.Const;
 import com.book.server.service.BookService;
+import com.book.server.service.CacheService;
 import com.book.server.service.UserService;
 import com.book.server.service.WxPayService;
 import com.book.server.utils.*;
@@ -54,6 +55,8 @@ public class WxPayServiceImpl implements WxPayService {
     private BookService bookService;
     @Autowired
     private AdminExtendMapper adminExtendMapper;
+    @Autowired
+    private CacheService cacheService;
 
     @Override
     public WxPayInfo createOrder(WxPayRequest wxPayRequest) {
@@ -219,9 +222,9 @@ public class WxPayServiceImpl implements WxPayService {
             }
 
 
+            cacheService.updateUserByIdCache(order.getUserId());
         }
 
-
         return "success";
     }