listData = User::lists($this->condition, $this->params, [ 'select' => 'UM.*, CU.USER_NAME MOVE_USER_NAME,CU.REAL_NAME MOVE_REAL_NAME,FUI.USER_NAME FROM_USER_NAME,TUI.USER_NAME TO_USER_NAME,ADMC.ADMIN_NAME MOVE_ADMIN_NAME,ADMU.ADMIN_NAME AUDIT_ADMIN_NAME ', 'orderBy' => 'UM.CREATED_AT DESC, UM.ID DESC', 'from' => UserMove::tableName() . ' AS UM', 'join' => [ ['LEFT JOIN', User::tableName() . ' AS CU', 'UM.USER_ID=CU.ID'], ['LEFT JOIN', UserInfo::tableName() . ' AS FUI', 'UM.FROM_UID=FUI.USER_ID'], ['LEFT JOIN', UserInfo::tableName() . ' AS TUI', 'UM.TO_UID=TUI.USER_ID'], ['LEFT JOIN', Admin::tableName() . ' AS ADMC', 'UM.MOVE_ADMIN_ID=ADMC.ID'], ['LEFT JOIN', Admin::tableName() . ' AS ADMU', 'UM.AUDIT_ADMIN_ID=ADMU.ID'], ], 'page' => $this->page, 'pageSize' => $this->pageSize, ]); } /** * 要展示和导出的所有字段 * @return array */ public function getColumn(){ if(!$this->columns){ $this->columns = [ 'ID' => null, 'USER_ID' => null, 'MOVE_USER_NAME' => [ 'header' => Yii::t('ctx', 'moveMember'), 'headerOther' => ['width' => '120'], ], 'MOVE_REAL_NAME' => [ 'header' => Yii::t('ctx', 'moveMemberName'), 'headerOther' => ['width' => '200'], 'valueOther' => [ 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border'] ], ], 'FROM_USER_NAME' => [ 'header' => Yii::t('ctx', 'uperCodeBeforeMoving'), 'headerOther' => ['width' => '120'], ], 'TO_USER_NAME' => [ 'header' => Yii::t('ctx', 'uperCodeAfterMoving'), 'headerOther' => ['width' => '120'], ], 'TYPE' => [ 'header' => Yii::t('ctx', 'typeOfMoving'), 'headerOther' => ['width' => '120'], 'value' => function($row) { return $row['TYPE'] == UserMove::TYPE_NETWORK ? Yii::t('ctx', 'placementNetwork') : Yii::t('ctx', 'sponsorNetwork'); }, ], 'LOCATION' => [ 'header' => Yii::t('ctx', 'position'), 'headerOther' => ['width' => '100'], 'value' => function($row) { return $row['LOCATION'] == 1 ? Yii::t('ctx', 'I.Market') : Yii::t('ctx', 'II.Market'); }, ], 'PERIOD_NUM' => [ 'header' => Yii::t('ctx', 'periodOfMoving'), 'headerOther' => ['width' => '130'], ], 'IS_MOVING' => [ 'header' => Yii::t('ctx', 'whetherToMove'), 'headerOther' => ['width' => '130'], ], 'MOVE_PERCENT' => [ 'header' => Yii::t('ctx', 'percentage'), 'headerOther' => ['width' => '100'], ], 'MOVE_ADMIN_NAME' => [ 'header' => Yii::t('ctx', 'AdministratorOfMoving'), 'headerOther' => ['width' => '180'], ], 'CREATED_AT' => [ 'header' => Yii::t('ctx', 'joiningDate'), 'value' => function($row) { return (new DateTime([ 'value' => $row['CREATED_AT'], ]))->result(); }, 'headerOther' => ['width' => '170'], ], 'AUDIT_STATUS' => null, 'AUDIT_STATUS_NAME' => [ 'header' => Yii::t('ctx', 'status'), 'headerOther' => ['width' => '100'], 'value' => function ($row) { return UserMove::getStatusName()[$row['AUDIT_STATUS']]; }, ], 'AUDIT_ADMIN_NAME' => [ 'header' => Yii::t('ctx', 'administratorOfReviewing'), 'headerOther' => ['width' => '150'], ], 'AUDITED_AT' => [ 'header' => Yii::t('ctx', 'reviewTime'), 'value' => function ($row) { return (new DateTime([ 'value' => $row['AUDITED_AT'], ]))->result(); }, 'headerOther' => ['width' => '150'], ], ]; } return $this->columns; } /** * 前台用于筛选的类型集合 * @return mixed */ public function getFilterTypes() { if(!$this->filterTypes){ $this->filterTypes = [ 'MOVE_USER_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'moveMember')], 'MOVE_REAL_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'moveMemberName')], 'filterStatus'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'status')], 'PERIOD_NUM'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'periodOfMoving')], 'MOVE_ADMIN_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'AdministratorOfMoving')], // 移网管理员 'AUDIT_ADMIN_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'administratorOfReviewing')], // 审核管理员 'AUDITED_AT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'reviewTime'), 'other' => 'Review Time'], // 审核时间 ]; } return $this->filterTypes; } }