| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- /**
- * Created by PhpStorm.
- * User: leo
- * Date: 2018/3/9
- * Time: 上午11:56
- */
- namespace console\controllers;
- use backendApi\modules\v1\models\lists\atlas\EmpUserList;
- use backendApi\modules\v1\models\lists\atlas\NetworkLineList;
- use backendApi\modules\v1\models\lists\atlas\NetworkList;
- use backendApi\modules\v1\models\lists\atlas\RelationList;
- use common\libs\export\module\AtlasExport;
- use Yii;
- class AtlasController extends BaseController {
- /**
- * 开拓网络列表导出
- * @param $taskId
- * @return bool
- */
- public function actionRelationListExport($taskId) {
- $factory = AtlasExport::factory($taskId);
- $factory->listModelClass = RelationList::class;
- try {
- if ($factory->generate()) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '开拓网络列表导出成功');
- }
- unset($factory);
- return true;
- } catch (\Exception $e) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '开拓网络列表导出失败。详情:' . $e->getMessage(), false);
- }
- // 记录日志
- // $logApiSystem = new ApiSystem();
- // $logApiSystem->setRequestContent($params)->setResponseContent($exportForm->getErrors())->saveByConsole([
- // 'apiName' => '开拓网络列表导出',
- // 'optType' => ApiSystem::OPT_TYPE_CALL
- // ]);
- unset($factory);
- return false;
- }
- /**
- * 安置网络列表导出
- * @param $taskId
- * @return bool
- */
- public function actionNetworkListExport($taskId) {
- $factory = AtlasExport::factory($taskId);
- $factory->listModelClass = NetworkList::class;
- try {
- if ($factory->generate()) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '安置网络列表导出成功');
- }
- unset($factory);
- return true;
- } catch (\Exception $e) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '安置网络列表导出失败。详情:' . $e->getMessage(), false);
- }
- unset($factory);
- return false;
- }
- /**
- * 安置链路列表导出
- * @param $taskId
- * @return bool
- */
- public function actionNetworkLineListExport($taskId) {
- $factory = AtlasExport::factory($taskId);
- $factory->listModelClass = NetworkLineList::class;
- try {
- if ($factory->generate()) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '安置链路列表导出成功');
- }
- unset($factory);
- return true;
- } catch (\Exception $e) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '安置链路列表导出失败。详情:' . $e->getMessage(), false);
- }
- unset($factory);
- return false;
- }
- /**
- * 聘级网络列表导出
- * @param $taskId
- * @return bool
- */
- public function actionEmpUserListExport($taskId) {
- $factory = AtlasExport::factory($taskId);
- $factory->listModelClass = EmpUserList::class;
- try {
- if ($factory->generate()) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '聘级网络列表导出成功');
- }
- unset($factory);
- return true;
- } catch (\Exception $e) {
- Yii::$app->swooleAsyncTimer->pushAsyncResultToAdmin($factory->getUserId(), '聘级网络列表导出失败。详情:' . $e->getMessage(), false);
- }
- unset($factory);
- return false;
- }
- }
|