| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace addons\Happiness\console\controllers;
- use addons\Happiness\common\logic\weight\PoolLogLogic;
- use addons\Happiness\common\service\CommissionService;
- use addons\Happiness\common\service\PensionService;
- use common\models\mall\Mall;
- use yii\console\Controller;
- use yii\console\ExitCode;
- use yii;
- class IndexController extends Controller
- {
- public function actionSendCommission()
- {
- try {
- $malls = Mall::getEnableMallList();
- $service=new CommissionService();
- if(!empty($malls))
- {
- foreach ($malls as $mall)
- {
- $mall_id = $mall['id'];
- $service->jobSend($mall_id);
- }
- }
- return ExitCode::OK;
- }
- catch (\Exception $e) {
- echo $e->getMessage();
- $this->stderr('Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
- return ExitCode::UNSPECIFIED_ERROR;
-
- }
-
- }
- public function actionSendPension()
- {
- try {
- $malls = Mall::getEnableMallList();
- $service=new PensionService();
- if(!empty($malls))
- {
- foreach ($malls as $mall)
- {
- $mall_id = $mall['id'];
- $service->jobSend($mall_id);
- }
- }
- return ExitCode::OK;
- }
- catch (\Exception $e) {
- echo $e->getMessage();
- $this->stderr('Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
- return ExitCode::UNSPECIFIED_ERROR;
- }
- }
- /**
- * 自动发放加权分红佣金定时任务
- * 0 20 0 * * * *
- * @return int
- */
- public function actionPoolRun(){
- try {
- $logic = new PoolLogLogic();
- $res = $logic->execute();
- if($res == true) {
- echo '操作成功';
- return ExitCode::OK;
- }
- } catch (\Exception $e) {
- echo $e->getMessage();
- $this->stderr('Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
- return ExitCode::UNSPECIFIED_ERROR;
- }
- }
- }
|