This commit is contained in:
Jason 2022-09-16 15:18:09 +08:00
commit 0d5444342d
3 changed files with 15 additions and 8 deletions

View File

@ -124,8 +124,12 @@ public class UserServiceImpl implements IUserService {
vo.setSex(user.getSex()); vo.setSex(user.getSex());
vo.setAvatar(UrlUtil.toAbsoluteUrl(user.getAvatar())); vo.setAvatar(UrlUtil.toAbsoluteUrl(user.getAvatar()));
vo.setChannel(ClientEnum.getMsgByCode(user.getChannel())); vo.setChannel(ClientEnum.getMsgByCode(user.getChannel()));
vo.setLastLoginTime(TimeUtil.timestampToDate(user.getLastLoginTime()));
vo.setCreateTime(TimeUtil.timestampToDate(user.getCreateTime())); vo.setCreateTime(TimeUtil.timestampToDate(user.getCreateTime()));
if (user.getLastLoginTime() <= 0) {
vo.setLastLoginTime("");
} else {
vo.setLastLoginTime(TimeUtil.timestampToDate(user.getLastLoginTime()));
}
return vo; return vo;
} }

View File

@ -2,6 +2,7 @@ package com.mdd.front.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.mdd.common.config.GlobalConfig; import com.mdd.common.config.GlobalConfig;
@ -165,9 +166,11 @@ public class LoginServiceImpl implements ILoginService {
String token = ToolsUtil.makeToken(); String token = ToolsUtil.makeToken();
RedisUtil.set(FrontConfig.frontendTokenKey+token, userId, 7200); RedisUtil.set(FrontConfig.frontendTokenKey+token, userId, 7200);
String mobile = StringUtil.isNull(user.getMobile()) ? "" : user.getMobile();
Map<String, Object> response = new LinkedHashMap<>(); Map<String, Object> response = new LinkedHashMap<>();
response.put("id", userId); response.put("id", userId);
response.put("isBindMobile", !user.getMobile().equals("")); response.put("isBindMobile", !mobile.equals(""));
response.put("token", token); response.put("token", token);
return response; return response;
} catch (WxErrorException e) { } catch (WxErrorException e) {

View File

@ -502,13 +502,13 @@ CREATE TABLE `la_user` (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `la_user_auth`; DROP TABLE IF EXISTS `la_user_auth`;
CREATE TABLE `la_user_auth` ( CREATE TABLE `la_user_auth` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`user_id` int(11) NOT NULL COMMENT '用户ID', `user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户ID',
`openid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Openid', `openid` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Openid',
`unionid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'Unionid', `unionid` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Unionid',
`client` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '客户端类型: [1=微信小程序, 2=微信公众号, 3=手机H5, 4=电脑PC, 5=苹果APP, 6=安卓APP]', `client` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '客户端类型: [1=微信小程序, 2=微信公众号, 3=手机H5, 4=电脑PC, 5=苹果APP, 6=安卓APP]',
`create_time` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '创建时间', `create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '更新时间', `update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `openid`(`openid`) USING BTREE UNIQUE INDEX `openid`(`openid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户授权表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户授权表' ROW_FORMAT = Dynamic;