first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
/**
* Created by PhpStorm.
* User: zhuxiaowei
* Date: 2019-03-19
* Time: 09:28
*/
namespace app\command;
use app\common\KeywordJson;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Exception;
use think\facade\Cache;
class CacheCommand extends Command{
protected function configure(){
$this->setName('CacheCommand')->setDescription("华源商品缓存");//这里的setName和php文件名一致,setDescription随意
}
/*
* 测试
*/
protected function execute(Input $input, Output $output)
{
Cache::set('test', 1);
Cache::rm('test');
//华源商品抓取
try{
$json = KeywordJson::getJson();
$keyList = json_decode($json,true);
foreach ($keyList as $key=>$value)
{
Cache::set('huayuangoods_'.$key,$value);
}
echo "华源商品缓存重制完成 \n";
}catch (Exception $exception){
echo $exception->getMessage()." \n";
return;
}
}
}