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,13 +31,22 @@ class OpenWeappHandler extends MessageHandler { ...@@ -31,13 +31,22 @@ class OpenWeappHandler extends MessageHandler {
} }
try { try {
return await _fluwx.open( if (path != null) {
target: MiniProgram( return await _fluwx.open(
username: appid, target: MiniProgram(
path: path, username: appid,
miniProgramType: _getWXMiniProgramType(envVersion), path: path,
), 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!