listData = Transfer::lists($this->condition, $this->params, [ 'orderBy' => 'CREATED_AT DESC, ID DESC', 'from' => Transfer::tableName(), 'page' => $this->page, 'pageSize' => $this->pageSize, ]); foreach ($this->listData['list'] as $key => $value) { $this->listData['list'][$key]['LAST_OUT_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_OUT_DEC_LV']]['LEVEL_NAME'] ?? '';; $this->listData['list'][$key]['LAST_IN_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_IN_DEC_LV']]['LEVEL_NAME'] ?? ''; } } /** * 要展示和导出的所有字段 * @return array */ public function getColumn() { if (!$this->columns) { $this->columns = [ 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID 'TRANSFER_SN' => [ 'header' => 'Transfer record serial number', // 转账记录流水号 'headerOther' => [ 'width' => '250', ], 'valueOther' => function ($row) { return [ 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border'] ]; }, ], 'LAST_OUT_USER_NAME' => [ 'header' => 'Transfer out Member No', // 转出会员编号 'headerOther' => ['width' => '150'], ], 'LAST_OUT_REAL_NAME' => [ 'header' => 'Name of transfer out member', // 转出会员姓名 'headerOther' => [ 'width' => '120', ], ], 'LAST_OUT_DEC_LV_NAME' => [ 'header' => '转出主体会员级别', 'headerOther' => [ 'width' => '150', ], ], 'OUT_WALLET' => [ 'header' => '转出账户', 'value' => function ($row) { return Transfer::WALLET_NAME[$row['OUT_WALLET']]; }, 'headerOther' => [ 'width' => '150', ], ], 'LAST_IN_USER_NAME' => [ 'header' => '转入会员编号', 'headerOther' => ['width' => '150'], ], 'LAST_IN_REAL_NAME' => [ 'header' => '转入会员姓名', 'headerOther' => [ 'width' => '120', ], ], 'LAST_IN_DEC_LV_NAME' => [ 'header' => '转入主体级别', 'headerOther' => [ 'width' => '150', ], ], 'IN_WALLET' => [ 'header' => '转入账户', 'value' => function ($row) { return Transfer::WALLET_NAME[$row['IN_WALLET']]; }, 'headerOther' => [ 'width' => '150', ], ], 'ORI_AMOUNT' => [ 'header' => '转账金额', 'value' => function ($row) { return Tool::formatPrice($row['ORI_AMOUNT']); }, 'headerOther' => [ 'width' => '150', ], ], 'FEE' => [ 'header' => '手续费', 'value' => function ($row) { return Tool::formatPrice($row['FEE']); }, 'headerOther' => [ 'width' => '150', ], ], 'AMOUNT' => [ 'header' => '实际转入金额', 'value' => function ($row) { return Tool::formatPrice($row['AMOUNT']); }, 'headerOther' => [ 'width' => '150', ], 'valueOther' => function ($row) { return [ 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border'] ]; }, ], 'CREATED_AT' => [ 'header' => '转账时间', 'value' => function ($row) { return (new DateTime([ 'value' => $row['CREATED_AT'], ]))->result(); }, 'headerOther' => ['width' => '190'], ], 'PERIOD_NUM' => [ 'header' => '转账期数', 'headerOther' => [ 'width' => '150', ], ], 'REMARK' => [ 'header' => '备注', 'headerOther' => [ 'width' => '200', ], ], ]; } return $this->columns; } /** * 前台用于筛选的类型集合 * @return mixed */ public function getFilterTypes() { if (!$this->filterTypes) { $this->filterTypes = [ 'TRANSFER_SN' => ['isUserTable' => false, 'name' => '转账记录流水号'], 'LAST_OUT_USER_NAME' => ['isUserTable' => false, 'name' => '转出会员编号'], 'LAST_OUT_REAL_NAME' => ['isUserTable' => false, 'name' => '转出会员姓名'], 'LAST_OUT_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '转出主体会员级别', 'other' => 'decLevel'], 'OUT_WALLET' => ['isUserTable' => false, 'name' => '转出账户', 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]], 'LAST_IN_USER_NAME' => ['isUserTable' => false, 'name' => '转入会员编号'], 'LAST_IN_REAL_NAME' => ['isUserTable' => false, 'name' => '转入会员姓名'], 'LAST_IN_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '转入主体级别', 'other' => 'decLevel'], 'IN_WALLET' => ['isUserTable' => false, 'name' => '转入账户', 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]], 'ORI_AMOUNT' => ['isUserTable' => false, 'name' => '转账金额'], 'FEE' => ['isUserTable' => false, 'name' => '手续费'], 'AMOUNT' => ['isUserTable' => false, 'name' => '实际转入金额'], 'CREATED_AT' => ['isUserTable' => false, 'name' => '转账时间', 'other' => 'date'], 'PERIOD_NUM' => ['isUserTable' => false, 'name' => '转账期数'], 'REMARK' => ['isUserTable' => false, 'name' => '备注'], ]; } return $this->filterTypes; } }