diff --git a/app/admin/controller/Goods.php b/app/admin/controller/Goods.php index 6d5d6715..cdc7d1ac 100644 --- a/app/admin/controller/Goods.php +++ b/app/admin/controller/Goods.php @@ -171,8 +171,16 @@ class Goods extends Controller 'goods_source' => $goods_sku->goods_source, 'is_check' => $goods_sku->is_check, 'delivery_time' => $goods_sku->delivery_time, + // 'is_pool' => $goods_sku->is_pool, + // 'is_sale' => $goods_sku->is_sale, 'update_time' => time(), ]; + if ($goods_sku->is_pool == 0 || $goods_sku->is_sale == 0) { + $goods_data['status'] = 20; + } + if ($goods_sku->is_pool == 1 && $goods_sku->is_sale == 1) { + $goods_data['status'] = 10; + } GoodsModel::where('origin_goods_id', $goodsId)->update($goods_data); $goods_sku_data = [ 'goods_price' => $goods_sku->goods_price_min, diff --git a/app/api/controller/Category.php b/app/api/controller/Category.php index c798ed76..f5fcb0b8 100644 --- a/app/api/controller/Category.php +++ b/app/api/controller/Category.php @@ -14,6 +14,7 @@ namespace app\api\controller; use think\response\Json; use app\api\model\Category as CategoryModel; +use think\facade\Cache; /** * 商品分类控制器 @@ -31,13 +32,20 @@ class Category extends Controller */ public function list(): Json { + $cache_key = "Category_list".$this->storeId; + if(Cache::has($cache_key)) { + $list = Cache::get($cache_key); + return $this->renderSuccess(compact('list')); + } $model = new CategoryModel; $list = $model->getListPublic($this->request->param()); + Cache::set($cache_key, $list, 86400); return $this->renderSuccess(compact('list')); } public function childrenList(): Json { + $model = new CategoryModel; $list = $model->getChildrenList($this->request->param()); return $this->renderSuccess(compact('list')); diff --git a/app/api/controller/Store.php b/app/api/controller/Store.php index 01889344..402c180b 100644 --- a/app/api/controller/Store.php +++ b/app/api/controller/Store.php @@ -115,10 +115,17 @@ class Store extends Controller { $storeid = request()->header()['storeid']; $info = StoreInfoModel::where('store_id', $storeid)->find()->toArray(); - $file = UploadFile::where('file_id', '=', $info['group_share_img_id'])->find(); - $info['group_share_img'] = $file->preview_url; - $file = UploadFile::where('file_id', '=', $info['logo_image_id'])->find(); - $info['logo_image'] = $file->preview_url; + $info['group_share_img'] = ""; + if ($info['group_share_img_id']) { + $file = UploadFile::where('file_id', '=', $info['group_share_img_id'])->find(); + $info['group_share_img'] = $file->preview_url; + } + $info['logo_image'] = ""; + if ($info['logo_image_id']) { + $file = UploadFile::where('file_id', '=', $info['logo_image_id'])->find(); + $info['logo_image'] = $file->preview_url; + } + return $this->renderSuccess($info); } diff --git a/app/api/model/Order.php b/app/api/model/Order.php index 3fa55aae..b284477b 100644 --- a/app/api/model/Order.php +++ b/app/api/model/Order.php @@ -497,9 +497,13 @@ class Order extends OrderModel $order->storeInfo = $info['storeInfo']->toArray(); } $total_num = 0; - foreach ($order->goods as $value) { - $total_num += $value->total_num ?? 0; + if (isset($order->goods) && $order->goods) { + foreach ($order->goods as $value) { + $total_num += $value->total_num ?? 0; + } } + + $order->total_num = $total_num; return $order; }