MoveList.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\user;
  3. use backendApi\modules\v1\models\Admin;
  4. use common\helpers\Cache;
  5. use common\helpers\http\BackendToFrontendApi;
  6. use common\helpers\user\Info;
  7. use common\libs\dataList\DataListInterface;
  8. use common\models\DecRole;
  9. use common\models\OpenBank;
  10. use common\models\Region;
  11. use common\models\User;
  12. use common\models\UserInfo;
  13. use common\libs\dataList\column\DateTime;
  14. use common\libs\dataList\column\YesNo;
  15. use common\models\UserMove;
  16. use common\models\UserNetwork;
  17. use common\models\UserSystem;
  18. use Yii;
  19. class MoveList extends \common\libs\dataList\DataList implements DataListInterface
  20. {
  21. /**
  22. * 列表名称
  23. * @return string
  24. */
  25. public function getListName(){
  26. return '会员移网列表';
  27. }
  28. /**
  29. * 列表筛选到的数据
  30. */
  31. public function dataHandle()
  32. {
  33. $this->listData = User::lists($this->condition, $this->params, [
  34. 'select' => 'UM.*,
  35. CU.USER_NAME MOVE_USER_NAME,CU.REAL_NAME MOVE_REAL_NAME,FUI.USER_NAME FROM_USER_NAME,TUI.USER_NAME TO_USER_NAME,ADMC.ADMIN_NAME MOVE_ADMIN_NAME,ADMU.ADMIN_NAME AUDIT_ADMIN_NAME
  36. ',
  37. 'orderBy' => 'UM.CREATED_AT DESC, UM.ID DESC',
  38. 'from' => UserMove::tableName() . ' AS UM',
  39. 'join' => [
  40. ['LEFT JOIN', User::tableName() . ' AS CU', 'UM.USER_ID=CU.ID'],
  41. ['LEFT JOIN', UserInfo::tableName() . ' AS FUI', 'UM.FROM_UID=FUI.USER_ID'],
  42. ['LEFT JOIN', UserInfo::tableName() . ' AS TUI', 'UM.TO_UID=TUI.USER_ID'],
  43. ['LEFT JOIN', Admin::tableName() . ' AS ADMC', 'UM.MOVE_ADMIN_ID=ADMC.ID'],
  44. ['LEFT JOIN', Admin::tableName() . ' AS ADMU', 'UM.AUDIT_ADMIN_ID=ADMU.ID'],
  45. ],
  46. 'page' => $this->page,
  47. 'pageSize' => $this->pageSize,
  48. ]);
  49. }
  50. /**
  51. * 要展示和导出的所有字段
  52. * @return array
  53. */
  54. public function getColumn(){
  55. if(!$this->columns){
  56. $this->columns = [
  57. 'ID' => null,
  58. 'USER_ID' => null,
  59. 'MOVE_USER_NAME' => [
  60. 'header' => Yii::t('ctx', 'moveMember'),
  61. 'headerOther' => ['width' => '120'],
  62. ],
  63. 'MOVE_REAL_NAME' => [
  64. 'header' => Yii::t('ctx', 'moveMemberName'),
  65. 'headerOther' => ['width' => '200'],
  66. 'valueOther' => [
  67. 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
  68. ],
  69. ],
  70. 'FROM_USER_NAME' => [
  71. 'header' => Yii::t('ctx', 'uperCodeBeforeMoving'),
  72. 'headerOther' => ['width' => '120'],
  73. ],
  74. 'TO_USER_NAME' => [
  75. 'header' => Yii::t('ctx', 'uperCodeAfterMoving'),
  76. 'headerOther' => ['width' => '120'],
  77. ],
  78. 'TYPE' => [
  79. 'header' => Yii::t('ctx', 'typeOfMoving'),
  80. 'headerOther' => ['width' => '120'],
  81. 'value' => function($row) {
  82. return $row['TYPE'] == UserMove::TYPE_NETWORK ? Yii::t('ctx', 'placementNetwork') : Yii::t('ctx', 'sponsorNetwork');
  83. },
  84. ],
  85. 'LOCATION' => [
  86. 'header' => Yii::t('ctx', 'position'),
  87. 'headerOther' => ['width' => '100'],
  88. 'value' => function($row) {
  89. return $row['LOCATION'] == 1 ? Yii::t('ctx', 'I.Market') : Yii::t('ctx', 'II.Market');
  90. },
  91. ],
  92. 'PERIOD_NUM' => [
  93. 'header' => Yii::t('ctx', 'periodOfMoving'),
  94. 'headerOther' => ['width' => '130'],
  95. ],
  96. 'IS_MOVING' => [
  97. 'header' => Yii::t('ctx', 'whetherToMove'),
  98. 'headerOther' => ['width' => '130'],
  99. ],
  100. 'MOVE_PERCENT' => [
  101. 'header' => Yii::t('ctx', 'percentage'),
  102. 'headerOther' => ['width' => '100'],
  103. ],
  104. 'MOVE_ADMIN_NAME' => [
  105. 'header' => Yii::t('ctx', 'AdministratorOfMoving'),
  106. 'headerOther' => ['width' => '180'],
  107. ],
  108. 'CREATED_AT' => [
  109. 'header' => Yii::t('ctx', 'joiningDate'),
  110. 'value' => function($row) {
  111. return (new DateTime([
  112. 'value' => $row['CREATED_AT'],
  113. ]))->result();
  114. },
  115. 'headerOther' => ['width' => '170'],
  116. ],
  117. 'AUDIT_STATUS' => null,
  118. 'AUDIT_STATUS_NAME' => [
  119. 'header' => Yii::t('ctx', 'status'),
  120. 'headerOther' => ['width' => '100'],
  121. 'value' => function ($row) {
  122. return UserMove::getStatusName()[$row['AUDIT_STATUS']];
  123. },
  124. ],
  125. 'AUDIT_ADMIN_NAME' => [
  126. 'header' => Yii::t('ctx', 'administratorOfReviewing'),
  127. 'headerOther' => ['width' => '150'],
  128. ],
  129. 'AUDITED_AT' => [
  130. 'header' => Yii::t('ctx', 'reviewTime'),
  131. 'value' => function ($row) {
  132. return (new DateTime([
  133. 'value' => $row['AUDITED_AT'],
  134. ]))->result();
  135. },
  136. 'headerOther' => ['width' => '150'],
  137. ],
  138. ];
  139. }
  140. return $this->columns;
  141. }
  142. /**
  143. * 前台用于筛选的类型集合
  144. * @return mixed
  145. */
  146. public function getFilterTypes()
  147. {
  148. if(!$this->filterTypes){
  149. $this->filterTypes = [
  150. 'MOVE_USER_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'moveMember')],
  151. 'MOVE_REAL_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'moveMemberName')],
  152. 'filterStatus'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'status')],
  153. 'PERIOD_NUM'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'periodOfMoving')],
  154. 'MOVE_ADMIN_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'AdministratorOfMoving')], // 移网管理员
  155. 'AUDIT_ADMIN_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'administratorOfReviewing')], // 审核管理员
  156. 'AUDITED_AT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'reviewTime'), 'other' => 'Review Time'], // 审核时间
  157. ];
  158. }
  159. return $this->filterTypes;
  160. }
  161. }