| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace backendApi\modules\v1\models\lists\user;
- use backendApi\modules\v1\models\Admin;
- use common\helpers\Cache;
- use common\libs\dataList\DataListInterface;
- use common\models\Countries;
- use common\models\HighestEmpLevelLog;
- use common\models\User;
- use common\libs\dataList\column\DateTime;
- use common\models\UserImmigrant;
- use Yii;
- class ImmigrantList extends \common\libs\dataList\DataList implements DataListInterface
- {
- /**
- * 列表名称
- * @return string
- */
- public function getListName(){
- return '会员移民列表';
- }
- /**
- * 列表筛选到的数据
- */
- public function dataHandle()
- {
- $this->listData = UserImmigrant::lists($this->condition, $this->params, [
- 'select' => 'UI.*, CU.USER_NAME, ADM.ADMIN_NAME, BC.NAME AS before_country, AC.NAME AS after_country',
- 'orderBy' => 'UI.CREATED_AT DESC, UI.id DESC',
- 'from' => UserImmigrant::tableName() . ' AS UI',
- 'join' => [
- ['INNER JOIN', Admin::tableName() . ' AS ADM', 'UI.created_by=ADM.ID'],
- ['INNER JOIN', User::tableName() . ' AS CU', 'UI.user_id=CU.ID'],
- ['INNER JOIN', Countries::tableName() . ' AS BC', 'UI.before_country_id=CU.ID'],
- ['INNER JOIN', Countries::tableName() . ' AS AC', 'UI.after_country_id=CU.ID'],
- ],
- 'page' => $this->page,
- 'pageSize' => $this->pageSize,
- ]);
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn() {
- if (!$this->columns) {
- $this->columns = [
- 'id' => null,
- 'user_id' => null,
- 'USER_NAME' => [
- 'header' => Yii::t('ctx', 'memberCode'),
- ],
- 'before_country' => [
- 'header' => Yii::t('ctx', 'beforeCountry'),
- 'valueOther' => [
- 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'after_country' => [
- 'header' => Yii::t('ctx', 'afterCountry'),
- 'valueOther' => [
- 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'ADMIN_NAME' => [
- 'header' => Yii::t('ctx', 'operationAdministrator'),
- ],
- 'CREATED_AT' => [
- 'header' => Yii::t('ctx', 'createAt'),
- 'value' => function($row) {
- return (new DateTime([
- 'value' => $row['CREATED_AT'],
- ]))->result();
- },
- ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes()
- {
- if (!$this->filterTypes) {
- $this->filterTypes = [
- 'USER_NAME'=> ['isUserTable' => false, 'name'=> Yii::t('ctx', 'memberCode')],
- 'CREATED_AT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'createAt'), 'other' => 'date'],
- 'ADMIN_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'operationAdministrator')],
- ];
- }
- return $this->filterTypes;
- }
- }
|