cache = $cache; } /** * */ public function getKeyLst() { $type = $this->request->param('type',0); $data = $this->cache->getAgreeList($type); return to_assign(0,'',$data); } /** * @return mixed */ public function getAgree($key) { $allow = $this->cache->getAgreeKey(); if (!in_array($key, $allow)) return app('json')->fail('数据不存在'); $data = $this->cache->getResult($key); return to_assign(0,'success', $data); } /** * @return mixed */ public function saveAgree($key) { $allow = $this->cache->getAgreeKey(); if (!in_array($key, $allow)) return app('json')->fail('KEY不存在'); $value = get_params('agree'); $this->cache->saveCache($key, $value); if ($key == CacheModel::USER_PRIVACY) $this->cache->setUserAgreement($value); if ($key == CacheModel::USER_AGREE) $this->cache->setUserRegister($value); return to_assign(0, '保存成功'); } /** * TODO 清除缓存 * @return \think\response\Json */ public function clearCache() { return to_assign(0,'清除缓存成功'); } }