diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php index 62c10f21a..787594709 100644 --- a/Application/Admin/Controller/ConsoleController.class.php +++ b/Application/Admin/Controller/ConsoleController.class.php @@ -94,7 +94,7 @@ class ConsoleController extends Think { } } - public function runTask($queue = 'common', $count = 1) + public function runTask($queue = 'common', $count = 10) { Printer::export($queue); Printer::export($count); @@ -109,7 +109,7 @@ class ConsoleController extends Think { public function addTask() { - $id = M('market_shift', 'tab_')->add([ + /* $id = M('market_shift', 'tab_')->add([ 'from_id' => 1, 'to_id' => 2, 'split_time' => 0, @@ -117,8 +117,10 @@ class ConsoleController extends Think { ]); $params = [ 'market_shift_id' => $id - ]; - Task::add('market-shift', $params); + ]; */ + for ($i=0; $i<50; $i++) { + Task::add('test', ['value' => $i]); + } } public function initMarketAdmin() diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index 43e4699d5..24a0b62f3 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -127,7 +127,10 @@ class FinancePromoteController extends AdminController ); $promotes = []; if (count($senddata) > 0) { - $promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', array_column($senddata, 'p_id')]])->select(); + $promoteIds = array_column($senddata, 'p_id'); + if ($promoteIds) { + $promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', $promoteIds]])->select(); + } } $promotes = index_by_column('id', $promotes); $adminUsernames = getAdminUsernameList(array_column($promotes, 'admin_id')); @@ -355,7 +358,10 @@ class FinancePromoteController extends AdminController $promotes = []; if (count($senddata) > 0) { - $promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', array_column($senddata, 'promote_id')]])->select(); + $promoteIds = array_column($senddata, 'promote_id'); + if (count($promoteIds)) { + $promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', $promoteIds]])->select(); + } } $promotes = index_by_column('id', $promotes); $adminUsernames = getAdminUsernameList(array_column($promotes, 'admin_id')); @@ -507,7 +513,10 @@ class FinancePromoteController extends AdminController } $promotes = []; if (count($data) > 0) { - $promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', array_column($data, 'p_id')]])->select(); + $promoteIds = array_column($data, 'p_id'); + if (count($promoteIds) > 0) { + $promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', $promoteIds]])->select(); + } } $promotes = index_by_column('id', $promotes); $adminUsernames = getAdminUsernameList(array_column($promotes, 'admin_id')); diff --git a/Application/Base/Task/Task.class.php b/Application/Base/Task/Task.class.php index b2b91e0a2..902f5ad97 100644 --- a/Application/Base/Task/Task.class.php +++ b/Application/Base/Task/Task.class.php @@ -9,10 +9,11 @@ class Task { public static $types = [ 'market-shift' => '\Base\Task\MarketShiftTask', + 'test' => '\Base\Task\TestTask', ]; public static $queues = [ - 'common' => [], + 'common' => ['test'], 'market-shift' => ['market-shift'] ]; diff --git a/Application/Base/Task/TestTask.class.php b/Application/Base/Task/TestTask.class.php new file mode 100644 index 000000000..f4f8894f6 --- /dev/null +++ b/Application/Base/Task/TestTask.class.php @@ -0,0 +1,17 @@ + + */ +class TestTask extends BaseTask +{ + public function run() + { + echo '测试' . $this->params['value'] . '执行成功'; + echo PHP_EOL; + } +} \ No newline at end of file