debug
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\task\logic;
|
||||
|
||||
use app\model\GuangGaoFenZuModel;
|
||||
use app\model\GuangGaoModel;
|
||||
use app\model\GuangGaoPeiZhiModel;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class AdTask
|
||||
{
|
||||
/**
|
||||
* Undocumented variable
|
||||
*
|
||||
* @var \GuzzleHttp\Client
|
||||
*/
|
||||
protected $Client = NULL;
|
||||
|
||||
/**
|
||||
* Undocumented variable
|
||||
*
|
||||
* @var \app\task\core\TaskCore
|
||||
*/
|
||||
protected $TaskCore = NULL;
|
||||
|
||||
protected $arrCaiJiPeiZhi = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->Client = new Client();
|
||||
}
|
||||
|
||||
public function pullAdBySourceSite()
|
||||
{
|
||||
$intOpen = GuangGaoPeiZhiModel::getValByCode('GUANG_GAO_TONG_BU_KAI_GUAN');
|
||||
|
||||
if ($intOpen != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$strUrl = GuangGaoPeiZhiModel::getValByCode('GUANG_GAO_TONG_BU_DI_ZHI');
|
||||
|
||||
|
||||
$strResult = $this->Client->request('GET', $strUrl);
|
||||
$strResult = (string)$strResult->getBody();
|
||||
|
||||
$arrData = json_decode($strResult, true);
|
||||
|
||||
if (!is_array($arrData) || empty($arrData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($arrData['code'] != 1000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GuangGaoModel::where('gg_id', '>', 0)->delete();
|
||||
GuangGaoFenZuModel::where('ggfz_id', '>', 0)->delete();
|
||||
|
||||
GuangGaoFenZuModel::insertAll($arrData['data']['ggfz']);
|
||||
GuangGaoModel::insertAll($arrData['data']['gg']);
|
||||
|
||||
GuangGaoModel::flushCache();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\task\logic;
|
||||
|
||||
use think\Container;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class SystemLogic
|
||||
{
|
||||
static public function reloadRedis()
|
||||
{
|
||||
Container::getInstance()->delete('cache');
|
||||
}
|
||||
|
||||
static public function reloadDb()
|
||||
{
|
||||
Db::close();
|
||||
Container::getInstance()->delete('think\DbManager');
|
||||
}
|
||||
|
||||
static public function destructConnectSource()
|
||||
{
|
||||
self::reloadDb();
|
||||
self::reloadRedis();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user