Browse Source

6.10
1.1.01
添加微信支付
优化多人订单支付
优化版本监控

huxiaoqiang 4 years ago
parent
commit
d21e2f7851
5 changed files with 57 additions and 15 deletions
  1. 11 8
      lib/https/my_request.dart
  2. 41 4
      lib/main.dart
  3. 2 1
      lib/my_tools/my_cookie.dart
  4. 2 1
      lib/paegs/mine_page/set_page/set_page.dart
  5. 1 1
      pubspec.yaml

+ 11 - 8
lib/https/my_request.dart

@@ -38,12 +38,10 @@ uploadFiles(List<File> files, SCallBack sCallBack, FCallBack fCallBack) async {
     var name =
         file.path.substring(file.path.lastIndexOf("/") + 1, file.path.length);
     print(file.path);
-    formData.files.add(
-      MapEntry(
-        "files",
-        MultipartFile.fromFileSync(file.path,
-            filename: name),
-      ));
+    formData.files.add(MapEntry(
+      "files",
+      MultipartFile.fromFileSync(file.path, filename: name),
+    ));
   });
   MyDio().post(s, formData, sCallBack, fCallBack);
 }
@@ -60,8 +58,13 @@ loginAccount(data, SCallBack sCallBack, FCallBack fCallBack) {
 
 //检查登录
 checkLogin(SCallBack sCallBack, FCallBack fCallBack) {
-  MyDio().post('/ap/checkLogin', {'__user__': MyCookie().getUser(),
-  'version':MyCookie().packageInfo.version}, sCallBack,
+  MyDio().post(
+      '/ap/checkLogin',
+      {
+        '__user__': MyCookie().getUser(),
+        'version': MyCookie().packageInfo.version
+      },
+      sCallBack,
       fCallBack);
 }
 

+ 41 - 4
lib/main.dart

@@ -148,6 +148,10 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
 
   @override
   Widget build(BuildContext context) {
+    SystemChrome.setPreferredOrientations([
+      DeviceOrientation.portraitUp, //只能纵向
+      DeviceOrientation.portraitDown, //只能纵向
+    ]);
     return RefreshConfiguration(
       child: MaterialApp(
         navigatorKey: navigatorKey,
@@ -239,8 +243,12 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
 
   var orderHash;
 
+  //最大金额赢家数量 0---发送订单的人不是最大赢家 1---发订单的人是最大赢家 2---发订单的人是最大赢家且有两个一样的金额
+  int commissionPayerNum = -1;
+
   //匹配模板去除不是自己的订单
   void checkOrder(List<TemplateBeanData> data) {
+    commissionPayerNum = -1;
     bool hasMatch = false;
     w:
     for (int i = 0; i < data.length; i++) {
@@ -248,9 +256,37 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
         var res = parseString2(
             data[i].template.replaceAll('\r', ''), '''$clipboardT''');
         if (res != null) {
+          print('-----------data[i].template-----------');
           print(data[i].template);
           print(json.encode(res));
           var order = parse2(res);
+          print(order.toString());
+          var maxAmount = 0;
+          int maxAmountNum = 0;
+          order.forEach((element) {
+            if (maxAmount < element.seller.amount) {
+              maxAmount = element.seller.amount;
+              maxAmountNum = 1;
+            } else if (maxAmount == element.seller.amount) {
+              maxAmountNum++;
+            }
+          });
+          print('maxAmount---------$maxAmount');
+          print('maxAmountNum---------$maxAmountNum');
+          int meIsMaximum = order.indexWhere((element) =>
+              element.seller.amount == maxAmount &&
+              (element.seller.name
+                      .contains(MyCookie().loginInformation.data.extra.name) ||
+                  MyCookie()
+                      .loginInformation
+                      .data
+                      .extra
+                      .name
+                      .contains(element.seller.name)));
+          if (meIsMaximum >= 0) {
+            commissionPayerNum = maxAmountNum;
+          }
+          print('commissionPayerNum-----------$commissionPayerNum');
           order.removeWhere((element) =>
               !element.seller.name
                   .contains(MyCookie().loginInformation.data.extra.name) &&
@@ -622,7 +658,8 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
         'seller_name': MyCookie().loginInformation.data.extra.name,
         'buyer_name': element.payer.name,
         'type': orderTypeThirdPlatform,
-        'amount': NumUtil.multiply(element.payer.amount, element.factor)
+        'amount': NumUtil.multiply(element.payer.amount, element.factor),
+        'commission_payer_num': commissionPayerNum
       }
     }, (response, hasError) {
       if (!hasError) {
@@ -1267,9 +1304,9 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
       }
     }, (response, hasError) {
       if (!hasError) {
-        MyCookie().userBean.wxOpenid =entity.openid;
-        MyCookie().userBean.wxName =entity.nickname;
-        MyCookie().userBean.wxPicture =entity.headimgurl;
+        MyCookie().userBean.wxOpenid = entity.openid;
+        MyCookie().userBean.wxName = entity.nickname;
+        MyCookie().userBean.wxPicture = entity.headimgurl;
         EventBus().emit('bindToWeChat');
       }
     }, (error) {});

+ 2 - 1
lib/my_tools/my_cookie.dart

@@ -87,7 +87,8 @@ class MyCookie {
 
   clean() {
     loginInformation = null;
-    prefs.clear();
+    prefs.remove('LoginInformationBeanEntity');
+    // prefs.clear();
   }
 
   String getName() {

+ 2 - 1
lib/paegs/mine_page/set_page/set_page.dart

@@ -215,7 +215,8 @@ class _SetPageState extends State<SetPage> {
             margin: EdgeInsets.symmetric(vertical: 101, horizontal: 62),
             child: GestureDetector(
               onTap: () {
-                MyCookie().prefs.clear();
+                MyCookie().prefs.remove('LoginInformationBeanEntity');
+                // MyCookie().prefs.clear();
                 RootPageView().bNIndex = 0;
                 MyTools().toPage(context, LoginPage(), (then) {}, noBack: true);
               },

+ 1 - 1
pubspec.yaml

@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 1.0.99+1
+version: 1.1.01+1
 
 environment:
   sdk: ">=2.7.0 <3.0.0"