Browse Source

创建订单-修复下单问题

sunxbiao 5 months ago
parent
commit
59018703db
1 changed files with 9 additions and 19 deletions
  1. 9 19
      app/entity/data/store/StoreOrderEntity.php

+ 9 - 19
app/entity/data/store/StoreOrderEntity.php

@@ -1608,18 +1608,15 @@ class StoreOrderEntity extends DataEntity
1608 1608
      */
1609 1609
     public function setFzonePaytype($fzonePaytype): StoreOrderEntity
1610 1610
     {
1611
-        if (!is_string($fzonePaytype)) {
1612
-            $fzonePaytypePre = $fzonePaytype;
1613
-            $fzonePaytype = '';
1614
-
1615
-            if (is_array($fzonePaytypePre)) {
1616
-                $fzonePaytype = json_encode($fzonePaytypePre);
1611
+        if (is_array($fzonePaytype)) {
1612
+            $this->fzonePaytype = json_encode($fzonePaytype);
1613
+            $this->deconstructionFzonePaytype();
1614
+        } else if (is_string($fzonePaytype)) {
1615
+            if (!empty(json_decode($fzonePaytype, true))) {
1616
+                $this->fzonePaytype = $fzonePaytype;
1617
+                $this->deconstructionFzonePaytype();
1617 1618
             }
1618
-
1619
-            unset($fzonePaytypePre);
1620 1619
         }
1621
-        $this->fzonePaytype = $fzonePaytype;
1622
-        $this->deconstructionFzonePaytype();
1623 1620
         return $this;
1624 1621
     }
1625 1622
 
@@ -1751,16 +1748,9 @@ class StoreOrderEntity extends DataEntity
1751 1748
 
1752 1749
     public function deconstructionFzonePaytype()
1753 1750
     {
1754
-        if (!empty($this->getFzonePaytype())) {
1755
-            $fzonePaytypeArr = [];
1756
-            if (is_array($this->getFzonePaytype())) {
1757
-                $fzonePaytypeArr = $this->getFzonePaytype();
1758
-            } else if (is_string($this->getFzonePaytype())) {
1759
-                $fzonePaytypeArr = json_decode($this->getFzonePaytype(), true);
1760
-            }
1761
-
1751
+        if (!empty($this->getFzonePayType()) && is_array(json_decode($this->getFzonePayType(), true))) {
1762 1752
             /** @var FzonePayTypeEntity $fzonePayTypeEntity */
1763
-            $fzonePayTypeEntity = FzonePayTypeEntity::newInstance($fzonePaytypeArr);
1753
+            $fzonePayTypeEntity = FzonePayTypeEntity::newInstance(json_decode($this->getFzonePayType(), true));
1764 1754
             $this->setFzonePayNote($fzonePayTypeEntity->getNote());
1765 1755
             $this->setFzonePayTypeBySplit($fzonePayTypeEntity->getType());
1766 1756
             // 验证支付方式