ソースを参照

没有就为空判断

xialei 1 年間 前
コミット
3ec9c25c3e
共有2 個のファイルを変更した49 個の追加5 個の削除を含む
  1. 41 4
      app/common/repositories/store/order/StoreOrderRepository.php
  2. 8 1
      app/controller/api/store/order/StoreOrder.php

+ 41 - 4
app/common/repositories/store/order/StoreOrderRepository.php

@@ -4565,7 +4565,14 @@ class StoreOrderRepository extends BaseRepository
4565 4565
             $address['town'] = isset($code_list[3]) && $code_list[3] > 0 && isset($address_list[$code_list[3]]) ? $address_list[$code_list[3]] : '';
4566 4566
             $data['user_address'] = $address['province'] . $address['city'] . $address['district'] . $address['town'] . ' ' . explode(' ', $data['user_address'])[1];
4567 4567
         }
4568
-        $data['fzone_paytype'] = json_decode($data['fzone_paytype'], true);
4568
+        if($data['fzone_paytype']){
4569
+            $data['fzone_paytype'] = json_decode($data['fzone_paytype'], true);
4570
+            if (!count($data['fzone_paytype'])) {
4571
+                $data['fzone_paytype'] = null;
4572
+            }
4573
+        }else{
4574
+            $data['fzone_paytype'] = null;
4575
+        }
4569 4576
         return $data;
4570 4577
     }
4571 4578
 
@@ -4665,7 +4672,14 @@ class StoreOrderRepository extends BaseRepository
4665 4672
         $wechatpay = $query->where($this->getOrderType($status))->where('test_order', 0)->where('paid', 1)->where('pay_type', '<>', 0)->field('sum(pay_price) as pay_price')->find();
4666 4673
 
4667 4674
         foreach ($list as $key=>$item) {
4668
-            $list[$key]['fzone_paytype'] = json_decode($item['fzone_paytype'], true);
4675
+            if($item['fzone_paytype']){
4676
+                $list[$key]['fzone_paytype'] = json_decode($item['fzone_paytype'], true);
4677
+                if (!count($list[$key]['fzone_paytype'])) {
4678
+                    $list[$key]['fzone_paytype'] = null;
4679
+                }
4680
+            }else{
4681
+                $list[$key]['fzone_paytype'] = null;
4682
+            }
4669 4683
         }
4670 4684
 
4671 4685
         $list1[] = ['count' => 1753141, 'name' => '现金'];
@@ -4745,6 +4759,15 @@ class StoreOrderRepository extends BaseRepository
4745 4759
             if ($v['is_settlement'] == 0) $list[$k]['ylj_status_string'] = "未结算";
4746 4760
             if ($v['is_settlement'] == 1) $list[$k]['ylj_status_string'] = "已结算";
4747 4761
             if ($v['is_settlement'] == -1 || in_array($v['status'], [-1, 6])) $list[$k]['ylj_status_string'] = "已失效";
4762
+
4763
+            if ($v['fzone_paytype']){
4764
+                $list[$k]['fzone_paytype'] = json_decode($v['fzone_paytype'], true);
4765
+                if (!count($list[$k]['fzone_paytype'])) {
4766
+                    $list[$k]['fzone_paytype'] = null;
4767
+                }
4768
+            }else{
4769
+                $list[$k]['fzone_paytype'] = null;
4770
+            }
4748 4771
         }
4749 4772
 
4750 4773
 
@@ -4838,7 +4861,14 @@ class StoreOrderRepository extends BaseRepository
4838 4861
                 $value['refund_order_id'] = $refund_order_id;
4839 4862
             }
4840 4863
 
4841
-            $value['fzone_paytype'] = json_decode($value['fzone_paytype'], true);
4864
+            if($value['fzone_paytype']){
4865
+                $value['fzone_paytype'] = json_decode($value['fzone_paytype'], true);
4866
+                if (!count($value['fzone_paytype'])) {
4867
+                    $value['fzone_paytype'] = null;
4868
+                }
4869
+            }else{
4870
+                $value['fzone_paytype'] = null;
4871
+            }
4842 4872
         }
4843 4873
         return compact('list', 'count');
4844 4874
     }
@@ -7009,7 +7039,14 @@ class StoreOrderRepository extends BaseRepository
7009 7039
                     $val['close_time'] = date('Y-m-d H:i:s', strtotime($val['create_time']) + 3 * 60);
7010 7040
                 }
7011 7041
                 $val['youhui_price'] = set_price_rtrim($val['youhui_price']);
7012
-                $val['fzone_paytype'] = json_decode($val['fzone_paytype'], true);
7042
+                if($val['fzone_paytype']){
7043
+                    $val['fzone_paytype'] = json_decode($val['fzone_paytype'], true);
7044
+                    if (!count($val['fzone_paytype'])) {
7045
+                        $val['fzone_paytype'] = null;
7046
+                    }
7047
+                }else{
7048
+                    $val['fzone_paytype'] = null;
7049
+                }
7013 7050
                 return $val;
7014 7051
             });
7015 7052
         if ($this->source == 'yhc') {

+ 8 - 1
app/controller/api/store/order/StoreOrder.php

@@ -921,7 +921,14 @@ class StoreOrder extends BaseController
921 921
                 $_v['refund_order_id']=$refund_order_id;
922 922
             }
923 923
 
924
-            $_v['fzone_paytype'] = json_decode($_v['fzone_paytype'], true);
924
+            if($_v['fzone_paytype']){
925
+                $_v['fzone_paytype'] = json_decode($_v['fzone_paytype'], true);
926
+                if (!count($_v['fzone_paytype'])) {
927
+                    $_v['fzone_paytype'] = null;
928
+                }
929
+            }else{
930
+                $_v['fzone_paytype'] = null;
931
+            }
925 932
         }
926 933
 //        $count=Db::name('store_group_order')
927 934
 //            ->alias('sgo')