| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <?php
- namespace backendApi\modules\v1\models\lists\bonus;
- use common\helpers\Cache;
- use common\helpers\Tool;
- use common\helpers\user\Info;
- use common\libs\dataList\column\Price;
- use common\libs\dataList\DataListInterface;
- use common\models\CalcBonus;
- use common\models\UserInfo;
- use common\libs\dataList\column\DateTime;
- use Yii;
- class PeriodBonusList extends \common\libs\dataList\DataList implements DataListInterface
- {
- /**
- * 列表名称
- * @return string
- */
- public function getListName(){
- return '奖金列表';
- }
- /**
- * 列表筛选到的数据
- * @throws \yii\base\Exception
- */
- public function dataHandle()
- {
- $yearMonth = $this->others['yearMonth'];
- $this->listData = CalcBonus::lists($this->condition, $this->params, [
- 'select'=>'CB.*,UI.CON_UID,UI.REC_UID',
- 'from' => CalcBonus::tableName().' AS CB',
- 'join' => [
- ['INNER JOIN', UserInfo::tableName() . ' AS UI', 'CB.USER_ID=UI.USER_ID'],
- ],
- 'yearMonth' => $yearMonth,
- 'orderBy' => 'CB.CREATED_AT DESC, CB.ID DESC',
- 'page' => $this->page,
- 'pageSize' => $this->pageSize,
- ]);
- unset($yearMonth);
- if ($this->listData['list']) {
- foreach ($this->listData['list'] as $key => $value) {
- $this->listData['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_DEC_LV']]['LEVEL_NAME'];
- $this->listData['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_EMP_LV']]['LEVEL_NAME'];
- $this->listData['list'][$key]['LAST_ELITE_LV_NAME'] = Cache::getEliteLevelConfig()[$value['LAST_ELITE_LV']]['LEVEL_NAME'];
- $this->listData['list'][$key]['LAST_STATUS_NAME'] = Tool::paramConvert(Yii::$app->params['userStatus'])[$value['LAST_STATUS']]['label'];
- $this->listData['list'][$key]['LAST_REC_USER_NAME'] = Info::getUserNameByUserId($value['REC_UID']);
- $this->listData['list'][$key]['LAST_REC_REAL_NAME'] = Info::getUserRealNameByUserId($value['REC_UID']);
- $this->listData['list'][$key]['LAST_CON_USER_NAME'] = Info::getUserNameByUserId($value['CON_UID']);
- $this->listData['list'][$key]['LAST_CON_REAL_NAME'] = Info::getUserRealNameByUserId($value['CON_UID']);
- }
- }
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn(){
- if(!$this->columns){
- $this->columns = [
- 'ID' => null,
- 'PERIOD_NUM' => [
- 'header' => \Yii::t('ctx', 'payCycle'), // 结算期数
- 'headerOther' => [
- 'width' => '150',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'', 'size' => 'small', 'class'=>'no-border'],
- ],
- ],
- 'CALCULATED_AT' => [
- 'header' => \Yii::t('ctx', 'bonusDate'), // 结算时间
- 'value' => function($row) {
- return (new DateTime([
- 'value' => $row['CALCULATED_AT'],
- ]))->result();
- },
- 'headerOther' => ['width' => '170'],
- ],
- 'LAST_USER_NAME' => [
- 'header' => \Yii::t('ctx', 'memberCode'), // 会员编号
- 'headerOther' => [
- 'width' => '150',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'LAST_REAL_NAME' => [
- 'header' => \Yii::t('ctx', 'memberName'), // 会员姓名
- 'headerOther' => [
- 'width' => '120',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'LAST_DEC_LV_NAME' => [
- 'header' => \Yii::t('ctx', 'PCMemberLevel'), // 结算时会员级别
- 'headerOther' => [
- 'width' => '140',
- ],
- ],
- 'LAST_EMP_LV_NAME' => [
- 'header' => \Yii::t('ctx', 'latestDirector'), // 结算时会员最新管理星级
- 'headerOther' => [
- 'width' => '140',
- ],
- ],
- 'LAST_ELITE_LV_NAME' => [
- 'header' => \Yii::t('ctx', 'latestElite'), // 结算时会员最新ELite
- 'headerOther' => [
- 'width' => '140',
- ],
- ],
- 'LAST_MOBILE' => [
- 'header' => \Yii::t('ctx', 'phoneNumber'),//手机号码
- 'headerOther' => [
- 'width' => '120',
- ],
- ],
- 'LAST_PERIOD_AT' => [
- 'header' => Yii::t('ctx', 'joiningPeriod'), // 加入期数
- 'headerOther' => [
- 'width' => '110',
- ],
- ],
- 'LAST_CREATED_AT' => [
- 'header' => Yii::t('ctx', 'joiningDate'), // 加入时间
- 'value' => function($row) {
- return (new DateTime([
- 'value' => $row['LAST_CREATED_AT'],
- ]))->result();
- },
- 'headerOther' => ['width' => '170'],
- ],
- 'LAST_REC_USER_NAME' => [
- 'header' => Yii::t('ctx', 'sponsorNo'), // 开拓者编号
- 'headerOther' => [
- 'width' => '150',
- ],
- ],
- 'LAST_REC_REAL_NAME' => [
- 'header' => Yii::t('ctx', 'sponsorName'), // 开拓者姓名
- 'headerOther' => [
- 'width' => '120',
- ],
- ],
- 'CALC_MONTH' => [
- 'header' => Yii::t('ctx', 'bonusMonth'), // 结算月
- 'headerOther' => [
- 'width' => '110',
- ],
- ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes()
- {
- if(!$this->filterTypes){
- $this->filterTypes = [
- 'LAST_USER_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'memberCode')], // 会员编号
- 'LAST_REAL_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'memberName')], // 会员姓名
- 'LAST_DEC_LV_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'PCMemberLevel'), 'other'=> 'decLevel'], // 结算时会员级别
- 'LAST_EMP_LV_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'latestDirector'), 'other'=> 'empLevel'], // 结算时会员管理星级
- 'LAST_ELITE_LV_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'latestElite'), 'other'=> 'elite'], // 结算时会员Elite
- 'LAST_MOBILE'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'phoneNumber')], // 手机号
- 'LAST_PERIOD_AT'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'joiningPeriod')], // 加入期数
- 'LAST_CREATED_AT'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'joiningDate'), 'other'=> 'date'], // 加入时间
- 'CALCULATED_AT'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'date'), 'other'=> 'date'], // 备份时间
- 'LAST_REC_USER_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'sponsorNo')], // 开拓者编号
- 'LAST_REC_REAL_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'sponsorName')], // 开拓者姓名
- 'LAST_CON_USER_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'superiorNumber')], // 上级编号
- 'LAST_CON_REAL_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'superiorName')], // 上级姓名
- 'CALC_MONTH'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'bonusMonth')], // 结算月
- ];
- }
- return $this->filterTypes;
- }
- }
|