Class WechatUtils
java.lang.Object
com.sankcrm.erp.auth.infrastructure.thirdauth.wechant.WechatUtils
微信配置
- Since:
- 2.1.4
- Author:
- zhsxin
- create time:
- 2023/11/23 下午4:21
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T发送Get请求static AuthCodeVerifier.UserInfogetUserinfoByCode(ThirdAppInfo thirdApp, String code) 授权码转换帐号信息static String获得支付签名(微信支付,现金红包)static <T> Tstatic booleanremoveClient(com.sankcrm.erp.auth.domain.model.thirdauth.ThirdAppId thirdAppId) static org.springframework.web.client.RequestCallbackrequestCallback(StringBuffer debug) 处理请求参数static <T> org.springframework.web.client.ResponseExtractor<T> responseExtractor(Class<T> type, StringBuffer debug) 处理响应static String数据签名static Stringstatic Scopes授权范围转换static StringtoWechatScope(Scopes scope) 授权范围转换static Stringv2MapToXml(Map<String, Object> params) static com.sankcrm.erp.auth.application.thirdauth.command.request.BizResultv2Request(ThirdAppInfo thirdApp, String url, Map<String, Object> bizContent, String appCode, String mchIdName, String mchId) 发送微信请求static com.sankcrm.erp.auth.application.thirdauth.command.request.BizResultv3Request(ThirdAppInfo thirdApp, String url, Map<String, Object> bizContent, String appCode, String mchIdName, org.springframework.http.HttpMethod httpMethod, String mchId) 发送微信请求
-
Field Details
-
AUTH_TYPE
授权方式- See Also:
-
BASE_SCOPE
静默授权,只能获取用户OpenId,和用户Access_token 用户已关注公众号 可以调用接口获取用户信息- See Also:
-
USER_SCOPE
需要弹窗,用户手动确认授权,拿到用户OpenId,和用户Access_token后,可以调用接口获取用户信息- See Also:
-
DEF_SCOPE
- See Also:
-
CODE_URI
- See Also:
-
DEF_GATEWAY
API 网关默认地址- Since:
- 2.1.7
- See Also:
-
-
Constructor Details
-
WechatUtils
public WechatUtils(org.springframework.web.client.RestTemplate restTemplate)
-
-
Method Details
-
parse
-
toJson
-
requestCallback
处理请求参数- Parameters:
debug- Debug- Returns:
- RequestCallback
- Since:
- 2.1.5
-
responseExtractor
public static <T> org.springframework.web.client.ResponseExtractor<T> responseExtractor(Class<T> type, StringBuffer debug) 处理响应- Type Parameters:
T- 类型- Parameters:
type- 类型debug- Debug- Returns:
- ResponseExtractor
- Since:
- 2.1.5
-
sha1
数据签名- Parameters:
src- 数据- Returns:
- 签名
- Since:
- 2.1.5
-
toWechatScope
授权范围转换- Parameters:
scope- 授权范围- Returns:
- WechatScope
- Since:
- 2.1.7
-
toScope
授权范围转换- Parameters:
scope- 授权范围- Returns:
- Scopes
- Since:
- 2.1.7
-
getUserinfoByCode
授权码转换帐号信息- Parameters:
thirdApp- 微信应用信息code- 微信授权码- Returns:
- 微信帐号信息
- Since:
- 2.1.7
-
get
发送Get请求- Type Parameters:
T- 类型- Parameters:
uri- 请求地址param- 参数retType- 返回值类型- Returns:
- 请求结果
- Since:
- 2.1.7
-
v3Request
public static com.sankcrm.erp.auth.application.thirdauth.command.request.BizResult v3Request(ThirdAppInfo thirdApp, String url, Map<String, Object> bizContent, String appCode, String mchIdName, org.springframework.http.HttpMethod httpMethod, String mchId) 发送微信请求- Parameters:
thirdApp- 应用信息url- 接口bizContent- 请求参数mchIdName- 商户号参数名- Returns:
- 请求结果
- Since:
- 2.1.6
-
v2Request
public static com.sankcrm.erp.auth.application.thirdauth.command.request.BizResult v2Request(ThirdAppInfo thirdApp, String url, Map<String, Object> bizContent, String appCode, String mchIdName, String mchId) 发送微信请求- Parameters:
thirdApp- 应用信息url- 接口bizContent- 请求参数mchIdName- 商户号参数名mchId- 商户号- Returns:
- 请求结果
- Since:
- 2.1.6
-
getV2Sign
获得支付签名(微信支付,现金红包)- Parameters:
params- 参数payKey- 密钥- Returns:
- 签名
-
v2MapToXml
-
removeClient
public static boolean removeClient(com.sankcrm.erp.auth.domain.model.thirdauth.ThirdAppId thirdAppId) - Parameters:
thirdAppId- 应用信息- Returns:
- true
- Since:
- 2.1.6
-