Pārlūkot izejas kodu

商户后台-设置-运费模板-修改配送地址城市编码

sunxbiao 11 mēneši atpakaļ
vecāks
revīzija
6539e00d89

+ 18 - 0
app/common/model/Region.php

@@ -0,0 +1,18 @@
1
+<?php
2
+
3
+namespace app\common\model;
4
+
5
+
6
+class Region extends BaseModel
7
+{
8
+
9
+    public static function tablePk(): string
10
+    {
11
+        return 'id';
12
+    }
13
+
14
+    public static function tableName(): string
15
+    {
16
+        return 'regions';
17
+    }
18
+}

+ 3 - 1
app/common/model/store/shipping/ShippingTemplateFree.php

@@ -8,6 +8,7 @@
8
 namespace app\common\model\store\shipping;
8
 namespace app\common\model\store\shipping;
9
 
9
 
10
 use app\common\model\BaseModel;
10
 use app\common\model\BaseModel;
11
+use app\common\model\Region;
11
 
12
 
12
 class ShippingTemplateFree extends BaseModel
13
 class ShippingTemplateFree extends BaseModel
13
 {
14
 {
@@ -41,7 +42,8 @@ class ShippingTemplateFree extends BaseModel
41
         $result = [];
42
         $result = [];
42
         if(is_array($city_id)){
43
         if(is_array($city_id)){
43
             foreach ($city_id as $v){
44
             foreach ($city_id as $v){
44
-                $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
45
+                // $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
46
+                $result[] = [Region::where('id',$v)->value('pid') ?? 0,intval($v) ];
45
             }
47
             }
46
         }
48
         }
47
         return $result;
49
         return $result;

+ 3 - 1
app/common/model/store/shipping/ShippingTemplateRegion.php

@@ -8,6 +8,7 @@
8
 namespace app\common\model\store\shipping;
8
 namespace app\common\model\store\shipping;
9
 
9
 
10
 use app\common\model\BaseModel;
10
 use app\common\model\BaseModel;
11
+use app\common\model\Region;
11
 
12
 
12
 class ShippingTemplateRegion extends BaseModel
13
 class ShippingTemplateRegion extends BaseModel
13
 {
14
 {
@@ -40,7 +41,8 @@ class ShippingTemplateRegion extends BaseModel
40
         $result = [];
41
         $result = [];
41
         if(is_array($city_id)){
42
         if(is_array($city_id)){
42
             foreach ($city_id as $v){
43
             foreach ($city_id as $v){
43
-                $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
44
+                // $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
45
+                $result[] = [Region::where('id',$v)->value('pid') ?? 0,intval($v) ];
44
             }
46
             }
45
         }
47
         }
46
         return $result;
48
         return $result;

+ 3 - 1
app/common/model/store/shipping/ShippingTemplateUndelivery.php

@@ -8,6 +8,7 @@
8
 namespace app\common\model\store\shipping;
8
 namespace app\common\model\store\shipping;
9
 
9
 
10
 use app\common\model\BaseModel;
10
 use app\common\model\BaseModel;
11
+use app\common\model\Region;
11
 
12
 
12
 class ShippingTemplateUndelivery extends BaseModel
13
 class ShippingTemplateUndelivery extends BaseModel
13
 {
14
 {
@@ -40,7 +41,8 @@ class ShippingTemplateUndelivery extends BaseModel
40
         $result = [];
41
         $result = [];
41
         if(is_array($city_id)){
42
         if(is_array($city_id)){
42
             foreach ($city_id as $v){
43
             foreach ($city_id as $v){
43
-                $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
44
+                // $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
45
+                $result[] = [Region::where('id',$v)->value('pid') ?? 0,intval($v) ];
44
             }
46
             }
45
         }else{
47
         }else{
46
             $result['city_id'] = [];
48
             $result['city_id'] = [];