mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 13:06:54 +08:00
增加根据openid获取用户信息的重载方法,不指定语言,默认使用zh_CN
This commit is contained in:
parent
e89d009ae0
commit
ed17c2aa39
@ -1,12 +1,12 @@
|
|||||||
package me.chanjar.weixin.mp.api;
|
package me.chanjar.weixin.mp.api;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.bean.WxMpUserQuery;
|
import me.chanjar.weixin.mp.bean.WxMpUserQuery;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户管理相关操作接口
|
* 用户管理相关操作接口
|
||||||
*
|
*
|
||||||
@ -25,10 +25,22 @@ public interface WxMpUserService {
|
|||||||
*/
|
*/
|
||||||
void userUpdateRemark(String openid, String remark) throws WxErrorException;
|
void userUpdateRemark(String openid, String remark) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 获取用户基本信息(语言为默认的zh_CN 简体)
|
||||||
|
* 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN
|
||||||
|
* http请求方式: GET https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param openid 用户openid
|
||||||
|
*/
|
||||||
|
WxMpUser userInfo(String openid) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* 获取用户基本信息
|
* 获取用户基本信息
|
||||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息
|
* 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN
|
||||||
|
* http请求方式: GET https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param openid 用户openid
|
* @param openid 用户openid
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package me.chanjar.weixin.mp.api.impl;
|
package me.chanjar.weixin.mp.api.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.WxMpService;
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxMpUserService;
|
import me.chanjar.weixin.mp.api.WxMpUserService;
|
||||||
@ -11,6 +8,8 @@ import me.chanjar.weixin.mp.bean.WxMpUserQuery;
|
|||||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Binary Wang on 2016/7/21.
|
* Created by Binary Wang on 2016/7/21.
|
||||||
*/
|
*/
|
||||||
@ -31,6 +30,11 @@ public class WxMpUserServiceImpl implements WxMpUserService {
|
|||||||
this.wxMpService.post(url, json.toString());
|
this.wxMpService.post(url, json.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxMpUser userInfo(String openid) throws WxErrorException {
|
||||||
|
return this.userInfo(openid, null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
|
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
|
||||||
String url = API_URL_PREFIX + "/info";
|
String url = API_URL_PREFIX + "/info";
|
||||||
|
Loading…
Reference in New Issue
Block a user