lqmac 6 months ago
parent 996f037afc
commit 83628be5a1
  1. 8
      app/admin/controller/Goods.php
  2. 8
      app/api/controller/Category.php
  3. 15
      app/api/controller/Store.php
  4. 8
      app/api/model/Order.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,

@ -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'));

@ -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);
}

@ -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;
}

Loading…
Cancel
Save