Skip to content

luzhanbo/flutter_taobaokeapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

淘宝客API的dart SDK.

使用方法

import 'package:taobaokeapi/taobaokeapi.dart';

main() {
  //usertoken 在https://taobaokeapi.com/获取
  var client = TaobaokeAPI(userToken: usertoken,defaultAdzoneId: adzoneId,defaultSiteId: siteId);
  //搜索 
  var ret = await client.search(q: '苹果');
}
//订单同步
void testOneMonth() async{
  var client = getClient();
  final st = DateTime.now();
  var timeSpan = await client.getTimeSpan();
  var startTime = DateTime.now();
  var endTime = lastMonthFirstDay();

  final orderStream = client.syncOrders(startTime: startTime, endTime: endTime,
      timeSpan: timeSpan,threads: 2,
      onFinish: (SyncProgress progress){
        print(progress.duration);
        print('Finish>>>>>>>>');
      },
      onProgress: (SyncProgress progress){
        print('finish ${(progress.finishRate*100).toStringAsFixed(2)}');
      }
  );
  var index = 0;
  orderStream.listen((order) {
    index++;
    if(index==1){
      print(order);
    }

  }).onDone(() {
    final et = DateTime.now();
    print('lastTime:${et.difference(st)}');
  });
}

Releases

No releases published

Packages

No packages published

Languages