UserController.php 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: leo
  5. * Date: 2018/2/24
  6. * Time: 下午12:48
  7. */
  8. namespace backendApi\modules\v1\controllers;
  9. use backendApi\modules\v1\components\UserAuth;
  10. use backendApi\modules\v1\models\Admin;
  11. use backendApi\modules\v1\models\AdminCountry;
  12. use backendApi\modules\v1\models\AdminRole;
  13. use backendApi\modules\v1\models\exportForms\BaUserExportForm;
  14. use backendApi\modules\v1\models\exportForms\UserExportForm;
  15. use backendApi\modules\v1\models\lists\shop\BaUserList;
  16. use backendApi\modules\v1\models\lists\user\BindList;
  17. use backendApi\modules\v1\models\lists\user\ChangeHighestEmpLevelList;
  18. use backendApi\modules\v1\models\lists\user\DecLevelList;
  19. use backendApi\modules\v1\models\lists\user\GroupList;
  20. use backendApi\modules\v1\models\lists\user\IndexList;
  21. use backendApi\modules\v1\models\lists\user\MoveList;
  22. use backendApi\modules\v1\models\lists\user\StatusAuditList;
  23. use backendApi\modules\v1\models\lists\user\SystemList;
  24. use backendApi\modules\v1\models\lists\user\TeamworkList;
  25. use backendApi\modules\v1\models\lists\user\YearHighestEmpLvList;
  26. use common\helpers\Date;
  27. use common\helpers\Form;
  28. use common\helpers\http\BackendToFrontendApi;
  29. use common\helpers\Log;
  30. use common\helpers\LoggerTool;
  31. use common\helpers\NetPoint;
  32. use common\helpers\Tool;
  33. use common\helpers\user\Balance;
  34. use common\helpers\user\Cash;
  35. use common\helpers\user\Info;
  36. use common\helpers\user\Status;
  37. use common\models\BaUser;
  38. use common\models\CompanyBank;
  39. use common\models\Countries;
  40. use common\models\CurrencyConversions;
  41. use common\models\FlowBonus;
  42. use common\models\forms\AdminAddUserForm;
  43. use common\models\forms\BaUserBasicForm;
  44. use common\models\forms\ChangeShowEmpLvForm;
  45. use common\models\forms\CloseDecForm;
  46. use common\models\forms\CloseLoginForm;
  47. use common\models\forms\DecLevelLogForm;
  48. use common\models\forms\DecRoleLogForm;
  49. use common\models\forms\HighestEmpLevelLogForm;
  50. use common\models\forms\ImmigrantForm;
  51. use common\models\forms\NetMoveForm;
  52. use common\models\forms\RechargeForm;
  53. use common\models\forms\ReconsumeForm;
  54. use common\models\forms\RegInfoAuditForm;
  55. use common\models\forms\UploadForm;
  56. use common\models\forms\UserBasicForm;
  57. use common\models\forms\UserBindForm;
  58. use common\models\forms\UserCloseForm;
  59. use common\models\forms\UserDecForm;
  60. use common\models\forms\UserForm;
  61. use common\models\forms\UserGroupForm;
  62. use common\models\forms\UserStatusForm;
  63. use common\models\forms\UserSystemForm;
  64. use common\models\forms\UserTeamworkForm;
  65. use common\models\forms\UserTransferPropForm;
  66. use common\models\Instalment;
  67. use common\models\Language;
  68. use common\models\Period;
  69. use common\models\ReconsumeAudit;
  70. use common\models\ReconsumePool;
  71. use common\models\RegInfoAudit;
  72. use common\models\Region;
  73. use common\models\RegType;
  74. use common\models\DecOrder;
  75. use common\models\DecRole;
  76. use common\models\EmployLevel;
  77. use common\models\OpenBank;
  78. use common\models\UserBind;
  79. use common\models\UserClose;
  80. use common\models\UserImmigrant;
  81. use common\models\UserMove;
  82. use common\models\UserNetwork;
  83. use common\models\UserRelation;
  84. use common\models\UserStatusAudit;
  85. use common\models\UserSystem;
  86. use common\models\YearHighestEmpLv;
  87. use SebastianBergmann\CodeCoverage\Report\PHP;
  88. use sunmoon\phpspreadsheet\Excel;
  89. use Yii;
  90. use common\helpers\Cache;
  91. use common\models\User;
  92. use common\models\UserInfo;
  93. use common\models\UserTeamwork;
  94. use yii\base\Exception;
  95. use yii\web\HttpException;
  96. use yii\web\UploadedFile;
  97. class UserController extends BaseController
  98. {
  99. public $modelClass = User::class;
  100. public function behaviors()
  101. {
  102. $behaviors = parent::behaviors();
  103. //$behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON;
  104. return $behaviors;
  105. }
  106. /**
  107. * 会员列表
  108. * @return mixed
  109. * @throws Exception
  110. * @throws HttpException
  111. */
  112. public function actionIndex()
  113. {
  114. $filter = $this->filterCondition([
  115. 'USER_NAME' => 'U.USER_NAME',
  116. 'REAL_NAME' => 'U.REAL_NAME',
  117. 'STATUS' => 'U.STATUS',
  118. 'ALLOW_LOGIN' => 'U.ALLOW_LOGIN',
  119. 'CREATED_AT' => 'U.CREATED_AT',
  120. 'PERIOD_AT' => 'U.PERIOD_AT',
  121. 'DEC_LV_NAME' => 'U.DEC_LV',
  122. 'COUNTRY' => 'U.COUNTRY_ID',
  123. 'DEC_LV_UPDATED_AT' => 'U.DEC_LV_UPDATED_AT',
  124. 'LAST_DEC_LV_NAME' => 'U.LAST_DEC_LV',
  125. 'EMP_LV_NAME' => 'U.EMP_LV',
  126. 'LAST_EMP_LV_NAME' => 'U.LAST_EMP_LV',
  127. 'ELITE_LV_NAME' => 'U.ELITE_LV',
  128. 'LAST_ELITE_LV_NAME' => 'U.LAST_ELITE_LV',
  129. 'REC_USER_NAME' => 'RU.USER_NAME',
  130. 'CON_USER_NAME' => 'CU.USER_NAME',
  131. 'SPOUSE_NAME' => 'U.SPOUSE_NAME',
  132. 'MOBILE' => 'U.MOBILE',
  133. 'TEL' => 'U.TEL',
  134. 'DEC_USER_NAME' => 'DU.USER_NAME',
  135. 'IS_DEC' => 'U.IS_DEC',
  136. 'IS_STUDIO' => 'U.IS_STUDIO',
  137. 'DEC_ROLE_NAME' => 'U.DEC_ROLE_ID',
  138. 'AREA' => [
  139. 'FIELD' => ['U.PROVINCE', 'U.CITY', 'U.COUNTY'],
  140. 'BIND' => ['PROVINCE', 'CITY', 'COUNTY'],
  141. ],
  142. 'ADDRESS' => 'U.ADDRESS',
  143. ]);
  144. $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
  145. if (!$isSuper) {
  146. $adminId = Yii::$app->getUser()->getUserInfo()['id'];
  147. $adminCountry = AdminCountry::getCountry($adminId);
  148. $quotedAdminCountry = array_map(function($item) {
  149. return "'" . addslashes($item) . "'";
  150. }, $adminCountry);
  151. $condition = $filter['condition'] ?? '';
  152. $filter['condition'] = $condition . " AND U.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
  153. $condition = $filter['condition'];
  154. $params = $filter['params'];
  155. $condition .= " AND UI.DELETED=0 AND U.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
  156. } else {
  157. $condition = $filter['condition'] ?? '';
  158. $params = $filter['params'];
  159. }
  160. $listObj = new IndexList();
  161. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  162. return static::notice($data);
  163. }
  164. /**
  165. * 导出会员列表
  166. * @return mixed
  167. * @throws \yii\db\Exception
  168. * @throws HttpException
  169. */
  170. public function actionIndexExport()
  171. {
  172. $filter = $this->filterCondition([
  173. 'USER_NAME' => 'U.USER_NAME',
  174. 'REAL_NAME' => 'U.REAL_NAME',
  175. 'STATUS' => 'U.STATUS',
  176. 'ALLOW_LOGIN' => 'U.ALLOW_LOGIN',
  177. 'CREATED_AT' => 'U.CREATED_AT',
  178. 'PERIOD_AT' => 'U.PERIOD_AT',
  179. 'DEC_LV_NAME' => 'U.DEC_LV',
  180. 'DEC_LV_UPDATED_AT' => 'U.DEC_LV_UPDATED_AT',
  181. 'LAST_DEC_LV_NAME' => 'U.LAST_DEC_LV',
  182. 'EMP_LV_NAME' => 'U.EMP_LV',
  183. 'REC_USER_NAME' => 'RU.USER_NAME',
  184. 'CON_USER_NAME' => 'CU.USER_NAME',
  185. 'ID_CARD' => 'U.ID_CARD',
  186. 'SPOUSE_NAME' => 'U.SPOUSE_NAME',
  187. 'SPOUSE_IDCARD' => 'U.SPOUSE_IDCARD',
  188. 'SYSTEM_NAME' => 'U.SYSTEM_ID',
  189. 'MOBILE' => 'U.MOBILE',
  190. 'TEL' => 'U.TEL',
  191. 'DEC_USER_NAME' => 'DU.USER_NAME',
  192. 'IS_DEC' => 'U.IS_DEC',
  193. 'IS_STUDIO' => 'U.IS_STUDIO',
  194. 'DEC_ROLE_NAME' => 'U.DEC_ROLE_ID',
  195. 'OPEN_BANK_NAME' => 'U.OPEN_BANK',
  196. 'BANK_AREA' => [
  197. 'FIELD' => ['U.BANK_PROVINCE', 'U.BANK_CITY', 'U.BANK_COUNTY'],
  198. 'BIND' => ['BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY'],
  199. ],
  200. 'BANK_ADDRESS' => 'U.BANK_ADDRESS',
  201. 'BANK_NO' => 'U.BANK_NO',
  202. 'SEX' => 'U.SEX',
  203. 'NATION_NAME' => 'U.NATION',
  204. 'AREA' => [
  205. 'FIELD' => ['U.PROVINCE', 'U.CITY', 'U.COUNTY'],
  206. 'BIND' => ['PROVINCE', 'CITY', 'COUNTY'],
  207. ],
  208. 'ADDRESS' => 'U.ADDRESS',
  209. 'VERIFIED' => 'U.VERIFIED',
  210. 'VERIFIED_AT' => 'U.VERIFIED_AT',
  211. 'ALLOW_TRANSFER' => 'UI.ALLOW_TRANSFER',
  212. ]);
  213. $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
  214. if (!$isSuper) {
  215. $adminId = Yii::$app->getUser()->getUserInfo()['id'];
  216. $adminCountry = AdminCountry::getCountry($adminId);
  217. $quotedAdminCountry = array_map(function($item) {
  218. return "'" . addslashes($item) . "'";
  219. }, $adminCountry);
  220. $condition = $filter['condition'] ?? '';
  221. $filter['condition'] = $condition . " AND U.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
  222. } else {
  223. $condition = $filter['condition'] ?? '';
  224. $filter['condition'] = $condition;
  225. }
  226. $form = new UserExportForm();
  227. $result = $form->run($filter, 'Member_List');
  228. if (!$result) {
  229. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  230. }
  231. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  232. }
  233. /**
  234. * 空单会员列表
  235. * @return mixed
  236. * @throws Exception
  237. * @throws HttpException
  238. */
  239. public function actionEmptyList()
  240. {
  241. $filter = $this->filterCondition([
  242. 'USER_NAME' => 'U.USER_NAME',
  243. 'REAL_NAME' => 'U.REAL_NAME',
  244. 'STATUS' => 'U.STATUS',
  245. 'ALLOW_LOGIN' => 'U.ALLOW_LOGIN',
  246. 'CREATED_AT' => 'U.CREATED_AT',
  247. 'PERIOD_AT' => 'U.PERIOD_AT',
  248. 'DEC_LV_NAME' => 'U.DEC_LV',
  249. 'DEC_LV_UPDATED_AT' => 'U.DEC_LV_UPDATED_AT',
  250. 'LAST_DEC_LV_NAME' => 'U.LAST_DEC_LV',
  251. 'EMP_LV_NAME' => 'U.EMP_LV',
  252. // 'HIGHEST_EMP_LV_NAME' => 'UI.HIGHEST_EMP_LV',
  253. // 'HIGHEST_EMP_LV_PERIOD' => 'UI.HIGHEST_EMP_LV_PERIOD',
  254. 'REC_USER_NAME' => 'RU.USER_NAME',
  255. 'CON_USER_NAME' => 'CU.USER_NAME',
  256. 'ID_CARD' => 'U.ID_CARD',
  257. 'SPOUSE_NAME' => 'U.SPOUSE_NAME',
  258. 'SPOUSE_IDCARD' => 'U.SPOUSE_IDCARD',
  259. 'SYSTEM_NAME' => 'U.SYSTEM_ID',
  260. 'MOBILE' => 'U.MOBILE',
  261. 'TEL' => 'U.TEL',
  262. 'DEC_USER_NAME' => 'DU.USER_NAME',
  263. 'IS_DEC' => 'U.IS_DEC',
  264. 'DEC_ROLE_NAME' => 'U.DEC_ROLE_ID',
  265. 'OPEN_BANK_NAME' => 'U.OPEN_BANK',
  266. 'BANK_AREA' => [
  267. 'FIELD' => ['U.BANK_PROVINCE', 'U.BANK_CITY', 'U.BANK_COUNTY'],
  268. 'BIND' => ['BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY'],
  269. ],
  270. 'BANK_ADDRESS' => 'U.BANK_ADDRESS',
  271. 'BANK_NO' => 'U.BANK_NO',
  272. 'SEX' => 'U.SEX',
  273. 'NATION_NAME' => 'U.NATION',
  274. 'AREA' => [
  275. 'FIELD' => ['U.PROVINCE', 'U.CITY', 'U.COUNTY'],
  276. 'BIND' => ['PROVINCE', 'CITY', 'COUNTY'],
  277. ],
  278. 'ADDRESS' => 'U.ADDRESS',
  279. // 'IS_AUTO_WITHDRAW' => 'UI.IS_AUTO_WITHDRAW',
  280. 'VERIFIED' => 'U.VERIFIED',
  281. 'VERIFIED_AT' => 'U.VERIFIED_AT',
  282. // 'IS_DIRECT_SELLER' => 'U.IS_DIRECT_SELLER',
  283. // 'IS_SYSTEM_LEADER' => 'UI.IS_SYSTEM_LEADER',
  284. // 'IS_GROUP_LEADER' => 'UI.IS_GROUP_LEADER',
  285. 'ALLOW_TRANSFER' => 'UI.ALLOW_TRANSFER',
  286. ]);
  287. $condition = $filter['condition'];
  288. $params = $filter['params'];
  289. $condition .= ' AND UI.DELETED=0 AND U.REG_FROM=0';
  290. $listObj = new IndexList();
  291. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  292. return static::notice($data);
  293. }
  294. /**
  295. * 点位绑定
  296. * @return mixed
  297. * @throws Exception
  298. * @throws HttpException
  299. */
  300. public function actionBind()
  301. {
  302. $filter = $this->filterCondition([
  303. 'userIds' => 'UI.USER_ID',
  304. 'MAIN_USER_NAME' => 'MUI.USER_NAME',
  305. 'HIGHEST_EMP_LV' => 'UI.HIGHEST_EMP_LV',
  306. 'CREATED_AT' => 'UB.CREATED_AT',
  307. 'UPDATED_AT' => 'UB.UPDATED_AT',
  308. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  309. 'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  310. ]);
  311. $condition = $filter['condition'];
  312. $params = $filter['params'];
  313. $condition .= ' AND UB.IS_DEL=0';
  314. $listObj = new BindList();
  315. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  316. return static::notice($data);
  317. }
  318. /**
  319. * 点位绑定导出
  320. * @return mixed
  321. * @throws \yii\db\Exception
  322. * @throws HttpException
  323. */
  324. public function actionBindExport()
  325. {
  326. $filter = $this->filterCondition([
  327. 'userIds' => 'UI.USER_ID',
  328. 'MAIN_USER_NAME' => 'MUI.USER_NAME',
  329. 'HIGHEST_EMP_LV' => 'UI.HIGHEST_EMP_LV',
  330. 'CREATED_AT' => 'UB.CREATED_AT',
  331. 'UPDATED_AT' => 'UB.UPDATED_AT',
  332. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  333. 'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  334. ]);
  335. $filter['condition'] .= ' AND UB.IS_DEL=0';
  336. $form = new UserExportForm();
  337. $result = $form->run($filter, '点位绑定');
  338. if (!$result) {
  339. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  340. }
  341. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  342. }
  343. /**
  344. * 添加点位绑定
  345. * @return mixed
  346. * @throws HttpException
  347. */
  348. public function actionBindAdd()
  349. {
  350. if (Yii::$app->request->isPost) {
  351. return parent::edit(UserBindForm::class, Yii::t('ctx', 'successfully'), 'add', ['add'], null, function ($form, $result) {
  352. // Log::adminHandle('为' . $form->userName . '添加点位绑定,主点位:' . $form->mainUserName);
  353. });
  354. }
  355. }
  356. /**
  357. * 编辑点位绑定
  358. * @return mixed
  359. * @throws Exception
  360. * @throws HttpException
  361. */
  362. public function actionBindEdit()
  363. {
  364. $id = Yii::$app->request->get('id');
  365. if (Yii::$app->request->isPost) {
  366. return parent::edit(UserBindForm::class, Yii::t('ctx', 'successfully'), 'edit', ['edit'], null, function ($form, $result) {
  367. //$userBaseInfo = Info::baseInfo($result->USER_ID);
  368. // Log::adminHandle('为' . $userBaseInfo['USER_NAME'] . '更改点位绑定关系');
  369. });
  370. }
  371. // 获得当前会员的用户名等信息
  372. $userBind = UserBind::findOneAsArray('ID=:ID AND IS_DEL=0', [':ID' => $id]);
  373. $userBinds = UserBind::findAllAsArray('MAIN_UID=:MAIN_UID AND IS_DEL=0', [':MAIN_UID' => $userBind['MAIN_UID']]);
  374. foreach ($userBinds as $key => $value) {
  375. $userBinds[$key]['BASE_INFO'] = Info::baseInfoZh($value['USER_ID']);
  376. }
  377. return static::notice(['userBinds' => $userBinds, 'mainUid' => $userBind['MAIN_UID']]);
  378. }
  379. /**
  380. * 删除点位绑定
  381. * @return mixed
  382. * @throws \yii\db\Exception
  383. * @throws HttpException
  384. */
  385. public function actionBindDelete()
  386. {
  387. $userBindForm = new UserBindForm();
  388. $result = static::delete(UserBind::class, function ($selected) use ($userBindForm) {
  389. $userBindForm->beforeDelete($selected);
  390. }, function ($selected) use ($userBindForm) {
  391. $userBindForm->delete($selected);
  392. }, false);
  393. return self::notice(Yii::t('ctx', 'successfully'));
  394. }
  395. /**
  396. * 生成点位合作的用户名
  397. * @return mixed
  398. * @throws \yii\base\InvalidConfigException
  399. * @throws HttpException
  400. */
  401. public function actionGenerateUserName()
  402. {
  403. // 获取用户名
  404. if (!$userName = Info::generateUserName('hz')) {
  405. return static::notice(Yii::t('ctx', 'failed'), 400);
  406. }
  407. return static::notice(['userName' => $userName]);
  408. }
  409. /**
  410. * 点位合作
  411. * @return mixed
  412. * @throws Exception
  413. * @throws HttpException
  414. */
  415. public function actionTeamwork()
  416. {
  417. $filter = $this->filterCondition([
  418. 'userIds' => 'UI.USER_ID',
  419. 'MAIN_USER_NAME' => 'MUI.USER_NAME',
  420. 'DIVIDE_PERCENT' => 'UT.DIVIDE_PERCENT',
  421. 'CREATE_REMARK' => 'UT.CREATE_REMARK',
  422. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  423. 'CREATED_AT' => 'UT.CREATED_AT',
  424. 'PERIOD_NUM' => 'UT.PERIOD_NUM',
  425. 'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  426. 'UPDATED_AT' => 'UT.UPDATED_AT',
  427. 'UPDATED_PERIOD' => 'UT.PERIOD_NUM',
  428. ]);
  429. $condition = $filter['condition'];
  430. $params = $filter['params'];
  431. $condition .= ' AND UT.IS_DEL=0';
  432. $listObj = new TeamworkList();
  433. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  434. return static::notice($data);
  435. }
  436. /**
  437. * 点位合作导出
  438. * @return mixed
  439. * @throws \yii\db\Exception
  440. * @throws HttpException
  441. */
  442. public function actionTeamworkExport()
  443. {
  444. $filter = $this->filterCondition([
  445. 'userIds' => 'UI.USER_ID',
  446. 'MAIN_USER_NAME' => 'MUI.USER_NAME',
  447. 'DIVIDE_PERCENT' => 'UT.DIVIDE_PERCENT',
  448. 'CREATE_REMARK' => 'UT.CREATE_REMARK',
  449. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  450. 'CREATED_AT' => 'UT.CREATED_AT',
  451. 'PERIOD_NUM' => 'UT.PERIOD_NUM',
  452. 'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  453. 'UPDATED_AT' => 'UT.UPDATED_AT',
  454. 'UPDATED_PERIOD' => 'UT.PERIOD_NUM',
  455. ]);
  456. $filter['condition'] .= ' AND UT.IS_DEL=0';
  457. $form = new UserExportForm();
  458. $result = $form->run($filter, '点位合作');
  459. if (!$result) {
  460. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  461. }
  462. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  463. }
  464. /**
  465. * 添加点位合作
  466. * @return mixed
  467. * @throws HttpException
  468. */
  469. public function actionTeamworkAdd()
  470. {
  471. if (Yii::$app->request->isPost) {
  472. return parent::edit(UserTeamworkForm::class, Yii::t('ctx', 'successfully'), 'add', ['add'], null, function ($form, $result) {
  473. // Log::adminHandle('为' . $form->mainUserName . '添加合作点位,姓名:' . $form->userName, 0, $result->USER_ID, $form->userName);
  474. });
  475. }
  476. // 所有民族
  477. $allNation = Yii::$app->params['nation'];
  478. // 所有开户行
  479. $allOpenBank = OpenBank::findAllAsArray('STATUS=1');
  480. return static::notice(['allNation' => $allNation, 'allOpenBank' => $allOpenBank]);
  481. }
  482. /**
  483. * 编辑点位合作
  484. * @return mixed
  485. * @throws Exception
  486. * @throws HttpException
  487. */
  488. public function actionTeamworkEdit()
  489. {
  490. $id = Yii::$app->request->get('id');
  491. if (Yii::$app->request->isPost) {
  492. return parent::edit(UserTeamworkForm::class, Yii::t('ctx', 'successfully'), 'changeDivide', ['changeDivide'], null, function ($form, $result) {
  493. foreach ($result['logs'] as $k => $value) {
  494. $userName = Info::getUserNameByUserId($k);
  495. // Log::adminHandle('为' . $userName . '编辑合作点位分成比例为' . $value , 1, $k, $userName);
  496. }
  497. });
  498. }
  499. // 获得当前会员的用户名等信息
  500. if (!$userTeamwork = UserTeamwork::findOneAsArray('ID=:ID AND IS_DEL=0', [':ID' => $id], 'MAIN_UID')) {
  501. return static::notice('点位合作不存在', 404);
  502. }
  503. $teamwork = UserTeamwork::findAllAsArray('MAIN_UID=:MAIN_UID AND IS_DEL=0', [':MAIN_UID' => $userTeamwork['MAIN_UID']], 'ID,USER_ID,MAIN_UID,DIVIDE_PERCENT');
  504. foreach ($teamwork as $key => $value) {
  505. $userInfo = Info::baseInfo($value['USER_ID']);
  506. $teamwork[$key]['USER_NAME'] = $userInfo['USER_NAME'];
  507. $teamwork[$key]['REAL_NAME'] = $userInfo['REAL_NAME'];
  508. }
  509. unset($userInfo);
  510. return static::notice($teamwork);
  511. }
  512. /**
  513. * 删除方法
  514. * @return mixed
  515. * @throws \yii\db\Exception
  516. * @throws HttpException
  517. */
  518. public function actionTeamworkDelete()
  519. {
  520. return static::notice('无法删除', 400);
  521. $result = static::delete(UserTeamwork::class, null, function ($selected) {
  522. UserTeamworkForm::delete($selected);
  523. // Log::adminHandle('删除合作点位');
  524. }, false);
  525. return $result;
  526. }
  527. /**
  528. * 会员体系
  529. * @return mixed
  530. * @throws Exception
  531. * @throws HttpException
  532. */
  533. public function actionSystem()
  534. {
  535. $filter = $this->filterCondition([
  536. 'userIds' => 'US.LEADER_UID',
  537. 'SYSTEM_NAME' => 'US.SYSTEM_NAME',
  538. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  539. 'PERIOD_NUM' => 'US.PERIOD_NUM',
  540. 'CREATED_AT' => 'US.CREATED_AT',
  541. 'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  542. 'UPDATE_PERIOD_NUM' => 'US.UPDATE_PERIOD_NUM',
  543. 'UPDATED_AT' => 'US.UPDATED_AT',
  544. 'IS_DEL' => 'US.IS_DEL',
  545. 'CREATE_REMARK' => 'US.CREATE_REMARK',
  546. ]);
  547. $condition = $filter['condition'];
  548. $params = $filter['params'];
  549. $listObj = new SystemList();
  550. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  551. return static::notice($data);
  552. }
  553. /**
  554. * 体系管理导出
  555. * @return mixed
  556. * @throws \yii\db\Exception
  557. * @throws HttpException
  558. */
  559. public function actionSystemExport()
  560. {
  561. $filter = $this->filterCondition([
  562. 'userIds' => 'US.LEADER_UID',
  563. 'SYSTEM_NAME' => 'US.SYSTEM_NAME',
  564. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  565. 'PERIOD_NUM' => 'US.PERIOD_NUM',
  566. 'CREATED_AT' => 'US.CREATED_AT',
  567. 'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  568. 'UPDATE_PERIOD_NUM' => 'US.UPDATE_PERIOD_NUM',
  569. 'UPDATED_AT' => 'US.UPDATED_AT',
  570. 'IS_DEL' => 'US.IS_DEL',
  571. 'CREATE_REMARK' => 'US.CREATE_REMARK',
  572. ]);
  573. $form = new UserExportForm();
  574. $result = $form->run($filter, '体系管理');
  575. if (!$result) {
  576. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  577. }
  578. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  579. }
  580. /**
  581. * 添加体系
  582. * @return mixed
  583. * @throws \yii\base\InvalidConfigException
  584. * @throws \yii\db\Exception
  585. * @throws \yii\httpclient\Exception
  586. * @throws HttpException
  587. */
  588. public function actionSystemAdd()
  589. {
  590. if (Yii::$app->request->post()) {
  591. $formModel = new UserSystemForm();
  592. $formModel->scenario = 'add';
  593. if ($formModel->load(Yii::$app->request->post(), '') && $formModel->edit()) {
  594. // Log::adminHandle('添加体系' . Yii::$app->request->post('systemName'));
  595. return static::notice(Yii::t('ctx', 'successfully'));
  596. } else {
  597. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  598. }
  599. }
  600. }
  601. /**
  602. * 编辑体系
  603. * @return mixed
  604. * @throws \yii\base\InvalidConfigException
  605. * @throws \yii\httpclient\Exception
  606. * @throws HttpException
  607. */
  608. public function actionSystemEdit()
  609. {
  610. $id = Yii::$app->request->get('id');
  611. if (Yii::$app->request->isPost) {
  612. return parent::edit(UserSystemForm::class, Yii::t('ctx', 'successfully'), 'edit', ['edit'], null, function ($form, $result) {
  613. // Log::adminHandle('编辑体系' . $result['SYSTEM_NAME']);
  614. });
  615. }
  616. if (!$oneData = UserSystem::find()->select('US.*, UI.USER_NAME AS LEADER_NAME')->where('US.ID=:ID AND US.IS_DEL=0', [':ID' => $id])->from(UserSystem::tableName() . ' AS US')->join('LEFT JOIN', UserInfo::tableName() . ' AS UI', 'US.LEADER_UID=UI.USER_ID')->asArray()->one()) {
  617. return static::notice('体系已撤销或不存在', 400);
  618. }
  619. return static::notice(['oneData' => $oneData]);
  620. }
  621. /**
  622. * 恢复体系
  623. * @return mixed
  624. * @throws HttpException
  625. */
  626. public function actionSystemRenew()
  627. {
  628. return parent::edit(UserSystemForm::class, Yii::t('ctx', 'successfully'), 'renewSystem', [
  629. 'renewSystem',
  630. ], null, function ($form, $result) {
  631. // Log::adminHandle('编辑体系' . $result['SYSTEM_NAME']);
  632. });
  633. }
  634. /**
  635. * 删除方法
  636. * @return mixed
  637. * @throws \yii\db\Exception
  638. * @throws HttpException
  639. */
  640. public function actionSystemDelete()
  641. {
  642. $userSystemForm = new UserSystemForm();
  643. $result = static::delete(UserSystem::class, function ($selected) use ($userSystemForm) {
  644. $userSystemForm->beforeDelete($selected);
  645. }, function ($selected) use ($userSystemForm) {
  646. $userSystemForm->delete($selected);
  647. }, false);
  648. return self::notice(Yii::t('ctx', 'successfully'));
  649. }
  650. /**
  651. * 团队领导人列表
  652. * @return mixed
  653. * @throws Exception
  654. * @throws HttpException
  655. */
  656. public function actionGroup()
  657. {
  658. $filter = $this->filterCondition([
  659. 'userName' => 'UI.USER_NAME',
  660. ]);
  661. $condition = $filter['condition'];
  662. $params = $filter['params'];
  663. $condition .= ' AND PUI.IS_GROUP_LEADER=1';
  664. $listObj = new GroupList();
  665. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  666. return static::notice($data);
  667. }
  668. /**
  669. * 团队领导人列表导出
  670. * @return mixed
  671. * @throws \yii\db\Exception
  672. * @throws HttpException
  673. */
  674. public function actionGroupExport()
  675. {
  676. $filter = $this->filterCondition([
  677. 'userName' => 'UI.USER_NAME',
  678. ]);
  679. $filter['condition'] .= ' AND PUI.IS_GROUP_LEADER=1';
  680. $form = new UserExportForm();
  681. $result = $form->run($filter, '团队领导人列表');
  682. if (!$result) {
  683. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  684. }
  685. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  686. }
  687. /**
  688. * 会员移网记录
  689. * @return mixed
  690. * @throws Exception
  691. * @throws HttpException
  692. */
  693. public function actionMove()
  694. {
  695. $filter = $this->filterCondition([
  696. // 'userIds' => 'UM.USER_ID',
  697. 'filterStatus' => 'UM.AUDIT_STATUS',
  698. 'MOVE_USER_NAME' => 'CU.USER_NAME',
  699. 'MOVE_REAL_NAME' => 'CU.REAL_NAME',
  700. // 'moveType' => 'UM.TYPE',
  701. // 'FROM_USER_NAME' => 'FUI.USER_NAME',
  702. // 'TO_USER_NAME' => 'TUI.USER_NAME',
  703. 'MOVE_PERCENT_SHOW' => 'UM.MOVE_PERCENT',
  704. // 'STARTED_AT' => 'UM.STARTED_AT',
  705. // 'ENDED_AT' => 'UM.ENDED_AT',
  706. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  707. 'PERIOD_NUM' => 'UM.PERIOD_NUM',
  708. // 'CREATED_AT' => 'UM.CREATED_AT',
  709. 'AUDIT_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  710. 'MOVE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  711. // 'AUDIT_PERIOD_NUM' => 'UM.AUDIT_PERIOD_NUM',
  712. 'AUDITED_AT' => 'UM.AUDITED_AT',
  713. // 'CREATE_REMARK' => 'UM.CREATE_REMARK',
  714. ]);
  715. $condition = $filter['condition'];
  716. $params = $filter['params'];
  717. $listObj = new MoveList();
  718. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  719. return static::notice($data);
  720. }
  721. /**
  722. * 移网管理导出
  723. * @return mixed
  724. * @throws \yii\db\Exception
  725. * @throws HttpException
  726. */
  727. public function actionMoveExport()
  728. {
  729. $filter = $this->filterCondition([
  730. //'userIds' => 'UM.USER_ID',
  731. 'filterStatus' => 'UM.AUDIT_STATUS',
  732. 'moveType' => 'UM.TYPE',
  733. 'FROM_USER_NAME' => 'FUI.USER_NAME',
  734. 'TO_USER_NAME' => 'TUI.USER_NAME',
  735. //'MOVE_PERCENT_SHOW' => 'UM.MOVE_PERCENT',
  736. //'STARTED_AT' => 'UM.STARTED_AT',
  737. //'ENDED_AT' => 'UM.ENDED_AT',
  738. 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
  739. 'PERIOD_NUM' => 'UM.PERIOD_NUM',
  740. 'CREATED_AT' => 'UM.CREATED_AT',
  741. 'AUDIT_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
  742. //'AUDIT_PERIOD_NUM' => 'UM.AUDIT_PERIOD_NUM',
  743. 'AUDITED_AT' => 'UM.AUDITED_AT',
  744. //'CREATE_REMARK' => 'UM.CREATE_REMARK',
  745. ]);
  746. $form = new UserExportForm();
  747. $result = $form->run($filter, 'Move_Network'); // 移网管理
  748. if (!$result) {
  749. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  750. }
  751. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  752. }
  753. /**
  754. * 申请移网
  755. * @return mixed
  756. * @throws \yii\base\InvalidConfigException
  757. * @throws \yii\httpclient\Exception
  758. * @throws HttpException
  759. */
  760. public function actionMoveAdd()
  761. {
  762. if (Yii::$app->request->isPost) {
  763. return parent::edit(NetMoveForm::class, Yii::t('ctx', 'successfully'), 'add', ['add'], null, function ($form, $result) { // 移网申请成功
  764. // $user = User::getBaseInfoFromRedis($result['USER_ID']);
  765. // Log::adminHandle('申请为' . $user['USER_NAME'] . '移网', 1, $result['USER_ID'], $user['USER_NAME']);
  766. });
  767. }
  768. }
  769. /**
  770. * 获取全部移网类型
  771. * @return mixed
  772. * @throws HttpException
  773. */
  774. public function actionMoveNetType()
  775. {
  776. return static::notice(['netType' => UserMove::getNetWork()]);
  777. }
  778. /**
  779. * 获取移网数据
  780. * @return mixed
  781. * @throws Exception
  782. * @throws HttpException
  783. */
  784. public function actionMoveGet()
  785. {
  786. $id = Yii::$app->request->get('id');
  787. $userMove = UserMove::find()->where('ID=:ID', [':ID' => $id])->asArray()->one();
  788. if (!$userMove) {
  789. return static::notice('Data not exists', 400);
  790. }
  791. $userMove['BASE_INFO'] = Info::baseInfoWithNet($userMove['USER_ID']);
  792. $toUserInfo = Info::baseInfoZh($userMove['TO_UID']);
  793. return static::notice(['moveId' => $userMove['ID'], 'moveUserName' => $userMove['BASE_INFO']['USER_NAME'], 'baseInfo' => $userMove['BASE_INFO'], 'type' => $userMove['TYPE'], 'toConUserName' => $toUserInfo['USER_NAME'], 'toConRealName' => $toUserInfo['REAL_NAME'], 'location' => $userMove['LOCATION'], 'remark' => $userMove['CREATE_REMARK']]);
  794. }
  795. /**
  796. * 修改移网数据
  797. * @return mixed
  798. * @throws \yii\db\Exception
  799. * @throws HttpException
  800. */
  801. public function actionMoveEdit()
  802. {
  803. $formModel = new NetMoveForm();
  804. $formModel->scenario = 'edit';
  805. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->edit()) {
  806. $user = Info::baseInfoZh($result['USER_ID']);
  807. // Log::adminHandle('修改' . $user['USER_NAME'] . '移网录入数据', 1, $result['USER_ID'], $user['USER_NAME']);
  808. return static::notice(Yii::t('ctx', 'successfully')); // 修改移网录入数据完成
  809. }
  810. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  811. }
  812. /**
  813. * 审核通过移网数据(实际的移网动作在这里,异步操作)
  814. * @return mixed
  815. * @throws \yii\db\Exception
  816. * @throws HttpException
  817. */
  818. public function actionMovePass()
  819. {
  820. $formModel = new NetMoveForm();
  821. $formModel->scenario = 'pass';
  822. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->pass()) {
  823. $user = Info::baseInfoZh($result['USER_ID']);
  824. // Log::adminHandle('审核通过移网数据', 1, $result['USER_ID'], $user['USER_NAME']);
  825. return static::notice("It's on the move. Please wait"); // 正在移动中,请稍候
  826. }
  827. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  828. }
  829. /**
  830. * 审核移网数据
  831. * @return mixed
  832. * @throws \yii\base\InvalidConfigException
  833. * @throws \yii\db\Exception
  834. * @throws \yii\httpclient\Exception
  835. * @throws HttpException
  836. */
  837. public function actionMoveAudit()
  838. {
  839. $formModel = new NetMoveForm();
  840. $formModel->scenario = 'changeAudit';
  841. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->changeAudit()) {
  842. // Log::adminHandle('审核移网数据');
  843. return static::notice(Yii::t('ctx', 'successfully')); // 审核移网数据完成
  844. }
  845. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  846. }
  847. /**
  848. * 删除移网数据
  849. * @return mixed
  850. * @throws \yii\db\Exception
  851. * @throws HttpException
  852. */
  853. public function actionMoveDelete()
  854. {
  855. $netMoveForm = new NetMoveForm();
  856. $result = static::delete(UserMove::class, function ($selected) use ($netMoveForm) {
  857. $netMoveForm->beforeDelete($selected);
  858. }, function ($selected) use ($netMoveForm) {
  859. $netMoveForm->delete($selected);
  860. }, true);
  861. return $result;
  862. }
  863. /**
  864. * 会员的基础用户信息
  865. * @return mixed
  866. * @throws HttpException
  867. */
  868. public function actionFullInfo()
  869. {
  870. $userName = Yii::$app->request->get('userName');
  871. $userInfo = Info::getBaseUserByUserName($userName);
  872. if($userInfo){
  873. $decLevelConfig = Cache::getDecLevelConfig();
  874. $userInfo['LEVEL_NAME'] = isset($decLevelConfig[$userInfo['DEC_LV']])?$decLevelConfig[$userInfo['DEC_LV']]['LEVEL_NAME'] : '';
  875. $userInfo['BONUS'] = Balance::getAvailableBalance($userInfo['ID']);
  876. $userInfo['CASH'] = Cash::getAvailableBalance($userInfo['ID']);
  877. $userInfo['RECONSUME_POINTS'] = Balance::getBalanceReconsumePoints($userInfo['ID']);
  878. $userInfo['EXCHANGE_POINTS'] = Balance::getBalanceExchangePoints($userInfo['ID']);
  879. return static::notice($userInfo);
  880. }else{
  881. return static::notice('Member number does not exist', 400);//会员编号不存在
  882. }
  883. }
  884. /**
  885. * 会员的基本信息编号名称
  886. * @return mixed
  887. * @throws HttpException
  888. */
  889. public function actionBaseInfo()
  890. {
  891. $userName = Yii::$app->request->get('userName');
  892. $baseUser = Info::getBaseUserByUserName($userName);
  893. return static::notice($baseUser);
  894. }
  895. /**
  896. * 点位合作主点位分成比例
  897. * @return mixed
  898. * @throws HttpException
  899. */
  900. public function actionMainDivide()
  901. {
  902. $userId = Yii::$app->request->get('userId');
  903. $divide = 100;
  904. if ($teamwork = UserTeamwork::findOneAsArray('USER_ID=:USER_ID AND MAIN_UID=:USER_ID AND IS_DEL=0', [':USER_ID' => $userId], 'DIVIDE_PERCENT')) {
  905. $divide = $teamwork['DIVIDE_PERCENT'];
  906. }
  907. return static::notice($divide);
  908. }
  909. /**
  910. * 获取子公司
  911. * @return mixed
  912. * @throws HttpException
  913. */
  914. public function actionGetSubCom()
  915. {
  916. $areaSelected = Yii::$app->request->get('areaSelected');
  917. $location = [];
  918. return static::notice($location);
  919. }
  920. /**
  921. * 判断是否在同一推荐网络
  922. * @return mixed
  923. * @throws HttpException
  924. */
  925. public function actionChkRelation()
  926. {
  927. $userName = Yii::$app->request->get('userName');
  928. $toUserName = Yii::$app->request->get('toUserName');
  929. $userId = Info::getUserIdByUserName($userName);
  930. $toUserId = Info::getUserIdByUserName($toUserName);
  931. $is = 0;
  932. if (UserRelation::isParentUser($userId, $toUserId)) {
  933. $is = 1;
  934. }
  935. $toUser = Info::baseInfoWithNetAndBalance($toUserId);
  936. $real_name = $toUser ? $toUser['REAL_NAME'] : '';
  937. return static::notice(['is' => $is, 'real_name' => $real_name]);
  938. }
  939. /**
  940. * 获取当前期数
  941. * @return mixed
  942. * @throws HttpException
  943. */
  944. public function actionGetPeriodNum()
  945. {
  946. $period = Period::instance();
  947. $periodNum = $period->getNowPeriodNum();
  948. //上期是否挂网
  949. $lastPeriodNum = $periodNum - 1;
  950. $periodArr = [$periodNum];
  951. if ($period->isSent($lastPeriodNum)) {
  952. $periodArr[] = $periodNum + 1;
  953. } else {
  954. $periodArr[] = $lastPeriodNum;
  955. }
  956. return static::notice($periodArr);
  957. }
  958. /**
  959. * 关停列表
  960. * @return mixed
  961. * @throws HttpException
  962. */
  963. // public function actionClose()
  964. // {
  965. // $filter = $this->filterCondition([
  966. // 'userIds' => 'UC.USER_ID',
  967. // 'filterStatus' => 'UC.AUDIT_STATUS',
  968. // ]);
  969. // $condition = $filter['condition'];
  970. // $params = $filter['params'];
  971. // $data = UserClose::lists($condition, $params, [
  972. // 'from' => UserClose::tableName() . ' AS UC',
  973. // 'orderBy' => 'UC.CREATED_AT DESC',
  974. // ]);
  975. // // 获取全部移网类型
  976. // $data['type'] = [
  977. // UserClose::TYPE_GT => '关停',
  978. // UserClose::TYPE_TF => '停发',
  979. // ];
  980. // $auditStatus = array_column(\Yii::$app->params['auditStatus'], null, 'value');
  981. // foreach ($data['list'] as $key => $value) {
  982. // $data['list'][$key]['BASE_INFO'] = Info::baseInfoZh($value['USER_ID']);
  983. // $data['list'][$key]['CREATE_ADMIN_NAME'] = Admin::getAdminNameById($value['ADMIN_ID']);
  984. // $data['list'][$key]['AUDIT_ADMIN_NAME'] = Admin::getAdminNameById($value['AUDIT_ADMIN_ID']);
  985. // $data['list'][$key]['STATUS_NAME'] = $auditStatus[$value['AUDIT_STATUS']]['label'];
  986. // }
  987. // return static::notice($data);
  988. //
  989. // }
  990. /**
  991. * 申请关停或停发
  992. * @return mixed
  993. * @throws HttpException
  994. */
  995. // public function actionCloseAdd()
  996. // {
  997. // if (Yii::$app->request->isPost) {
  998. // return parent::edit(UserCloseForm::class, '申请成功', null, null, null, function ($form, $result) {
  999. // $user = User::getBaseInfoFromRedis($result['USER_ID']);
  1000. // $type = '';
  1001. // switch ($result['TYPE']) {
  1002. // case UserClose::TYPE_GT:
  1003. // $type = '关停';
  1004. // break;
  1005. // case UserClose::TYPE_TF:
  1006. // $type = '停发';
  1007. // break;
  1008. // }
  1009. // // Log::adminHandle('申请' . $user['USER_NAME'] . $type, 1, $result['USER_ID'], $user['USER_NAME']);
  1010. // });
  1011. // }
  1012. // // 获取全部移网类型
  1013. // $type = [
  1014. // UserClose::TYPE_GT => '关停',
  1015. // UserClose::TYPE_TF => '停发',
  1016. // ];
  1017. // return static::notice(['type' => $type]);
  1018. // }
  1019. /**
  1020. * 审核关停或停发
  1021. * @return mixed
  1022. * @throws \yii\db\Exception
  1023. * @throws HttpException
  1024. */
  1025. // public function actionCloseAudit()
  1026. // {
  1027. // $formModel = new UserCloseForm();
  1028. // $formModel->scenario = 'audit';
  1029. // if ($formModel->load(Yii::$app->request->get(), '') && $result = $formModel->audit()) {
  1030. // $user = User::getBaseInfoFromRedis($result['USER_ID']);
  1031. // $type = '';
  1032. // switch ($result['TYPE']) {
  1033. // case UserClose::TYPE_GT:
  1034. // $type = '关停';
  1035. // break;
  1036. // case UserClose::TYPE_TF:
  1037. // $type = '停发';
  1038. // break;
  1039. // }
  1040. // // Log::adminHandle('审核' . $user['USER_NAME'] . $type, 1, $result['USER_ID'], $user['USER_NAME']);
  1041. // return static::notice('操作成功');
  1042. // }
  1043. // return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  1044. // }
  1045. /**
  1046. * 添加会员
  1047. * @return mixed
  1048. * @throws HttpException
  1049. */
  1050. public function actionUserAdd()
  1051. {
  1052. if (Yii::$app->request->isPost) {
  1053. return parent::edit(AdminAddUserForm::class, Yii::t('ctx', 'successfully'), null, null, null, function ($form, $result) {//添加成功
  1054. // Log::adminHandle('后台添加会员:' . $result['USER_NAME'], 1, $result['ID'], $result['USER_NAME']);
  1055. });
  1056. }
  1057. $countryId = \Yii::$app->request->get('countryId');
  1058. // 获取所有报单中心级别
  1059. $allDecRole = DecRole::getAllData();
  1060. // 所有民族
  1061. $allNation = Yii::$app->params['nation'];
  1062. // 行政区划
  1063. $regions = Region::getByCountryId($countryId);
  1064. // 银行开户行
  1065. $allOpenBank = OpenBank::findAllAsArray('STATUS=:STATUS AND COUNTRY_ID=:COUNTRY_ID', [':STATUS' => 1, ':COUNTRY_ID' => $countryId]);
  1066. // 生成用户名
  1067. if (!$userName = Info::generateWebName($countryId)) {
  1068. return static::notice('Failed to generate member number', 400);//会员编号生成失败
  1069. }
  1070. return static::notice(
  1071. [
  1072. 'allDecRole' => $allDecRole,
  1073. 'allNation' => $allNation,
  1074. 'allOpenBank' => $allOpenBank,
  1075. 'userName' => $userName,
  1076. 'region' => $regions,
  1077. ]);
  1078. }
  1079. /**
  1080. * 分页导入excel文件到待导入数据的表中
  1081. * @return mixed
  1082. * @throws HttpException
  1083. */
  1084. public function actionImportUsersToExcelTable()
  1085. {
  1086. // 先上传到服务器文件
  1087. if (\Yii::$app->request->isPost) {
  1088. $excelImportId = Yii::$app->request->post('excelImportId');
  1089. $rowCount = Yii::$app->request->post('rowCount');
  1090. $startRow = Yii::$app->request->post('startRow');
  1091. $limit = Yii::$app->request->post('limit', 1000);
  1092. $errorMsg = '';
  1093. try {
  1094. $excel = new \common\helpers\Excel();
  1095. $result = $excel->pageImportDataFromExcel('addUser', $excelImportId, $rowCount, $startRow, $limit);
  1096. } catch (Exception $e) {
  1097. $result = false;
  1098. $errorMsg = $e->getMessage();
  1099. }
  1100. // 还有数据
  1101. if ($result === 1) {
  1102. return static::notice(['finish' => false]);
  1103. } elseif ($result === 0) {
  1104. return static::notice(['finish' => true]);
  1105. } else {
  1106. return static::notice('An error occurred:' . $errorMsg, 400);//发生错误
  1107. }
  1108. }
  1109. }
  1110. public function actionModifyPassword() {
  1111. $form = new UserBasicForm();
  1112. $form->scenario = 'modifyPassword';
  1113. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->edit()){
  1114. return static::notice(Yii::t('ctx', 'successfully')); // 密码修改成功
  1115. } else {
  1116. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  1117. }
  1118. }
  1119. /**
  1120. * 个人资料获取
  1121. * @return mixed
  1122. * @throws HttpException
  1123. */
  1124. public function actionProfileGet() {
  1125. $id = Yii::$app->request->get('id');
  1126. $userInfo = User::findOneAsArray('ID=:ID', [':ID' => $id]);
  1127. if (!$userInfo) {
  1128. return static::notice('Data does not exist', 400);//数据不存在
  1129. }
  1130. $data['allNation'] = \Yii::$app->params['nation'];
  1131. $data['region'] = Region::getByCountryId($userInfo['COUNTRY_ID']);
  1132. $data['language'] = Language::getFromCache();
  1133. $data['allOpenBank'] = OpenBank::find()
  1134. ->where('STATUS=:STATUS AND COUNTRY_ID=:COUNTRY_ID', [':STATUS' => 1, ':COUNTRY_ID' => $userInfo['COUNTRY_ID']])
  1135. ->orderBy('BANK_NAME ASC')
  1136. ->asArray()
  1137. ->all();
  1138. $adminId = Yii::$app->getUser()->getUserInfo()['id'];
  1139. $adminCountry = AdminCountry::getCountry($adminId);
  1140. $countries = Countries::getFromCache();
  1141. $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
  1142. $data['country'] = array_values($countries);
  1143. $data['userInfo'] = [
  1144. 'userId' => $userInfo['ID'],
  1145. 'nation' => \Yii::$app->params['nation'][$userInfo['NATION']]['name']??'',
  1146. 'realName' => $userInfo['REAL_NAME'],
  1147. 'idCard' => $userInfo['ID_CARD'],
  1148. 'mobile' => $userInfo['MOBILE'],
  1149. 'openBank' => $userInfo['OPEN_BANK'],
  1150. 'bankAddress' => $userInfo['BANK_ADDRESS'],
  1151. 'bankNo' => $userInfo['BANK_NO'],
  1152. 'language' => $userInfo['LANGUAGE_ID'],
  1153. 'country' => $userInfo['COUNTRY_ID'],
  1154. ];
  1155. return static::notice($data);
  1156. }
  1157. public function actionModifyProfile() {
  1158. $form = new UserBasicForm();
  1159. $form->scenario = 'modifyProfile';
  1160. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->modifyProfile()){
  1161. return static::notice(Yii::t('ctx', 'successfully'));//个人资料修改成功
  1162. } else {
  1163. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  1164. }
  1165. }
  1166. public function actionModifyStatus() {
  1167. $form = new UserBasicForm();
  1168. $form->scenario = 'modifyStatus';
  1169. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->modifyStatus()){
  1170. return static::notice(Yii::t('ctx', 'successfully'));//会员状态修改成功
  1171. } else {
  1172. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  1173. }
  1174. }
  1175. /**
  1176. * @return mixed
  1177. * @throws \yii\db\Exception
  1178. * @throws HttpException
  1179. */
  1180. public function actionIsModifyPasswordStatus() {
  1181. $form = new UserBasicForm();
  1182. $form->scenario = 'isModifyPasswordStatus';
  1183. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->isModifyPasswordStatus()){
  1184. return static::notice(Yii::t('ctx', 'successfully'));//状态修改成功
  1185. } else {
  1186. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  1187. }
  1188. }
  1189. /**
  1190. * 分页把待导入表中的数据导入到真正的数据中
  1191. * @return mixed
  1192. * @throws HttpException
  1193. */
  1194. public function actionImportUsersAdd()
  1195. {
  1196. if (\Yii::$app->request->isPost) {
  1197. $excelImportId = Yii::$app->request->post('excelImportId');
  1198. $offset = Yii::$app->request->post('offset');
  1199. $limit = Yii::$app->request->post('limit', 1000);
  1200. $errorMsg = '';
  1201. try {
  1202. $excel = new \common\helpers\Excel();
  1203. $result = $excel->pageImportDataFromExcelTable('addUser', $excelImportId, $offset, $limit);
  1204. } catch (Exception $e) {
  1205. $result = false;
  1206. $errorMsg = $e->getMessage();
  1207. }
  1208. // 还有数据
  1209. if ($result === 1) {
  1210. return static::notice(['finish' => false]);
  1211. } elseif ($result === 0) {
  1212. return static::notice(['finish' => true]);
  1213. } else {
  1214. return static::notice('An error occurred:' . $errorMsg, 400);//发生错误
  1215. }
  1216. }
  1217. }
  1218. /**
  1219. * 判断是否满足删除条件
  1220. * @return mixed
  1221. * @throws HttpException
  1222. */
  1223. public function actionChkDelUser()
  1224. {
  1225. $userName = Yii::$app->request->get('userName');
  1226. if (!$uid = Info::getUserIdByUserName($userName)) {
  1227. return static::notice('user does not exist' . $userName, 400);//用户不存在
  1228. }
  1229. if (UserInfo::findOneAsArray('REC_UID=:REC_UID AND DELETED=0', [':REC_UID' => $uid], 'USER_ID')) {
  1230. return static::notice('This member has developed other members and cannot be deleted', 400);//此会员已开拓其它会员不可以删除
  1231. }
  1232. if (UserInfo::findOneAsArray('CON_UID=:CON_UID AND DELETED=0', [':CON_UID' => $uid], 'USER_ID')) {
  1233. return static::notice('This member has been placed with other members and cannot be deleted', 400);//此会员已安置其它会员不可以删除
  1234. }
  1235. if (User::findOneAsArray('DEC_ID=:DEC_ID AND DELETED=0', [':DEC_ID' => $uid], 'ID')) {
  1236. return static::notice('This member has submitted a bill and other members cannot delete it', 400);//此会员已报单其它会员不可以删除
  1237. }
  1238. if (DecOrder::findOneAsArray('USER_ID=:TO_USER_ID OR TO_USER_ID=:TO_USER_ID', [':TO_USER_ID' => $uid], 'ID')) {
  1239. return static::notice('This member has submitted a bill and cannot be deleted', 400);//此会员已报单不可以删除
  1240. }
  1241. $info = Info::baseInfoWithNet($uid);
  1242. if ($info['REG_FROM'] == 1) {
  1243. return static::notice('This member is not empty and cannot be deleted', 400);//此会员不是空单无法删除
  1244. }
  1245. $sentMaxPeriodNum = Period::sentMaxPeriodNum();
  1246. if ($info['PERIOD_AT'] <= $sentMaxPeriodNum) {
  1247. return static::notice('The number of enrollment periods of this member is less than or equal to the number of online periods', 400);//此会员加入期数小于等于已挂网期数
  1248. }
  1249. if (User::find()->where('ID=:ID AND VERIFIED=1', [':ID' => $uid])->exists()) {
  1250. return static::notice('This member has been authenticated by real name and cannot be deleted', 400);//此会员已实名认证无法删除
  1251. }
  1252. if (User::find()->where('ID=:ID AND SUB_COM_LEADER=1', [':ID' => $uid])->exists()) {
  1253. return static::notice('This member is a branch leader and cannot be deleted', 400);//此会员是分公司领导人无法删除
  1254. }
  1255. if (UserInfo::find()->where('USER_ID=:USER_ID AND (IS_GROUP_LEADER=1 OR IS_SYSTEM_LEADER=1 OR IS_BIND=1 OR IS_TEAM=1)', [':USER_ID' => $uid])->exists()) {
  1256. return static::notice('This member cannot be deleted due to the following conditions: Team Leader / system leader / point binding / point cooperation', 400);//此会员存在以下情况无法删除,团队领导人/体系领导人/点位绑定/点位合作
  1257. }
  1258. if (FlowBonus::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $uid], 'ID')) {
  1259. return static::notice('This member has generated a balance flow, which cannot be deleted', 400);//该会员产生过余额流水无法删除
  1260. }
  1261. if (UserMove::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $uid], 'ID')) {
  1262. return static::notice('The member cannot be deleted due to network migration', 400);//该会员发生过移网无法删除
  1263. }
  1264. return static::notice($info);
  1265. }
  1266. /**
  1267. * 删除空单会员
  1268. * @return mixed
  1269. * @throws Exception
  1270. * @throws HttpException
  1271. */
  1272. public function actionUserDel()
  1273. {
  1274. $formModel = new AdminAddUserForm();
  1275. $formModel->scenario = 'userDel';
  1276. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->userDel()) {
  1277. $user = User::getBaseInfoFromRedis($result);
  1278. //// Log::adminHandle('删除空单会员' . $user['USER_NAME'], 1, $result, $user['USER_NAME']);
  1279. // Log::adminHandle('删除空单会员' . $user['USER_NAME'], 1);
  1280. return static::notice(Yii::t('ctx', 'successfully'));//删除空单会员完成
  1281. }
  1282. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  1283. }
  1284. /**
  1285. * 复销列表
  1286. * @return mixed
  1287. * @throws HttpException
  1288. */
  1289. public function actionReConsumeList()
  1290. {
  1291. // $filter = $this->filterCondition(ReconsumePool::tableName(), [
  1292. // 'userName' => ['UI.USER_NAME', '='],
  1293. // ]);
  1294. $condition = '';
  1295. $params = [];
  1296. $data = ReconsumePool::lists($condition, $params, [
  1297. 'select' => 'RP.USER_ID,RP.UNUSED_PV,RP.UNUSED_MONTH',
  1298. 'from' => ReconsumePool::tableName() . ' AS RP',
  1299. 'join' => [
  1300. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'UI.USER_ID=RP.USER_ID']
  1301. ],
  1302. 'orderBy' => 'RP.USER_ID ASC'
  1303. ]);
  1304. foreach ($data['list'] as $key => $value) {
  1305. $userBaseInfo = Cache::getUserBaseInfo($value['USER_ID']);
  1306. $data['list'][$key]['USER_NAME'] = $userBaseInfo['USER_NAME'];
  1307. $data['list'][$key]['REAL_NAME'] = $userBaseInfo['REAL_NAME'];
  1308. $data['list'][$key]['DEC_LV'] = Info::getDecLv($value['USER_ID']);
  1309. $data['list'][$key]['EMP_LV'] = Info::getEmpLv($value['USER_ID']);
  1310. }
  1311. return static::notice($data);
  1312. }
  1313. /**
  1314. * 筛选用户
  1315. * 前端传过来的get参数类似于
  1316. * [
  1317. * 'USER_NAME' => 'like,test',
  1318. * 'CREATED_AT' => '>=,2018-11-10,date'
  1319. * ]
  1320. * @return mixed
  1321. * @throws HttpException
  1322. */
  1323. public function actionFilterUser()
  1324. {
  1325. $filter = $this->filterCondition([
  1326. 'USER_NAME' => 'U.USER_NAME',
  1327. 'REAL_NAME' => 'U.REAL_NAME',
  1328. 'STATUS' => 'U.STATUS',
  1329. 'STATUS_AT' => 'U.STATUS_AT',
  1330. 'STATUS_NAME' => 'U.STATUS',
  1331. 'ALLOW_LOGIN' => 'U.ALLOW_LOGIN',
  1332. 'CREATED_AT' => 'U.CREATED_AT',
  1333. 'USER_CREATED_AT' => 'U.CREATED_AT',
  1334. 'PERIOD_AT' => 'U.PERIOD_AT',
  1335. 'DEC_LV' => 'U.DEC_LV',
  1336. 'DEC_LV_NAME' => 'U.DEC_LV',
  1337. 'DEC_LV_UPDATED_AT' => 'U.DEC_LV_UPDATED_AT',
  1338. 'LAST_DEC_LV' => 'U.LAST_DEC_LV',
  1339. 'LAST_DEC_LV_NAME' => 'U.LAST_DEC_LV',
  1340. 'EMP_LV' => 'U.EMP_LV',
  1341. 'EMP_LV_NAME' => 'U.EMP_LV',
  1342. //'ID_TYPE' => 'U.ID_TYPE',
  1343. 'ID_CARD' => 'U.ID_CARD',
  1344. 'SPOUSE_NAME' => 'U.SPOUSE_NAME',
  1345. 'SPOUSE_IDCARD' => 'U.SPOUSE_IDCARD',
  1346. 'SUB_COM_ID' => 'U.SUB_COM_ID',
  1347. 'SUB_COM_NAME' => 'U.SUB_COM_ID',
  1348. 'MOBILE' => 'U.MOBILE',
  1349. 'TEL' => 'U.TEL',
  1350. 'DEC_DEC_ROLE_ID' => 'UD.DEC_ROLE_ID',
  1351. 'DEC_DEC_ROLE_NAME' => 'UD.DEC_ROLE_ID',
  1352. 'DEC_USER_NAME' => 'UD.USER_NAME',
  1353. 'IS_DEC' => 'U.IS_DEC',
  1354. 'DEC_ROLE_ID' => 'U.DEC_ROLE_ID',
  1355. 'DEC_ROLE_NAME' => 'U.DEC_ROLE_ID',
  1356. 'OPEN_BANK' => 'U.OPEN_BANK',
  1357. 'OPEN_BANK_NAME' => 'U.OPEN_BANK',
  1358. 'BANK_AREA' => [
  1359. 'FIELD' => ['U.BANK_PROVINCE', 'U.BANK_CITY', 'U.BANK_COUNTY'],
  1360. 'BIND' => ['BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY'],
  1361. ],
  1362. 'BANK_ADDRESS' => 'U.BANK_ADDRESS',
  1363. 'BANK_NO' => 'U.BANK_NO',
  1364. 'SEX' => 'U.SEX',
  1365. 'NATION' => 'U.NATION',
  1366. 'NATION_NAME' => 'U.NATION',
  1367. 'AREA' => [
  1368. 'FIELD' => ['U.PROVINCE', 'U.CITY', 'U.COUNTY'],
  1369. 'BIND' => ['PROVINCE', 'CITY', 'COUNTY'],
  1370. ],
  1371. 'ADDRESS' => 'U.ADDRESS',
  1372. 'VERIFIED' => 'U.VERIFIED',
  1373. 'VERIFIED_AT' => 'U.VERIFIED_AT',
  1374. 'IS_DIRECT_SELLER' => 'U.IS_DIRECT_SELLER',
  1375. 'PART_FUNC_CLOSED' => 'U.PART_FUNC_CLOSED',
  1376. //'BIRTHDAY' => 'U.BIRTHDAY',
  1377. 'DEC_CLOSED' => 'U.DEC_CLOSED',
  1378. 'NOT_OPERATING' => 'U.NOT_OPERATING',
  1379. ]);
  1380. $condition = $filter['condition'];
  1381. $params = $filter['params'];
  1382. $data = User::lists($condition, $params, [
  1383. 'select' => 'U.*, UD.USER_NAME AS UD_USER_NAME',
  1384. 'from' => User::tableName() . ' AS U',
  1385. 'join' => [
  1386. ['LEFT JOIN', User::tableName() . ' AS UD', 'U.DEC_ID=UD.ID'],
  1387. ],
  1388. 'orderBy' => 'U.CREATED_AT DESC',
  1389. ]);
  1390. return static::notice($data);
  1391. }
  1392. /**
  1393. * 会员级别变动记录
  1394. * @return mixed
  1395. * @throws \yii\base\Exception
  1396. * @throws HttpException
  1397. */
  1398. public function actionDecLevelList()
  1399. {
  1400. $filter = $this->filterCondition([
  1401. 'USER_NAME' => 'CU.USER_NAME',
  1402. 'CREATED_AT' => 'LL.CREATED_AT',
  1403. 'ADMIN_NAME' => 'ADM.ADMIN_NAME',
  1404. ]);
  1405. $condition = $filter['condition'];
  1406. $params = $filter['params'];
  1407. $listObj = new DecLevelList();
  1408. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  1409. return static::notice($data);
  1410. }
  1411. /**
  1412. * 调整会员级别报单级别
  1413. * @return mixed
  1414. * @throws HttpException
  1415. */
  1416. public function actionChangeUserDecLevel()
  1417. {
  1418. if (Yii::$app->request->isPost) {
  1419. return parent::edit(DecLevelLogForm::class, Yii::t('ctx', 'successfully'), 'adminChange', [ // 修改会员级别成功
  1420. 'adminChange',
  1421. ], null, function ($form, $result) {
  1422. //$userName = Info::getUserNameByUserId($result['ID']);
  1423. // Log::adminHandle('后台调整会员级别级别:'.$userName, 1, $result['ID'], $userName);
  1424. });
  1425. }
  1426. }
  1427. /**
  1428. * 调整会员级别报单级别
  1429. * @return mixed
  1430. * @throws HttpException
  1431. */
  1432. public function actionChangeUserDecRole()
  1433. {
  1434. if (Yii::$app->request->isPost) {
  1435. return parent::edit(DecRoleLogForm::class, Yii::t('ctx', 'successfully'), 'adminChange', [//修改报单中心级别成功
  1436. 'adminChange',
  1437. ], null, function ($form, $result) {
  1438. //$userName = Info::getUserNameByUserId($result['ID']);
  1439. // Log::adminHandle('后台调整会员级别级别:'.$userName, 1, $result['ID'], $userName);
  1440. });
  1441. }
  1442. }
  1443. /**
  1444. * 修改会员前台显示聘级
  1445. * @return mixed
  1446. * @throws HttpException
  1447. */
  1448. public function actionChangeShowEmpLevel()
  1449. {
  1450. if (Yii::$app->request->isPost) {
  1451. return parent::edit(ChangeShowEmpLvForm::class, Yii::t('ctx', 'successfully'), 'adminChange', [//修改会员前台显示聘级成功
  1452. 'adminChange',
  1453. ], null, function ($form, $result) {
  1454. //$userName = Info::getUserNameByUserId($result['ID']);
  1455. // Log::adminHandle('后台调整会员级别级别:'.$userName, 1, $result['ID'], $userName);
  1456. });
  1457. }
  1458. }
  1459. /**
  1460. * 注册信息管理
  1461. * @return mixed
  1462. * @throws Exception
  1463. * @throws HttpException
  1464. */
  1465. public function actionRegInfo()
  1466. {
  1467. $filter = $this->filterCondition([
  1468. 'userIds' => 'UI.USER_ID',
  1469. 'regType' => 'UI.REG_TYPE',
  1470. ]);
  1471. $condition = $filter['condition'];
  1472. $params = $filter['params'];
  1473. $condition .= ' AND UI.DELETED=0';
  1474. $data = UserInfo::lists($condition, $params, [
  1475. 'orderBy' => 'UI.CREATED_AT DESC',
  1476. 'from' => UserInfo::tableName() . ' AS UI',
  1477. ]);
  1478. foreach ($data['list'] as $key => $value) {
  1479. $data['list'][$key]['BASE_INFO'] = Info::baseInfoZh($value['USER_ID']);
  1480. $data['list'][$key]['AUDIT_INFO'] = RegInfoAudit::find()->from(RegInfoAudit::tableName() . ' AS RIA')->select('RIA.*,ADM.ADMIN_NAME CREATE_ADMIN_NAME,ADMA.ADMIN_NAME AUDIT_ADMIN_NAME')->where('USER_ID=:USER_ID AND AUDIT_STATUS=:AUDIT_STATUS', [':USER_ID' => $value['USER_ID'], ':AUDIT_STATUS' => \Yii::$app->params['auditStatus']['true']['value']])->join('LEFT JOIN', Admin::tableName() . ' AS ADM', 'ADM.ID=RIA.CREATE_ADMIN')->join('LEFT JOIN', Admin::tableName() . ' AS ADMA', 'ADMA.ID=RIA.AUDIT_ADMIN')->orderBy('AUDITED_AT DESC')->asArray()->one();
  1481. }
  1482. return static::notice($data);
  1483. }
  1484. /**
  1485. * 注册信息管理中提交修改注册信息
  1486. * @return mixed
  1487. * @throws HttpException
  1488. */
  1489. public function actionRegInfoEdit()
  1490. {
  1491. if (Yii::$app->request->isPost) {
  1492. return parent::edit(RegInfoAuditForm::class, 'The registration information modification has been submitted successfully and will take effect after approval', 'editRegInfo', ['editRegInfo'], null, function ($form, $result) {//注册信息修改提交成功,审核后生效
  1493. $user = User::getBaseInfoFromRedis($result['USER_ID']);
  1494. // Log::adminHandle('申请为' . $user['USER_NAME'] . '注册信息修改', 1, $result['USER_ID'], $user['USER_NAME']);
  1495. });
  1496. }
  1497. $allOpenBank = OpenBank::findAllAsArray('STATUS=1');
  1498. return static::notice(['allOpenBank' => $allOpenBank]);
  1499. }
  1500. /**
  1501. * 会员注册信息审核
  1502. * @return mixed
  1503. * @throws Exception
  1504. * @throws HttpException
  1505. */
  1506. public function actionRegInfoAudit()
  1507. {
  1508. $filter = $this->filterCondition([
  1509. 'userIds' => 'UI.USER_ID',
  1510. 'createdAt' => 'RIA.CREATED_AT',
  1511. 'regType' => 'RIA.REG_TYPE',
  1512. 'filterStatus' => 'RIA.AUDIT_STATUS',
  1513. ]);
  1514. $condition = $filter['condition'];
  1515. $params = $filter['params'];
  1516. $data = RegInfoAudit::lists($condition, $params, [
  1517. 'orderBy' => 'RIA.CREATED_AT DESC',
  1518. 'from' => RegInfoAudit::tableName() . ' AS RIA',
  1519. 'join' => [
  1520. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'RIA.USER_ID=UI.USER_ID'],
  1521. ],
  1522. ]);
  1523. $auditStatus = array_column(\Yii::$app->params['auditStatus'], null, 'value');
  1524. foreach ($data['list'] as $key => $value) {
  1525. $data['list'][$key]['BASE_INFO'] = Info::baseInfoZh($value['USER_ID']);
  1526. $data['list'][$key]['CREATE_ADMIN_NAME'] = Admin::getAdminNameById($value['CREATE_ADMIN']);
  1527. $data['list'][$key]['AUDIT_ADMIN_NAME'] = Admin::getAdminNameById($value['AUDIT_ADMIN']);
  1528. $data['list'][$key]['STATUS_NAME'] = $auditStatus[$value['AUDIT_STATUS']]['label'];
  1529. }
  1530. return static::notice($data);
  1531. }
  1532. /**
  1533. * 会员注册信息添加
  1534. * @return mixed
  1535. * @throws HttpException
  1536. */
  1537. public function actionRegInfoAuditAdd()
  1538. {
  1539. if (Yii::$app->request->isPost) {
  1540. return parent::edit(RegInfoAuditForm::class, Yii::t('ctx', 'successfully'), 'add', ['add'], null, function ($form, $result) {//注册信息录入成功
  1541. $user = User::getBaseInfoFromRedis($result['USER_ID']);
  1542. // Log::adminHandle('申请为' . $user['USER_NAME'] . '注册信息录入', 1, $result['USER_ID'], $user['USER_NAME']);
  1543. });
  1544. }
  1545. }
  1546. /**
  1547. * 会员注册信息添加获取
  1548. * @return mixed
  1549. * @throws HttpException
  1550. */
  1551. public function actionRegInfoAuditAddOpt()
  1552. {
  1553. $allOpenBank = OpenBank::findAllAsArray('STATUS=1');
  1554. return static::notice(['allOpenBank' => $allOpenBank]);
  1555. }
  1556. /**
  1557. * 会员注册信息获取
  1558. * @return mixed
  1559. * @throws Exception
  1560. * @throws HttpException
  1561. */
  1562. public function actionRegInfoAuditGet()
  1563. {
  1564. $id = Yii::$app->request->get('id');
  1565. $regInfo = RegInfoAudit::findOneAsArray('ID=:ID', [':ID' => $id]);
  1566. if (!$regInfo) {
  1567. return static::notice('Data does not exist', 400);//数据不存在
  1568. }
  1569. $regInfo['BASE_INFO'] = Info::baseInfoZh($regInfo['USER_ID']);
  1570. $regInfo['REG_EXPIRES'] = Date::convert($regInfo['REG_EXPIRES']);
  1571. $allOpenBank = OpenBank::findAllAsArray('STATUS=1');
  1572. $companyBank = CompanyBank::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $regInfo['USER_ID']]);
  1573. $bank = ['openBank' => null, 'bankAreaSelected' => [], 'bankAddress' => null, 'openName' => null, 'bankNo' => null];
  1574. if ($companyBank) $bank = ['openBank' => $companyBank['OPEN_BANK'], 'bankAreaSelected' => [$companyBank['BANK_PROVINCE'], $companyBank['BANK_CITY'], $companyBank['BANK_COUNTY']], 'bankAddress' => $companyBank['BANK_ADDRESS'], 'openName' => $companyBank['OPEN_NAME'], 'bankNo' => $companyBank['BANK_NO']];
  1575. return static::notice(['form' => ['id' => $regInfo['ID'], 'userId' => $regInfo['USER_ID'], 'baseInfo' => $regInfo['BASE_INFO'], 'type' => $regInfo['REG_TYPE'], 'regName' => $regInfo['REG_NAME'], 'creditCode' => $regInfo['CREDIT_CODE'], 'premises' => $regInfo['PREMISES'], 'legalPerson' => $regInfo['LEGAL_PERSON'], 'regExpires' => $regInfo['REG_EXPIRES'], 'createRemark' => $regInfo['CREATE_REMARK'], 'companyBank' => $bank], 'allOpenBank' => $allOpenBank]);
  1576. }
  1577. /**
  1578. * 会员注册信息修改
  1579. * @return mixed
  1580. * @throws \yii\db\Exception
  1581. * @throws HttpException
  1582. */
  1583. public function actionRegInfoAuditEdit()
  1584. {
  1585. $formModel = new RegInfoAuditForm();
  1586. $formModel->scenario = 'edit';
  1587. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->edit()) {
  1588. $user = User::getBaseInfoFromRedis($result['USER_ID']);
  1589. // Log::adminHandle('修改' . $user['USER_NAME'] . '注册信息录入数据', 1, $result['USER_ID'], $user['USER_NAME']);
  1590. return static::notice(Yii::t('ctx', 'successfully'));//修改注册信息录入数据完成
  1591. }
  1592. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  1593. }
  1594. /**
  1595. * 会员注册信息审核
  1596. * @return mixed
  1597. * @throws \yii\db\Exception
  1598. * @throws HttpException
  1599. */
  1600. public function actionRegInfoAuditAudit()
  1601. {
  1602. $formModel = new RegInfoAuditForm();
  1603. $formModel->scenario = 'audit';
  1604. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->audit()) {
  1605. $user = User::getBaseInfoFromRedis($result['USER_ID']);
  1606. // Log::adminHandle('审核' . $user['USER_NAME'] . '注册信息', 1, $result['USER_ID'], $user['USER_NAME']);
  1607. return static::notice(Yii::t('ctx', 'successfully'));//审核注册信息完成
  1608. }
  1609. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  1610. }
  1611. /**
  1612. * 分页导入excel文件到待导入数据的表中
  1613. * @return mixed
  1614. * @throws HttpException
  1615. */
  1616. public function actionImportRegInfoToExcelTable()
  1617. {
  1618. // 先上传到服务器文件
  1619. if (\Yii::$app->request->isPost) {
  1620. $excelImportId = Yii::$app->request->post('excelImportId');
  1621. $rowCount = Yii::$app->request->post('rowCount');
  1622. $startRow = Yii::$app->request->post('startRow');
  1623. $limit = Yii::$app->request->post('limit', 1000);
  1624. $errorMsg = '';
  1625. try {
  1626. $excel = new \common\helpers\Excel();
  1627. $result = $excel->pageImportDataFromExcel('regInfo', $excelImportId, $rowCount, $startRow, $limit);
  1628. } catch (Exception $e) {
  1629. $result = false;
  1630. $errorMsg = $e->getMessage();
  1631. }
  1632. // 还有数据
  1633. if ($result === 1) {
  1634. return static::notice(['finish' => false]);
  1635. } elseif ($result === 0) {
  1636. return static::notice(['finish' => true]);
  1637. } else {
  1638. return static::notice('发生错误:' . $errorMsg, 400);
  1639. }
  1640. }
  1641. }
  1642. /**
  1643. * 分页把待导入表中的数据导入到真正的数据中
  1644. * @return mixed
  1645. * @throws Exception
  1646. * @throws HttpException
  1647. */
  1648. public function actionImportRegInfo()
  1649. {
  1650. if (\Yii::$app->request->isPost) {
  1651. $excelImportId = Yii::$app->request->post('excelImportId');
  1652. $offset = Yii::$app->request->post('offset');
  1653. $limit = Yii::$app->request->post('limit', 1000);
  1654. $errorMsg = '';
  1655. $excel = new \common\helpers\Excel();
  1656. $result = $excel->pageImportDataFromExcelTable('regInfo', $excelImportId, $offset, $limit);
  1657. // 还有数据
  1658. if ($result === 1) {
  1659. return static::notice(['finish' => false]);
  1660. } elseif ($result === 0) {
  1661. return static::notice(['finish' => true]);
  1662. } else {
  1663. return static::notice('发生错误:' . $errorMsg, 400);
  1664. }
  1665. }
  1666. }
  1667. /**
  1668. * 会员注册信息删除
  1669. * @return mixed
  1670. * @throws \yii\db\Exception
  1671. * @throws HttpException
  1672. */
  1673. public function actionRegInfoAuditDelete()
  1674. {
  1675. $result = static::delete(RegInfoAudit::class, null, function ($selected) {
  1676. RegInfoAuditForm::delete($selected);
  1677. // Log::adminHandle('删除注册信息');
  1678. }, true);
  1679. return $result;
  1680. }
  1681. /**
  1682. * 禁止登录
  1683. * @return mixed
  1684. * @throws HttpException
  1685. */
  1686. public function actionCloseLogin()
  1687. {
  1688. if (Yii::$app->request->isPost) {
  1689. return parent::edit(CloseLoginForm::class, Yii::t('ctx', 'successfully'), 'single', ['single'], null, function ($form, $result) {
  1690. // $appStr = CloseLoginForm::$apps[$form->shopOrBonus];
  1691. // $closeStr = CloseLoginForm::$closeSwitch[$form->isClose];
  1692. // $typeStr = CloseLoginForm::$types[$form->type];
  1693. // $remark = $form->remark;
  1694. // Log::adminHandle('为会员' . $form->userName . $typeStr . $closeStr . $appStr, 1, $result, $form->userName, $remark);
  1695. });
  1696. }
  1697. }
  1698. /**
  1699. * 禁止登陆类型获取
  1700. * @return mixed
  1701. * @throws HttpException
  1702. */
  1703. public function actionCloseLoginGet()
  1704. {
  1705. return static::notice(['types' => CloseLoginForm::$types, 'closeSwitch' => CloseLoginForm::$closeSwitch]);
  1706. }
  1707. /**
  1708. * 关闭地区登录
  1709. * @return mixed
  1710. * @throws HttpException
  1711. */
  1712. public function actionCloseAreaLogin()
  1713. {
  1714. if (Yii::$app->request->isPost) {
  1715. return parent::edit(CloseLoginForm::class, Yii::t('ctx', 'successfully'), 'area', ['area'], null, function ($form, $result) {
  1716. // $appStr = CloseLoginForm::$apps[$form->shopOrBonus];
  1717. // $closeStr = CloseLoginForm::$closeSwitch[$form->isClose];
  1718. // $province = $form->areaSelected[0] ?? '';
  1719. // $city = $form->areaSelected[1] ?? '';
  1720. // $county = $form->areaSelected[2] ?? '';
  1721. // $remark = $form->remark;
  1722. // Log::adminHandle('区域'.$appStr.$closeStr.':' . $province . $city . $county, 1, null, null, $remark);
  1723. });
  1724. }
  1725. return static::notice(['types' => CloseLoginForm::$types, 'closeSwitch' => CloseLoginForm::$closeSwitch]);
  1726. }
  1727. /**
  1728. * 批量登录管理
  1729. * @return mixed
  1730. * @throws HttpException
  1731. */
  1732. public function actionBatchCloseLogin()
  1733. {
  1734. if (Yii::$app->request->isPost) {
  1735. return parent::edit(CloseLoginForm::class, Yii::t('ctx', 'successfully'), 'batch', ['batch'], null, function ($form, $result) {
  1736. /*$appStr = CloseLoginForm::$apps[$form->shopOrBonus];
  1737. $closeStr = CloseLoginForm::$closeSwitch[$form->isClose];
  1738. $remark = $form->remark;
  1739. if (is_array($result)) {
  1740. foreach ($result as $value) {
  1741. // 获取其中一个人的会员编号
  1742. $userName = Info::getUserNameByUserId($value);
  1743. // Log::adminHandle('为会员' . $userName . $closeStr . $appStr, 1, $value, $userName, $remark);
  1744. }
  1745. }*/
  1746. });
  1747. }
  1748. return static::notice(['types' => CloseLoginForm::$types, 'closeSwitch' => CloseLoginForm::$closeSwitch]);
  1749. }
  1750. /**
  1751. * 关闭报单信息获取
  1752. * @return mixed
  1753. * @throws HttpException
  1754. */
  1755. public function actionCloseDecGet()
  1756. {
  1757. return static::notice(['types' => CloseDecForm::$types, 'closeSwitch' => CloseDecForm::$closeSwitch]);
  1758. }
  1759. /**
  1760. * 关闭报单
  1761. * @return mixed
  1762. * @throws HttpException
  1763. */
  1764. public function actionCloseDec()
  1765. {
  1766. if (Yii::$app->request->isPost) {
  1767. return parent::edit(CloseDecForm::class, Yii::t('ctx', 'successfully'), 'single', ['single'], null, function ($form, $result) {
  1768. // $closeStr = CloseDecForm::$closeSwitch[$form->isClose];
  1769. // $typeStr = CloseDecForm::$types[$form->type];
  1770. // $remark = $form->remark;
  1771. // Log::adminHandle('为会员' . $form->userName . $typeStr . $closeStr, 1, $result, $form->userName, $remark);
  1772. });
  1773. }
  1774. }
  1775. /**
  1776. * 批量关闭报单
  1777. * @return mixed
  1778. * @throws HttpException
  1779. */
  1780. public function actionBatchCloseDec()
  1781. {
  1782. if (Yii::$app->request->isPost) {
  1783. return parent::edit(CloseDecForm::class, Yii::t('ctx', 'successfully'), 'batch', ['batch'], null, function ($form, $result) {
  1784. /*$closeStr = CloseDecForm::$closeSwitch[$form->isClose];
  1785. $remark = $form->remark;
  1786. if (is_array($result)) {
  1787. foreach ($result as $value) {
  1788. // 获取其中一个人的会员编号
  1789. $userName = Info::getUserNameByUserId($value);
  1790. // Log::adminHandle('为会员' . $userName . $closeStr, 1, $value, $userName, $remark);
  1791. }
  1792. }*/
  1793. });
  1794. }
  1795. return static::notice(['types' => CloseDecForm::$types, 'closeSwitch' => CloseDecForm::$closeSwitch]);
  1796. }
  1797. /**
  1798. * 按地区关闭报单
  1799. * @return mixed
  1800. * @throws HttpException
  1801. */
  1802. public function actionCloseAreaDec()
  1803. {
  1804. if (Yii::$app->request->isPost) {
  1805. return parent::edit(CloseDecForm::class, Yii::t('ctx', 'successfully'), 'area', ['area'], null, function ($form, $result) {
  1806. // $closeStr = CloseDecForm::$closeSwitch[$form->isClose];
  1807. // $province = $form->areaSelected[0] ?? '';
  1808. // $city = $form->areaSelected[1] ?? '';
  1809. // $county = $form->areaSelected[2] ?? '';
  1810. // $remark = $form->remark;
  1811. // Log::adminHandle('区域'.$closeStr.':' . $province . $city . $county, 1, null, null, $remark);
  1812. });
  1813. }
  1814. return static::notice(['types' => CloseDecForm::$types, 'closeSwitch' => CloseDecForm::$closeSwitch]);
  1815. }
  1816. /**
  1817. * 会员状态管理
  1818. * @return mixed
  1819. * @throws Exception
  1820. * @throws HttpException
  1821. */
  1822. // public function actionStatusAuditList()
  1823. // {
  1824. // $filter = $this->filterCondition([
  1825. // 'userIds' => 'UI.USER_ID',
  1826. // 'filterStatus' => 'USA.AUDIT_STATUS',
  1827. // 'SYSTEM_NAME' => 'UI.SYSTEM_ID',
  1828. // 'ORI_STATUS_NAME' => 'USA.ORI_VALUE',
  1829. // 'STATUS_NAME' => 'USA.STATUS_VALUE',
  1830. // 'PERIOD_NUM' => 'USA.PERIOD_NUM',
  1831. // 'CREATE_REMARK' => 'USA.CREATE_REMARK',
  1832. // 'IS_PERIOD_ADD_T' => 'USA.IS_PERIOD_ADD_T',
  1833. // 'ADD_T_PERIOD_NUM' => 'USA.ADD_T_PERIOD_NUM',
  1834. // 'IS_PERIOD_OPEN' => 'USA.IS_PERIOD_OPEN',
  1835. // 'OPEN_PERIOD_NUM' => 'USA.OPEN_PERIOD_NUM',
  1836. // 'CREATE_ADMIN_NAME' => 'ADM.ADMIN_NAME',
  1837. // 'CREATED_AT' => 'ADM.CREATED_AT',
  1838. // 'AUDIT_ADMIN_NAME' => 'ADMA.ADMIN_NAME',
  1839. // 'AUDITED_AT' => 'ADM.AUDITED_AT',
  1840. // ]);
  1841. // $condition = $filter['condition'];
  1842. // $params = $filter['params'];
  1843. // $listObj = new StatusAuditList();
  1844. // $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  1845. // return static::notice($data);
  1846. // }
  1847. /**
  1848. * 会员状态管理导出
  1849. * @return mixed
  1850. * @throws \yii\db\Exception
  1851. * @throws HttpException
  1852. */
  1853. public function actionStatusAuditExport()
  1854. {
  1855. $filter = $this->filterCondition([
  1856. 'userIds' => 'UI.USER_ID',
  1857. 'filterStatus' => 'USA.AUDIT_STATUS',
  1858. 'SYSTEM_NAME' => 'UI.SYSTEM_ID',
  1859. 'ORI_STATUS_NAME' => 'USA.ORI_VALUE',
  1860. 'STATUS_NAME' => 'USA.STATUS_VALUE',
  1861. 'PERIOD_NUM' => 'USA.PERIOD_NUM',
  1862. 'CREATE_REMARK' => 'USA.CREATE_REMARK',
  1863. 'IS_PERIOD_ADD_T' => 'USA.IS_PERIOD_ADD_T',
  1864. 'ADD_T_PERIOD_NUM' => 'USA.ADD_T_PERIOD_NUM',
  1865. 'IS_PERIOD_OPEN' => 'USA.IS_PERIOD_OPEN',
  1866. 'OPEN_PERIOD_NUM' => 'USA.OPEN_PERIOD_NUM',
  1867. 'CREATE_ADMIN_NAME' => 'ADM.ADMIN_NAME',
  1868. 'CREATED_AT' => 'ADM.CREATED_AT',
  1869. 'AUDIT_ADMIN_NAME' => 'ADMA.ADMIN_NAME',
  1870. 'AUDITED_AT' => 'ADM.AUDITED_AT',
  1871. ]);
  1872. $form = new UserExportForm();
  1873. $result = $form->run($filter, '会员状态管理');
  1874. if (!$result) {
  1875. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  1876. }
  1877. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  1878. }
  1879. /**
  1880. * 申请修改会员状态
  1881. * @return mixed
  1882. * @throws HttpException
  1883. */
  1884. public function actionStatusAuditAdd()
  1885. {
  1886. if (Yii::$app->request->isPost) {
  1887. return parent::edit(UserStatusForm::class, Yii::t('ctx', 'successfully'), 'add', ['add'], null, function ($form, $result) {
  1888. $userInfo = Info::baseInfo($result->USER_ID);
  1889. // Log::adminHandle('申请修改' . $userInfo['USER_NAME'] . '状态为' . Yii::$app->params['userStatus'][$result->STATUS_VALUE]['label'], 1, $result->USER_ID, $userInfo['USER_NAME']);
  1890. });
  1891. }
  1892. }
  1893. /**
  1894. * 获取全部移网类型
  1895. * @return mixed
  1896. * @throws HttpException
  1897. */
  1898. public function actionStatusAuditGetStatuses()
  1899. {
  1900. $statuses = Tool::paramConvert(Yii::$app->params['userStatus']);
  1901. return static::notice(['statuses' => $statuses]);
  1902. }
  1903. /**
  1904. * 获取会员状态数据
  1905. * @return mixed
  1906. * @throws Exception
  1907. * @throws HttpException
  1908. */
  1909. public function actionStatusAuditGet()
  1910. {
  1911. $id = Yii::$app->request->get('id');
  1912. $userStatusAudit = UserStatusAudit::findOneAsArray('ID=:ID', [':ID' => $id]);
  1913. if (!$userStatusAudit) {
  1914. return static::notice('The data does not exist', 400); // 数据不存在
  1915. }
  1916. $userStatusAudit['BASE_INFO'] = Info::baseInfoZh($userStatusAudit['USER_ID']);
  1917. $statuses = Tool::paramConvert(Yii::$app->params['userStatus']);
  1918. return static::notice([
  1919. 'id' => $userStatusAudit['ID'],
  1920. 'baseInfo' => $userStatusAudit['BASE_INFO'],
  1921. 'statusValue' => $userStatusAudit['STATUS_VALUE'],
  1922. 'isPeriodAddT' => $userStatusAudit['IS_PERIOD_ADD_T'] ? true : false,
  1923. 'addTPeriodNum' => $userStatusAudit['ADD_T_PERIOD_NUM'],
  1924. 'isPeriodOpen' => $userStatusAudit['IS_PERIOD_OPEN'] ? true : false,
  1925. 'openPeriodNum' => $userStatusAudit['OPEN_PERIOD_NUM'],
  1926. 'remark' => $userStatusAudit['CREATE_REMARK'],
  1927. ]);
  1928. }
  1929. /**
  1930. * 审核修改会员状态
  1931. * @return mixed
  1932. * @throws Exception
  1933. * @throws \yii\db\Exception
  1934. * @throws HttpException
  1935. */
  1936. public function actionStatusAudit()
  1937. {
  1938. $formModel = new UserStatusForm();
  1939. $formModel->scenario = 'audit';
  1940. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->audit()) {
  1941. $userInfo = Info::baseInfo($result->USER_ID);
  1942. // Log::adminHandle('审核修改' . $userInfo['USER_NAME'] . '状态为' . Yii::$app->params['userStatus'][$result->STATUS_VALUE]['label'], 1, $result->USER_ID, $userInfo['USER_NAME']);
  1943. return static::notice(Yii::t('ctx', 'successfully'));
  1944. }
  1945. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  1946. }
  1947. /**
  1948. * 删除审核修改会员状态
  1949. * @return mixed
  1950. * @throws \yii\db\Exception
  1951. * @throws HttpException
  1952. */
  1953. public function actionStatusAuditDelete()
  1954. {
  1955. $userStatusForm = new UserStatusForm();
  1956. $result = static::delete(UserStatusAudit::class, function ($selected) use ($userStatusForm) {
  1957. $userStatusForm->beforeDelete($selected);
  1958. // Log::adminHandle('删除审核修改会员状态信息');
  1959. }, function ($selected) use ($userStatusForm) {
  1960. $userStatusForm->delete($selected);
  1961. // Log::adminHandle('删除审核修改会员状态信息');
  1962. }, true);
  1963. return $result;
  1964. }
  1965. /**
  1966. * 设置是否运作
  1967. * @return mixed
  1968. * @throws HttpException
  1969. */
  1970. public function actionIsOperating()
  1971. {
  1972. if (Yii::$app->request->isPost) {
  1973. return parent::edit(UserStatusForm::class, Yii::t('ctx', 'successfully'), 'operating', ['operating'], null, function ($form, $result) {
  1974. /*$isOperating = $form->isOperating ? '运作' : '不运作';
  1975. if(is_array($result)){
  1976. foreach ($result as $value){
  1977. // 获取其中一个人的会员编号
  1978. $userName = Info::getUserNameByUserId($value);
  1979. // Log::adminHandle('为会员' . $userName . '会员设置为' . $isOperating, 1, $value, $userName);
  1980. }
  1981. }*/
  1982. });
  1983. }
  1984. }
  1985. /**
  1986. * 团队领导人
  1987. * @return mixed
  1988. * @throws HttpException
  1989. */
  1990. public function actionIsGroup()
  1991. {
  1992. if (Yii::$app->request->isPost) {
  1993. return parent::edit(UserGroupForm::class, Yii::t('ctx', 'successfully'), 'group', ['group'], null, function ($form, $result) {
  1994. $isGroup = $form->isGroup ? '设为团队领导人' : '取消团队领导人';
  1995. if (is_array($result)) {
  1996. foreach ($result as $value) {
  1997. // 获取其中一个人的会员编号
  1998. $userName = Info::getUserNameByUserId($value);
  1999. // Log::adminHandle('为会员' . $userName . $isGroup, 1, $value, $userName);
  2000. }
  2001. }
  2002. });
  2003. }
  2004. }
  2005. /**
  2006. * 报单中心
  2007. * @return mixed
  2008. * @throws HttpException
  2009. */
  2010. public function actionIsDec()
  2011. {
  2012. if (Yii::$app->request->isPost) {
  2013. return parent::edit(UserDecForm::class, Yii::t('ctx', 'successfully'), 'isDec', ['isDec'], null, null);
  2014. }
  2015. }
  2016. /**
  2017. * 工作室
  2018. * @return mixed
  2019. * @throws HttpException
  2020. */
  2021. public function actionIsStudio()
  2022. {
  2023. if (Yii::$app->request->isPost) {
  2024. return parent::edit(UserDecForm::class, Yii::t('ctx', 'successfully'), 'isStudio', ['isStudio'], null, null);
  2025. }
  2026. }
  2027. /**
  2028. * 网络图谱
  2029. * @return mixed
  2030. * @throws HttpException
  2031. */
  2032. public function actionIsAtlas()
  2033. {
  2034. if (Yii::$app->request->isPost) {
  2035. return parent::edit(UserDecForm::class, Yii::t('ctx', 'successfully'), 'isAtlas', ['isAtlas'], null, null);
  2036. }
  2037. }
  2038. /**
  2039. * 会员充值管理显隐设置
  2040. * @return mixed
  2041. * @throws HttpException
  2042. */
  2043. public function actionIsRecharge()
  2044. {
  2045. if (Yii::$app->request->isPost) {
  2046. return parent::edit(UserDecForm::class, Yii::t('ctx', 'successfully'), 'isRecharge', ['isRecharge'], null, null);
  2047. }
  2048. }
  2049. /**
  2050. * 获取企业银行信息
  2051. * @return mixed
  2052. * @throws HttpException
  2053. */
  2054. public function actionCompanyBankGet()
  2055. {
  2056. $id = Yii::$app->request->get('id');
  2057. $userName = Yii::$app->request->get('userName');
  2058. $companyBank = [];
  2059. if ($id) {
  2060. $companyBank = CompanyBank::findOneAsArray('ID=:ID', [':ID' => $id]);
  2061. }
  2062. if ($userName) {
  2063. $userId = Info::getUserIdByUserName($userName);
  2064. if ($userId) $companyBank = CompanyBank::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId]);
  2065. }
  2066. if ($companyBank) return static::notice(['openBank' => $companyBank['OPEN_BANK'], 'bankAreaSelected' => [$companyBank['BANK_PROVINCE'], $companyBank['BANK_CITY'], $companyBank['BANK_COUNTY']], 'bankAddress' => $companyBank['BANK_ADDRESS'], 'openName' => $companyBank['OPEN_NAME'], 'bankNo' => $companyBank['BANK_NO']]);
  2067. return static::notice(['openBank' => null, 'bankAreaSelected' => [], 'bankAddress' => null, 'openName' => null, 'bankNo' => null]);
  2068. }
  2069. /**
  2070. * 调整会员转账/提现比例
  2071. * @return mixed
  2072. * @throws HttpException
  2073. */
  2074. public function actionChangeTransferProp()
  2075. {
  2076. if (Yii::$app->request->isPost) {
  2077. return parent::edit(UserTransferPropForm::class, Yii::t('ctx', 'successfully'), 'change', ['change'], null, function ($form, $result) {
  2078. /*$remark = $form->remark;
  2079. if (is_array($result)) {
  2080. foreach ($result as $value) {
  2081. // 获取其中一个人的会员编号
  2082. $userName = Info::getUserNameByUserId($value);
  2083. // Log::adminHandle('调整会员'.$userName.'转账/提现比例成功', 1, $value, $userName, $remark);
  2084. }
  2085. }*/
  2086. });
  2087. }
  2088. }
  2089. public function actionStatusCloseGet()
  2090. {
  2091. $users = Status::getCloseUser();
  2092. return $users;
  2093. }
  2094. /**
  2095. * 清空关停会员钱包
  2096. * @return mixed
  2097. * @throws Exception
  2098. * @throws \yii\db\Exception
  2099. * @throws HttpException
  2100. */
  2101. public function actionClearWallet()
  2102. {
  2103. $formModel = new UserStatusForm();
  2104. $formModel->scenario = 'clearWallet';
  2105. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->clearWallet()) {
  2106. /*if (is_array($result)) {
  2107. foreach ($result as $value) {
  2108. // 获取其中一个人的会员编号
  2109. $userName = Info::getUserNameByUserId($value);
  2110. Log::adminHandle('清空关停会员' . $userName . '钱包', 1, $value, $userName);
  2111. }
  2112. }*/
  2113. return static::notice('清空关停会员钱包,影响会员【' . count($result) . '】人');
  2114. }
  2115. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  2116. }
  2117. /**
  2118. * 会员历史年度最高聘级表
  2119. * @return mixed
  2120. * @throws Exception
  2121. * @throws HttpException
  2122. */
  2123. public function actionYearHighestEmpLv()
  2124. {
  2125. $filter = $this->filterCondition([
  2126. 'userIds' => 'UI.USER_ID',
  2127. 'YEAR' => 'YHEL.YEAR',
  2128. 'HIGHEST_EMP_LV_NAME' => 'YHEL.HIGHEST_EMP_LV',
  2129. 'HIGHEST_EMP_LV_PERIOD' => 'YHEL.HIGHEST_EMP_LV_PERIOD',
  2130. ]);
  2131. $condition = $filter['condition'];
  2132. $params = $filter['params'];
  2133. $listObj = new YearHighestEmpLvList();
  2134. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  2135. return static::notice($data);
  2136. }
  2137. /**
  2138. * 会员历史年度最高聘级表导出
  2139. * @return mixed
  2140. * @throws \yii\db\Exception
  2141. * @throws HttpException
  2142. */
  2143. public function actionYearHighestEmpLvExport()
  2144. {
  2145. $filter = $this->filterCondition([
  2146. 'userIds' => 'UI.USER_ID',
  2147. 'YEAR' => 'YHEL.YEAR',
  2148. 'HIGHEST_EMP_LV_NAME' => 'YHEL.HIGHEST_EMP_LV',
  2149. 'HIGHEST_EMP_LV_PERIOD' => 'YHEL.HIGHEST_EMP_LV_PERIOD',
  2150. ]);
  2151. $form = new UserExportForm();
  2152. $result = $form->run($filter, '会员历史年度最高聘级表');
  2153. if (!$result) {
  2154. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  2155. }
  2156. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  2157. }
  2158. /**
  2159. * 会员现金充值
  2160. * @return mixed
  2161. * @throws \yii\db\Exception
  2162. * @throws HttpException
  2163. */
  2164. public function actionRechargeToUser()
  2165. {
  2166. $formModel = new RechargeForm();
  2167. $formModel->scenario = 'addByAdmin';
  2168. if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->recharge()) {
  2169. return static::notice(Yii::t('ctx', 'successfully'));
  2170. }
  2171. return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
  2172. }
  2173. /**
  2174. * 会员修改密码
  2175. * @return mixed
  2176. * @throws HttpException
  2177. */
  2178. public function actionBaModifyPassword()
  2179. {
  2180. $form = new BaUserBasicForm();
  2181. $form->scenario = 'modifyPassword';
  2182. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->edit()){
  2183. return static::notice(Yii::t('ctx', 'successfully')); // 密码修改成功
  2184. } else {
  2185. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  2186. }
  2187. }
  2188. /**
  2189. * 个人资料获取
  2190. * @return mixed
  2191. * @throws HttpException
  2192. */
  2193. public function actionBaProfileGet() {
  2194. $id = Yii::$app->request->get('id');
  2195. $userInfo = BaUser::findOneAsArray('ID=:ID', [':ID' => $id]);
  2196. if (!$userInfo) {
  2197. return static::notice('Data does not exist', 400);//数据不存在
  2198. }
  2199. $data['userInfo'] = [
  2200. 'userId' => $userInfo['ID'],
  2201. 'realName' => $userInfo['REAL_NAME'],
  2202. 'mobile' => $userInfo['MOBILE'],
  2203. ];
  2204. return static::notice($data);
  2205. }
  2206. public function actionBaModifyProfile() {
  2207. $form = new BaUserBasicForm();
  2208. $form->scenario = 'modifyProfile';
  2209. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->modifyProfile()){
  2210. return static::notice(Yii::t('ctx', 'successfully'));//个人资料修改成功
  2211. } else {
  2212. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  2213. }
  2214. }
  2215. public function actionBaModifyStatus() {
  2216. $form = new BaUserBasicForm();
  2217. $form->scenario = 'modifyStatus';
  2218. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->modifyStatus()){
  2219. return static::notice(Yii::t('ctx', 'successfully'));//会员状态修改成功
  2220. } else {
  2221. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  2222. }
  2223. }
  2224. /**
  2225. * @return mixed
  2226. * @throws \yii\db\Exception
  2227. * @throws HttpException
  2228. */
  2229. public function actionBaIsModifyPasswordStatus() {
  2230. $form = new BaUserBasicForm();
  2231. $form->scenario = 'isModifyPasswordStatus';
  2232. if(Yii::$app->request->isPost && $form->load(Yii::$app->request->post(), '') && $result = $form->isModifyPasswordStatus()){
  2233. return static::notice(Yii::t('ctx', 'successfully'));//状态修改成功
  2234. } else {
  2235. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  2236. }
  2237. }
  2238. /**
  2239. * BA会员列表
  2240. * @return mixed
  2241. * @throws Exception
  2242. * @throws \yii\web\HttpException
  2243. */
  2244. public function actionBaUserList() {
  2245. $filter = $this->filterCondition([
  2246. 'USER_NAME' => 'U.USER_NAME',
  2247. 'REAL_NAME' => 'U.REAL_NAME',
  2248. 'STATUS' => 'U.STATUS',
  2249. 'ALLOW_LOGIN' => 'U.ALLOW_LOGIN',
  2250. 'CREATED_AT' => 'U.CREATED_AT',
  2251. 'PERIOD_AT' => 'U.PERIOD_AT',
  2252. 'SPOUSE_NAME' => 'U.SPOUSE_NAME',
  2253. 'MOBILE' => 'U.MOBILE',
  2254. 'TEL' => 'U.TEL',
  2255. 'SEX' => 'U.SEX',
  2256. 'AREA' => [
  2257. 'FIELD' => ['U.PROVINCE', 'U.CITY', 'U.COUNTY'],
  2258. 'BIND' => ['PROVINCE', 'CITY', 'COUNTY'],
  2259. ],
  2260. 'ADDRESS' => 'U.ADDRESS',
  2261. 'ALLOW_TRANSFER' => 'UI.ALLOW_TRANSFER',
  2262. ]);
  2263. $condition = $filter['condition'];
  2264. $params = $filter['params'];
  2265. $condition .= ' AND UI.DELETED=0 ';
  2266. $listObj = new BaUserList();
  2267. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  2268. return static::notice($data);
  2269. }
  2270. /**
  2271. * @throws \yii\db\Exception
  2272. * @throws HttpException
  2273. */
  2274. public function actionBaUserListExport() {
  2275. $filter = $this->filterCondition([
  2276. 'USER_NAME' => 'U.USER_NAME',
  2277. 'REAL_NAME' => 'U.REAL_NAME',
  2278. 'STATUS' => 'U.STATUS',
  2279. 'ALLOW_LOGIN' => 'U.ALLOW_LOGIN',
  2280. 'CREATED_AT' => 'U.CREATED_AT',
  2281. 'PERIOD_AT' => 'U.PERIOD_AT',
  2282. 'REC_USER_NAME' => 'RU.USER_NAME',
  2283. 'CON_USER_NAME' => 'CU.USER_NAME',
  2284. 'SPOUSE_NAME' => 'U.SPOUSE_NAME',
  2285. 'SYSTEM_NAME' => 'U.SYSTEM_ID',
  2286. 'MOBILE' => 'U.MOBILE',
  2287. 'TEL' => 'U.TEL',
  2288. 'SEX' => 'U.SEX',
  2289. 'AREA' => [
  2290. 'FIELD' => ['U.PROVINCE', 'U.CITY', 'U.COUNTY'],
  2291. 'BIND' => ['PROVINCE', 'CITY', 'COUNTY'],
  2292. ],
  2293. 'ADDRESS' => 'U.ADDRESS',
  2294. 'ALLOW_TRANSFER' => 'UI.ALLOW_TRANSFER',
  2295. ]);
  2296. $form = new BaUserExportForm();
  2297. $result = $form->run($filter, 'Brand_Ambassador_List');
  2298. if (!$result) {
  2299. return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
  2300. }
  2301. return static::notice(Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
  2302. }
  2303. /**
  2304. * 会员最高聘级变动记录.
  2305. * @return mixed
  2306. * @throws \yii\base\Exception
  2307. * @throws \yii\web\HttpException
  2308. */
  2309. public function actionChangeHighestEmpLevelList()
  2310. {
  2311. $filter = $this->filterCondition([
  2312. 'USER_NAME' => 'CU.USER_NAME',
  2313. 'CREATED_AT' => 'LL.CREATED_AT',
  2314. 'ADMIN_NAME' => 'ADM.ADMIN_NAME',
  2315. ]);
  2316. $condition = $filter['condition'];
  2317. $params = $filter['params'];
  2318. $listObj = new ChangeHighestEmpLevelList();
  2319. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  2320. return static::notice($data);
  2321. }
  2322. /**
  2323. * 调整会员最高聘级.
  2324. * @return mixed
  2325. * @throws \yii\web\HttpException
  2326. */
  2327. public function actionChangeHighestEmpLevel()
  2328. {
  2329. if (Yii::$app->request->isPost) {
  2330. return parent::edit(HighestEmpLevelLogForm::class, Yii::t('ctx', 'successfully'), 'adminChange', ['adminChange',], null, function ($form, $result) {
  2331. });
  2332. }
  2333. return static::notice('无效请求', 400);
  2334. }
  2335. /**
  2336. * 移民记录.
  2337. * @return mixed
  2338. * @throws \yii\base\Exception
  2339. * @throws \yii\web\HttpException
  2340. */
  2341. public function actionImmigrantList()
  2342. {
  2343. $filter = $this->filterCondition([
  2344. 'USER_NAME' => 'CU.USER_NAME',
  2345. 'CREATED_AT' => 'UU.CREATED_AT',
  2346. 'ADMIN_NAME' => 'ADM.ADMIN_NAME',
  2347. ]);
  2348. $condition = $filter['condition'];
  2349. $params = $filter['params'];
  2350. $listObj = new UserImmigrant();
  2351. $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
  2352. return static::notice($data);
  2353. }
  2354. /**
  2355. * 移民.
  2356. * @return mixed
  2357. * @throws \yii\web\HttpException
  2358. */
  2359. public function actionImmigrant()
  2360. {
  2361. // 移民条件检查
  2362. if (Yii::$app->request->isGet) {
  2363. // 会员
  2364. $userId = Info::getUserIdByUserName(Yii::$app->request->get('userName'));
  2365. // 1.是否有进行中的分期订单
  2366. $instalmentOrder = Instalment::findOne(['USER_ID' => $userId]);
  2367. // 订单分期总期数配置
  2368. if ($instalmentOrder) {
  2369. // 分期的总期数
  2370. $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
  2371. // 分期商品的期数不能大于总分期数限制
  2372. if (intval($instalmentOrder['STAGE']) < $instalment) {
  2373. return static::notice(Yii::t('app', 'instalmentOrderInProcess'), 400);
  2374. }
  2375. }
  2376. }
  2377. // 移民
  2378. if (Yii::$app->request->isPost) {
  2379. return parent::edit(ImmigrantForm::class, Yii::t('ctx', 'successfully'), 'userImmigrant', ['userImmigrant'], null, function ($form, $result) {});
  2380. }
  2381. return static::notice(Yii::t('app', 'illegalRequest'), 400);
  2382. }
  2383. }