From 69bcfd7f9f2ab0407cea7db954c0e9da1f3ae1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Thu, 1 Jul 2021 11:51:06 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=96=B9=E6=B3=95=E8=B0=83?= =?UTF-8?q?=E7=94=A8SDK=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/register.dart | 43 +++++++++++++++++++++++++++++++++++++++++++ pubspec.yaml | 4 ++++ 2 files changed, 47 insertions(+) create mode 100644 lib/register.dart diff --git a/lib/register.dart b/lib/register.dart new file mode 100644 index 0000000..b07de70 --- /dev/null +++ b/lib/register.dart @@ -0,0 +1,43 @@ +import 'dart:io'; + +import 'package:zhiying_comm/util/application.dart'; + +import 'jdsdk.dart'; + +class FlutterJDSDKRegister { + static init() { + initMethod(); + } + + static void initMethod() { + ////初始化JDSDK + Application.addStringParamsMethod( + type: "init_jd_sdk", + method: (param, callback) async { + if (param == null) { + print("jd初始化参数为空"); + return; + } + var result = await Jdsdk.init(appKey: param['appKey'] ?? '', appSecret: param['appSecret'] ?? ''); + print(result); + if (callback != null) { + callback(result); + } + }); + + ////打开京东appUrl + Application.addStringParamsMethod( + type: "open_jd_url", + method: (param, callback) async { + if (param == null) { + print("jd初始化参数为空"); + return; + } + var result = await Jdsdk.openUrl(url: param['url'] ?? ''); + print(result); + if (callback != null) { + callback(result); + } + }); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index e97fa56..fba50db 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,9 +11,13 @@ dependencies: flutter: sdk: flutter + + dev_dependencies: flutter_test: sdk: flutter + zhiying_comm: + path: ../zhiying_comm # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec