| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?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\DecLevelLog;
- use common\models\User;
- use common\models\UserInfo;
- use common\libs\dataList\column\DateTime;
- use common\models\UserMove;
- use Yii;
- class DecLevelList extends \common\libs\dataList\DataList implements DataListInterface
- {
- /**
- * 列表名称
- * @return string
- */
- public function getListName(){
- return '会员级别调整列表';
- }
- /**
- * 列表筛选到的数据
- */
- public function dataHandle()
- {
- $this->listData = DecLevelLog::lists($this->condition, $this->params, [
- 'select' => 'LL.*, CU.USER_NAME, ADM.ADMIN_NAME',
- 'orderBy' => 'LL.CREATED_AT DESC, LL.ID DESC',
- 'from' => DecLevelLog::tableName() . ' AS LL',
- 'join' => [
- ['LEFT JOIN', Admin::tableName() . ' AS ADM', 'LL.ADMIN_ID=ADM.ID'],
- ['INNER JOIN', User::tableName() . ' AS CU', 'LL.USER_ID=CU.ID'],
- ],
- 'page' => $this->page,
- 'pageSize' => $this->pageSize,
- ]);
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn(){
- $decLevelConfig = Cache::getDecLevelConfig();
- if(!$this->columns){
- $this->columns = [
- 'ID' => null,
- 'USER_ID' => null,
- 'USER_NAME' => [
- 'header' => Yii::t('ctx', 'memberCode'),
- 'headerOther' => ['minWidth' => '120'],
- ],
- 'FROM_DEC_LV_NAME' => [
- 'header' => Yii::t('ctx', 'levelBeforeModification'),
- 'headerOther' => ['minWidth' => '110'],
- 'value' => function($row) use($decLevelConfig) {
- return $decLevelConfig[$row['FROM_ID']]['LEVEL_NAME'];
- },
- 'valueOther' => [
- 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'TO_DEC_LV_NAME' => [
- 'header' => Yii::t('ctx', 'modifiedLevel'),
- 'headerOther' => ['minWidth' => '120'],
- 'value' => function($row) use($decLevelConfig) {
- return isset($decLevelConfig[$row['TO_ID']])?$decLevelConfig[$row['TO_ID']]['LEVEL_NAME']:'';
- },
- 'valueOther' => [
- 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'ADMIN_NAME' => [
- 'header' => Yii::t('ctx', 'operationAdministrator'),
- 'headerOther' => ['minWidth' => '100'],
- ],
- 'CREATED_AT' => [
- 'header' => Yii::t('ctx', 'createAt'),
- 'value' => function($row) {
- return (new DateTime([
- 'value' => $row['CREATED_AT'],
- ]))->result();
- },
- 'headerOther' => ['minWidth' => '100'],
- ],
- ];
- }
- 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;
- }
- }
|