diff --git a/app/api/service/Goods.php b/app/api/service/Goods.php index a75eac89..bdb3e2cc 100644 --- a/app/api/service/Goods.php +++ b/app/api/service/Goods.php @@ -250,7 +250,11 @@ class Goods extends GoodsService 'store_id' => $storeid, 'is_main' => 1, ])->field('shop_name,star,shop_hours,summary,phone, - province_id,city_id,region_id,shop_id,address,latitude,longitude,wechat_img_id,history1,history2,history3,remark,history,parking_name,parking_desc,parking_latitude,parking_longitude,shop_image_id,fuwu_hours,fuwu_num')->find()->toArray(); + province_id,city_id,region_id,shop_id,address,latitude,longitude,wechat_img_id,history1,history2,history3,remark,history,parking_name,parking_desc,parking_latitude,parking_longitude,shop_image_id,fuwu_hours,fuwu_num')->find(); + if (!$info) { + return []; + } + $info = $info->toArray(); //todo wmc $info['remark'] = json_decode($info['remark'],true); $arr = explode(" ", $info['shop_hours']); diff --git a/app/api/service/order/Checkout.php b/app/api/service/order/Checkout.php index 2dd15cb3..90e4e9f4 100644 --- a/app/api/service/order/Checkout.php +++ b/app/api/service/order/Checkout.php @@ -178,13 +178,17 @@ class Checkout extends BaseService $this->orderData = $this->getOrderData(); //校验是否在销售区域 foreach ($this->goodsList as $key => $value) { - if (!$value['sale_areas']) { + if (!$value['region']) { continue; } - if (strpos($this->orderData['address']->province_id.".".$this->orderData['address']->city_id, $value['sale_areas']) === false) { + + if (!in_array($this->orderData['address']->city_id, json_decode($value['region']))) { $this->setError("您的收货地址不在商品 [{$value['goods_name']}] 的销售区域内"); - break; } + // if (strpos($this->orderData['address']->province_id.".".$this->orderData['address']->city_id, $value['sale_areas']) === false) { + // $this->setError("您的收货地址不在商品 [{$value['goods_name']}] 的销售区域内"); + // break; + // } } // 验证商品状态, 是否允许购买 diff --git a/app/common/model/Channel.php b/app/common/model/Channel.php index 1843eecb..5d1625b5 100644 --- a/app/common/model/Channel.php +++ b/app/common/model/Channel.php @@ -29,5 +29,9 @@ class Channel extends BaseModel // 定义主键 protected $pk = 'id'; - + public static function init() + { + self::$storeId = 0; + app()->request->setStoreId(0); + } } diff --git a/app/common/model/Region.php b/app/common/model/Region.php index 4e9d4f6b..c90ed10b 100644 --- a/app/common/model/Region.php +++ b/app/common/model/Region.php @@ -44,7 +44,11 @@ class Region extends BaseModel // 当前数据版本号 private static string $version = '1.0.3'; - + public static function init() + { + self::$storeId = 0; + app()->request->setStoreId(0); + } /** * 根据ID获取地区名称 * @param int $id diff --git a/app/job/service/goods/AdminImport.php b/app/job/service/goods/AdminImport.php index 0878c635..ec9e28a9 100644 --- a/app/job/service/goods/AdminImport.php +++ b/app/job/service/goods/AdminImport.php @@ -196,6 +196,7 @@ class AdminImport extends BaseService */ public function createData(array $original, int $storeId): array { + $channel = Channel::where('name', $original["B"])->find(); $arr = []; @@ -225,6 +226,8 @@ class AdminImport extends BaseService 'goods_status' => 10,//上架 'store_id' => $storeId, 'sale_areas' => $arr ? implode("、", $arr) : "", + 'region' => $arr ? implode("、", $arr) : "", + 'region_text' => $arr ? implode("、", $arr) : "", 'import' => 1,//是否是导入采集 ]; // echo "
";
diff --git a/app/store/controller/Goods.php b/app/store/controller/Goods.php
index 5fd05c21..7b6ce645 100644
--- a/app/store/controller/Goods.php
+++ b/app/store/controller/Goods.php
@@ -33,7 +33,7 @@ class Goods extends Controller
     {
         // 获取列表记录
         $model = new GoodsModel;
-        $list= $model->getList($this->request->param());
+        $list= $model->getList($this->request->param(), (int)$this->request->param('pageSize', 15));
         return $this->renderSuccess(compact('list'));
     }
 
diff --git a/app/store/model/goods/Import.php b/app/store/model/goods/Import.php
index afeb9572..1b130847 100644
--- a/app/store/model/goods/Import.php
+++ b/app/store/model/goods/Import.php
@@ -78,15 +78,19 @@ class Import extends ImportModel
         $this->checkLimit($execlData);
         
         self::$storeId = $form['store_id'] ?? 0;
-        // $obj = new \app\job\service\goods\AdminImport();
-        // $service = new \app\job\service\goods\Collector();
-        // foreach ($execlData as $item) {
+        $obj = new \app\job\service\goods\AdminImport();
+        $service = new \app\job\service\goods\Collector();
+        foreach ($execlData as $item) {
 
-        //     $data = $obj->createData($item, self::$storeId);
-        //     $service->single($item['D'], $data, self::$storeId);
-        //     // // 记录导入成功
-        //     // $this->successCount++;
-        // }
+            $data = $obj->createData($item, self::$storeId);
+            echo "
";
+            print_r($data);
+            exit();
+            $service->single($item['D'], $data, self::$storeId);
+            // // 记录导入成功
+            // $this->successCount++;
+        }
+        exit();
 
         // 新增商品导入记录
         $recordId = $this->addRecord(\count($execlData));
diff --git a/public/store/static/template/batch-goods.xlsx b/public/store/static/template/batch-goods.xlsx
index ae3b1911..b546456f 100644
Binary files a/public/store/static/template/batch-goods.xlsx and b/public/store/static/template/batch-goods.xlsx differ