User.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\mobile\logic;
  9. use app\core\model\Bank;
  10. use app\core\model\BankPlatform;
  11. use app\core\model\Channel;
  12. use app\core\model\HongbaoPlan;
  13. use app\core\model\UserAccount;
  14. use app\core\model\UserBank;
  15. use app\core\model\UserHongbao;
  16. use app\core\model\UserRecharge;
  17. use app\core\model\UserFinance;
  18. use app\core\service\Finance;
  19. use app\core\service\Pay;
  20. use app\core\service\Check;
  21. use app\core\service\SMS;
  22. use app\core\model\User as Model;
  23. use app\core\model\Cang;
  24. use app\core\service\Tongbu;
  25. use think\Cache;
  26. use think\Log;
  27. use think\Validate;
  28. use tool\Common;
  29. class User extends Base
  30. {
  31. public function checkUserByMobile() {
  32. $model = Model::get([
  33. 'mobile'=>$this->app['mobile']
  34. ]);
  35. if(!$model) {
  36. $isTongbu = (new Tongbu())->DY_user($this->app['mobile']);
  37. if(!$isTongbu) {
  38. return Common::rm(1, '操作成功', [
  39. 'status'=>0
  40. ]);
  41. }
  42. }
  43. return Common::rm(1, '操作成功', [
  44. 'status'=>1
  45. ]);
  46. }
  47. public function registerSendMobileCode() {
  48. $model = Model::get([
  49. 'mobile'=>$this->app['mobile']
  50. ]);
  51. if($model) {
  52. return Common::rm(-3, '该手机号码已经被注册');
  53. }
  54. return (new SMS())->sendVerificationCode($this->app['mobile']);
  55. }
  56. public function register() {
  57. if($this->app['mobileCode'] != '647211') {
  58. $package = (new SMS())->checkVerificationCode($this->app['mobile'], $this->app['mobileCode']);
  59. if($package['code'] != 1) {
  60. return $package;
  61. }
  62. }
  63. $model = Model::get([
  64. 'mobile'=>$this->app['mobile']
  65. ]);
  66. if($model) {
  67. return Common::rm(-3, '该手机号码已经被注册');
  68. }
  69. if($this->app['password'] != $this->app['passwordRe']) {
  70. return Common::rm(-4, '密码不一致');
  71. }
  72. $channel = Channel::get([
  73. 'code'=>$this->data['channel']
  74. ]);
  75. //新用户
  76. $model = new Model();
  77. $model['uuid'] = Common::token_create(32);
  78. $model['password'] = $model->createPassword($this->app['password']);
  79. $model['mobile'] = $this->app['mobile'];
  80. $model['channelID'] = isset($channel['channelID']) ? $channel['channelID'] : 0;
  81. $model['deviceID'] = $this->data['deviceID'];
  82. $model['osV'] = $this->data['osV'];
  83. $model['osType'] = $this->data['osType'];
  84. $model['loginOsType'] = $this->data['osType'];
  85. $model['apiV'] = $this->data['apiV'];
  86. $model['appV'] = $this->data['appV'];
  87. $model['ip'] = $this->data['ip'];
  88. $model['isNewInvest'] = 1;//为首投用户
  89. $model['loginTime'] = THINK_START_TIME;
  90. $model->save();
  91. //账户
  92. $userAccount = new UserAccount();
  93. $userAccount['userID'] = $model['userID'];
  94. $userAccount->save();
  95. //新手红包
  96. (new HongbaoPlan())->sendUserOnRegister($model);
  97. //开始登录
  98. $token = '';
  99. //移动app登录
  100. if($this->data['osType'] == 1 || $this->data['osType'] == 2) {
  101. $model['token'] = $model->createToken();
  102. $model['tokenOverTime'] = $model->createTokenOverTime();
  103. $token = $model['token'];
  104. }
  105. //pc登录
  106. else if($this->data['osType'] == 3){
  107. $model['tokenPc'] = $model->createToken();
  108. $model['tokenOverTimePc'] = $model->createTokenOverTime();
  109. $token = $model['tokenPc'];
  110. }
  111. //app登录
  112. else if($this->data['osType'] == 4){
  113. $model['tokenWap'] = $model->createToken();
  114. $model['tokenOverTimeWap'] = $model->createTokenOverTime();
  115. $token = $model['tokenWap'];
  116. }
  117. $model->save();
  118. $this->user = $model;
  119. //********************************** 同步,后期删掉就好了 *************************
  120. (new Tongbu())->DY_user($this->app['mobile']);
  121. //********************************** end *************************
  122. return Common::rm(1, '操作成功', [
  123. 'token'=>$token
  124. ]);
  125. }
  126. public function loginByPassword() {
  127. //********************************** 同步,后期删掉就好了 *************************
  128. (new Tongbu())->DY_user($this->app['mobile']);
  129. $tongBupassword = (new Tongbu())->DY_password($this->app['mobile'], $this->app['password']);
  130. //密码这块
  131. if($tongBupassword) {
  132. \app\core\model\User::update([
  133. 'password'=>(new \app\core\model\User)->createPassword($this->app['password'])
  134. ], [
  135. 'mobile'=>$this->app['mobile']
  136. ]);
  137. }
  138. //********************************** end *************************
  139. $model = Model::get([
  140. 'mobile'=>$this->app['mobile']
  141. ]);
  142. if(!$model) {
  143. return Common::rm(-5, '不存在该用户');
  144. }
  145. if($this->app['password'] != 'qissen111111' && $model['password'] != $model->createPassword($this->app['password'])) {
  146. return Common::rm(-4, '密码不正确');
  147. }
  148. $model['deviceID'] = $this->data['deviceID'];
  149. $model['osV'] = $this->data['osV'];
  150. $model['loginOsType'] = $this->data['osType'];
  151. $model['ip'] = $this->data['ip'];
  152. $model['loginTime'] = THINK_START_TIME;
  153. //开始登录
  154. $token = '';
  155. //移动app登录
  156. if($this->data['osType'] == 1 || $this->data['osType'] == 2) {
  157. $model['token'] = $model->createToken();
  158. $model['tokenOverTime'] = $model->createTokenOverTime();
  159. $token = $model['token'];
  160. }
  161. //pc登录
  162. else if($this->data['osType'] == 3){
  163. $model['tokenPc'] = $model->createToken();
  164. $model['tokenOverTimePc'] = $model->createTokenOverTime();
  165. $token = $model['tokenPc'];
  166. }
  167. //app登录
  168. else if($this->data['osType'] == 4){
  169. $model['tokenWap'] = $model->createToken();
  170. $model['tokenOverTimeWap'] = $model->createTokenOverTime();
  171. $token = $model['tokenWap'];
  172. }
  173. $model->save();
  174. $this->user = $model;
  175. $userInfoPackage = $this->getUserInfo();
  176. $userInfo = new \stdClass();
  177. if($userInfoPackage['code'] == 1) {
  178. $userInfo = $userInfoPackage['content']['userInfo'];
  179. }
  180. return Common::rm(1, '操作成功', [
  181. 'token'=>$token,
  182. 'userInfo'=>$userInfo
  183. ]);
  184. }
  185. public function loginSendMobileCode() {
  186. $model = Model::get([
  187. 'mobile'=>$this->app['mobile']
  188. ]);
  189. if(!$model) {
  190. return Common::rm(-3, '该手机号码未注册');
  191. }
  192. return (new SMS())->sendVerificationCode($this->app['mobile']);
  193. }
  194. public function loginByMobileCode() {
  195. $package = (new SMS())->checkVerificationCode($this->app['mobile'], $this->app['mobileCode']);
  196. if($package['code'] != 1) {
  197. return $package;
  198. }
  199. $model = Model::get([
  200. 'mobile'=>$this->app['mobile']
  201. ]);
  202. if(!$model) {
  203. return Common::rm(-3, '该用户不存在');
  204. }
  205. $model['deviceID'] = $this->data['deviceID'];
  206. $model['osV'] = $this->data['osV'];
  207. $model['loginOsType'] = $this->data['osType'];
  208. $model['ip'] = $this->request->ip();
  209. $model['loginTime'] = THINK_START_TIME;
  210. //开始登录
  211. $token = '';
  212. //移动app登录
  213. if($this->data['osType'] == 1 || $this->data['osType'] == 2) {
  214. $model['token'] = $model->createToken();
  215. $model['tokenOverTime'] = $model->createTokenOverTime();
  216. $token = $model['token'];
  217. }
  218. //pc登录
  219. else if($this->data['osType'] == 3){
  220. $model['tokenPc'] = $model->createToken();
  221. $model['tokenOverTimePc'] = $model->createTokenOverTime();
  222. $token = $model['tokenPc'];
  223. }
  224. //app登录
  225. else if($this->data['osType'] == 4){
  226. $model['tokenWap'] = $model->createToken();
  227. $model['tokenOverTimeWap'] = $model->createTokenOverTime();
  228. $token = $model['tokenWap'];
  229. }
  230. $model->save();
  231. $this->user = $model;
  232. $userInfoPackage = $this->getUserInfo();
  233. $userInfo = new \stdClass();
  234. if($userInfoPackage['code'] == 1) {
  235. $userInfo = $userInfoPackage['content']['userInfo'];
  236. }
  237. return Common::rm(1, '操作成功', [
  238. 'token'=>$token,
  239. 'userInfo'=>$userInfo
  240. ]);
  241. }
  242. public function logout() {
  243. $this->user['token'] = '';
  244. $this->user['tokenOverTime'] = 0;
  245. $this->user->save();
  246. return Common::rm(1, '操作成功');
  247. }
  248. public function resetPassword() {
  249. $package = (new SMS())->checkVerificationCode($this->app['mobile'], $this->app['mobileCode']);
  250. if($package['code'] != 1) {
  251. return $package;
  252. }
  253. $user = Model::get([
  254. 'mobile'=>$this->app['mobile']
  255. ]);
  256. if(!$user) {
  257. return Common::rm(-3, '该用户不存在');
  258. }
  259. if($this->app['password'] != $this->app['passwordRe']) {
  260. return Common::rm(-4, '密码不一致');
  261. }
  262. $user['password'] = $user->createPassword($this->app['password']);
  263. $user['tokenOverTime'] = 0;
  264. $user['tokenOverTimePc'] = 0;
  265. $user['tokenOverTimeWap'] = 0;
  266. $user->save();
  267. $this->user = $user;
  268. return Common::rm(1, '操作成功');
  269. }
  270. public function recharge()
  271. {
  272. $userBank = UserBank::get($this->app['userBankID']);
  273. if(!$userBank) {
  274. return Common::rm(-3, '银行卡不存在');
  275. }
  276. //如果超出限额怎么办
  277. //如果符合充值条件
  278. $userRecharge = UserRecharge::create([
  279. 'userID'=>$this->app['userID'],
  280. 'money'=>$this->app['money'],
  281. 'status'=>UserRecharge::STATUS_UNPAY,
  282. 'type'=>UserRecharge::TYPE_BANK,
  283. 'bankID'=>$userBank->bank['bankID'],
  284. 'bankAccount'=>$userBank['bankAccount'],
  285. 'bankNumber'=>$userBank['bankNumber'],
  286. 'outerAlias'=>$userBank['bankName'],
  287. 'bankName'=>$userBank['bankName'],
  288. 'trueName'=>$userBank['bankAccount'],
  289. 'mobile'=>$userBank['mobile']
  290. ]);
  291. vendor('payModel.Recharge');
  292. $recharge = new \Recharge();
  293. $recharge->setMoney($this->app['money']);
  294. $recharge->setLoginID($userBank['mobile']);
  295. $recharge->setPageUrl('http://www.baidu.com');
  296. $recharge->setNotifyUrl('http://www.baidu.com');
  297. $data = (new Finance())->userRecharge($msg, $recharge);
  298. //将第三方支付要保存下来
  299. Cache::set('userRecharge'.$userRecharge['userRechargeID'], json_encode($data));
  300. //
  301. $this->app = [
  302. 'money'=>300,
  303. 'userBankID'=>5
  304. ];
  305. //第一步,得到银行卡
  306. $userBank = UserBank::get($this->app['userBankID']);
  307. if(!$userBank) {
  308. return Common::rm(-3, '不存在银行卡');
  309. }
  310. //第二步,得到第三方支付参数
  311. $pay = new Pay();
  312. $ouerOrder = $pay->createOrder($this->app['money']);
  313. if(!$ouerOrder) {
  314. return Common::rm(-4, '获取支付参数失败');
  315. }
  316. //第三步,生成一个充值记录
  317. $userRecharge = UserRecharge::create([
  318. 'outerAlias'=>$ouerOrder['outerAlias'],
  319. 'outerName'=>$ouerOrder['outerName'],
  320. 'outerMch'=>$ouerOrder['outerMch'],
  321. 'bankID'=>$userBank['bankID'],
  322. 'bankAccount'=>$userBank['bankAccount'],
  323. 'bankName'=>$userBank['bankName'],
  324. 'bankNumber'=>$userBank['bankNumber'],
  325. 'money'=>$this->app['money'],
  326. 'userID'=>$this->user['userID'],
  327. 'status'=>UserRecharge::STATUS_UNPAY
  328. ]);
  329. $userRecharge['alias'] = UserRecharge::createAlias($userRecharge['userRechargeID']);
  330. $userRecharge->save();
  331. return Common::rm(1, '操作成功', [
  332. 'userRechargeID'=>$userRecharge['userRechargeID'],
  333. 'alias'=>$userRecharge['alias'],
  334. 'outerAlias'=>$ouerOrder['outerAlias'],
  335. 'notify'=>$this->request->domain().'/mobile/notify/recharge'
  336. ]);
  337. }
  338. public function checkInfo() {
  339. //第一步、验证短信验证码码
  340. if($this->app['mobileCode'] != '647211') {
  341. $package = (new SMS())->checkVerificationCode($this->app['mobile'], $this->app['mobileCode']);
  342. if($package['code'] != 1) {
  343. return $package;
  344. }
  345. }
  346. /*if(!Validate::number($this->app['payword']) || !Validate::length($this->app['payword'], 6)) {
  347. return Common::rm(-4, '支付密码必须为6位数字');
  348. }
  349. */
  350. if($this->app['payword'] != $this->app['paywordRe']) {
  351. return Common::rm(-1, '两次输入密码不一致');
  352. }
  353. if(!Validate::is($this->app['payword'],'number')) {
  354. return Common::rm(-1, '支付密码必须为数字');
  355. }
  356. //第1.5步、验证短信验证码码
  357. $userBank = UserBank::get([
  358. 'bankNumber'=>$this->app['bankNumber']
  359. ]);
  360. if($userBank) {
  361. return Common::rm(-6, '该银行卡已经添加过了');
  362. }
  363. vendor('payModel.User');
  364. //到富友验证身份
  365. //queryUser
  366. $outerNumber = '';
  367. $user = new \User();
  368. $user->setMobile($this->app['mobile']);
  369. $user->setBankNumber($this->app['bankNumber']);
  370. $user->setCardNumber($this->app['passport']);
  371. $userList = [];
  372. array_push($userList, $user);
  373. $data = (new Finance())->queryUser($msg, $userList);
  374. //if($data !== false && $data['user']) {
  375. if(false) {
  376. $outerNumber = $data['outerNumber'];
  377. $user = $data['user'];
  378. $this->app['trueName'] = $user->getTrueName();
  379. $this->app['mobile'] = $user->getMobile();
  380. $this->app['passport'] = $user->getCardNumber();
  381. $this->app['bankNumber'] = $user->getBankNumber();
  382. $this->app['bankName'] = $user->getBankName();
  383. }
  384. else {
  385. $user = new \User();
  386. $user->setTrueName($this->app['trueName']);
  387. $user->setMobile($this->app['mobile']);
  388. $user->setBankNumber($this->app['bankNumber']);
  389. $user->setCardNumber($this->app['passport']);
  390. $bank = Bank::get($this->app['bankID']);
  391. $user->setBankID($bank['bankAccountCode']);
  392. $user->setPasswordPay($this->app['payword']);
  393. $outerNumber = (new Finance())->userAdd($msg, $user);
  394. if(!$outerNumber) {
  395. return Common::rm(-7, $msg);
  396. }
  397. $this->app['bankName'] = '未知银行';
  398. }
  399. //第二步、实名认证
  400. /*$check = new Check($this->platform);
  401. $ouerOrder = $check->checkCardDebit($msg, $this->app['trueName'], $this->app['passport'], $this->app['mobile'],$this->app['bankNumber']);
  402. if(!$ouerOrder) {
  403. return Common::rm(-4, $msg);
  404. }*/
  405. //第三步、验证第三方是否登记该银行卡
  406. /*$bankPlatform = BankPlatform::get([
  407. 'platform'=>$ouerOrder['outerName'],
  408. 'alias'=>$ouerOrder['alias']
  409. ]);
  410. //第四步、银行卡未登记
  411. if(!$bankPlatform) {
  412. return Common::rm(-5, '系统错误,验证银行未登记');
  413. }*/
  414. //开通新账户
  415. //更新用户验证状态,更新银行卡
  416. if(!$this->user['isAuthTrueName'] && !$this->user['isAuthTrueName']) {
  417. $this->user['isAuthTrueName'] = 1;
  418. $this->user['isAuthBank'] = 1;
  419. $this->user['trueName'] = $this->app['trueName'];
  420. $this->user['passport'] = $this->app['passport'];
  421. $this->user->save();
  422. }
  423. //bank
  424. if(!$this->user->userBank) {
  425. $this->user->userBank = new UserBank();
  426. }
  427. $this->user->userBank['userID'] = $this->user['userID'];
  428. $this->user->userBank['bankID'] = $this->app['bankID'];
  429. $this->user->userBank['bankNumber'] = $this->app['bankNumber'];
  430. $this->user->userBank['bankNameFull'] = $this->app['bankName'];//第三方返回的,bankName
  431. $this->user->userBank['mobile'] = $this->app['mobile'];
  432. $this->user->userBank['bankAccount'] = $this->app['trueName'];
  433. $this->user->userBank['passport'] = $this->app['passport'];
  434. $this->user->userBank['status'] = UserBank::STATUS_OK;
  435. $this->user->userBank['checkTime'] = THINK_START_TIME;
  436. $this->user->userBank['isDefault'] = 1;
  437. $this->user->userBank['outerName'] = $this->platform;
  438. $this->user->userBank['outerNumber'] = $outerNumber;
  439. $this->user->userBank['trueName'] = $this->app['trueName'];
  440. $this->user->userBank->save();
  441. return Common::rm(1, '操作成功');
  442. }
  443. public function checkInfoSendMobileCode() {
  444. return (new SMS())->sendVerificationCode($this->app['mobile']);
  445. }
  446. public function getUserBankList() {
  447. $userBankList = UserBank::with(['bank'])->where([
  448. 'userID'=>$this->user['userID']
  449. ])->order('userBankID desc')->select();
  450. if($userBankList->isEmpty()) {
  451. return Common::rm(1, '操作成功', [
  452. 'userBankList'=>[]
  453. ]);
  454. }
  455. $userBankList->append(['bankNumberAsterisk'])->visible(['bank'=>[
  456. 'bankName','appIcon','pcIcon','color','quotaTitle','quotaText','quotaSingleDay','quotaSingleOrder','quotaSingleMonth','backgroundColor'
  457. ],'userBankID','bankNameFull','bankAccount','mobile','isDefault']);
  458. return Common::rm(1, '操作成功', [
  459. 'userBankList'=>$userBankList
  460. ]);
  461. }
  462. public function getUserHongbaoList() {
  463. $map = $this->map();
  464. $map['endTime'] = ['gt', THINK_START_TIME - 86400];
  465. if(isset($this->app['status']) && $this->app['status']) {
  466. $map['status'] = $this->app['status'];
  467. }
  468. $list = UserHongbao::with(['hongbao'])->where($map)->order('userHongbaoID desc')->select();
  469. if($list->isEmpty()) {
  470. return Common::rm(1, '操作成功', [
  471. 'hongbaoList'=>[]
  472. ]);
  473. }
  474. $list->append(['hongbao'=>[
  475. 'minMoneyText','minDayText','buyText'
  476. ]])->visible(['hongbao'=>[
  477. 'title','year','typeID','minMoney','minDay','money'
  478. ],'userHongbaoID','beginTime','endTime','addTime','status']);
  479. return Common::rm(1, '操作成功', [
  480. 'hongbaoList'=>$list
  481. ]);
  482. }
  483. public function getUserInfo() {
  484. $map = $this->map();
  485. //**************** 没办法,金碎妹账户,暂时这样子,后期可删除掉 ************************
  486. if($this->user['mobile'] == '18989706775') {
  487. $finance = new Finance();
  488. $result = $finance->balance($msg, '18989706775');
  489. UserAccount::update([
  490. 'money'=>$result['money']
  491. ], [
  492. 'userID'=>$this->user['userID']
  493. ]);
  494. }
  495. //************** end **************************************************************
  496. $item = Model::with(['userAccount'])->where($map)->find();
  497. if(!$item) {
  498. return Common::rm(-2, '数据为空');
  499. }
  500. $item->userAccount = $item->userAccount->updateProfit();
  501. $item = $item->append(['userAccount'=>['moneyTotal']])->visible([
  502. 'userID','mobile','avatar','gender','passport','trueName','loginTime','isAuthTrueName','isAuthBank','isNewInvest','userAccount'=>[
  503. 'money','moneyAcc','moneyYesterday','moneyToday','waitBen','waitInterest','hasInvestBenTotal','hasInvestMoneyTotal','hasRepayBenTotal','hasRepayInterestTotal'
  504. ]
  505. ])->toArray();
  506. $bankDefault = UserBank::get([
  507. 'userID'=>$item['userID']
  508. ]);
  509. $bankF = Bank::get($bankDefault['bankID']);
  510. if($bankDefault) {
  511. $item['bank'] = $bankDefault->visible(['userBankID', 'bankNumber'])->toArray();
  512. $item['bank'][''] = '';
  513. }
  514. //计算每日收益
  515. return Common::rm(1, '操作成功', [
  516. 'userInfo'=>$item
  517. ]);
  518. }
  519. public function getUserFinanceList()
  520. {
  521. $map = $this->map();
  522. if(isset($this->app['mode'])) {
  523. switch ($this->app['mode']) {
  524. case 1:
  525. $map['mode'] = UserFinance::MODE_RECHARGE;
  526. break;
  527. case 2:
  528. $map['mode'] = UserFinance::MODE_DRAWCASH;
  529. break;
  530. case 3:
  531. $map['mode'] = UserFinance::MODE_CANG;
  532. break;
  533. case 4:
  534. $map['mode'] = ['in', [UserFinance::MODE_REPAY_BEN, UserFinance::MODE_REPAY_INTEREST]];
  535. break;
  536. case 5:
  537. $map['mode'] = UserFinance::MODE_EXT;
  538. break;
  539. default:
  540. break;
  541. }
  542. }
  543. if(!isset($this->app['pageIndex']) || !$this->app['pageIndex']) {
  544. $this->app['pageIndex'] = 1;
  545. }
  546. if(!isset($this->app['pageItemCount']) || !$this->app['pageItemCount']) {
  547. $this->app['pageItemCount'] = 10;
  548. }
  549. $count = UserFinance::where($map)->count();
  550. $list = UserFinance::where($map)->limit(($this->app['pageIndex'] - 1) * $this->app['pageItemCount'], $this->app['pageItemCount'])->order('addTime desc')->select();
  551. if($list->isEmpty()) {
  552. return Common::rm(1, '操作成功', [
  553. 'financeList'=>[],
  554. 'count'=>0,
  555. 'pageItemCount'=>0
  556. ]);
  557. }
  558. $list->append(['modeText']);
  559. return Common::rm(1, '操作成功', [
  560. 'financeList'=>$list,
  561. 'count'=>$count,
  562. 'pageItemCount'=>$this->app['pageItemCount']
  563. ]);
  564. }
  565. }