Commit d0ea9762 by tanghuan

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

1 parent 705b7049
......@@ -19,10 +19,10 @@ class OpenWeappHandler extends MessageHandler {
}
final appid = params['appid'] as String;
final path = params['path'] as String;
final path = params['path'] as String?;
final envVersion = params['envVersion'] as String?;
if (appid.isEmpty || path.isEmpty) {
if (appid.isEmpty) {
throw Exception('参数错误');
}
......@@ -31,13 +31,22 @@ class OpenWeappHandler extends MessageHandler {
}
try {
return await _fluwx.open(
target: MiniProgram(
username: appid,
path: path,
miniProgramType: _getWXMiniProgramType(envVersion),
),
);
if (path != null) {
return await _fluwx.open(
target: MiniProgram(
username: appid,
path: path,
miniProgramType: _getWXMiniProgramType(envVersion),
),
);
} else {
return await _fluwx.open(
target: MiniProgram(
username: appid,
miniProgramType: _getWXMiniProgramType(envVersion),
),
);
}
} catch (e) {
print(e);
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!