UserPerfList.php 3.9 KB

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