小程序方法 | MiniOpenApiProxy 方法 | 描述 |
wx.login | login | 登陆接口 |
wx.getUserInfo | getUserInfo | 获取用户基本信息 |
wx.getUserProfile | getUserProfile | 获取用户属性信息 |
wx.getPhoneNumber | getPhoneNumber | 获取电话号码 |
wx.requestPayment | requestPayment | 发起支付 |
wx.checkSession | checkSession | 检查登陆状态是否过期 |
abstract class OpenApiHandler {//当小程序调用 wx.requestPayment,请求第三方支付操作时调用Future<Map<String, dynamic>> requestPayment(AppInfo appInfo, Map<Object?, Object?> params);/// 当小程序调用 wx.getUserProfile 请求主机应用程序的用户信息时调用///Future<Map<String, dynamic>> getUserProfile(AppInfo appInfo, Map<Object?, Object?> params);/// 当小程序调用 wx.login 时调用,请求主机应用程序的登录证书///Future<Map<String, dynamic>> login(AppInfo appInfo, Map<Object?, Object?> params);/// 当小程序调用 wx.checkSession 时调用,请求主机应用程序的登录状态/// 检查登录是否已过期///Future<Map<String, dynamic>> checkSession(AppInfo appInfo, Map<Object?, Object?> params);/// 当小程序调用 wx.getUserInfo 时调用,已被 wx.getUserProfile 过时/// 兼容早期的小程序 api///Future<Map<String, dynamic>> getUserInfo(AppInfo appInfo, Map<Object?, Object?> params);/// 当小程序调用 wx.getPhoneNumber 时调用,获取当前用户的电话号码///Future<Map<String, dynamic>> getPhoneNumber(AppInfo appInfo, Map<Object?, Object?> params);}
@overrideFuture<Map<String, dynamic>> getUserProfile(AppInfo appInfo, Map<Object?, Object?> params) async {print("getUserProfile:$appInfo params:$params");Map<String, dynamic> result = {"userInfo": {"nickName": "xcode","avatarUrl":"https://staticintl.cloudcachetci.com/cms/backend-cms/8WGP653_%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7%E9%80%9A%E7%94%A8.png","gender": 1,"country": "China","province": "ChongQing","city": "ChongQing",}};return Future.value(result);}
本页内容是否解决了您的问题?