增加用户修改自己头像和昵称
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package cn.iocoder.mall.user.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.ValidationUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.dao.MobileCodeMapper;
|
||||
import cn.iocoder.mall.user.dataobject.MobileCodeDO;
|
||||
@@ -77,10 +79,8 @@ public class MobileCodeServiceImpl implements MobileCodeService {
|
||||
|
||||
// TODO 芋艿,后面要返回有效时间
|
||||
public CommonResult<Void> send(String mobile) {
|
||||
// TODO 芋艿,校验手机格式
|
||||
// 校验手机号码是否已经注册
|
||||
if (userService.getUser(mobile) != null) {
|
||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_MOBILE_ALREADY_REGISTERED.getCode());
|
||||
if (!ValidationUtil.isMobile(mobile)) {
|
||||
return CommonResult.error(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "手机格式不正确"); // TODO 有点搓
|
||||
}
|
||||
// 校验是否可以发送验证码
|
||||
MobileCodeDO lastMobileCodePO = mobileCodeMapper.selectLast1ByMobile(mobile);
|
||||
|
||||
@@ -11,6 +11,7 @@ import cn.iocoder.mall.user.dao.UserRegisterMapper;
|
||||
import cn.iocoder.mall.user.dataobject.UserDO;
|
||||
import cn.iocoder.mall.user.dataobject.UserRegisterDO;
|
||||
import cn.iocoder.mall.user.service.api.UserService;
|
||||
import cn.iocoder.mall.user.service.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.service.api.bo.UserPageBO;
|
||||
import cn.iocoder.mall.user.service.api.constant.UserConstants;
|
||||
import cn.iocoder.mall.user.service.api.constant.UserErrorCodeEnum;
|
||||
@@ -76,6 +77,11 @@ public class UserServiceImpl implements UserService {
|
||||
return CommonResult.success(userPageBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<UserBO> getUser(Integer userId) {
|
||||
return CommonResult.success(UserConvert.INSTANCE.convert(userMapper.selectById(userId)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateUser(UserUpdateDTO userUpdateDTO) {
|
||||
// 校验用户存在
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<insert id="insert" parameterType="MobileCodeDO">
|
||||
INSERT INTO mobile_code (
|
||||
id, mobile, code, today_index, used,
|
||||
used_uid, used_time, create_time
|
||||
userd_user_id, used_time, create_time
|
||||
) VALUES (
|
||||
#{id}, #{mobile}, #{code}, #{todayIndex}, #{used},
|
||||
#{usedUserId}, #{usedTime}, #{createTime}
|
||||
@@ -16,7 +16,7 @@
|
||||
UPDATE mobile_code
|
||||
<set>
|
||||
<if test="used != null"> used = #{used}, </if>
|
||||
<if test="usedUserId != null"> used_uid = #{usedUserId}, </if>
|
||||
<if test="usedUserId != null"> userd_user_id = #{usedUserId}, </if>
|
||||
<if test="usedTime != null"> used_time = #{usedTime}, </if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
@@ -25,7 +25,7 @@
|
||||
<select id="selectLast1ByMobile" parameterType="String" resultType="MobileCodeDO">
|
||||
SELECT
|
||||
id, mobile, code, today_index, used,
|
||||
used_uid, used_time, create_time
|
||||
userd_user_id, used_time, create_time
|
||||
FROM mobile_code
|
||||
WHERE mobile = #{mobile}
|
||||
ORDER BY id DESC
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<select id="selectByTokenId" parameterType="String" resultType="OAuth2AccessTokenDO">
|
||||
SELECT
|
||||
id, adminId, valid, expires_time
|
||||
id, user_id, valid, expires_time
|
||||
FROM oauth2_access_token
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user