智莺生活APP的阿里百川 Flutter 插件
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

516 строки
23 KiB

  1. //
  2. // FlutterAlibcHandle.m
  3. // flutter_alibc
  4. //
  5. // Created by 吴兴 on 2019/8/28.
  6. //
  7. #import "FlutterAlibcHandle.h"
  8. #import "FlutterAlibcTools.h"
  9. #import "FlutterAlibcConstKey.h"
  10. #import <AlibcTradeSDK/AlibcTradeSDK.h>
  11. //#import <AlibabaAuthSDK/albbsdk.h>
  12. #import "ALiTradeWebViewController.h"
  13. #import "FlutterWxViewCtrlViewController.h"
  14. #import <AlibabaAuthEntrance/ALBBSDK.h>
  15. #import <AlibabaAuthEntrance/ALBBCompatibleSession.h>
  16. @implementation FlutterAlibcHandle
  17. FlutterMethodChannel *_flutterAlibcChannel = nil;
  18. - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar methodChannel:(FlutterMethodChannel *)flutterMethodChannel {
  19. self = [super init];
  20. if (self) {
  21. _flutterAlibcChannel = flutterMethodChannel;
  22. }
  23. return self;
  24. }
  25. #pragma mark- 对flutter暴露的方法
  26. #pragma mark -- 初始化阿里百川
  27. - (void)initAlibc:(FlutterMethodCall *)call result:(FlutterResult)result {
  28. // 百川平台基础SDK初始化,加载并初始化各个业务能力插件
  29. NSString *version = call.arguments[@"version"];
  30. NSString *appName = call.arguments[@"appName"];
  31. // 判断是否为空
  32. if(![FlutterAlibcTools isNil:version]){
  33. [[AlibcTradeSDK sharedInstance] setIsvVersion:version]; //设置三方App版本,可用于标识App版本
  34. }
  35. if(![FlutterAlibcTools isNil:appName]){
  36. [[AlibcTradeSDK sharedInstance] setIsvAppName:appName]; //设置三方App名称,可用于标识App
  37. }
  38. [[AlibcTradeSDK sharedInstance] setDebugLogOpen:YES];//开发阶段打开日志开关,方便排查错误信息
  39. [[AlibcTradeSDK sharedInstance] setEnv:AlibcEnvironmentRelease];//线上环境
  40. [[AlibcTradeSDK sharedInstance] asyncInitWithSuccess:^{
  41. // 告诉flutter,初始化完成
  42. result(@{FlutterAlibcConstKey_ErrorCode:@"0",FlutterAlibcConstKey_ErrorMessage:@"success"});
  43. } failure:^(NSError *error) {
  44. NSLog(@"Init failed: %@", error.description);
  45. result(@{FlutterAlibcConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", (long)error.code],FlutterAlibcConstKey_ErrorMessage:error.description});
  46. }];
  47. }
  48. #pragma mark --淘宝登录
  49. - (void)loginTaoBao:(FlutterMethodCall *)call result:(FlutterResult)result{
  50. if(![[ALBBCompatibleSession sharedInstance] isLogin]) {
  51. UIViewController *rootViewController =
  52. [UIApplication sharedApplication].delegate.window.rootViewController;
  53. [[ALBBSDK sharedInstance] setH5Only:NO];
  54. [[ALBBSDK sharedInstance] auth:rootViewController successCallback:^{
  55. ALBBUser *userInfo =[[ALBBCompatibleSession sharedInstance] getUser];
  56. // 登录成功
  57. result(@{
  58. FlutterAlibcConstKey_ErrorCode:@"0",
  59. FlutterAlibcConstKey_ErrorMessage:@"success",
  60. FlutterAlibcConstKey_Data:@{
  61. // 昵称
  62. @"nick":userInfo.nick,
  63. // 头像地址
  64. @"avatarUrl":userInfo.avatarUrl,
  65. @"openId":userInfo.openId,
  66. @"openSid":userInfo.openSid,
  67. @"topAccessToken":userInfo.topAccessToken,
  68. @"topAuthCode":userInfo.topAuthCode,
  69. }
  70. });
  71. } failureCallback:^(NSError *error) {
  72. // 登录失败
  73. result(@{
  74. FlutterAlibcConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", (long)error.code],
  75. FlutterAlibcConstKey_ErrorMessage:error.localizedDescription,
  76. FlutterAlibcConstKey_Data:@{}
  77. });
  78. }];
  79. } else {
  80. ALBBUser *userInfo =[[ALBBCompatibleSession sharedInstance] getUser];
  81. // 登录成功
  82. result(@{
  83. FlutterAlibcConstKey_ErrorCode:@"0",
  84. FlutterAlibcConstKey_ErrorMessage:@"success",
  85. FlutterAlibcConstKey_Data:@{
  86. // 昵称
  87. @"nick":userInfo.nick,
  88. // 头像地址
  89. @"avatarUrl":userInfo.avatarUrl,
  90. @"openId":userInfo.openId,
  91. @"openSid":userInfo.openSid,
  92. @"topAccessToken":userInfo.topAccessToken,
  93. @"topAuthCode":userInfo.topAuthCode,
  94. }
  95. });
  96. }
  97. }
  98. //
  99. //else if([@"useAlipayNative" isEqualToString:call.method]){
  100. // [_handler useAlipayNative:call result:result];
  101. //}
  102. #pragma mark --淘客登录
  103. -(void)taoKeLogin:(FlutterMethodCall *)call result:(FlutterResult)result{
  104. // 需要获取的数据
  105. NSNumber *type1 = call.arguments[@"openType"];
  106. AlibcOpenType openType = [self openType:[type1 intValue]];
  107. BOOL isNeedCustomNativeFailMode = [call.arguments[@"isNeedCustomNativeFailMode"] boolValue];
  108. // 不用push了,没有nav,默认都present
  109. // BOOL isNeedPush = [call.arguments[@"isNeedPush"] boolValue];
  110. BOOL isNeedPush = YES;
  111. NSNumber *failMode = call.arguments[@"nativeFailMode"];
  112. AlibcNativeFailMode nativeFailMode = [self NativeFailMode:[failMode intValue]];
  113. NSNumber *schemeType = call.arguments[@"schemeType"];
  114. NSString *linkKey = [self schemeType:[schemeType intValue]];
  115. NSString *url = call.arguments[@"url"];
  116. AlibcTradeTaokeParams *taokeParam = [self getTaokeParams:call];
  117. NSDictionary *trackParam = call.arguments[@"trackParam"];
  118. NSString *backUrl = [FlutterAlibcTools changeType:call.arguments[@"backUrl"]];
  119. // NSString *backUrl = [FlutterAlibcTools nullToNil:call.arguments[@"backUrl"]];
  120. UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
  121. AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
  122. showParam.openType = openType;
  123. showParam.isNeedCustomNativeFailMode = isNeedCustomNativeFailMode;
  124. showParam.isNeedPush=isNeedPush;
  125. showParam.nativeFailMode=nativeFailMode;
  126. showParam.linkKey=linkKey;
  127. showParam.backUrl= backUrl;
  128. ALiTradeWebViewController* webviewVC = [[ALiTradeWebViewController alloc] init];
  129. NSInteger res = [[AlibcTradeSDK sharedInstance].tradeService
  130. openByUrl:url
  131. identity:@"trade"
  132. webView:webviewVC.webView
  133. parentController:rootViewController
  134. showParams:showParam
  135. taoKeParams:taokeParam
  136. trackParam:trackParam tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable alibcTradeResult) {
  137. // // 交易成功,判断是付款成功还是加入购物车
  138. // if(alibcTradeResult.result == AlibcTradeResultTypePaySuccess){
  139. // // 付款成功
  140. // result(@{
  141. // FlutterAlibcConstKey_ErrorCode:@"0",
  142. // FlutterAlibcConstKey_ErrorMessage:@"付款成功",
  143. // FlutterAlibcConstKey_Data:@{
  144. // @"type":@0,
  145. // @"paySuccessOrders":[alibcTradeResult payResult].paySuccessOrders,
  146. // @"payFailedOrders":[alibcTradeResult payResult].payFailedOrders,
  147. // }
  148. // });
  149. // }else if(alibcTradeResult.result== AlibcTradeResultTypeAddCard){
  150. // // 加入购物车
  151. // result(@{
  152. // FlutterAlibcConstKey_ErrorCode:@"0",
  153. // FlutterAlibcConstKey_ErrorMessage:@"加入购物车成功",
  154. // FlutterAlibcConstKey_Data:@{
  155. // @"type":@1,
  156. // }
  157. // });
  158. // }
  159. } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  160. // result(@{
  161. // FlutterAlibcConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", (long)error.code],
  162. // FlutterAlibcConstKey_ErrorMessage:[error localizedDescription],
  163. // });
  164. }];
  165. if (res == 1) {
  166. // 新建一个view
  167. FlutterWxViewCtrlViewController *WxVC = [[FlutterWxViewCtrlViewController alloc] init];
  168. WxVC.vc = webviewVC;
  169. WxVC.accessBlock = ^(NSString * accessToken){
  170. NSLog(@"accessToken = %@",accessToken);
  171. if (accessToken) {
  172. result(@{
  173. @"accessToken":accessToken
  174. });
  175. }else{
  176. result(@{
  177. @"accessToken":@""
  178. });
  179. }
  180. };
  181. UINavigationController *root = [[UINavigationController alloc] initWithRootViewController:WxVC];
  182. [rootViewController presentViewController:root animated:NO completion:^{
  183. }];
  184. }
  185. }
  186. #pragma mark --退出登录
  187. - (void)loginOut{
  188. [[ALBBSDK sharedInstance] logout];
  189. }
  190. #pragma mark --通过url打开,包括h5,唤起手淘等
  191. - (void)openByUrl:(FlutterMethodCall *)call result:(FlutterResult)result{
  192. // 需要获取的数据
  193. NSNumber *type1 = call.arguments[@"openType"];
  194. AlibcOpenType openType = [self openType:[type1 intValue]];
  195. BOOL isNeedCustomNativeFailMode = [call.arguments[@"isNeedCustomNativeFailMode"] boolValue];
  196. // 不用push了,没有nav,默认都present
  197. // BOOL isNeedPush = [call.arguments[@"isNeedPush"] boolValue];
  198. BOOL isNeedPush = NO;
  199. NSNumber *failMode = call.arguments[@"nativeFailMode"];
  200. AlibcNativeFailMode nativeFailMode = [self NativeFailMode:[failMode intValue]];
  201. NSNumber *schemeType = call.arguments[@"schemeType"];
  202. NSString *linkKey = [self schemeType:[schemeType intValue]];
  203. NSString *url = call.arguments[@"url"];
  204. AlibcTradeTaokeParams *taokeParam = [self getTaokeParams:call];
  205. NSDictionary *trackParam = call.arguments[@"trackParam"];
  206. NSString *backUrl = [FlutterAlibcTools changeType:call.arguments[@"backUrl"]];
  207. // NSString *backUrl = [FlutterAlibcTools nullToNil:call.arguments[@"backUrl"]];
  208. UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
  209. AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
  210. showParam.openType = openType;
  211. showParam.isNeedCustomNativeFailMode = isNeedCustomNativeFailMode;
  212. showParam.isNeedPush=isNeedPush;
  213. showParam.nativeFailMode=nativeFailMode;
  214. showParam.linkKey=linkKey;
  215. showParam.backUrl= backUrl;
  216. [[AlibcTradeSDK sharedInstance].tradeService openByUrl:url identity:@"trade" webView:nil parentController:rootViewController showParams:showParam taoKeParams:taokeParam trackParam:trackParam tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable alibcTradeResult) {
  217. // 交易成功,判断是付款成功还是加入购物车
  218. if(alibcTradeResult.result == AlibcTradeResultTypePaySuccess){
  219. // 付款成功
  220. result(@{
  221. FlutterAlibcConstKey_ErrorCode:@"0",
  222. FlutterAlibcConstKey_ErrorMessage:@"付款成功",
  223. FlutterAlibcConstKey_Data:@{
  224. @"type":@0,
  225. @"paySuccessOrders":[alibcTradeResult payResult].paySuccessOrders,
  226. @"payFailedOrders":[alibcTradeResult payResult].payFailedOrders,
  227. }
  228. });
  229. }else if(alibcTradeResult.result== AlibcTradeResultTypeAddCard){
  230. // 加入购物车
  231. result(@{
  232. FlutterAlibcConstKey_ErrorCode:@"0",
  233. FlutterAlibcConstKey_ErrorMessage:@"加入购物车成功",
  234. FlutterAlibcConstKey_Data:@{
  235. @"type":@1,
  236. }
  237. });
  238. }
  239. } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  240. result(@{
  241. FlutterAlibcConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", (long)error.code],
  242. FlutterAlibcConstKey_ErrorMessage:[error localizedDescription],
  243. // android没有,直接去掉
  244. // FlutterAlibcConstKey_Data:@{
  245. // @"orderIdList":[[error userInfo] objectForKey:@"orderIdList"],
  246. // }
  247. });
  248. }];
  249. }
  250. #pragma mark --打开商品详情
  251. - (void)openItemDetail:(FlutterMethodCall *)call result:(FlutterResult)result{
  252. NSString *itemID = call.arguments[@"itemID"];
  253. id<AlibcTradePage> page = [AlibcTradePageFactory itemDetailPage:itemID];
  254. [self OpenPageByNewWay:page BizCode:@"detail" Call:call callback:result];
  255. }
  256. #pragma mark --打开店铺
  257. - (void)openShop:(FlutterMethodCall *)call result:(FlutterResult)result{
  258. NSString *shopId = call.arguments[@"shopId"];
  259. id<AlibcTradePage> page = [AlibcTradePageFactory shopPage:shopId];
  260. [self OpenPageByNewWay:page BizCode:@"shop" Call:call callback:result];
  261. }
  262. #pragma mark --打开我的购物车
  263. - (void)openCart:(FlutterMethodCall *)call result:(FlutterResult)result{
  264. id<AlibcTradePage> page = [AlibcTradePageFactory myCartsPage];
  265. [self OpenPageByNewWay:page BizCode:@"cart" Call:call callback:result];
  266. }
  267. #pragma mark --淘客打点
  268. - (void)syncForTaoke:(FlutterMethodCall *)call result:(FlutterResult)result{
  269. BOOL isSync = [call.arguments[@"isSync"] boolValue];
  270. [[AlibcTradeSDK sharedInstance] setIsSyncForTaoke:isSync];
  271. }
  272. #pragma mark --设置是否需要 Native AliPay 接口
  273. - (void)useAlipayNative:(FlutterMethodCall *)call result:(FlutterResult)result{
  274. BOOL isNeed = [call.arguments[@"isNeed"] boolValue];
  275. [[AlibcTradeSDK sharedInstance] setShouldUseAlizfNative:isNeed];
  276. }
  277. #pragma mark - 不对flutter暴露
  278. #pragma mark --打开page
  279. - (void)OpenPageByNewWay:(id<AlibcTradePage>)page BizCode:(NSString *)bizCode Call:(FlutterMethodCall *)call callback:(FlutterResult)callback{
  280. AlibcTradeShowParams* showParam = [[AlibcTradeShowParams alloc] init];
  281. NSNumber *type1 = call.arguments[@"openType"];
  282. AlibcOpenType openType = [self openType:[type1 intValue]];
  283. BOOL isNeedCustomNativeFailMode = [call.arguments[@"isNeedCustomNativeFailMode"] boolValue];
  284. // 不用push了,没有nav,默认都present
  285. // BOOL isNeedPush = [call.arguments[@"isNeedPush"] boolValue];
  286. BOOL isNeedPush = NO;
  287. // 不用绑定了,默认为没有,有的话flutter太难搞了
  288. // BOOL isBindWebview = [call.arguments[@"isBindWebview"] boolValue];
  289. NSNumber *failMode = call.arguments[@"nativeFailMode"];
  290. AlibcNativeFailMode nativeFailMode = [self NativeFailMode:[failMode intValue]];
  291. NSNumber *schemeType = call.arguments[@"schemeType"];
  292. NSString *linkKey = [self schemeType:[schemeType intValue]];
  293. AlibcTradeTaokeParams *taokeParam = [self getTaokeParams:call];
  294. NSDictionary *trackParam = [FlutterAlibcTools nullToNil:call.arguments[@"trackParam"]];
  295. NSString *backUrl = [FlutterAlibcTools changeType:call.arguments[@"backUrl"]];
  296. // 判断
  297. UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
  298. showParam.openType = openType;
  299. showParam.isNeedPush = isNeedPush;
  300. showParam.nativeFailMode = nativeFailMode;
  301. showParam.isNeedCustomNativeFailMode = isNeedCustomNativeFailMode;
  302. showParam.linkKey = linkKey;
  303. showParam.backUrl = backUrl;
  304. // if (isBindWebview) {
  305. // ALiTradeWebViewController *viewCtrl = [[ALiTradeWebViewController alloc]init];
  306. // NSInteger res = [[AlibcTradeSDK sharedInstance].tradeService openByBizCode:bizCode page:page webView:view.webView parentController:view showParams:showParam taoKeParams:[self taokeParam] trackParam:[self customParam] tradeProcessSuccessCallback:self.onTradeSuccess tradeProcessFaelseiledCallback:self.onTradeFailure];
  307. // }else{
  308. // if (isNeedPush) {
  309. // [[AlibcTradeSDK sharedInstance].tradeService openByBizCode:bizCode page:page webView:nil parentController:rootViewController showParams:showParam taoKeParams:taokeParam trackParam:trackParam tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) {
  310. //// 交易成功,判断是付款成功还是加入购物车
  311. // if(result.result == AlibcTradeResultTypePaySuccess){
  312. //// 付款成功
  313. // callback(@{
  314. // FlutterAlibcConstKey_ErrorCode:@"0",
  315. // FlutterAlibcConstKey_ErrorMessage:@"付款成功",
  316. // FlutterAlibcConstKey_Data:@{
  317. // @"type":@0,
  318. // @"paySuccessOrders":[result payResult].paySuccessOrders,
  319. // @"payFailedOrders":[result payResult].payFailedOrders,
  320. // }
  321. // });
  322. // }else if(result.result== AlibcTradeResultTypeAddCard){
  323. //// 加入购物车
  324. // callback(@{
  325. // FlutterAlibcConstKey_ErrorCode:@"0",
  326. // FlutterAlibcConstKey_ErrorMessage:@"付款成功",
  327. // FlutterAlibcConstKey_Data:@{
  328. // @"type":@1,
  329. // }
  330. // });
  331. // }
  332. // } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  333. //// 退出交易流程
  334. // callback(@{
  335. // FlutterAlibcConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", (long)error.code],
  336. // FlutterAlibcConstKey_ErrorMessage:[error localizedDescription],
  337. // FlutterAlibcConstKey_Data:@{
  338. // @"orderIdList":[[error userInfo] objectForKey:@"orderIdList"],
  339. // }
  340. // });
  341. // }];
  342. // }else{
  343. [[AlibcTradeSDK sharedInstance].tradeService openByBizCode:bizCode page:page webView:nil parentController:rootViewController showParams:showParam taoKeParams:taokeParam trackParam:trackParam tradeProcessSuccessCallback:^(AlibcTradeResult * _Nullable result) {
  344. // 交易成功,判断是付款成功还是加入购物车
  345. if(result.result == AlibcTradeResultTypePaySuccess){
  346. // 付款成功
  347. callback(@{
  348. FlutterAlibcConstKey_ErrorCode:@"0",
  349. FlutterAlibcConstKey_ErrorMessage:@"付款成功",
  350. FlutterAlibcConstKey_Data:@{
  351. @"type":@0,
  352. @"paySuccessOrders":[result payResult].paySuccessOrders,
  353. @"payFailedOrders":[result payResult].payFailedOrders,
  354. }
  355. });
  356. }else if(result.result== AlibcTradeResultTypeAddCard){
  357. // 加入购物车
  358. callback(@{
  359. FlutterAlibcConstKey_ErrorCode:@"0",
  360. FlutterAlibcConstKey_ErrorMessage:@"加入购物车成功",
  361. FlutterAlibcConstKey_Data:@{
  362. @"type":@1,
  363. }
  364. });
  365. }
  366. } tradeProcessFailedCallback:^(NSError * _Nullable error) {
  367. // 退出交易流程
  368. callback(@{
  369. FlutterAlibcConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", (long)error.code],
  370. FlutterAlibcConstKey_ErrorMessage:[error localizedDescription],
  371. // Android没有,所以去掉
  372. // FlutterAlibcConstKey_Data:@{
  373. // @"orderIdList":[[error userInfo] objectForKey:@"orderIdList"],
  374. // }
  375. });
  376. }];
  377. // }
  378. //}
  379. }
  380. #pragma mark --设置淘客参数
  381. - (AlibcTradeTaokeParams *)getTaokeParams:(FlutterMethodCall *)call{
  382. AlibcTradeTaokeParams *taoke = [[AlibcTradeTaokeParams alloc] init];
  383. if (call.arguments[@"taoKeParams"] == nil || [call.arguments[@"taoKeParams"] isKindOfClass:[NSNull class]]) {
  384. return nil;
  385. }
  386. NSDictionary *taoKeParams = call.arguments[@"taoKeParams"];
  387. taoke.adzoneId = (taoKeParams[@"adzoneId"] == (id) [NSNull null]) ? nil : taoKeParams[@"adzoneId"];
  388. taoke.pid = (taoKeParams[@"pid"] == (id) [NSNull null]) ? nil : taoKeParams[@"pid"];
  389. //有adzoneId则pid失效
  390. taoke.unionId = (taoKeParams[@"unionId"] == (id) [NSNull null]) ? nil : taoKeParams[@"unionId"];
  391. taoke.subPid = (taoKeParams[@"subPid"] == (id) [NSNull null]) ? nil : taoKeParams[@"subPid"];
  392. // 必须是dic
  393. taoke.extParams = (taoKeParams[@"extParams"] == (id) [NSNull null]) ? nil : taoKeParams[@"extParams"];
  394. // 判断这玩意是什么格式,dic就直接赋值,jsoÏn需要转dic
  395. // if ([extParams isKindOfClass:[NSDictionary class]]) {
  396. // taoke.extParams = extParams;
  397. // }else{
  398. // 解析字符串
  399. // taoke.extParams = [FlutterAlibcTools dictionaryWithJsonString:extParams];
  400. // }
  401. return taoke;
  402. }
  403. #pragma mark - 转换
  404. #pragma mark --唤起端失败的策略转换
  405. -(AlibcNativeFailMode )NativeFailMode:(int)mode{
  406. AlibcNativeFailMode openType=AlibcNativeFailModeJumpH5;
  407. switch (mode) {
  408. case 0:
  409. openType=AlibcNativeFailModeJumpH5;
  410. break;
  411. case 1:
  412. openType=AlibcNativeFailModeJumpDownloadPage;
  413. break;
  414. case 2:
  415. openType=AlibcNativeFailModeNone;
  416. break;
  417. default:
  418. break;
  419. }
  420. return openType;
  421. }
  422. //唤起类型
  423. - (AlibcOpenType)openType:(int)mode{
  424. AlibcOpenType openType=AlibcOpenTypeAuto;
  425. switch (mode) {
  426. case 0:
  427. openType=AlibcOpenTypeAuto;
  428. break;
  429. case 1:
  430. openType=AlibcOpenTypeNative;
  431. break;
  432. default:
  433. break;
  434. }
  435. return openType;
  436. }
  437. //打开类型
  438. -(NSString*)schemeType:(int)mode{
  439. NSString *linkKey=@"tmall";
  440. switch (mode) {
  441. case 0:
  442. linkKey=@"tmall";
  443. break;
  444. case 1:
  445. linkKey=@"taobao";
  446. break;
  447. default:
  448. break;
  449. }
  450. return linkKey;
  451. }
  452. /**
  453. 可设置的参数
  454. 1.是否同步淘客打点
  455. 2.是否使用Native支付宝
  456. 3.是否使用淘客参数(是,需要设置如下参数)
  457. adzoneId
  458. pid
  459. //有adzoneId则pid失效
  460. unionId
  461. subPid
  462. extParams{
  463. sellerId
  464. taokeAppkey
  465. }
  466. 4.页面打开方式
  467. 是否唤端 Auto/Native
  468. 唤起目标应用 淘宝/天猫
  469. 是否以push的方式打开页面
  470. 是否绑定webview
  471. 是否自定义唤端失败策略(若是:H5,DownLoad,None)
  472. 5.跟踪参数 customParams自定义
  473. */
  474. @end