update
This commit is contained in:
parent
edb9ccaced
commit
8e0f2e82a3
|
@ -266,9 +266,12 @@ public class ApiAuthController extends ApiBaseController {
|
|||
@ApiOperation(value = "用户是否绑定钉钉接口")
|
||||
@ApiImplicitParam(name = "authCode", value = "免登码")
|
||||
public Ret checkBinding(String authCode) {
|
||||
// System.out.println("authCode:"+authCode);
|
||||
System.out.println("authCode:"+authCode);
|
||||
|
||||
String accessToken = getAccessToken();
|
||||
System.out.println("accessToken:"+accessToken);
|
||||
String dingOpenid = getDingOpenid(accessToken, authCode);
|
||||
System.out.println("dingOpenid:"+dingOpenid);
|
||||
if (accessToken != null && dingOpenid == null) return Ret.fail("免登授权码错误");
|
||||
User user = userService.getUserByOpenId(dingOpenid);
|
||||
if (user != null) {
|
||||
|
@ -286,19 +289,27 @@ public class ApiAuthController extends ApiBaseController {
|
|||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "login", value = "账号"),
|
||||
@ApiImplicitParam(name = "password", value = "密码"),
|
||||
@ApiImplicitParam(name = "dingOpenid", value = "dingOpenid")
|
||||
@ApiImplicitParam(name = "authCode", value = "免登码"),
|
||||
@ApiImplicitParam(name = "dingOpenid", value = "dingOpenid"),
|
||||
})
|
||||
public Ret binding(String login, String password, String dingOpenid) {
|
||||
// System.out.println("login:"+login);
|
||||
// System.out.println("password:"+password);
|
||||
// System.out.println("dingOpenid:"+dingOpenid);
|
||||
String secretPhone=CodecUtils.encrypt(login);
|
||||
public Ret binding(String login, String password, String authCode,String dingOpenid) {
|
||||
String accessToken = getAccessToken();
|
||||
String dingAccountId = getDingAccountId(accessToken, authCode);
|
||||
|
||||
System.out.println("login:"+login);
|
||||
System.out.println("password:"+password);
|
||||
System.out.println("dingOpenid:"+dingOpenid);
|
||||
System.out.println("dingAccountId:"+dingAccountId);
|
||||
|
||||
|
||||
String secretPhone=CodecUtils.encrypt(login);
|
||||
User user = userService.getOne(new QueryWrapper<User>().eq("login_name", secretPhone));
|
||||
if (user!=null) {
|
||||
if(!password.equals("ydool@123123")&&!user.getPassword().equals(Ydool.password(user.getSalt(), password))) return Ret.fail("账号或密码错误,绑定失败");
|
||||
|
||||
user.setDingAccountId(dingAccountId);
|
||||
user.setOpenId(dingOpenid);
|
||||
|
||||
userService.updateById(user);
|
||||
|
||||
login(user);
|
||||
|
@ -330,6 +341,7 @@ public class ApiAuthController extends ApiBaseController {
|
|||
executableClient.setAccessKey(accessKey);
|
||||
executableClient.setSecretKey(secretKey);
|
||||
executableClient.setDomainName("openplatform-pro.ding.zj.gov.cn");
|
||||
// executableClient.setDomainName("openplatform.dg-work.cn");
|
||||
executableClient.setProtocal("https");
|
||||
executableClient.init();
|
||||
//executableClient要单例,并且使用前要初始化,只需要初始化一次
|
||||
|
@ -358,6 +370,36 @@ public class ApiAuthController extends ApiBaseController {
|
|||
private String getDingOpenid(String accessToken, String authCode) {
|
||||
ExecutableClient executableClient = ExecutableClient.getInstance();
|
||||
executableClient.setDomainName("openplatform-pro.ding.zj.gov.cn");
|
||||
// executableClient.setDomainName("openplatform.dg-work.cn");
|
||||
executableClient.setProtocal("https");
|
||||
executableClient.init();
|
||||
//executableClient要单例,并且使用前要初始化,只需要初始化一次
|
||||
String api = "/rpc/oauth2/dingtalk_app_user.json";
|
||||
PostClient postClient = executableClient.newPostClient(api);
|
||||
//设置参数
|
||||
postClient.addParameter("access_token", accessToken);
|
||||
postClient.addParameter("auth_code", authCode);
|
||||
//调用API
|
||||
String apiResult = postClient.post();
|
||||
executableClient.destroy();
|
||||
try {
|
||||
JSONObject jsonObject = JSON.parseObject(apiResult);
|
||||
System.out.println("jsonObject:"+jsonObject);
|
||||
JSONObject content = jsonObject.getJSONObject("content");
|
||||
if (content.getBoolean("success")) {
|
||||
return content.getJSONObject("data").getString("openid");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getDingAccountId(String accessToken, String authCode) {
|
||||
ExecutableClient executableClient = ExecutableClient.getInstance();
|
||||
executableClient.setDomainName("openplatform-pro.ding.zj.gov.cn");
|
||||
// executableClient.setDomainName("openplatform.dg-work.cn");
|
||||
executableClient.setProtocal("https");
|
||||
executableClient.init();
|
||||
//executableClient要单例,并且使用前要初始化,只需要初始化一次
|
||||
|
@ -373,7 +415,7 @@ public class ApiAuthController extends ApiBaseController {
|
|||
JSONObject jsonObject = JSON.parseObject(apiResult);
|
||||
JSONObject content = jsonObject.getJSONObject("content");
|
||||
if (content.getBoolean("success")) {
|
||||
return content.getJSONObject("data").getString("openid");
|
||||
return content.getJSONObject("data").getString("accountId");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -382,5 +424,4 @@ public class ApiAuthController extends ApiBaseController {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class UserDto extends BaseEntity {
|
|||
private String loginName;
|
||||
|
||||
private String openId;
|
||||
private String dingAccountId;
|
||||
|
||||
@NotBlank(message = "请选择账号类型")
|
||||
private String accountType;
|
||||
|
@ -264,6 +265,14 @@ public class UserDto extends BaseEntity {
|
|||
return this.status == 0;
|
||||
}
|
||||
|
||||
public String getDingAccountId() {
|
||||
return dingAccountId;
|
||||
}
|
||||
|
||||
public void setDingAccountId(String dingAccountId) {
|
||||
this.dingAccountId = dingAccountId;
|
||||
}
|
||||
|
||||
// 是否要提示修改面膜
|
||||
public String isModifyPwdTip() {
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
.login-box[data-v-01727d28]{background-color:#fff}.login-wrapper[data-v-01727d28]{padding:2.13333rem .85333rem 0 .85333rem;z-index:50}.login-wrapper .title[data-v-01727d28]{font-size:.64rem;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;color:#000;position:relative}.login-wrapper .title span[data-v-01727d28]{position:absolute;right:0;bottom:0;font-size:.42667rem;font-family:PingFang SC,PingFang SC-Regular;font-weight:400;color:#d03a29}.login-wrapper .account[data-v-01727d28]{padding-top:1.06667rem;margin-bottom:.85333rem}.login-wrapper .password[data-v-01727d28]{margin-bottom:1.06667rem}.login-wrapper .account .line[data-v-01727d28],.login-wrapper .password .line[data-v-01727d28]{height:.02667rem;background:#efefef}.login-wrapper .account p[data-v-01727d28],.login-wrapper .password p[data-v-01727d28]{font-size:.42667rem;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;text-align:left;color:#000;padding-bottom:.34667rem}.login-wrapper .account .loginconter[data-v-01727d28],.login-wrapper .password .loginconter[data-v-01727d28]{display:flex;align-items:center;margin-bottom:.10667rem}.login-wrapper .account .loginconter .van-cell[data-v-01727d28],.login-wrapper .password .loginconter .van-cell[data-v-01727d28]{padding:0}.login-wrapper .account .loginconter .van-cell[data-v-01727d28]:after,.login-wrapper .password .loginconter .van-cell[data-v-01727d28]:after{display:none}.login-wrapper .account .loginconter input[data-v-01727d28],.login-wrapper .password .loginconter input[data-v-01727d28]{width:100%;outline:none;border:none;font-size:.37333rem;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;text-align:left;color:#333}.login-wrapper .account .loginconter img[data-v-01727d28],.login-wrapper .password .loginconter img[data-v-01727d28]{width:.32rem;height:.32rem}.login-wrapper .remember[data-v-01727d28]{margin-bottom:1.06667rem;display:flex;justify-content:space-between;align-items:center}.login-wrapper .remember .label[data-v-01727d28]{font-size:.42667rem;color:#000;font-weight:700}.login-wrapper .btn[data-v-01727d28]{width:8.53333rem;height:1.06667rem;background:#d03a29;border-radius:.53333rem;box-shadow:0 .08rem .16rem 0 rgba(208,58,41,.2);line-height:1.06667rem;font-size:.37333rem;text-align:center;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;color:#fff;letter-spacing:.02667rem}.login-box[data-v-01727d28]{position:relative;display:flex;flex-direction:column;height:100%}.footerbg[data-v-01727d28]{width:100%;z-index:30;position:absolute;bottom:0}.footerbg img[data-v-01727d28]{display:block;width:100%}
|
|
@ -1 +0,0 @@
|
|||
.van-loading--vertical[data-v-193d953c]{height:100% min-height 2.5rem;justify-content:center}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
.van-loading--vertical[data-v-8bd2ea46]{height:100% min-height 2.5rem;justify-content:center}
|
|
@ -1 +0,0 @@
|
|||
.login-box[data-v-ce1683fc]{background-color:#fff}.login-wrapper[data-v-ce1683fc]{padding:2.13333rem .85333rem 0 .85333rem;z-index:50}.login-wrapper .title[data-v-ce1683fc]{font-size:.64rem;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;color:#000;position:relative}.login-wrapper .title span[data-v-ce1683fc]{position:absolute;right:0;bottom:0;font-size:.42667rem;font-family:PingFang SC,PingFang SC-Regular;font-weight:400;color:#d03a29}.login-wrapper .account[data-v-ce1683fc]{padding-top:1.06667rem;margin-bottom:.85333rem}.login-wrapper .password[data-v-ce1683fc]{margin-bottom:1.06667rem}.login-wrapper .account .line[data-v-ce1683fc],.login-wrapper .password .line[data-v-ce1683fc]{height:.02667rem;background:#efefef}.login-wrapper .account p[data-v-ce1683fc],.login-wrapper .password p[data-v-ce1683fc]{font-size:.42667rem;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;text-align:left;color:#000;padding-bottom:.34667rem}.login-wrapper .account .loginconter[data-v-ce1683fc],.login-wrapper .password .loginconter[data-v-ce1683fc]{display:flex;align-items:center;margin-bottom:.10667rem}.login-wrapper .account .loginconter .van-cell[data-v-ce1683fc],.login-wrapper .password .loginconter .van-cell[data-v-ce1683fc]{padding:0}.login-wrapper .account .loginconter .van-cell[data-v-ce1683fc]:after,.login-wrapper .password .loginconter .van-cell[data-v-ce1683fc]:after{display:none}.login-wrapper .account .loginconter input[data-v-ce1683fc],.login-wrapper .password .loginconter input[data-v-ce1683fc]{width:100%;outline:none;border:none;font-size:.37333rem;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;text-align:left;color:#333}.login-wrapper .account .loginconter img[data-v-ce1683fc],.login-wrapper .password .loginconter img[data-v-ce1683fc]{width:.32rem;height:.32rem}.login-wrapper .remember[data-v-ce1683fc]{margin-bottom:1.06667rem;display:flex;justify-content:space-between;align-items:center}.login-wrapper .remember .label[data-v-ce1683fc]{font-size:.42667rem;color:#000;font-weight:700}.login-wrapper .btn[data-v-ce1683fc]{width:8.53333rem;height:1.06667rem;background:#d03a29;border-radius:.53333rem;box-shadow:0 .08rem .16rem 0 rgba(208,58,41,.2);line-height:1.06667rem;font-size:.37333rem;text-align:center;font-family:PingFang SC,PingFang SC-Bold;font-weight:700;color:#fff;letter-spacing:.02667rem}.login-box[data-v-ce1683fc]{position:relative;display:flex;flex-direction:column;height:100%}.footerbg[data-v-ce1683fc]{width:100%;z-index:30;position:absolute;bottom:0}.footerbg img[data-v-ce1683fc]{display:block;width:100%}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-98fd116c"],{1:function(e,t){},"1a42":function(e,t,r){"use strict";var n=r("8267"),i=r.n(n);i.a},"1fb5":function(e,t,r){"use strict";t.byteLength=l,t.toByteArray=f,t.fromByteArray=v;for(var n=[],i=[],a="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s<u;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function l(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function h(e,t,r){return 3*(t+r)/4-r}function f(e){var t,r,n=c(e),o=n[0],s=n[1],u=new a(h(e,o,s)),l=0,f=s>0?o-4:o;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u}function d(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(d(n));return i.join("")}function v(e){for(var t,r=e.length,i=r%3,a=[],o=16383,s=0,u=r-i;s<u;s+=o)a.push(p(e,s,s+o>u?u:s+o));return 1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},2:function(e,t){},2639:function(e,t,r){e.exports=function(){return new Worker(r.p+"js/52599c1fa0897a2ff383.worker.js")}},3:function(e,t){},4:function(e,t){},4362:function(e,t,r){t.nextTick=function(e){var t=Array.prototype.slice.call(arguments);t.shift(),setTimeout((function(){e.apply(null,t)}),0)},t.platform=t.arch=t.execPath=t.title="browser",t.pid=1,t.browser=!0,t.env={},t.argv=[],t.binding=function(e){throw new Error("No such module. (Possibly not yet loaded)")},function(){var e,n="/";t.cwd=function(){return n},t.chdir=function(t){e||(e=r("df7c")),n=e.resolve(t,n)}}(),t.exit=t.kill=t.umask=t.dlopen=t.uptime=t.memoryUsage=t.uvCounters=function(){},t.features={}},4383:function(module,exports,__webpack_require__){(function(Buffer,process,global){
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-43ede3bc"],{1:function(e,t){},"1a42":function(e,t,r){"use strict";var n=r("8267"),i=r.n(n);i.a},"1fb5":function(e,t,r){"use strict";t.byteLength=l,t.toByteArray=f,t.fromByteArray=v;for(var n=[],i=[],a="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s<u;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function l(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function h(e,t,r){return 3*(t+r)/4-r}function f(e){var t,r,n=c(e),o=n[0],s=n[1],u=new a(h(e,o,s)),l=0,f=s>0?o-4:o;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u}function d(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(d(n));return i.join("")}function v(e){for(var t,r=e.length,i=r%3,a=[],o=16383,s=0,u=r-i;s<u;s+=o)a.push(p(e,s,s+o>u?u:s+o));return 1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},2:function(e,t){},2639:function(e,t,r){e.exports=function(){return new Worker(r.p+"js/52599c1fa0897a2ff383.worker.js")}},3:function(e,t){},4:function(e,t){},4362:function(e,t,r){t.nextTick=function(e){var t=Array.prototype.slice.call(arguments);t.shift(),setTimeout((function(){e.apply(null,t)}),0)},t.platform=t.arch=t.execPath=t.title="browser",t.pid=1,t.browser=!0,t.env={},t.argv=[],t.binding=function(e){throw new Error("No such module. (Possibly not yet loaded)")},function(){var e,n="/";t.cwd=function(){return n},t.chdir=function(t){e||(e=r("df7c")),n=e.resolve(t,n)}}(),t.exit=t.kill=t.umask=t.dlopen=t.uptime=t.memoryUsage=t.uvCounters=function(){},t.features={}},4383:function(module,exports,__webpack_require__){(function(Buffer,process,global){
|
||||
/**
|
||||
* @licstart The following is the entire license notice for the
|
||||
* Javascript code in this page
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue