afa 10 hónapja
szülő
commit
335146b713
1 módosított fájl, 7 hozzáadás és 2 törlés
  1. 7 2
      application/admin/controller/product/Lists.php

+ 7 - 2
application/admin/controller/product/Lists.php

@@ -128,13 +128,13 @@ class Lists extends Backend
             $this->error(__('You have no permission'));
         }
         if (false === $this->request->isPost()) {
-            $area = $this->productArea::where('product_id', $ids)->where('status', 1)->select();
+            $area = $this->productArea::where('product_id', $ids)->select();
             $areaData = array();
             $areaCode = array();
             $areaTxt  = array();
             foreach ($area as $key =>$item) {
                 if($item->province > 0){
-                    $areaData[$key]        = $item->province;
+                    $areaData[$key]    = $item->province;
                     $areaCode[$key][0] = $item->province;
                 } 
                 if($item->city > 0){
@@ -202,6 +202,11 @@ class Lists extends Backend
             $arr['area']        = $row[2]??0;
             $arr['county']      = $row[3]??0;
             $arr['address']     = $areaArrTxt[$key][0];
+            if($this->productArea::where('product_id',$arr['product_id'])
+            ->where('province',$arr['province'])
+            ->where('city',$arr['city'])->where('area',$arr['area'])
+            ->where('county',$arr['county'])->where('status', 0)
+            ->count() > 0) continue;
             $this->productArea::create($arr);
         }
         return true;