ImportFailLogController.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace addons\CardSecret\backend\controllers;
  3. use addons\CardSecret\common\models\CardSecretImportFailLog;
  4. use addons\CardSecret\common\models\Cate;
  5. use common\enums\StatusEnum;
  6. use Yii;
  7. use yii\db\Exception;
  8. /**
  9. * 默认控制器
  10. *
  11. * Class DefaultController
  12. * @package addons\CardSecret\backend\controllers
  13. */
  14. class ImportFailLogController extends BaseController
  15. {
  16. public $enableCsrfValidation = false;
  17. /**
  18. * 首页
  19. *
  20. * @return string
  21. */
  22. public function actionIndex()
  23. {
  24. $retuest = Yii::$app->request;
  25. if ($retuest->isAjax) {
  26. if ($retuest->isGet) {
  27. $get = Yii::$app->request->get();
  28. // 检查提交的参数
  29. $res = Yii::$app->services->validate->validate($get,[
  30. [['id','import_id'], 'safe'],
  31. [['limit'],'default','value' => '15'],
  32. ]);
  33. if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  34. $where = [];
  35. if(!empty($get['keyword'])) $where[] = ['like', 'name', $get['keyword']];
  36. $where[] = ['=', 'mall_id', $this->mall_id];
  37. $where[] = ['=', 'import_id', $get['import_id']];
  38. $where[] = ['>=', 'status', StatusEnum::DISABLED];
  39. $order = 'id desc';
  40. $params = array('where' => $where, 'order'=>$order, 'limit' => $get['limit']);
  41. $list = CardSecretImportFailLog::listPage($params, false, true);
  42. $this->success('获取成功', $list);
  43. }
  44. } else {
  45. return $this->render($this->action->id);
  46. }
  47. }
  48. }