| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * Created by PhpStorm.
- * User: leo
- * Date: 2018/3/9
- * Time: 上午11:56
- */
- namespace console\controllers;
- use backendApi\modules\v1\models\lists\finance\RechargeList;
- use common\libs\export\module\ReconsumeExport;
- use Yii;
- class ReconsumeController extends BaseController {
- // /**
- // * 复销池余额列表导出
- // * @param $taskId
- // * @return bool
- // */
- // public function actionPoolListExport($taskId) {
- // return $this->_export($taskId, PoolList::class, '复销池余额列表');
- // }
- //
- // /**
- // * 复销余额调整审核列表导出
- // * @param $taskId
- // * @return bool
- // */
- // public function actionChangeAuditListExport($taskId) {
- // return $this->_export($taskId, ReconsumeAuditList::class, '复销余额调整审核列表');
- // }
- //
- // /**
- // * 复销流水导出
- // * @param $taskId
- // * @return bool
- // */
- // public function actionFlowListExport($taskId) {
- // return $this->_export($taskId, FlowList::class, '复销流水');
- // }
- /**
- * 导出方法
- * @param $taskId
- * @param $className
- * @param $listName
- * @return bool
- */
- private function _export($taskId, $className, $listName){
- $factory = ReconsumeExport::factory($taskId);
- $factory->listModelClass = $className;
- try {
- if ($factory->generate()) {
- \Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), $listName.'导出成功');
- }
- unset($factory, $taskId, $className, $listName);
- return true;
- } catch (\Exception $e) {
- \Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), $listName.'导出失败。详情:' . $e->getMessage(), false);
- }
- unset($factory, $taskId, $className, $listName);
- return false;
- }
- }
|