Browse Source

stash changes

joe 3 years ago
parent
commit
f614814430

+ 2 - 1
app/admin/model/system/SystemAttachment.php

@@ -125,7 +125,8 @@ class SystemAttachment extends BaseModel
      */
     public static function emptyYesterdayAttachment()
     {
-        $list = self::whereTime('time', 'yesterday')->where('module_type', 2)->field('name,att_dir,id,image_type')->select();
+        $list = self::whereTime('time', 'yesterday')->where('module_type', 2)
+            ->field('name,att_dir,id,image_type')->select();
         try {
             $uploadType = (int)sys_config('upload_type', 1);
             $upload = new Upload($uploadType, [

+ 27 - 6
app/models/store/StoreOrder.php

@@ -510,12 +510,33 @@ class StoreOrder extends BaseModel
     public static function RegressionIntegral($order)
     {
         if ($order['paid'] || $order['status'] == -2 || $order['is_del']) return true;
-        if ($order['use_integral'] <= 0) return true;
-        if ((int)$order['status'] != -2 && (int)$order['refund_status'] != 2 && $order['back_integral'] >= $order['use_integral']) return true;
-        $res = User::bcInc($order['uid'], 'integral', $order['use_integral']);
-        if (!$res) return self::setErrorInfo('回退积分增加失败');
-        UserBill::income('积分回退', $order['uid'], 'integral', 'deduction', $order['use_integral'], $order['unique'], User::where('uid', $order['uid'])->value('integral'), '购买商品失败,回退积分' . floatval($order['use_integral']));
-        return false !== self::where('order_id', $order['order_id'])->update(['back_integral' => $order['use_integral']]);
+        if ($order['use_integral'] <= 0) {
+            return true;
+        }
+        if (
+            (int)$order['status'] != -2 &&
+            (int)$order['refund_status'] != 2 &&
+            $order['back_integral'] >= $order['use_integral']
+        ) {
+            return true;
+        }
+        self::beginTrans();
+        try {
+            $res1 = User::bcInc($order['uid'], 'integral', $order['use_integral']);
+            // if (!$res) return self::setErrorInfo('回退积分增加失败');
+            $res2 = UserBill::income('积分回退', $order['uid'], 'integral', 'deduction', $order['use_integral'], $order['unique'], User::where('uid', $order['uid'])->value('integral'), '购买商品失败,回退积分' . floatval($order['use_integral']));
+            $res3 = self::where('order_id', $order['order_id'])->update(['back_integral' => $order['use_integral']]);
+            $res = $res1 && $res2 && $res3;
+            if (!$res) {
+                self::rollbackTrans();
+                return self::setErrorInfo("积分回退失败");
+            }
+            self::commitTrans();
+            return true;
+        } catch (\Exception $e) {
+            self::rollbackTrans();
+            return self::setErrorInfo(['line' => $e->getLine(), 'message' => $e->getMessage()]);
+        }
     }
 
 

+ 76 - 74
composer.json

@@ -1,78 +1,80 @@
 {
-    "name": "topthink/think",
-    "description": "the new thinkphp framework",
-    "type": "project",
-    "keywords": [
-        "framework",
-        "thinkphp",
-        "ORM"
-    ],
-    "homepage": "http://thinkphp.cn/",
-    "license": "Apache-2.0",
-    "authors": [
-        {
-            "name": "liu21st",
-            "email": "liu21st@gmail.com"
-        }
-    ],
-    "require": {
-        "php": ">=7.1.0",
-        "ext-json": "*",
-        "ext-curl": "*",
-        "ext-bcmath": "*",
-        "ext-mbstring": "*",
-        "topthink/think-view": "^1.0",
-        "symfony/var-dumper":"^4.2",
-        "overtrue/wechat": "^3.3",
-        "topthink/think-captcha": "^3.0",
-        "topthink/think-image": "^1.0",
-        "xaboy/form-builder": "^1.2",
-        "firebase/php-jwt": "^5.0",
-        "phpoffice/phpexcel": "^1.8",
-        "aliyuncs/oss-sdk-php": "^2.3",
-        "qcloud/cos-sdk-v5": "^1.3",
-        "qiniu/php-sdk": "^7.2",
-        "workerman/workerman": "^3.5",
-        "workerman/channel": "^1.0",
-        "topthink/think-queue": "^3.0",
-        "spatie/macroable": "^1.0",
-        "dh2y/think-qrcode": "^2.0",
-        "topthink/think-multi-app": "^1.0",
-        "topthink/think-template": "^2.0",
-        "alibabacloud/dysmsapi": "^1.8",
-        "alipaysdk/easysdk": "^2.2",
-        "pda/pheanstalk": "^4.0",
-        "robthree/twofactorauth": "^1.8",
-        "yurunsoft/yurun-oauth-login": "^3.0",
-        "yurunsoft/pay-sdk": "^3.1"
-    },
-    "autoload": {
-        "psr-4": {
-            "app\\": "app",
-            "crmeb\\": "crmeb",
-            "tw\\": "tw",
-            "tests\\": "tests"
-        },
-        "psr-0": {
-            "": "extend/"
-        }
-    },
-    "config": {
-        "preferred-install": "dist"
-    },
-    "scripts": {
-        "post-autoload-dump": [
-            "@php think service:discover",
-            "@php think vendor:publish"
-        ]
-    },
-    "repositories": {
-        "packagist": {
-            "type": "composer",
-            "url": "https://mirrors.aliyun.com/composer/"
-        }
+  "name": "topthink/think",
+  "description": "the new thinkphp framework",
+  "type": "project",
+  "keywords": [
+    "framework",
+    "thinkphp",
+    "ORM"
+  ],
+  "homepage": "http://thinkphp.cn/",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "liu21st",
+      "email": "liu21st@gmail.com"
+    }
+  ],
+  "require": {
+    "php": ">=7.1.0",
+    "ext-json": "*",
+    "ext-curl": "*",
+    "ext-bcmath": "*",
+    "ext-mbstring": "*",
+    "ext-redis": "*",
+    "topthink/think-view": "^1.0",
+    "symfony/var-dumper": "^4.2",
+    "overtrue/wechat": "^3.3",
+    "topthink/think-captcha": "^3.0",
+    "topthink/think-image": "^1.0",
+    "xaboy/form-builder": "^1.2",
+    "firebase/php-jwt": "^5.0",
+    "phpoffice/phpexcel": "^1.8",
+    "aliyuncs/oss-sdk-php": "^2.3",
+    "qcloud/cos-sdk-v5": "^1.3",
+    "qiniu/php-sdk": "^7.2",
+    "workerman/workerman": "^3.5",
+    "workerman/channel": "^1.0",
+    "topthink/think-queue": "^3.0",
+    "spatie/macroable": "^1.0",
+    "dh2y/think-qrcode": "^2.0",
+    "topthink/think-multi-app": "^1.0",
+    "topthink/think-template": "^2.0",
+    "alibabacloud/dysmsapi": "^1.8",
+    "alipaysdk/easysdk": "^2.2",
+    "pda/pheanstalk": "^4.0",
+    "robthree/twofactorauth": "^1.8",
+    "yurunsoft/yurun-oauth-login": "^3.0",
+    "yurunsoft/pay-sdk": "^3.1",
+    "wenstudioasia/zinc-php": "@dev"
+  },
+  "autoload": {
+    "psr-4": {
+      "app\\": "app",
+      "crmeb\\": "crmeb",
+      "tw\\": "tw",
+      "tests\\": "tests"
     },
-    "require-dev": {
-        "phpunit/phpunit": "^8.5.21"
+    "psr-0": {
+      "": "extend/"
+    }
+  },
+  "config": {
+    "preferred-install": "dist"
+  },
+  "scripts": {
+    "post-autoload-dump": [
+      "@php think service:discover",
+      "@php think vendor:publish"
+    ]
+  },
+  "repositories": {
+    "packagist": {
+      "type": "composer",
+      "url": "https://mirrors.aliyun.com/composer/"
     }
+  },
+  "require-dev": {
+    "phpunit/phpunit": "^8.5.21"
+  }
 }

+ 1 - 1
tw/async/activities/ActivityCalc.php

@@ -165,7 +165,7 @@ abstract class ActivityCalc
                 $itWin = true;
             }
 
-            $poolBalance = floatval((new ActivityPool)->get('', $this->getName())); // pool 中金额
+            $poolBalance = floatval((new ActivityPool)->hget('', $this->getName())); // pool 中金额
             if (!$itWin) {
                 // 如果为新用户,且池子有钱,让他胜
                 if ($poolBalance > $profit && $products[0]['pay_count'] <= 1) {

+ 1 - 1
vendor/phpunit/phpunit/.phpunit.result.cache

@@ -1 +1 @@
-{"version":1,"defects":{"tests\\UserTaskTest::test_generate_user_poster":5,"tests\\RedisTest::test_zset":5},"times":{"tests\\UserTaskTest::test_generate_user_poster":0.015,"tests\\RedisTest::test_zset":0.002}}
+{"version":1,"defects":{"tests\\UserTaskTest::test_generate_user_poster":5,"tests\\RedisTest::test_zset":5},"times":{"tests\\UserTaskTest::test_generate_user_poster":0.015,"tests\\RedisTest::test_zset":0.071}}