袁野 3 weeks ago
parent 0dcbffd9a8
commit 758705b08d
  1. 46
      cweb/src/main/java/com/hfkj/controller/UserController.java

@ -14,6 +14,7 @@ import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject; import com.hfkj.model.UserSessionObject;
import com.hfkj.service.pdd.PddService;
import com.hfkj.service.user.BsUserPlatformAuthorizeService; import com.hfkj.service.user.BsUserPlatformAuthorizeService;
import com.hfkj.service.user.BsUserService; import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.user.UserAuthorizePlatformEnum; import com.hfkj.sysenum.user.UserAuthorizePlatformEnum;
@ -185,6 +186,51 @@ public class UserController {
} }
} }
@RequestMapping(value = "/userAccreditList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "用户授权列表")
public ResponseData userAccreditList() {
try {
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
JSONObject object = new JSONObject();
object.put("taobao", userSession.getUser().getRelationId() != null);
Map<String , Object> mapUser = new JSONObject();
mapUser.put("uid", userSession.getUser().getId());
// 判断是否需要授权
JSONObject jsonObject = PddService.authority(mapUser.toString());
boolean generateAuthorityUrl = jsonObject.getJSONObject("authorityQueryResponse").getInteger("bind") == 1;
object.put("pdd", generateAuthorityUrl);
return ResponseMsgUtil.success(object);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/taoBaoAccreditDelete", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "淘宝授权取消")
public ResponseData taoBaoAccreditDelete() {
try {
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
BsUser user = userService.getUser(userSession.getUser().getId());
user.setRelationId(null);
userService.editData(user);
return ResponseMsgUtil.success("取消成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/bindPhone", method = RequestMethod.POST) @RequestMapping(value = "/bindPhone", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "绑定手机号") @ApiOperation(value = "绑定手机号")

Loading…
Cancel
Save