Commit 8d842de7 authored by hujun's avatar hujun

缓存清理

parent 68107c57
...@@ -627,6 +627,9 @@ Route::group('task', [ ...@@ -627,6 +627,9 @@ Route::group('task', [
'killOutTimeSql' => ['task/KillOutTimeSql/killOutTimeSql', ['method' => 'get']],//超过有效期的券改过期 'killOutTimeSql' => ['task/KillOutTimeSql/killOutTimeSql', ['method' => 'get']],//超过有效期的券改过期
'delHouseVideo' => ['task/JobTask/delHouseVideo', ['method' => 'get']],//删除无效视频 'delHouseVideo' => ['task/JobTask/delHouseVideo', ['method' => 'get']],//删除无效视频
'updateBargainPerformance' => ['task/ResultsSummaryNewTask/updateBargainPerformance', ['method' => 'get']],//根据bargain_id统计 'updateBargainPerformance' => ['task/ResultsSummaryNewTask/updateBargainPerformance', ['method' => 'get']],//根据bargain_id统计
'delAgent' => ['task/UpdateRedisCache/delAgent', ['method' => 'get']],//清空经纪人缓存
'delCache' => ['task/UpdateRedisCache/delCache', ['method' => 'get']],//清空多种缓存
'delGroup' => ['task/UpdateRedisCache/delGroup', ['method' => 'get']],//批量去除角色缓存
]); ]);
Route::group('broker', [ Route::group('broker', [
......
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/4/9
* Time: 16:38
*/
namespace app\task\controller;
use app\api_broker\service\RedisCacheService;
use app\model\AAgents;
use app\model\AuthGroup;
use think\Request;
class UpdateRedisCache
{
private $redis_service;
public function __construct()
{
$this->redis_service = new RedisCacheService();
}
/**
* 批量去除经纪人缓存
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delAgent()
{
$m_agent = new AAgents();
$agent_data = $m_agent->getAgentById('id', []);
foreach ($agent_data as $v) {
echo $this->redis_service->delRedisCache(2, $v['id']);
}
}
/**
* 删除多种缓存
*/
public function delCache()
{
$param = Request::instance()->param();
echo $this->redis_service->delRedisCache($param['type'], $param['id']);
}
/**
* 批量去除角色缓存
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delGroup()
{
$m_group = new AuthGroup();
$group_data = $m_group->getList2('', 'id',[]);
foreach ($group_data as $v) {
echo $this->redis_service->delRedisCache(3, $v['id']);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment