lqmac 6 months ago
parent 996f037afc
commit 83628be5a1
  1. 8
      app/admin/controller/Goods.php
  2. 8
      app/api/controller/Category.php
  3. 7
      app/api/controller/Store.php
  4. 4
      app/api/model/Order.php

@ -171,8 +171,16 @@ class Goods extends Controller
'goods_source' => $goods_sku->goods_source, 'goods_source' => $goods_sku->goods_source,
'is_check' => $goods_sku->is_check, 'is_check' => $goods_sku->is_check,
'delivery_time' => $goods_sku->delivery_time, 'delivery_time' => $goods_sku->delivery_time,
// 'is_pool' => $goods_sku->is_pool,
// 'is_sale' => $goods_sku->is_sale,
'update_time' => time(), '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); GoodsModel::where('origin_goods_id', $goodsId)->update($goods_data);
$goods_sku_data = [ $goods_sku_data = [
'goods_price' => $goods_sku->goods_price_min, 'goods_price' => $goods_sku->goods_price_min,

@ -14,6 +14,7 @@ namespace app\api\controller;
use think\response\Json; use think\response\Json;
use app\api\model\Category as CategoryModel; use app\api\model\Category as CategoryModel;
use think\facade\Cache;
/** /**
* 商品分类控制器 * 商品分类控制器
@ -31,13 +32,20 @@ class Category extends Controller
*/ */
public function list(): Json 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; $model = new CategoryModel;
$list = $model->getListPublic($this->request->param()); $list = $model->getListPublic($this->request->param());
Cache::set($cache_key, $list, 86400);
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));
} }
public function childrenList(): Json public function childrenList(): Json
{ {
$model = new CategoryModel; $model = new CategoryModel;
$list = $model->getChildrenList($this->request->param()); $list = $model->getChildrenList($this->request->param());
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));

@ -115,10 +115,17 @@ class Store extends Controller
{ {
$storeid = request()->header()['storeid']; $storeid = request()->header()['storeid'];
$info = StoreInfoModel::where('store_id', $storeid)->find()->toArray(); $info = StoreInfoModel::where('store_id', $storeid)->find()->toArray();
$info['group_share_img'] = "";
if ($info['group_share_img_id']) {
$file = UploadFile::where('file_id', '=', $info['group_share_img_id'])->find(); $file = UploadFile::where('file_id', '=', $info['group_share_img_id'])->find();
$info['group_share_img'] = $file->preview_url; $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(); $file = UploadFile::where('file_id', '=', $info['logo_image_id'])->find();
$info['logo_image'] = $file->preview_url; $info['logo_image'] = $file->preview_url;
}
return $this->renderSuccess($info); return $this->renderSuccess($info);
} }

@ -497,9 +497,13 @@ class Order extends OrderModel
$order->storeInfo = $info['storeInfo']->toArray(); $order->storeInfo = $info['storeInfo']->toArray();
} }
$total_num = 0; $total_num = 0;
if (isset($order->goods) && $order->goods) {
foreach ($order->goods as $value) { foreach ($order->goods as $value) {
$total_num += $value->total_num ?? 0; $total_num += $value->total_num ?? 0;
} }
}
$order->total_num = $total_num; $order->total_num = $total_num;
return $order; return $order;
} }

Loading…
Cancel
Save