Merge branch 'main' of git.njrzwl.cn:wangmingchuan/yanzong into main

es
ztt 8 months ago
commit 8c1c1fa6e1
  1. 2
      app/admin/controller/goods/Import.php
  2. 4
      app/api/controller/Controller.php
  3. 4
      app/api/controller/Goods.php
  4. 2
      app/common/model/Goods.php
  5. 4
      app/store/model/Goods.php
  6. 2
      app/store/model/Store.php

@ -35,7 +35,7 @@ class Import extends Controller
$params['store_id'] = 0;
$model = new ImportModel;
$platform = $this->getUserPlatform();
$params['channels'] = $platform ? array_column($platform->toArray(), "code") : [];
$params['channels'] = $this->admin['user']['role'] == 0 ? [] : ($platform ? array_column($platform->toArray(), "code") : []);
$list = $model->getList($params);
return $this->renderSuccess(compact('list'));
}

@ -34,6 +34,8 @@ class Controller extends BaseController
protected $storeInfo;
protected $user;
/**
* API基类初始化
* @throws BaseException
@ -49,7 +51,7 @@ class Controller extends BaseController
$this->checkStore();
// 验证当前客户端状态
$this->checkClient();
//$user = $this->getLoginUser();
$this->user = $this->getLoginUser(false);
// if ($user) {
// if ($user->user_type == 0 || $user->status == 0) {
// throwError('很抱歉,您没有权限进入系统');

@ -294,7 +294,7 @@ class Goods extends Controller
public function recommended(): Json
{
$service = new GoodsService;
$cache_key = "goods_recommended".$this->storeId;
$cache_key = "goods_recommended".$this->storeId.($this->user ? $this->user->user_type : 0);
if(Cache::has($cache_key)) {
$goodsList = Cache::get($cache_key);
return $this->renderSuccess(compact('goodsList'));
@ -411,7 +411,7 @@ class Goods extends Controller
$wxConfig = WxappSettingModel::getConfigBasic($store_id);
// 请求api获取短连接
$link_obj = new ShortLink($wxConfig['app_id'], $wxConfig['app_secret']);
$url = $link_obj->shortUrl($page_url, $page_title);
$url = $link_obj->shortUrl($page_url, "");
return $this->renderSuccess(['url' => $url]);
}

@ -584,7 +584,7 @@ class Goods extends BaseModel
protected function setGoodsData($goodsInfo, callable $callback = null)
{
$channel = Channel::withoutGlobalScope()->where('code', $goodsInfo['channel'])->find();
$goodsInfo['channel_name'] = $channel['name'] ?? "";
$goodsInfo['channel_name'] = $channel['alias'] ?? "";
$goodsInfo['goods_images'] = helper::getArrayColumn($goodsInfo['images'], 'file');
// 商品主图

@ -183,7 +183,7 @@ class Goods extends GoodsModel
public function setIsPool(array $goodsIds, int $is_pool): bool
{
// 批量更新记录
return static::updateBase(['is_pool' => $is_pool,'update_time' => time()], [['goods_id', 'in', $goodsIds]]);
return static::updateBase(['is_pool' => $is_pool,'update_time' => time(),'sale_time' => time()], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
@ -194,7 +194,7 @@ class Goods extends GoodsModel
public function setIsSale(array $goodsIds, int $is_sale): bool
{
// 批量更新记录
return static::updateBase(['is_sale' => $is_sale,'update_time' => time()], [['goods_id', 'in', $goodsIds]]);
return static::updateBase(['is_sale' => $is_sale,'update_time' => time(),'sale_time' => time()], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态

@ -30,7 +30,7 @@ class Store extends StoreModel
{
// 是否删除图片
!isset($data['logo_image_id']) && $data['logo_image_id'] = 0;
$data['fliter_condition'] = json_encode($data['fliter_condition'], JSON_UNESCAPED_UNICODE);
$data['fliter_condition'] = isset($data['fliter_condition']) ? json_encode($data['fliter_condition'], JSON_UNESCAPED_UNICODE) : "";
return $this->save($data) !== false;
}
}

Loading…
Cancel
Save