Kaynağa Gözat

Merge branch 'master' of https://gitee.com/xany/yoshop2.0

萤火科技 2 yıl önce
ebeveyn
işleme
2b8c86cf97

+ 8 - 3
app/api/service/coupon/GoodsDeduct.php

@@ -203,9 +203,14 @@ class GoodsDeduct extends BaseService
     private function setGoodsListCouponMoneyDiff($assignedCouponMoney): void
     {
         $tempDiff = $this->actualReducedMoney - $assignedCouponMoney;
-        foreach ($this->rangeGoodsList as &$goods) {
-            if ($tempDiff < 1) break;
-            $goods['coupon_money']++ && $tempDiff--;
+
+        while ($tempDiff > 0){
+            foreach ($this->rangeGoodsList as &$goods) {
+                if ($tempDiff < 1) break;
+                if(!$goods['coupon_money']) continue;
+                $goods['coupon_money']++;
+                $tempDiff--;
+            }
         }
     }
 }

+ 3 - 3
app/api/service/user/Avatar.php

@@ -71,12 +71,12 @@ class Avatar extends BaseService
         // 实例化存储驱动
         $storage = new Storage($this->config);
         // 设置上传文件的信息
-        $storage->setUploadFileByReal($filePath)
+        $result = $storage->setUploadFileByReal($filePath)
             ->setRootDirName((string)$this->storeId)
             ->setValidationScene('image')
             ->upload();
         // 执行文件上传
-        if (!$storage->upload()) {
+        if (!$result) {
             throwError('图片上传失败:' . $storage->getError());
         }
         // 文件信息
@@ -106,4 +106,4 @@ class Avatar extends BaseService
         $Download = new Download;
         return $Download->saveTempImage($this->storeId, $avatarUrl, 'avatar');
     }
-}
+}