Commit 5bff1ec4 authored by zhoujun's avatar zhoujun

预警

parent a17c5cb9
Pipeline #2096 passed with stage
in 0 seconds
<?php
/**
* curl方法
* @param $object
* @return array
*/
if(!function_exists('postCurlJson')){
function postCurlJson($url, $data,$headers = [], $timeout = 30){
try {
$requestHeader[] = "API-RemoteIP: ";
$requestHeader[] = "Content-type: application/json";
$curl = curl_init();
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER,$requestHeader);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$timeout = intval ( $timeout ) ? intval ( $timeout ) : 30;
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 0);
$result = curl_exec($curl);
curl_close($curl);
return $result;
} catch (exception $e) {
throw new Exception($e->getMessage());
}
}
}
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Facades\Util\Log;
use App\Services\Script\IScriptService;
class ClearLogData extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ClearLogData';
/**
* The console command description.
*
* @var string
*/
protected $description = '定时清理历史数据';
/**
* @var ActivityOrder
*/
private $scriptService;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public function __construct(IScriptService $scriptService)
{
parent::__construct();
$this->scriptService = $scriptService;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
set_time_limit(0);
$this->line('开始');
$this->scriptService->getClearLogData();
$this->line('结束');
}
}
\ No newline at end of file
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Facades\Util\Log;
use App\Services\Script\IScriptService;
class PolymerizeWithdrawal extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'PolymerizeWithdrawal';
/**
* The console command description.
*
* @var string
*/
protected $description = '聚合玩家提现数据';
/**
* @var ActivityOrder
*/
private $scriptService;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public function __construct(IScriptService $scriptService)
{
parent::__construct();
$this->scriptService = $scriptService;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
set_time_limit(0);
$this->line('开始');
$this->scriptService->getPolymerizeWithdrawal();
$this->line('结束');
}
}
\ No newline at end of file
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Facades\Util\Log;
use App\Services\Script\IScriptService;
class SendDDMsg extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'SendDDMsg';
/**
* The console command description.
*
* @var string
*/
protected $description = '发送钉钉消息';
/**
* @var ActivityOrder
*/
private $scriptService;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public function __construct(IScriptService $scriptService)
{
parent::__construct();
$this->scriptService = $scriptService;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
set_time_limit(0);
$this->line('开始');
$this->scriptService->getSendDDMsg();
$this->line('结束');
}
}
\ No newline at end of file
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Facades\Util\Log;
use App\Services\Script\IScriptService;
class SingleDayWithdrawal extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'SingleDayWithdrawal';
/**
* The console command description.
*
* @var string
*/
protected $description = '单日提现预警';
/**
* @var ActivityOrder
*/
private $scriptService;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public function __construct(IScriptService $scriptService)
{
parent::__construct();
$this->scriptService = $scriptService;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
set_time_limit(0);
$this->line('开始');
$this->scriptService->getSingleDayWithdrawal();
$this->line('结束');
}
}
\ No newline at end of file
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Facades\Util\Log;
use App\Services\Script\IScriptService;
class SingleUserDayWithdrawal extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'SingleUserDayWithdrawal';
/**
* The console command description.
*
* @var string
*/
protected $description = '单日单用户提现预警';
/**
* @var ActivityOrder
*/
private $scriptService;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public function __construct(IScriptService $scriptService)
{
parent::__construct();
$this->scriptService = $scriptService;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
set_time_limit(0);
$this->line('开始');
$this->scriptService->getSingleUserDayWithdrawal();
$this->line('结束');
}
}
\ No newline at end of file
......@@ -12,7 +12,13 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
'App\Console\Commands\ClearLogData',
'App\Console\Commands\SingleWithdrawal',
'App\Console\Commands\PolymerizeWithdrawal',
'App\Console\Commands\SingleDayWithdrawal',
'App\Console\Commands\SingleUserDayWithdrawal',
'App\Console\Commands\SendDDMsg',
];
/**
......@@ -23,7 +29,14 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('SingleWithdrawal')->everyMinute()->withoutOverlapping();//每分钟跑一次
$schedule->command('ClearLogData')->dailyAt('3:00')->withoutOverlapping();//每天凌晨3:00点钟跑一次
$schedule->command('SingleWithdrawal')->everyFiveMinutes()->withoutOverlapping();//每5分钟跑一次
$schedule->command('PolymerizeWithdrawal')->everyFiveMinutes()->withoutOverlapping();//每5分钟跑一次
$schedule->command('SingleDayWithdrawal')->everyFiveMinutes()->withoutOverlapping();//每5分钟跑一次
$schedule->command('SingleUserDayWithdrawal')->everyFiveMinutes()->withoutOverlapping();//每5分钟跑一次
$schedule->command('SendDDMsg')->everyMinute()->withoutOverlapping();//每分钟跑一次
}
/**
......
......@@ -2,11 +2,9 @@
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserCashModel extends BaseModel
{
use SoftDeletes;
protected $connection = 'mysql';
protected $table = 'club_user_cash';
}
\ No newline at end of file
......@@ -2,11 +2,9 @@
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
class WarnWaitModel extends BaseModel
{
use SoftDeletes;
protected $connection = 'mysql';
protected $table = 'club_warn_wait';
}
\ No newline at end of file
......@@ -4,4 +4,14 @@ namespace App\Services\Script;
interface IScriptService
{
public function getSingleWithdrawal();//单次最高提现预警
public function getPolymerizeWithdrawal();//聚合玩家提现数据
public function getClearLogData();//清理历史数据
public function getSingleDayWithdrawal();//单日最高提现预警
public function getSingleUserDayWithdrawal();//单日单用户最高提现预警
public function getSendDDMsg();//发送钉钉消息
}
This diff is collapsed.
......@@ -38,6 +38,9 @@
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"app/Common/Common.php"
]
},
"autoload-dev": {
......
......@@ -13,4 +13,7 @@ return [
'CURRENCY' => [
'1' => '元宝'
],
'DINGDING_URL' => 'http://api.srccwl.com/dingding/send_message',
'DINGDING_TOKEN' => 'qPf99DyrCgdSSrJFbhwYHOPEv66HE02FAJy2x3KTx65BfLHbxNlue1Nbbmu5',
];
\ No newline at end of file
......@@ -13,4 +13,7 @@ return [
'CURRENCY' => [
'1' => '元宝'
],
'DINGDING_URL' => 'http://api.srccwl.com/dingding/send_message',
'DINGDING_TOKEN' => 'qPf99DyrCgdSSrJFbhwYHOPEv66HE02FAJy2x3KTx65BfLHbxNlue1Nbbmu5',
];
\ 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