|
|
@@ -2,6 +2,7 @@ package com.sharemao.web.wx.ctrl;
|
|
2
|
2
|
|
|
3
|
3
|
import java.net.URLEncoder;
|
|
4
|
4
|
import java.util.Arrays;
|
|
|
5
|
+import java.util.HashMap;
|
|
5
|
6
|
import java.util.Map;
|
|
6
|
7
|
|
|
7
|
8
|
import javax.servlet.http.HttpSession;
|
|
|
@@ -42,6 +43,15 @@ public class AuthCtrl
|
|
42
|
43
|
log.info("para=="+para);
|
|
43
|
44
|
String cursn=para.get("sn");
|
|
44
|
45
|
session.setAttribute("cursn", cursn);//当前设备编号
|
|
|
46
|
+
|
|
|
47
|
+ /*if(!Tools.isEmpty(cursn)&&getDevtype(cursn)==16)
|
|
|
48
|
+ {
|
|
|
49
|
+ String url="http://dy.yunjia99.cn/user/index.do?&sn="+cursn;
|
|
|
50
|
+ url = URLEncoder.encode(url);
|
|
|
51
|
+ log.info("url="+url);
|
|
|
52
|
+ String path = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb06cf14f96dd7149&redirect_uri=" + url + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
|
|
|
53
|
+ return new TextView(path);
|
|
|
54
|
+ }*/
|
|
45
|
55
|
|
|
46
|
56
|
String openid = (String) session.getAttribute("openid"); // 获取用户微信openid
|
|
47
|
57
|
String accessToken="";
|
|
|
@@ -79,8 +89,15 @@ public class AuthCtrl
|
|
79
|
89
|
session.setAttribute("appuid", dataJson.getString("appuid")); // 用户ID
|
|
80
|
90
|
session.setAttribute("phonenum", phonenum); // 用户账户
|
|
81
|
91
|
String defaultdev =dataJson.getString("defaultdev");
|
|
82
|
|
- if(Tools.isEmpty(defaultdev))
|
|
83
|
|
- defaultdev=cursn;
|
|
|
92
|
+ if(Tools.isEmpty(defaultdev)) {
|
|
|
93
|
+ defaultdev = cursn;
|
|
|
94
|
+ } /*else if(!Tools.isEmpty(defaultdev)&&getDevtype(defaultdev)==16) {
|
|
|
95
|
+ String url="http://dy.yunjia99.cn/user/index.do";
|
|
|
96
|
+ url = URLEncoder.encode(url);
|
|
|
97
|
+ log.info("url="+url);
|
|
|
98
|
+ String path = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb06cf14f96dd7149&redirect_uri=" + url + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
|
|
|
99
|
+ return new TextView(path);
|
|
|
100
|
+ }*/
|
|
84
|
101
|
session.setAttribute("defaultdev", defaultdev); // 默认设备
|
|
85
|
102
|
/*if(Tools.isEmpty(defaultdev)) {
|
|
86
|
103
|
return new TextView("/device/getDevInfo.do");
|
|
|
@@ -172,6 +189,27 @@ public class AuthCtrl
|
|
172
|
189
|
return new TextView("/activation.jsp");
|
|
173
|
190
|
}
|
|
174
|
191
|
}
|
|
|
192
|
+
|
|
|
193
|
+ /*private int getDevtype(String cursn){
|
|
|
194
|
+ Map<String, String> para = new HashMap<>();
|
|
|
195
|
+ para.put("devid", cursn);
|
|
|
196
|
+ String devTypeResult = GzhUtil.sendPost(Constants.m3IntAddr + "/device/getDevType.do", para);
|
|
|
197
|
+ try {
|
|
|
198
|
+ if(!Tools.isEmpty(devTypeResult))
|
|
|
199
|
+ {
|
|
|
200
|
+ JSONObject devTypeJson = JSONObject.parseObject(devTypeResult);
|
|
|
201
|
+ int resCode2 = devTypeJson.getIntValue("code");
|
|
|
202
|
+ if(resCode2 == 0){
|
|
|
203
|
+ JSONObject devTypeDataJson = devTypeJson.getJSONObject("data");
|
|
|
204
|
+ JSONObject devtypeJo = devTypeDataJson.getJSONObject("devtype");
|
|
|
205
|
+ return devtypeJo.getIntValue("id");
|
|
|
206
|
+ }
|
|
|
207
|
+ }
|
|
|
208
|
+ } catch (Exception e) {
|
|
|
209
|
+ log.info(Tools.getExceptionMessage( e));
|
|
|
210
|
+ }
|
|
|
211
|
+ return 0;
|
|
|
212
|
+ }*/
|
|
175
|
213
|
|
|
176
|
214
|
/**
|
|
177
|
215
|
* 用户登陆界面,登陆后将微信号自动绑定到用户账号
|