User.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\master\logic;
  9. use app\core\model\Channel;
  10. use app\core\model\User as Model;
  11. use app\core\service\Finance;
  12. use think\Db;
  13. use tool\Common;
  14. class User extends Base
  15. {
  16. public function getUserList() {
  17. $map = [
  18. 'isForged'=>0
  19. ];
  20. if( isset($this->app['addTimeFrom']) &&
  21. isset($this->app['addTimeTo'])) {
  22. $map['addTime'] = ['between time', [$this->app['addTimeFrom'],$this->app['addTimeTo']]];
  23. }
  24. /*if($this->app['repayTimeFrom'] && $this->app['repayTimeTo']) {
  25. $map['repayTime'] = ['between', [$this->app['repayTimeFrom'],$this->app['repayTimeTo']]];
  26. }
  27. if($this->app['repayTimeFrom'] && $this->app['repayTimeTo']) {
  28. $map['repayTime'] = ['between', [$this->app['repayTimeFrom'],$this->app['repayTimeTo']]];
  29. }*/
  30. if(isset($this->app['isAuthBank']) && $this->app['isAuthBank']) {
  31. $map['isAuthBank'] = $this->app['isAuthBank'];
  32. }
  33. if(isset($this->app['status']) && $this->app['status']) {
  34. $map['status'] = $this->app['status'];
  35. }
  36. if(isset($this->app['osType']) && $this->app['osType']) {
  37. $map['osType'] = $this->app['osType'];
  38. }
  39. if(isset($this->app['keyword']) && $this->app['keyword']) {
  40. $map['mobile|trueName'] = ['like', '%'.$this->app['keyword'].'%'];
  41. }
  42. if(!isset($this->app['pageIndex']) || !$this->app['pageIndex']) {
  43. $this->app['pageIndex'] = 1;
  44. }
  45. if(!isset($this->app['pageItemCount']) || !$this->app['pageItemCount']) {
  46. $this->app['pageItemCount'] = 10;
  47. }
  48. $count = Model::where($map)->count();
  49. $list = Model::with(['userAccount', 'channel'])->where($map)->limit(($this->app['pageIndex'] - 1) * $this->app['pageItemCount'], $this->app['pageItemCount'])->order('addTime desc')->select();
  50. if($list->isEmpty()) {
  51. return Common::rm(-2, '数据为空');
  52. }
  53. $list->visible(['trueName','mobile','userID','addTime','isAuthBank','osType','ip','loginTime','isNewInvest',
  54. 'userAccount'=>[
  55. 'money','money','moneyAcc','moneyYesterday','moneyToday','waitBen','waitInterest','hasInvestBenTotal','hasInvestMoneyTotal','hasRepayBenTotal','hasRepayBenTotal','hasRepayInterestTotal'
  56. ],
  57. 'channel'=>[
  58. 'name'
  59. ]
  60. ]);
  61. return Common::rm(1, '操作成功', [
  62. 'userList'=>$list,
  63. 'count'=>$count,
  64. 'pageItemCount'=>$this->app['pageItemCount']
  65. ]);
  66. }
  67. public function getChannelList() {
  68. $list = Channel::all();
  69. return Common::rm(1, '操作成功', [
  70. 'channelList'=>$list
  71. ]);
  72. }
  73. public function cancelUser() {
  74. $finance = new Finance();
  75. $user = Model::get($this->app['userID']);
  76. $result = $finance->userCancel($msg, $user['mobile'], 'http://www.jiaqiancaifu.com');
  77. }
  78. }