Commit cf745d8e authored by Quxl's avatar Quxl

查询会员信息

parent a7817ea3
package com.egolm.film.api.member; package com.egolm.film.api.member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.film.bean.Fc_member;
import com.egolm.film.common.MemberService;
import com.egolm.film.login.service.MemberTokenService;
import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -17,11 +22,20 @@ import io.swagger.annotations.ApiOperation; ...@@ -17,11 +22,20 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping("member/info") @RequestMapping("member/info")
public class MemberInfoController { public class MemberInfoController {
@Autowired
private MemberTokenService tokenService;
@Autowired
private MemberService memberService;
@ResponseBody @ResponseBody
@PostMapping("query") @PostMapping("query")
@ApiOperation("查询会员基本信息") @ApiOperation("查询会员基本信息")
public Object query() { public Object query() {
return Rjx.jsonOk(); LoginToken loginToken = tokenService.getToken();
Integer id = (Integer)loginToken.getId();
Fc_member member = memberService.getMemberById(id);
return Rjx.jsonOk().setData(member);
} }
@ResponseBody @ResponseBody
......
...@@ -12,4 +12,6 @@ public interface MemberService { ...@@ -12,4 +12,6 @@ public interface MemberService {
void saveMember(Fc_member member); void saveMember(Fc_member member);
Fc_member getMemberById(Integer id);
} }
...@@ -18,7 +18,6 @@ public class MemberServiceImpl implements MemberService { ...@@ -18,7 +18,6 @@ public class MemberServiceImpl implements MemberService {
@Override @Override
public void changePassword(String id, String newPassword) { public void changePassword(String id, String newPassword) {
String sql = "update fc_member set password = ? where id = ?"; String sql = "update fc_member set password = ? where id = ?";
jdbcTemplate.executeUpdate(sql, this.encodePassword(newPassword), id); jdbcTemplate.executeUpdate(sql, this.encodePassword(newPassword), id);
} }
...@@ -38,4 +37,10 @@ public class MemberServiceImpl implements MemberService { ...@@ -38,4 +37,10 @@ public class MemberServiceImpl implements MemberService {
jdbcTemplate.save(member); jdbcTemplate.save(member);
} }
@Override
public Fc_member getMemberById(Integer id) {
String sql = "select * from fc_member where id = ?";
return jdbcTemplate.queryForBean(sql, Fc_member.class, id);
}
} }
...@@ -36,8 +36,8 @@ public class MemberTokenServiceImpl implements MemberTokenService { ...@@ -36,8 +36,8 @@ public class MemberTokenServiceImpl implements MemberTokenService {
Map<String,Object> map = list.get(0); Map<String,Object> map = list.get(0);
Integer state = (Integer)map.get("state"); Integer state = (Integer)map.get("state");
if(state == 1) { if(state == 1) {
Integer adminid = (Integer)map.get("adminid"); Integer id = (Integer)map.get("id");
LoginToken token = new LoginToken(adminid); LoginToken token = new LoginToken(id);
session.setAttribute(TOKEN_NAME, token); session.setAttribute(TOKEN_NAME, token);
return token; return token;
} else if(state == 2) { } else if(state == 2) {
......
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