| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- /**
- * Created by PhpStorm.
- * User: leo
- * Date: 2018/2/24
- * Time: 下午12:48
- */
- namespace backendApi\modules\v1\controllers;
- use backendApi\modules\v1\models\exportForms\BonusExportForm;
- use backendApi\modules\v1\models\exportForms\LogExportForm;
- use backendApi\modules\v1\models\lists\log\AdminHandleList;
- use backendApi\modules\v1\models\lists\log\AdminLoginList;
- use backendApi\modules\v1\models\lists\bonus\FlowLxList;
- use backendApi\modules\v1\models\lists\log\SystemList;
- use backendApi\modules\v1\models\lists\log\UserHandleList;
- use backendApi\modules\v1\models\lists\log\UserLoginList;
- use backendApi\modules\v1\models\LogAdminHandle;
- use backendApi\modules\v1\models\LogAdminLogin;
- use backendApi\modules\v1\models\LogSystem;
- use backendApi\modules\v1\models\LogUserHandle;
- use backendApi\modules\v1\models\LogUserLogin;
- use common\helpers\Form;
- use common\helpers\MongodbSearchFilter;
- use common\models\User;
- use Yii;
- class LogController extends BaseController {
- public $modelClass = User::class;
- /**
- * 管理员操作日志
- * @return mixed
- * @throws \yii\base\Exception
- * @throws \yii\web\HttpException
- */
- public function actionAdminHandle() {
- $listObj = new AdminHandleList();
- $data = $listObj->getList();
- return static::notice($data);
- }
- /**
- * 会员操作日志
- * @return mixed
- * @throws \yii\base\Exception
- * @throws \yii\web\HttpException
- */
- public function actionUserHandle() {
- $listObj = new UserHandleList();
- $data = $listObj->getList();
- return static::notice($data);
- }
- /**
- * 管理员登录日志
- * @return mixed
- * @throws \yii\base\Exception
- * @throws \yii\web\HttpException
- */
- public function actionAdminLogin() {
- $listObj = new AdminLoginList();
- $data = $listObj->getList();
- return static::notice($data);
- }
- /**
- * 会员登录日志
- * @return mixed
- * @throws \yii\base\Exception
- * @throws \yii\web\HttpException
- */
- public function actionUserLogin() {
- $listObj = new UserLoginList();
- $data = $listObj->getList();
- return static::notice($data);
- }
- /**
- * 会员登录日志导出
- * @return mixed
- * @throws \yii\db\Exception
- * @throws \yii\web\HttpException
- */
- public function actionUserLoginExport() {
- $filter = MongodbSearchFilter::filterCondition([
- 'opt_type' => 'opt_type',
- 'user_name' => 'user_name',
- 'success_times' => 'success_times',
- 'fail_times' => 'fail_times',
- 'created_at' => 'created_at',
- 'period_num' => 'period_num',
- 'device' => 'device',
- 'user_agent' => 'user_agent',
- 'request_route' => 'user_agent',
- ]);
- $form = new LogExportForm();
- $result = $form->run($filter, 'Member_Login_Log'); // 会员登录日志
- if (!$result) {
- return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
- }
- return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
- }
- /**
- * 系统日志
- * @return mixed
- * @throws \yii\base\Exception
- * @throws \yii\web\HttpException
- */
- public function actionSystem() {
- $listObj = new SystemList();
- $data = $listObj->getList();
- return static::notice($data);
- }
- }
|