UserWaterController.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Http\Request as Req;
  5. use Request;
  6. /**
  7. *
  8. */
  9. class UserWaterController extends Controller {
  10. /**
  11. *
  12. * [Colse description]
  13. */
  14. function index(Req $req) {
  15. $id = $req->id;
  16. if (empty($id)) {
  17. abort(404);
  18. }
  19. return $this->show($id);
  20. }
  21. //流水
  22. function water(Req $req) {
  23. $id = $req->identity;
  24. if (empty($id)) {
  25. abort(404);
  26. }
  27. $user_db = new \App\Models\Account; //用户
  28. $account = $user_db->getinfo($id, 2);
  29. return $this->show($account['id']);
  30. }
  31. function show($id) {
  32. $dt = \App\Lib\DataTable\DataTable::init();
  33. $dt->setDataSource('/admin/userWater/getWater?id=' . $id);
  34. $dt->setLang('user');
  35. $dt->addColsFields('money_time', array('width' => 105)); //日期
  36. $dt->addColsFields('trade_id', array('width' => 205)); //定单号
  37. $dt->addColsFields('trade_type', array('width' => 100)); //交易类型
  38. $dt->addColsFields('old_money', array('width' => 100)); //交易前
  39. $dt->addColsFields('money', array('width' => 100)); //交易金额
  40. $dt->addColsFields('money_cash', array('width' => 100)); //交易后金额
  41. $dt->addColsFields('trade_desc'); //交易描述
  42. $dt->addColsFields('details', array('templet' => '#detailsTool', 'width' => 90));
  43. $dt->setPriKey('order_id');
  44. // $dt->setToolBar(array('view'));//详情
  45. return view('admin.user/userwater', $dt->render());
  46. }
  47. /**
  48. * 会员列表
  49. * 'user description'
  50. * @return 'type' 'description'
  51. */
  52. function View(Req $req) {
  53. return $this->Edit($req);
  54. }
  55. function getWater() {
  56. $id = Request::has('id') ? Request::get('id') : '';
  57. $page = Request::has('page') ? Request::get('page') : 1;
  58. $list = Request::has('limit') ? Request::get('limit') : 10;
  59. $startime = Request::get('startime') ? Request::get('startime').' 00:00:00' : '';
  60. $endtime = Request::get('endtime') ? Request::get('endtime').' 23:59:59' : '';
  61. $trade_type = Request::has('trade_type') ? Request::get('trade_type') : '';
  62. $where = array();
  63. if (!empty($startime)) {
  64. $startime = date('Y-m-d H:i:s', strtotime($startime));
  65. $where[] = array('money_time', '>=', $startime);
  66. }
  67. if (!empty($endtime)) {
  68. $endtime = date('Y-m-d H:i:s', strtotime($endtime));
  69. $where[] = array('money_time', '<=', $endtime);
  70. }
  71. if (!empty($trade_type)) {
  72. $where[] = array('trade_type', '=', $trade_type);
  73. }
  74. $user_db = new \App\Models\Account; //用户
  75. $account = $user_db->getinfo($id, 1);
  76. $money_db = new \App\Models\Money_details; //资金
  77. $data = $money_db->getUserWater($account['identity'], $list,$where);
  78. if (is_array($data['data']) && count($data['data']) > 0) {
  79. $money_type = trans('status.money_details.trade_type');
  80. foreach ($data['data'] as $k => $v) {
  81. $data['data'][$k]['trade_type'] = $money_type[$v['trade_type']];
  82. }
  83. }
  84. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
  85. }
  86. /**
  87. * 用户添加
  88. * [add description]
  89. */
  90. function userAdd() {
  91. return view('admin.menu/userAdd');
  92. }
  93. /**
  94. * 会员列表
  95. * [getCloseTable description]
  96. * @return [type] [description]
  97. */
  98. function getUserTable() {
  99. $table = new \App\Lib\Biz\Game\Table\UserTable();
  100. $data = $table->getUserTh();
  101. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
  102. }
  103. /**
  104. * 资金流水
  105. * 'money description'
  106. * @return 'type' 'description'
  107. */
  108. function money() {
  109. $db = new \App\Models\Money_details;
  110. $page = Request::has('statpageus') ? Request::get('page') : '20';
  111. $identity = Request::has('account_identity') ? Request::get('account_identity') : '45b7d4e9-2bb9-16b3-9a50-6fd6f62235f8';
  112. if (empty($identity)) {
  113. return -2020162003; //用户不存在
  114. }
  115. $status = Request::has('status') ? Request::get('status') : '1';
  116. if ($status == 1) {
  117. $data = $db->money($page, $identity, $status);
  118. return responseToJson($data);
  119. } else {
  120. return -2020162103; //账户异常
  121. }
  122. }
  123. /**
  124. * 会员详情
  125. */
  126. function Memdetails() {
  127. // DB::connection()->enableQueryLog();
  128. $id = Request::has('account.identity') ? Request::get('account.identity') : '19a67df4-b40e-3e40-ca25-deffbf0c846d';
  129. if (empty($id)) {
  130. return Rens(-2020023003); //此用户不存在
  131. }
  132. // $data = DB::table('account_detailed')
  133. // ->join('account', 'account_detailed.account_identity', '=', 'account.identity')
  134. // ->join('account_bank', 'account_detailed.account_identity', '=', 'account_bank.account_identity')
  135. // ->select('account', 'cash', 'phone', 'email', 'name', 'email', 'email', 'email', 'bank_name', 'bank_address', 'bank_number', 'register_time', 'register_ip', 'last_time', 'last_ip')
  136. // ->where('account.status', 1)
  137. // ->where('account.identity', $id)
  138. // ->first();
  139. //// $log= DB::getQueryLog();
  140. // // dd($log);die;
  141. // echo "<pre>";
  142. // print_r($data);
  143. $data = array(
  144. 'account' => '13434926679',
  145. 'cash' => '0.00',
  146. 'phone' => '13434926679',
  147. 'email' => '',
  148. 'name' => '方玉佳',
  149. 'bank_name' => '中国工商银行',
  150. 'bank_address' => '洪阳工商银行',
  151. 'bank_number' => '6222082019001327324',
  152. 'register_time' => '2016-10-03 11:10:00',
  153. 'register_ip' => '121.11.142.210',
  154. 'last_time' => '2016-10-07 10:11:45',
  155. 'last_ip' => '121.11.142.210',
  156. );
  157. return Rens($data);
  158. }
  159. /**
  160. * 查看财务
  161. * 'finance description'
  162. * @return 'type' 'description'
  163. */
  164. function finance() {
  165. // $id = Request::has('account_identity') ? Request::get('account_identity') : '45b7d4e9-2bb9-16b3-9a50-6fd6f62235f8';
  166. // $data = DB::table('money_details')->select('account_name', 'id', 'trade_type', 'trade_id', 'money_time', 'money', 'sysetem_user')->where('account_identity', $id)->limit(2)->get();
  167. // echo "<pre>";
  168. // print_r($data);
  169. $data = array(
  170. '0' => array
  171. (
  172. 'account_name' => '123qqq',
  173. 'id' => '1094327',
  174. 'trade_type' => 1,
  175. 'trade_id' => '20170913162223362227472',
  176. 'money_time' => '2017-09-13 16:22:23',
  177. 'money' => 20,
  178. 'sysetem_user' => '系统',
  179. ),
  180. '1' => array
  181. (
  182. 'account_name' => '123qqq',
  183. 'id' => '1094352',
  184. 'trade_type' => 1,
  185. 'trade_id' => '20170913162250796540257',
  186. 'money_time' => '2017-09-13 16:22:50',
  187. 'money' => 180,
  188. 'sysetem_user' => '系统',
  189. ),
  190. );
  191. if (!$data) {
  192. return Rens(-2020026003);
  193. }
  194. return Rens($data);
  195. }
  196. }
  197. ?>