MoveList.php 7.0 KB

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