Commit 558b2f11 authored by m1991's avatar m1991

登录模块——登录验证功能修复

parent 7468cecf
This diff is collapsed.
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -154,4 +155,12 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -154,4 +155,12 @@ public interface UsersMapper extends BaseMapper<User> {
* @return * @return
*/ */
User biInvitedCode1(@Param("inviteCode") String inviteCode); User biInvitedCode1(@Param("inviteCode") String inviteCode);
/**
* 用户邀请码查询用户数据
* @param inviteCode
* @return
*/
User InvitedCode2(@Param("inviteCode") String inviteCode);
} }
...@@ -209,6 +209,16 @@ ...@@ -209,6 +209,16 @@
</where> </where>
</select> </select>
<select id="InvitedCode2" resultType="cn.wisenergy.model.app.User" parameterType="string">
select
*
from
<include refid="table"/>
<where>
invite_code=#{InviteCode}
</where>
</select>
<select id="getuserIdById" resultType="java.lang.Integer"> <select id="getuserIdById" resultType="java.lang.Integer">
select select
id id
......
...@@ -58,7 +58,7 @@ public interface UploadService { ...@@ -58,7 +58,7 @@ public interface UploadService {
* @param zxid * @param zxid
* @return * @return
*/ */
Map Ilike(Integer zxid); Map Ilike(Integer zxid,String inviteCode);
/** /**
* TODO 资讯审核 * TODO 资讯审核
......
...@@ -4,6 +4,7 @@ import cn.wisenergy.common.expection.BaseException; ...@@ -4,6 +4,7 @@ import cn.wisenergy.common.expection.BaseException;
import cn.wisenergy.common.utils.*; import cn.wisenergy.common.utils.*;
import cn.wisenergy.mapper.UsersMapper; import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.shopZx; import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.model.app.zxUserDto; import cn.wisenergy.model.app.zxUserDto;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -291,8 +292,27 @@ public class UploadServiceImpl implements UploadService { ...@@ -291,8 +292,27 @@ public class UploadServiceImpl implements UploadService {
* @return * @return
*/ */
@Override @Override
public Map Ilike(Integer zxid) { public Map Ilike(Integer zxid, String inviteCode) {
Map map = new HashMap(); Map map = new HashMap();
//用户个人邀请码查询用户数据
User user=usersMapper.InvitedCode2(inviteCode);
//用户等于null
if(null == inviteCode || "".equals(inviteCode)){
map.put("code",1);
map.put("msg","用户信息不存在,请先注册!");
return map;
//用户存在
}else {
//判断该用户是否点过赞,如果点过赞,就返回信息告知前端,
user.getUserId();
// usersMapper.
// 没有点过的话,就进行插入点赞记录表,更新点赞数
}
try { try {
shopZx shopZx = shopZxMapper.selectByzxid(zxid); shopZx shopZx = shopZxMapper.selectByzxid(zxid);
int a = shopZx.getZxLikes(); int a = shopZx.getZxLikes();
......
...@@ -55,20 +55,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -55,20 +55,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Override @Override
public User getByUserId(String userId) { public User getByUserId(String userId) {
return usersMapper.getByUserId(userId); return usersMapper.getByUserId(userId);
} }
@Override @Override
public User queryUsersByPhone(String userId) { public User queryUsersByPhone(String userId) {
Map<String, Object> param = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
param.put("userId", userId); //查询数据库,看看是否存在该用户
List<User> usersList = usersMapper.getUsersListByMap(param); User ByuserId = usersMapper.getByUserId(userId);
if (!CollectionUtils.isEmpty(usersList)) {
return usersList.get(0); return ByuserId;
}
// return ResultUtils.returnFail("","");
return null;
} }
@Override @Override
......
...@@ -114,10 +114,13 @@ public class UploadController { ...@@ -114,10 +114,13 @@ public class UploadController {
/** /**
* 点赞接口 * 点赞接口
*/ */
@ApiImplicitParam(name = "zxid", value = "资讯ID", required = true,dataType = "integer") @ApiImplicitParams({
@ApiImplicitParam(name = "zxid", value = "资讯ID", required = true,dataType = "integer"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@RequestMapping(method = RequestMethod.POST, value = "/thumbUp") @RequestMapping(method = RequestMethod.POST, value = "/thumbUp")
public Map like(int zxid){ public Map like(int zxid,String inviteCode){
return uploadService.Ilike(zxid);
return uploadService.Ilike(zxid,inviteCode);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment