Mini program method | MiniOpenApiProxy method | Description |
wx.login | login | Login API. |
wx.getUserInfo | getUserInfo | Gets basic user information. |
wx.getUserProfile | getUserProfile | Gets user profile information. |
wx.getPhoneNumber | getPhoneNumber | Gets phone number. |
wx.requestPayment | requestPayment | Initiates a payment. |
wx.checkSession | checkSession | Checks if the login session has expired. |
wx.requestVirtualPayment | requestVirtualPayment | Initiates the virtual payment. |
abstract class OpenApiHandler {// The API is called when the mini program calls wx.requestPayment to request a third-party payment.Future<Map<String, dynamic>> requestPayment(AppInfo appInfo, Map<Object?, Object?> params);/// The API is called when the mini program calls wx.getUserProfile to request the user information of the superapp.///Future<Map<String, dynamic>> getUserProfile(AppInfo appInfo, Map<Object?, Object?> params);/// The API is called when the mini program calls wx.login to request the login certificate of the superapp.///Future<Map<String, dynamic>> login(AppInfo appInfo, Map<Object?, Object?> params);/// The API is called when the mini program calls wx.checkSession to request the login status of the superapp./// Check if the login has expired.///Future<Map<String, dynamic>> checkSession(AppInfo appInfo, Map<Object?, Object?> params);/// The API is called when the mini program calls wx.getUserInfo (wx.getUserInfo has been replaced by wx.getUserProfile)./// Compatible with earlier mini program APIs.///Future<Map<String, dynamic>> getUserInfo(AppInfo appInfo, Map<Object?, Object?> params);/// The API is called when the mini program calls wx.getPhoneNumber to request the current user's phone number.///Future<Map<String, dynamic>> getPhoneNumber(AppInfo appInfo, Map<Object?, Object?> params);/// The API is called when the mini program calls wx.requestVirtualPayment to initiate the virtual payment feature.Future<Map<String, dynamic>> requestVirtualPayment(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);}
文档反馈