Commit a4533103 authored by hezhen's avatar hezhen

修改code

parent abdf1f46
...@@ -76,9 +76,10 @@ public class AuthController { ...@@ -76,9 +76,10 @@ public class AuthController {
@RequestMapping(value = "/register", method = RequestMethod.POST) @RequestMapping(value = "/register", method = RequestMethod.POST)
public JSONObject register(@RequestParam(value="username",defaultValue="")String username, public JSONObject register(@RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password)throws Exception{ @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code",defaultValue="")String code)throws Exception{
log.info(username+"----require register..."); log.info(username+"----require register...");
JSONObject data=appAuthService.register(username,mobilecode,password); JSONObject data=appAuthService.register(username,mobilecode,password,code);
if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){ if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){
JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest(); JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest();
authenticationRequest.setUsername(username); authenticationRequest.setUsername(username);
...@@ -98,11 +99,12 @@ public class AuthController { ...@@ -98,11 +99,12 @@ public class AuthController {
@RequestParam(value="openid",defaultValue="")String openid, @RequestParam(value="openid",defaultValue="")String openid,
@RequestParam(value="unionid",defaultValue="")String unionid, @RequestParam(value="unionid",defaultValue="")String unionid,
@RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="type",defaultValue="0")Integer type,
@RequestParam(value="isQQ",defaultValue="0")Integer isQQ @RequestParam(value="isQQ",defaultValue="0")Integer isQQ,
@RequestParam(value="code",defaultValue="")String code
)throws Exception{ )throws Exception{
log.info(username+"----require wxregister..."); log.info(username+"----require wxregister...");
JSONObject data=appAuthService.wxregister( username, mobilecode, password, nickname, JSONObject data=appAuthService.wxregister( username, mobilecode, password, nickname,
headimgurl, openid, unionid,type,isQQ); headimgurl, openid, unionid,type,isQQ,code);
if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){ if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){
JSONObject result=data.getJSONObject("data"); JSONObject result=data.getJSONObject("data");
if(result==null){ if(result==null){
......
...@@ -28,13 +28,14 @@ public interface IUserService { ...@@ -28,13 +28,14 @@ public interface IUserService {
@RequestMapping(value = "/api/app/user/register", method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/register", method = RequestMethod.POST)
public JSONObject register( @RequestParam(value="username",defaultValue="")String username, public JSONObject register( @RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password); @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code")String code);
@RequestMapping(value = "/api/app/user/wxregister", method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/wxregister", method = RequestMethod.POST)
public JSONObject wxregister( public JSONObject wxregister(
@RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode, @RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode,
@RequestParam(value="password")String password,@RequestParam(value="nickname")String nickname, @RequestParam(value="password")String password,@RequestParam(value="nickname")String nickname,
@RequestParam(value="headimgurl")String headimgurl,@RequestParam(value="openid")String openid, @RequestParam(value="headimgurl")String headimgurl,@RequestParam(value="openid")String openid,
@RequestParam(value="unionid")String unionid,@RequestParam(value="type")Integer type,@RequestParam(value="isQQ")Integer isQQ); @RequestParam(value="unionid")String unionid,@RequestParam(value="type")Integer type,@RequestParam(value="isQQ")Integer isQQ,@RequestParam(value="code")String code);
@RequestMapping(value = "/api/app/user/checkBindWechat",method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/checkBindWechat",method = RequestMethod.POST)
public JSONObject checkBindWechat( @RequestParam(value="username")String username); public JSONObject checkBindWechat( @RequestParam(value="username")String username);
@RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST)
......
...@@ -10,8 +10,8 @@ public interface AuthService { ...@@ -10,8 +10,8 @@ public interface AuthService {
String refresh(String oldToken) throws Exception; String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception; void validate(String token) throws Exception;
JSONObject sendsms(String username, Integer type) throws Exception; JSONObject sendsms(String username, Integer type) throws Exception;
JSONObject register(String username, String mobilecode, String password) throws Exception; JSONObject register(String username, String mobilecode, String password,String code) throws Exception;
JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ) throws Exception; JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code) throws Exception;
JSONObject checkBindWechat(String username) throws Exception; JSONObject checkBindWechat(String username) throws Exception;
JSONObject wxlogin(String openid,Integer isQQ) throws Exception; JSONObject wxlogin(String openid,Integer isQQ) throws Exception;
JSONObject tlogin(String username, String password,String mobilecode,Integer type) throws Exception; JSONObject tlogin(String username, String password,String mobilecode,Integer type) throws Exception;
......
...@@ -51,13 +51,13 @@ public class AppAuthServiceImpl implements AuthService { ...@@ -51,13 +51,13 @@ public class AppAuthServiceImpl implements AuthService {
} }
@Override @Override
public JSONObject register(String username, String mobilecode, String password) throws Exception { public JSONObject register(String username, String mobilecode, String password,String code) throws Exception {
return userService.register(username,mobilecode,password); return userService.register(username,mobilecode,password,code);
} }
@Override @Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ) throws Exception { public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ); return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code);
} }
@Override @Override
......
...@@ -50,13 +50,13 @@ public class AuthServiceImpl implements AuthService { ...@@ -50,13 +50,13 @@ public class AuthServiceImpl implements AuthService {
return userService.sendsms(username,type); return userService.sendsms(username,type);
} }
@Override @Override
public JSONObject register(String username, String mobilecode, String password) throws Exception { public JSONObject register(String username, String mobilecode, String password,String code) throws Exception {
return userService.register(username,mobilecode,password); return userService.register(username,mobilecode,password,code);
} }
@Override @Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ) throws Exception { public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ); return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code);
} }
@Override @Override
......
...@@ -37,7 +37,7 @@ public interface ActivityFeign { ...@@ -37,7 +37,7 @@ public interface ActivityFeign {
public ObjectRestResponse cancelUse(@RequestParam(value = "TickerNo",defaultValue ="" ) String TickerNo); public ObjectRestResponse cancelUse(@RequestParam(value = "TickerNo",defaultValue ="" ) String TickerNo);
@ApiOperation("新人有礼参加活动") @ApiOperation("新人有礼参加活动")
@RequestMapping(value = "/user", method = RequestMethod.POST) @RequestMapping(value = "/join/user", method = RequestMethod.POST)
public ObjectRestResponse join(@RequestParam(value = "userId",defaultValue ="0" ) Integer userId); public ObjectRestResponse join(@RequestParam(value = "userId",defaultValue ="0" ) Integer userId);
} }
...@@ -45,7 +45,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -45,7 +45,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
userJoin.setActivityId(activityId); userJoin.setActivityId(activityId);
userJoin.setUserId(userId); userJoin.setUserId(userId);
Long num=selectCount(userJoin); Long num=selectCount(userJoin);
if(num!=null||num>0){ if(num!=null&&num>0){
log.error("----用户已经参与活动----userId===="+userId); log.error("----用户已经参与活动----userId===="+userId);
return; return;
} }
...@@ -63,11 +63,15 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -63,11 +63,15 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
ActivityUserJoin userJoin = new ActivityUserJoin(); ActivityUserJoin userJoin = new ActivityUserJoin();
userJoin.setActivityId(activityId); userJoin.setActivityId(activityId);
userJoin.setUserId(userId); userJoin.setUserId(userId);
Long num = selectCount(userJoin); userJoin= selectOne(userJoin);
if (num == null || num == 0) { if (userJoin == null ) {
log.error("----用户没有此参与活动----userId====" + userId); log.error("----用户没有此参与活动----userId====" + userId);
return; return;
} }
if(userJoin.getStatus()!=0){
log.error("----用户已领取----userId====" + userId);
return;
}
String value=rule.getValue(); String value=rule.getValue();
JSONObject json=JSONObject.parseObject(value); JSONObject json=JSONObject.parseObject(value);
if(json!=null){ if(json!=null){
...@@ -81,8 +85,9 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -81,8 +85,9 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
} }
} }
} }
} }
userJoin.setStatus(1);
updateById(userJoin);
} }
......
...@@ -29,7 +29,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -29,7 +29,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@RequestMapping(value = "/list/{type}", method = RequestMethod.GET) @RequestMapping(value = "/list/{type}", method = RequestMethod.GET)
public ObjectRestResponse list(@PathVariable Integer type) { public ObjectRestResponse list(@PathVariable Integer type) {
AppUserDTO userInfo = getUserInfo(); AppUserDTO userInfo = getUserInfo();
Integer userId = userInfo.getId(); Integer userId = userInfo.getUserid();
if(userId==null){ if(userId==null){
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
...@@ -66,7 +66,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -66,7 +66,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@RequestMapping(value = "/coupon/led", method = RequestMethod.POST) @RequestMapping(value = "/coupon/led", method = RequestMethod.POST)
public ObjectRestResponse led() { public ObjectRestResponse led() {
AppUserDTO userInfo = getUserInfo(); AppUserDTO userInfo = getUserInfo();
Integer userId = userInfo.getId(); Integer userId = userInfo.getUserid();
if (userId == null) { if (userId == null) {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
......
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