Cost.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. namespace app\user\controller;
  3. use think\Lang;
  4. class Cost extends UserControl
  5. {
  6. public function _initialize()
  7. {
  8. parent::_initialize(); // TODO: Change the autogenerated stub
  9. Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/db.lang.php');
  10. }
  11. public function orderManagement()
  12. {
  13. $condition['a.user_id'] = session('user_id');
  14. $status = input('get.status');
  15. if ($status) {
  16. $condition['order_status'] = input('get.status');
  17. }
  18. $time = input('get.timeRang');//print_r(input('get.page'));print_r(input('get.aa'));die;
  19. if(!empty($time)){
  20. $gap = explode(' - ', $time);
  21. $begin = $gap[0];
  22. $end = $gap[1];
  23. $condition['order_buyTime'] = array('between', array($begin, $end));
  24. }
  25. $allOrder = model('order')->getOrder($condition);
  26. $allProduct = model('product')->getProduct();
  27. foreach ($allOrder as $key=>$value) {
  28. foreach ($allProduct as $k=>$va) {
  29. if ($value->product_pid == $va->product_id) {
  30. $allOrder[$key]->fatherProduct = $va->product_name;
  31. }
  32. }
  33. }
  34. $this->assign('allOrder', $allOrder);
  35. $this->assign('show_page', $allOrder->render());
  36. $this->assign('status', $status);
  37. return $this->fetch('orderManagement');
  38. }
  39. public function recharge()
  40. {
  41. $userId = session('user_id');
  42. $userInfo = model('user')->getUserInfo($userId);
  43. $this->assign('userInfo', $userInfo);
  44. $status = input('get.status');
  45. $this->assign('status', $status);
  46. $systemPayment = model('systempayment')->getSystempayment($userId);
  47. $zhifubao = '';
  48. $weixin = '';
  49. $bank = '';
  50. foreach ($systemPayment as $value) {
  51. if ($value->systemPayment_type == 1 && $value->systemPayment_status == 1) {
  52. $zhifubao = $value;
  53. } elseif ($value->systemPayment_type == 2 && $value->systemPayment_status == 1) {
  54. $weixin = $value;
  55. } elseif ($value->systemPayment_type == 3 && $value->systemPayment_status == 1) {
  56. $bank = $value;
  57. }
  58. }
  59. $this->assign('zhifubao', $zhifubao);
  60. $this->assign('weixin', $weixin);
  61. $this->assign('bank', $bank);
  62. return $this->fetch('recharge');
  63. }
  64. public function rechargeSubmit()
  65. {
  66. $data['recharge_type'] = input('post.type');
  67. $data['recharge_identity'] = input('post.orderNumber');
  68. $getRecharge = model('recharge')->getRecharge($data);
  69. if ($getRecharge) {
  70. return ["msg"=>"错误:已提交过该订单号"];
  71. }
  72. $userId = session('user_id');
  73. $getInfo = model('userinfo')->getInfo($userId);
  74. $data['user_id'] = session('user_id');
  75. $data['user_money'] = $getInfo->userInfo_money;
  76. $data['recharge_time'] = date('Y-m-d H:i:s');
  77. $data['recharge_status'] = 2;
  78. $addBack = model('recharge')->addRecharge($data);
  79. if ($addBack) {
  80. return ["msg"=>"成功:人工操作流程较长,金额预计在操作完成后2-3天到账,请耐心等待"];
  81. } else {
  82. return ["msg"=>"错误:系统错误,请重新提交"];
  83. }
  84. }
  85. public function transaction()
  86. {
  87. $condition['user_id'] = session('user_id');
  88. $time = input('get.timeRang');
  89. if (!empty($time)) {
  90. $gap = explode(' - ', $time);
  91. $begin = $gap[0];
  92. $end = date('Y-m-d', strtotime ("+1 day", strtotime($gap[1])));
  93. $condition['recharge_time'] = array('between', array($begin, $end));
  94. }
  95. $type = input('get.type');
  96. if ($type) {
  97. $condition['recharge_type'] = $type;
  98. }
  99. $status = input('get.status');
  100. if (strlen($status)) {
  101. $condition['recharge_status'] = $status;
  102. }
  103. $allRecharge = model('recharge')->selectRecharge($condition);
  104. $this->assign('allRecharge', $allRecharge);
  105. $this->assign('show_page', $allRecharge->render());
  106. return $this->fetch('transaction');
  107. }
  108. public function capital()
  109. {
  110. $condition['user_id'] = session('user_id');
  111. $time = input('get.timeRang');
  112. if (!empty($time)) {
  113. $gap = explode(' - ', $time);
  114. $begin = $gap[0];
  115. $end = date('Y-m-d', strtotime ("+1 day", strtotime($gap[1])));
  116. $condition['capitalMovements_create'] = array('between', array($begin, $end));
  117. }
  118. $type = input('get.type');
  119. if ($type) {
  120. $condition['capitalMovements_type'] = $type;
  121. }
  122. $allCapital = model('CapitalMovements')->select($condition);
  123. $this->assign('allCapital', $allCapital);
  124. $this->assign('show_page', $allCapital->render());
  125. return $this->fetch();
  126. }
  127. }
  128. ?>