UserPerfList.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\bonus;
  3. use common\helpers\Cache;
  4. use common\helpers\user\Info;
  5. use common\models\Countries;
  6. use common\models\PerfMonth;
  7. use common\models\User as modelUser;
  8. use common\libs\dataList\column\Price;
  9. use common\libs\dataList\DataListInterface;
  10. use common\libs\dataList\column\DateTime;
  11. use common\models\UserInfo;
  12. use common\models\UserPerf;
  13. use Yii;
  14. class UserPerfList extends \common\libs\dataList\DataList implements DataListInterface
  15. {
  16. /**
  17. * 列表名称
  18. * @return string
  19. */
  20. public function getListName(){
  21. return '用户业绩列表';
  22. }
  23. /**
  24. * 列表筛选到的数据
  25. * @throws \yii\base\Exception
  26. */
  27. public function dataHandle()
  28. {
  29. $data = UserPerf::lists($this->condition, $this->params, [
  30. 'select'=>'UP.*, U.USER_NAME, U.REAL_NAME, C.NAME AS COUNTRY',
  31. 'from' => UserPerf::tableName().' AS UP',
  32. 'join' => [
  33. ['INNER JOIN', modelUser::tableName() . ' AS U', 'UP.USER_ID=U.ID'],
  34. ['INNER JOIN', Countries::tableName() . ' AS C', 'U.COUNTRY_ID=C.ID'],
  35. ],
  36. 'orderBy' => 'UP.ID DESC',
  37. 'page' => $this->page,
  38. 'pageSize' => $this->pageSize,
  39. ]);
  40. $this->listData = $data;
  41. }
  42. /**
  43. * 要展示和导出的所有字段
  44. * @return array
  45. */
  46. public function getColumn(){
  47. if(!$this->columns){
  48. $this->columns = [
  49. 'USER_NAME' => [
  50. 'header' => Yii::t('ctx', 'memberCode'), // 会员编号
  51. 'headerOther' => [
  52. 'width' => '200',
  53. ],
  54. ],
  55. 'REAL_NAME' => [
  56. 'header' => Yii::t('ctx', 'memberName'), // 会员姓名
  57. 'headerOther' => [
  58. 'width' => '200',
  59. ],
  60. ],
  61. 'COUNTRY' => [
  62. 'header' => Yii::t('ctx', 'country'),
  63. ],
  64. 'PV_PCS' => [
  65. 'header' => Yii::t('ctx', 'personalPerformance'), // 个人业绩
  66. 'headerOther' => [
  67. 'width' => '180',
  68. ],
  69. 'value' => function($row) {
  70. return (new Price([
  71. 'value' => $row['PV_PCS_ZC'] + $row['PV_PCS_FX'],
  72. ]))->result();
  73. },
  74. ],
  75. // 'SURPLUS_1L' => [
  76. // 'header' => Yii::t('ctx', 'remainderLeftLeg'), // 一市场剩余业绩
  77. // 'headerOther' => [
  78. // 'width' => '240',
  79. // ],
  80. // 'value' => function($row) {
  81. // return (new Price([
  82. // 'value' => $row['SURPLUS_1L'],
  83. // ]))->result();
  84. // },
  85. // ],
  86. // 'SURPLUS_2L' => [
  87. // 'header' => Yii::t('ctx', 'remainderRightLeg'), // 二市场剩余业绩
  88. // 'headerOther' => [
  89. // 'width' => '240',
  90. // ],
  91. // 'value' => function($row) {
  92. // return (new Price([
  93. // 'value' => $row['SURPLUS_2L'],
  94. // ]))->result();
  95. // },
  96. // ],
  97. 'PV_PSS_TOTAL' => [
  98. 'header' => Yii::t('ctx', 'cumulativeTeamPerformance'), // 累计团队业绩
  99. 'headerOther' => [
  100. 'width' => '250',
  101. ],
  102. 'value' => function($row) {
  103. return (new Price([
  104. 'value' => $row['PV_PSS_TOTAL'],
  105. ]))->result();
  106. },
  107. ],
  108. ];
  109. }
  110. return $this->columns;
  111. }
  112. /**
  113. * 前台用于筛选的类型集合
  114. * @return mixed
  115. */
  116. public function getFilterTypes()
  117. {
  118. if(!$this->filterTypes){
  119. $this->filterTypes = [
  120. 'USER_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'memberCode')], // 会员编号
  121. ];
  122. }
  123. return $this->filterTypes;
  124. }
  125. }