diy页面数据更新

This commit is contained in:
吴昊天 2023-02-23 09:26:09 +08:00
parent cbb4e6a688
commit d1d57ff800
4 changed files with 32 additions and 8 deletions

View File

@ -40,13 +40,14 @@ class CategoryController
}
/**
* @return mixed
* @author 等风来
* @email 136327134@qq.com
* @date 2022/11/11
* @return mixed
*/
public function getCategoryVersion()
{
return app('json')->success(['version' => $this->services->getCategoryVersion()]);
$data = $this->services->getCategoryVersion();
return app('json')->success(['version' => $data['version'], 'is_diy' => $data['diy']]);
}
}

View File

@ -85,8 +85,8 @@ class PublicController
{
/** @var DiyServices $diyService */
$diyService = app()->make(DiyServices::class);
$version = $diyService->getDiyVersion((int)$id);
return app('json')->success(['version' => $version ?: '']);
$data = $diyService->getDiyVersion((int)$id);
return app('json')->success(['version' => $data['version'] ?: '', 'is_diy' => $data['is_diy']]);
}
/**

View File

@ -147,11 +147,11 @@ class DiyServices extends BaseServices
{
if ($id) {
return $this->cacheDriver()->remember('index_diy_' . $id, function () use ($id) {
return $this->dao->value(['id' => $id], 'version');
return $this->dao->getOne(['id' => $id], 'version,is_diy');
});
} else {
return $this->cacheDriver()->remember('index_diy_default', function () {
return $this->dao->value(['status' => 1, 'is_del' => 0], 'version');
return $this->dao->getOne(['status' => 1, 'is_del' => 0], 'version,is_diy');
});
}
}

View File

@ -14,6 +14,7 @@ namespace app\services\product\product;
use app\dao\product\product\StoreCategoryDao;
use app\services\BaseServices;
use app\services\diy\DiyServices;
use crmeb\exceptions\AdminException;
use crmeb\services\CacheService;
use crmeb\services\FormBuilder as Form;
@ -214,6 +215,12 @@ class StoreCategoryServices extends BaseServices
* 保存修改数据
* @param $id
* @param $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/02/23
*/
public function editData($id, $data)
{
@ -267,7 +274,10 @@ class StoreCategoryServices extends BaseServices
public function getCategoryVersion()
{
return $this->cacheDriver()->remember('category_version', function () {
return uniqid();
return [
'is_diy' => app()->make(DiyServices::class)->value(['status' => 1], 'is_diy'),
'version' => uniqid()
];
});
}
@ -275,6 +285,12 @@ class StoreCategoryServices extends BaseServices
* 获取指定id下的分类,一=以数组形式返回
* @param string $cateIds
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/02/23
*/
public function getCateArray(string $cateIds)
{
@ -283,7 +299,14 @@ class StoreCategoryServices extends BaseServices
/**
* 前台分类列表
* @return bool|mixed|null
* @param array $where
* @return array|mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/02/23
*/
public function getCategory(array $where)
{