Commit d0ea9762 by tanghuan

打开小程序的接口,path参数不用必传

1 parent 705b7049
...@@ -19,10 +19,10 @@ class OpenWeappHandler extends MessageHandler { ...@@ -19,10 +19,10 @@ class OpenWeappHandler extends MessageHandler {
} }
final appid = params['appid'] as String; final appid = params['appid'] as String;
final path = params['path'] as String; final path = params['path'] as String?;
final envVersion = params['envVersion'] as String?; final envVersion = params['envVersion'] as String?;
if (appid.isEmpty || path.isEmpty) { if (appid.isEmpty) {
throw Exception('参数错误'); throw Exception('参数错误');
} }
...@@ -31,6 +31,7 @@ class OpenWeappHandler extends MessageHandler { ...@@ -31,6 +31,7 @@ class OpenWeappHandler extends MessageHandler {
} }
try { try {
if (path != null) {
return await _fluwx.open( return await _fluwx.open(
target: MiniProgram( target: MiniProgram(
username: appid, username: appid,
...@@ -38,6 +39,14 @@ class OpenWeappHandler extends MessageHandler { ...@@ -38,6 +39,14 @@ class OpenWeappHandler extends MessageHandler {
miniProgramType: _getWXMiniProgramType(envVersion), miniProgramType: _getWXMiniProgramType(envVersion),
), ),
); );
} else {
return await _fluwx.open(
target: MiniProgram(
username: appid,
miniProgramType: _getWXMiniProgramType(envVersion),
),
);
}
} catch (e) { } catch (e) {
print(e); print(e);
return false; return false;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!