| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\process\dataReport;
- use app\v1\logic\tool\dataReport\GameRegPayDayDataReportLogic;
- use app\v1\logic\tool\dataReport\GameRegPayMonthDataReportLogic;
- use Workerman\Crontab\Crontab;
- /**
- * 注册付费按月
- */
- class GameRegPay
- {
- public function onWorkerStart(): void
- {
- // 每2小时执行一次
- new Crontab('0 */2 * * *', function() {
- (new GameRegPayMonthDataReportLogic())->run();
- });
- // 每5分钟执行一次
- new Crontab('0 */5 * * * *', function() {
- (new GameRegPayDayDataReportLogic())->run();
- });
- }
- // {"date":["2025-06-25","2025-06-26"]}
- public function run($args)
- {
- $params = $args ? json_decode($args, true) : [];
- if(!empty($params["type"]) && $params["type"] == "month"){
- return (new GameRegPayMonthDataReportLogic())->run($params);
- }
- if(!empty($params["type"]) && $params["type"] == "day"){
- return (new GameRegPayDayDataReportLogic())->run($params);
- }
- return "无执行内容";
- }
- }
|