quyueting vor 5 Jahren
Ursprung
Commit
ef9127bc7b

+ 1 - 1
minigame/WebContent/index.html

@@ -159,7 +159,7 @@
 <script src="./js/wechat.js"></script>
 <script src="./assets.js?v=2"></script>
 <script src="./js/music.js?v=1"></script>
-<script src="./js/main.js?v=12"></script>
+<script src="./js/main.js?v=13"></script>
 <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
 <!-- 必须加在微信api资源 -->
 <script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

+ 1 - 1
minigame/WebContent/js/main.js

@@ -865,7 +865,7 @@ function getInfo() {
             type = 1;
             isAvatorSupport = true;
             url = "https://api.weibo.com/oauth2/authorize?"
-                +"client_id=2141531565&"
+                +"client_id=3741162137&"
                 +"response_type=code&"
                 +"redirect_uri=https://wx.ttkuaiban.com/minigame/index.html"
         }

+ 1 - 1
minigame/WebContent/js/poster.js

@@ -31,7 +31,7 @@
             type = 1;
             //url = "https://api.weibo.cn/oauth2/authorize?"
 			url = "https://api.weibo.com/oauth2/authorize?"
-                +"client_id=2141531565&"
+                +"client_id=3741162137&"
                 //+"display=mobile&"
                 +"response_type=code&"
                 +"redirect_uri=https://wx.ttkuaiban.com/minigame/index.html"

+ 18 - 1
minigame/src/com/hssx/controller/UserController.java

@@ -162,6 +162,23 @@ public class UserController {
 						System.out.println("返回User jsonData===>"+jsonData);
 						user.setNickName(EmojiHttpServletRequestWraper.filterEmoji(jsonData.getString("name")));
 						user.setHeaderPic(jsonData.getString("profile_image_url"));
+						String location = jsonData.getString("location");
+						String city = null;
+						if (location != null) {
+							if (location.contains(" ")) {
+								String prov = location.split(" ")[0];
+								String c = location.split(" ")[1];
+								//直辖市取第一个
+								if (prov.equals("上海") || prov.equals("天津") || prov.equals("北京") || prov.equals("重庆")) {
+									city = prov;
+								} else {
+									city = c;
+								}
+							} else {
+								city = location;
+							}
+						}
+						user.setCity(city);
 						example.createCriteria().andVoucherIdEqualTo(uid).andTypeEqualTo(type);
 						if (usermapper.countByExample(example) == 0) {
 							user.setId(Snowflake.getSnowflakeId());
@@ -278,7 +295,7 @@ public class UserController {
 			@RequestParam String url,
 			HttpServletResponse response) throws Exception {
 		HttpRespMsg msg = new HttpRespMsg();
-		System.out.println("微博接收到url=="+url);
+		log.info("微博接收到url=="+url);
 		WeiboParamExample example = new WeiboParamExample();
 		Date d = new Date();
 		example.createCriteria().andExpireTimeGreaterThan(d);