47 lines
1.4 KiB
PHP

<?php
namespace app\api\controller;
use app\common\controller\Api;
use think\Config;
use think\Db;
use think\db\exception\BindParamException;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use fast\Http;
/**
* 首页接口
*/
class Express extends Api
{
protected $noNeedLogin = ['resubscribe'];
protected $noNeedRight = ['create_subscribe','resubscribe'];
public function index(){
$WAREHOUSEID = $this->auth->warehouseid;
$params=$this->request->post();
$POSTCODE = $params['postcode'];
$TIMECODE = $params['timecode'];
$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);
$redis->auth('qwe2019@');
$redis->select(15);
$data = [];
$infos = $redis->get("ExpressSummary_".$POSTCODE."_".$TIMECODE."_".$WAREHOUSEID);
if($infos){
$data = json_decode($infos);
}
$this->success("获取成功",$data);
/*
$redis->lpush('subscribe_tasks',json_encode(['taskID'=>$taskID,'POSTCODE'=>$POSTCODE]));
*/
}
public function refresh(){
$WAREHOUSEID = $this->auth->warehouseid;
$req = Http::get("http://file.gztbyc.com/express/ExpressSummary");
$this->success("成功",$req);
}
}