feat: chef
This commit is contained in:
@@ -5,6 +5,17 @@ namespace App\Cache\Redis\Common;
|
|||||||
class CommonRedisKey
|
class CommonRedisKey
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* 获取系统配置列表
|
||||||
|
* @param $pid
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getSystemConfigList($pid): string
|
||||||
|
{
|
||||||
|
return '__system:config:list:' . $pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取系统配置
|
||||||
* @return string
|
* @return string
|
||||||
*@var string $type
|
*@var string $type
|
||||||
*/
|
*/
|
||||||
|
|||||||
31
app/Cache/Redis/Common/ConfigCache.php
Normal file
31
app/Cache/Redis/Common/ConfigCache.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Cache\Redis\Common;
|
||||||
|
|
||||||
|
use App\Cache\Redis\RedisCache;
|
||||||
|
use App\Model\Config;
|
||||||
|
use App\Model\Cycle;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class ConfigCache
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RedisCache
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected RedisCache $redis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Config $configModel
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Config $configModel;
|
||||||
|
|
||||||
|
public function setConfigCacheByPid($pid)
|
||||||
|
{
|
||||||
|
$key = CommonRedisKey::getSystemConfigList($pid);
|
||||||
|
if ($this->redis->exists($key,'system')) return json_decode($this->redis->get($key),true);
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ class ChefRequest extends FormRequest
|
|||||||
'user_id' =>'required|integer|exists:chef,user_id',
|
'user_id' =>'required|integer|exists:chef,user_id',
|
||||||
'profile' =>'sometimes',
|
'profile' =>'sometimes',
|
||||||
'specialties' =>'sometimes',
|
'specialties' =>'sometimes',
|
||||||
'query_city_id' => 'sometimes|integer|exists:city,id',
|
'query_city_id' => 'sometimes|integer|exists:system_city,id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
app/Service/ServiceTrait/Common/CycleTrait.php
Normal file
22
app/Service/ServiceTrait/Common/CycleTrait.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Service\ServiceTrait\Common;
|
||||||
|
|
||||||
|
use App\Cache\Redis\Common\CycleCache;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
trait CycleTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var CycleCache
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected CycleCache $cycleCache;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function initTodayCycleId()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user