UserDetails.php 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. <?php
  2. /**
  3. *------Create thems Controller------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2017-06-19 18:04:54------
  7. */
  8. namespace App\Api\Controller;
  9. //ini_set('display_errors', 1);
  10. //
  11. //error_reporting(E_ALL);
  12. class UserDetails extends BaseController {
  13. /**
  14. * 用户明细列表
  15. * @return [type] [description]
  16. */
  17. public function MoneyList() {
  18. $moneyClass = new \Biz\Money\MoneyQuery;
  19. $data = array();
  20. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  21. $res = $moneyClass->Winning($data);
  22. //echo $res;
  23. Render($res, '1', 'success');
  24. }
  25. /**
  26. * 资金流水订单详情
  27. * @return [type] [description]
  28. */
  29. public function MoneyDetail() {
  30. $moneyClass = new \Biz\Money\MoneyQuery;
  31. $data = array();
  32. $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id'] : '';
  33. if (empty($order_id)) Render('', '-4046');
  34. $res = $moneyClass->MorderDetail($order_id);
  35. //echo $res;
  36. if ($res < 0) Render('', $res);
  37. Render($res, '1', 'success');
  38. }
  39. /**
  40. * 充值列表
  41. * @return [type] [description]
  42. */
  43. public function MoneyRecharge() {
  44. $moneyClass = new \Biz\Money\MoneyQuery;
  45. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  46. $data['status'] = isset($_POST['status']) ? $_POST['status'] : '';
  47. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : '';
  48. $data['page'] = isset($_POST['page']) ? $_POST['page'] : '';
  49. $res = $moneyClass->Recharge($data);
  50. //echo $res;
  51. Render($res, '1', 'success');
  52. }
  53. /**
  54. * 提现列表
  55. * @return [type] [description]
  56. */
  57. public function MoneyTake() {
  58. $moneyClass = new \Biz\Money\MoneyQuery;
  59. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  60. $data['status'] = isset($_POST['status']) ? $_POST['status'] : '';
  61. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : '';
  62. $data['page'] = isset($_POST['page']) ? $_POST['page'] : '';
  63. $res = $moneyClass->Withdrawals($data);
  64. //echo $res;
  65. Render($res, '1', 'success');
  66. }
  67. //彩金升级记录
  68. public function cToUpgrade() {
  69. $moneyClass = new \Biz\Money\MoneyQuery;
  70. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  71. $data['create_time'] = isset($_POST['create_time']) ? $_POST['create_time'] : '';
  72. $data['page'] = isset($_POST['page']) ? $_POST['page'] : '';
  73. $res = $moneyClass->cToUpgrade($data);
  74. //echo $res;
  75. Render($res, '1', 'success');
  76. }
  77. //新增查询彩金记录
  78. public function getLotteryLog() {
  79. $moneyClass = new \Biz\Money\MoneyQuery;
  80. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  81. if (empty($data['account_identity'])) {
  82. Render('', -4010, '缺少用户唯一标识');
  83. }
  84. $data['time'] = isset($_POST['time']) ? $_POST['time'] : '';
  85. if (empty($data['time'])) {
  86. Render('', -4010, '缺少时间参数');
  87. }
  88. $data['page'] = isset($_POST['page']) ? $_POST['page'] : 1;
  89. $log = $moneyClass->getLotteryLog($data);
  90. if ($log < 0) {
  91. Render('', $log, '获取数据失败');
  92. }
  93. Render($log, 1, '获取数据成功');
  94. }
  95. //彩金详细
  96. public function cToDetail() {
  97. $moneyClass = new \Biz\Money\MoneyQuery;
  98. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  99. $data['uid'] = isset($_POST['uid']) ? $_POST['uid'] : '';
  100. $data['money_type'] = isset($_POST['money_type']) ? $_POST['money_type'] : '';
  101. $res = $moneyClass->CToDetail($data);
  102. //echo $res;
  103. Render($res, '1', 'success');
  104. }
  105. //充值明细新
  106. public function saveMoneyRecord() {
  107. $moneyClass = new \Biz\Money\MoneyQuery;
  108. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  109. $data['status'] = isset($_POST['status']) ? $_POST['status'] : '';
  110. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : '';
  111. $data['page'] = isset($_POST['page']) ? $_POST['page'] : '';
  112. $data['time'] = isset($_POST['time']) ? $_POST['time'] : '';
  113. $res = $moneyClass->saveMoneyRecord($data);
  114. //echo $res;
  115. Render($res, '1', 'success');
  116. }
  117. //提款明细新
  118. public function takeMoneyRecord() {
  119. $moneyClass = new \Biz\Money\MoneyQuery;
  120. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  121. $data['status'] = isset($_POST['status']) ? $_POST['status'] : '';
  122. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : '';
  123. $data['page'] = isset($_POST['page']) ? $_POST['page'] : '';
  124. $data['time'] = isset($_POST['time']) ? $_POST['time'] : '';
  125. $res = $moneyClass->takeMoneyRecord($data);
  126. // dump($res);
  127. if (intval($res) < 0) {
  128. Render('',$res);
  129. }
  130. Render($res, '1', 'success');
  131. }
  132. /**
  133. * 充值列表
  134. * @return [type] [description]
  135. */
  136. public function PCMoneyRecharge() {
  137. $moneyClass = new \Biz\Money\MoneyQuery;
  138. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  139. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  140. $data['num1'] = isset($_POST['num1']) ? $_POST['num1'] : "";
  141. $data['num2'] = isset($_POST['num2']) ? $_POST['num2'] : "";
  142. $data['time'] = isset($_POST['time']) ? $_POST['time'] : "";
  143. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  144. $res = $moneyClass->PCRecharge($data);
  145. //echo $res;
  146. Render($res, '1', 'success');
  147. }
  148. /**
  149. * 提现列表
  150. * @return [type] [description]
  151. */
  152. public function PCMoneyTake() {
  153. $moneyClass = new \Biz\Money\MoneyQuery;
  154. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  155. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  156. $data['num1'] = isset($_POST['num1']) ? $_POST['num1'] : "";
  157. $data['num2'] = isset($_POST['num2']) ? $_POST['num2'] : "";
  158. $data['time'] = isset($_POST['time']) ? $_POST['time'] : "";
  159. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  160. $res = $moneyClass->PCWithdrawals($data);
  161. //echo $res;
  162. Render($res, '1', 'success');
  163. }
  164. /**
  165. * PC用户明细列表
  166. * @return [type] [description]
  167. */
  168. public function PCMoneyList() {
  169. $moneyClass = new \Biz\Money\MoneyQuery;
  170. $data = array();
  171. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  172. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  173. $data['num1'] = isset($_POST['num1']) ? $_POST['num1'] : "";
  174. $data['num2'] = isset($_POST['num2']) ? $_POST['num2'] : "";
  175. $data['time'] = isset($_POST['time']) ? $_POST['time'] : "";
  176. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  177. $data['trade_type'] = isset($_POST['trade_type']) ? $_POST['trade_type'] : "";
  178. $res = $moneyClass->PcWinning($data);
  179. //echo $res;
  180. Render($res, '1', 'success');
  181. }
  182. public function OGMoney() {
  183. $moneyClass = new \Biz\Money\MoneyQuery;
  184. $data = array();
  185. $kyreturnMoney = 0;
  186. $ogreturnMoney = 0;
  187. $backMoney = 0;
  188. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  189. $a = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  190. $data['time'] = isset($_POST['time']) ? $_POST['time'] : date('Y-m-d');
  191. if(empty($data['time'])){
  192. $data['time'] = date('Y-m-d');
  193. }
  194. $kywhere[] = array('GameEndTime','>=',$data['time'].' 00:00:00');
  195. $kywhere[] = array('GameEndTime','<=',$data['time'].' 23:59:59');
  196. $ogwheres[] = array('AddTime','>=',strtotime($data['time'].' 00:00:00'));
  197. $ogwheres[] = array('AddTime','<=',strtotime($data['time'].' 23:59:59'));
  198. $where[] = array('pass_time','>=',strtotime($data['time'].' 00:00:00'));
  199. $where[] = array('pass_time','<=',strtotime($data['time'].' 23:59:59'));
  200. $agwhere[] = array('recalcuTime','>=',strtotime($data['time'].' 00:00:00'));
  201. $agwhere[] = array('recalcuTime','<=',strtotime($data['time'].' 23:59:59'));
  202. $hjwhere[] = array('bet_time','>=',$data['time'].' 00:00:00');
  203. $hjwhere[] = array('bet_time','<=',$data['time'].' 23:59:59');
  204. $kybetting_money = lm("Kygame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where($kywhere)->sum('CellScore');
  205. $ogbetting_money = lm("Oggame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where($ogwheres)->sum('BettingAmount');
  206. //$agbetting_money = lm("Aggame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where($agwhere)->sum('validBetAmount');
  207. $lcqpbetting_money = lm("Lcqpgame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where($kywhere)->sum('CellScore');
  208. $lybetting_money = lm("Lygame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where($kywhere)->sum('CellScore');
  209. $hjbetting_money = lm("Hjgame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where($hjwhere)->sum('bet_amount');
  210. $kywin_money = lm("Kygame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where('Profit','>',0)->where($kywhere)->sum('Profit');
  211. $ogwin_money = lm("Oggame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where('WinLoseAmount','>',0)->where($ogwheres)->sum('WinLoseAmount');
  212. //$agwin_money = lm("Aggame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where('netAmount','>',0)->where($agwhere)->sum('netAmount');
  213. $lcqpwin_money = lm("Lcqpgame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where('Profit','>',0)->where($kywhere)->sum('Profit');
  214. $lywin_money = lm("Lygame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where('Profit','>',0)->where($kywhere)->sum('Profit');
  215. $hjwin_money = lm("Hjgame_betting_ogrbv", "commons")->where('account_identity',$data['account_identity'])->where('state',1)->where($hjwhere)->sum('profit');
  216. $ogreturnMoney = lm("Og_backwater", "commons")->where('account_identity',$data['account_identity'])->where('game_type','Oggame')->where($where)->sum('money'); //返水金额
  217. $kyreturnMoney = lm("Og_backwater", "commons")->where('account_identity',$data['account_identity'])->where('game_type','Kygame')->where($where)->sum('money'); //返水金额
  218. $lcqpreturnMoney = lm("Og_backwater", "commons")->where('account_identity',$data['account_identity'])->where('game_type','Lcqpgame')->where($where)->sum('money');
  219. $lyreturnMoney = lm("Og_backwater", "commons")->where('account_identity',$data['account_identity'])->where('game_type','Lygame')->where($where)->sum('money'); //返水金额
  220. //$agreturnMoney = lm("Og_backwater", "commons")->where('account_identity',$data['account_identity'])->where('game_type','Kygame')->where($where)->sum('money'); //返水金额
  221. $hjreturnMoney = lm("Og_backwater", "commons")->where('account_identity',$data['account_identity'])->where('game_type','Hjgame')->where($where)->sum('money');
  222. $ogwin = $ogwin_money-$ogbetting_money;//赢亏
  223. $kywin = $kywin_money-$kybetting_money;//赢亏
  224. //$agwin = $agwin_money-$agbetting_money;//赢亏
  225. $lcqpwin = $lcqpwin_money-$lcqpbetting_money;//赢亏
  226. $lywin = $lywin_money-$lybetting_money;//赢亏
  227. $hjwin = $hjwin_money-$hjbetting_money;//赢亏
  228. if ($ogreturnMoney < 0) {
  229. $ogreturnMoney = 0;
  230. }
  231. if ($kyreturnMoney < 0) {
  232. $kyreturnMoney = 0;
  233. }
  234. if ($ogwin_money < 0) {
  235. $ogwin_money = 0;
  236. }
  237. if ($kywin_money < 0) {
  238. $kywin_money = 0;
  239. }
  240. if ($kybetting_money < 0) {
  241. $kybetting_money = 0;
  242. }
  243. if ($ogbetting_money < 0) {
  244. $ogbetting_money = 0;
  245. }
  246. // if ($agbetting_money < 0) {
  247. // $agbetting_money = 0;
  248. // }
  249. $lcqpbetting_money = ($lcqpbetting_money<0)? 0 : $lcqpbetting_money;
  250. $lybetting_money = ($lybetting_money<0)? 0 : $lybetting_money;
  251. // $data = lm('account_detailed', "Commons")->where('account_identity', $a)->first()->toArray();
  252. $dat = array(
  253. 'kywin_money' => sprintf("%.2f", $kywin_money),
  254. 'ogwin_money' => sprintf("%.2f", $ogwin_money),
  255. //'agwin_money' => sprintf("%.2f", $agwin_money),
  256. 'lcqpwin_money' => sprintf("%.2f", $lcqpwin_money),
  257. 'lywin_money' => sprintf("%.2f", $lywin_money),
  258. 'hjwin_money' => sprintf("%.2f", $hjwin_money),
  259. 'kybetting_money' => sprintf("%.2f", $kybetting_money),
  260. 'ogbetting_money' => sprintf("%.2f", $ogbetting_money),
  261. //'agbetting_money' => sprintf("%.2f", $agbetting_money),
  262. 'lcqpbetting_money' => sprintf("%.2f", $lcqpbetting_money),
  263. 'lybetting_money' => sprintf("%.2f", $lybetting_money),
  264. 'hjbetting_money' => sprintf("%.2f", $hjbetting_money),
  265. 'kyreturnMoney' => sprintf("%.2f", $kyreturnMoney),
  266. 'ogreturnMoney' => sprintf("%.2f", $ogreturnMoney),
  267. 'lcqpreturnMoney' => sprintf("%.2f", $lcqpreturnMoney),
  268. 'lyreturnMoney' => sprintf("%.2f", $lyreturnMoney),
  269. //'agreturnMoney' => sprintf("%.2f", $agreturnMoney),
  270. 'hjreturnMoney' => sprintf("%.2f", $hjreturnMoney),
  271. 'kywin' => sprintf("%.2f", $kywin),
  272. 'ogwin' => sprintf("%.2f", $ogwin),
  273. //'agwin' => sprintf("%.2f", $agwin),
  274. 'lcqpwin' => sprintf("%.2f", $lcqpwin),
  275. 'lywin' => sprintf("%.2f", $lywin),
  276. 'hjwin' => sprintf("%.2f", $hjwin),
  277. );
  278. Render($dat, '1', 'success');
  279. }
  280. /**
  281. * PC用户明细列表
  282. * @return [type] [description]
  283. */
  284. public function PCNewMoney() {
  285. $moneyClass = new \Biz\Money\MoneyQuery;
  286. $data = array();
  287. $withdrawalsMoney = 0;
  288. $rechargeMoney = 0;
  289. $betMoney = 0;
  290. $winMoney = 0;
  291. $profitMoney = 0;
  292. $returnMoney = 0;
  293. $backMoney = 0;
  294. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  295. $a = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  296. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  297. $data['num1'] = isset($_POST['num1']) ? $_POST['num1'] : "";
  298. $data['num2'] = isset($_POST['num2']) ? $_POST['num2'] : "";
  299. $data['time'] = isset($_POST['time']) ? $_POST['time'] : date('Y-m-d');//qtx 2018-12-25
  300. if(empty($data['time'])){//qtx 2018-12-25
  301. $data['time'] = date('Y-m-d');
  302. }
  303. $withdrawalsMoney = $moneyClass->PCRecharge($data, 1); //充值金额
  304. $rechargeMoney = $moneyClass->PCWithdrawals($data, 1); //提现金额
  305. $backMoney = $moneyClass->backWaterMoney($data, 1); //回水金额
  306. $returnMoney = $moneyClass->returnMoney($data, 3); //返水金额
  307. if ($backMoney < 0) {
  308. $backMoney = 0;
  309. }
  310. if ($returnMoney < 0) {
  311. $returnMoney = 0;
  312. }
  313. $data = array();
  314. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  315. $data['start'] = isset($_POST['start']) ? $_POST['start'] : "";
  316. $data['end'] = isset($_POST['end']) ? $_POST['end'] : "";
  317. $data['time'] = isset($_POST['time']) ? $_POST['time'] : date('Y-m-d');//qtx 2018-12-25
  318. if(empty($data['time'])){//qtx 2018-12-25
  319. $data['time'] = date('Y-m-d');
  320. }
  321. //dump($data);
  322. $resMoney = $moneyClass->EffectiveBetting($data, 1);
  323. $sixresMoney = $moneyClass->EffectivesixBetting($data, 1);
  324. $data = lm('account_detailed', "Commons")->where('account_identity', $a)->first()->toArray();
  325. $dat = array(//qtx 2018-12-19
  326. 'withdrawalsMoney' => $withdrawalsMoney,
  327. 'rechargeMoney' => $rechargeMoney,
  328. 'cash' => $data['cash'],
  329. 'betMoney' => sprintf("%.2f", $resMoney['countMoney']),
  330. 'winMoney' => sprintf("%.2f", $resMoney['winMoney']),
  331. 'profitMoney' => sprintf("%.2f", $resMoney['profitMoney']),
  332. 'sumbet' => sprintf("%.2f", $resMoney['sumbet']),
  333. 'noawardbet' => sprintf("%.2f", $resMoney['noawardbet']),
  334. 'cancelbet' => sprintf("%.2f", $resMoney['cancelbet']),
  335. 'backMoney' => sprintf("%.2f", $backMoney),
  336. 'returnMoney' => sprintf("%.2f", $returnMoney),
  337. 'sixbetMoney' => sprintf("%.2f", $sixresMoney['sixcountMoney']),
  338. 'sixwinMoney' => sprintf("%.2f", $sixresMoney['sixwinMoney']),
  339. 'sixprofitMoney' => sprintf("%.2f", $sixresMoney['sixprofitMoney']),
  340. 'sixsumbet' => sprintf("%.2f", $sixresMoney['sixsumbet']),
  341. 'sixnoawardbet' => sprintf("%.2f", $sixresMoney['sixnoawardbet']),
  342. 'sixcancelbet' => sprintf("%.2f", $sixresMoney['sixcancelbet']),
  343. );
  344. Render($dat, '1', 'success');
  345. }
  346. /**
  347. * PC投注记录和追号记录
  348. * @return [type] [description]
  349. */
  350. public function PcBettingRecord() {
  351. $moneyClass = new \Biz\Money\MoneyQuery;
  352. $data = array();
  353. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  354. $data['game'] = isset($_POST['game']) ? $_POST['game'] : "";
  355. $data['money_time'] = isset($_POST['money_time']) ? $_POST['money_time'] : "";
  356. $data['time1'] = isset($_POST['time1']) ? $_POST['time1'] : "";
  357. $data['time2'] = isset($_POST['time2']) ? $_POST['time2'] : "";
  358. $data['no'] = isset($_POST['no']) ? $_POST['no'] : "";
  359. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  360. $data['status'] = isset($_POST['status']) ? $_POST['status'] : "";
  361. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  362. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : "";
  363. $res = $moneyClass->PcBettingRecord($data);
  364. //echo $res;
  365. Render($res, '1', 'success');
  366. }
  367. /**
  368. * PC投注记录和追号记录
  369. * @return [type] [description]
  370. */
  371. public function PcSixlotteryRecord() {
  372. $moneyClass = new \Biz\Money\MoneyQuery;
  373. $data = array();
  374. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  375. $data['game'] = isset($_POST['game']) ? $_POST['game'] : "";
  376. $data['money_time'] = isset($_POST['money_time']) ? $_POST['money_time'] : "";
  377. $data['time1'] = isset($_POST['time1']) ? $_POST['time1'] : "";
  378. $data['time2'] = isset($_POST['time2']) ? $_POST['time2'] : "";
  379. $data['no'] = isset($_POST['no']) ? $_POST['no'] : "";
  380. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  381. $data['status'] = isset($_POST['status']) ? $_POST['status'] : "";
  382. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  383. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : "";
  384. $res = $moneyClass->PcSixlotteryRecord($data);
  385. //echo $res;
  386. Render($res, '1', 'success');
  387. }
  388. /**
  389. * PC塞子游戏投注记录
  390. * @return [type] [description]
  391. */
  392. public function PcDiceBettingRecord() {
  393. $moneyClass = new \Biz\Money\MoneyQuery;
  394. $data = array();
  395. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  396. $data['game'] = isset($_POST['game']) ? $_POST['game'] : "";
  397. $data['money_time'] = isset($_POST['money_time']) ? $_POST['money_time'] : "";
  398. $data['time1'] = isset($_POST['time1']) ? $_POST['time1'] : "";
  399. $data['time2'] = isset($_POST['time2']) ? $_POST['time2'] : "";
  400. $data['no'] = isset($_POST['no']) ? $_POST['no'] : "";
  401. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  402. $data['status'] = isset($_POST['status']) ? $_POST['status'] : "";
  403. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  404. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : "";
  405. $res = $moneyClass->PcDiceBettingRecord($data);
  406. //echo $res;
  407. Render($res, '1', 'success');
  408. }
  409. /**
  410. * PC投注记录和追号记录
  411. * @return [type] [description]
  412. */
  413. public function PcBettingDetails() {
  414. $moneyClass = new \Biz\Money\MoneyQuery;
  415. $data = array();
  416. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  417. $data['game'] = isset($_POST['game']) ? $_POST['game'] : "";
  418. $data['money_time'] = isset($_POST['money_time']) ? $_POST['money_time'] : "";
  419. $data['time1'] = isset($_POST['time1']) ? $_POST['time1'] : "";
  420. $data['time2'] = isset($_POST['time2']) ? $_POST['time2'] : "";
  421. $data['no'] = isset($_POST['no']) ? $_POST['no'] : "";
  422. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  423. $data['status'] = isset($_POST['status']) ? $_POST['status'] : "";
  424. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  425. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : "";
  426. $res = $moneyClass->PcBettingDetails($data);
  427. $dat = $moneyClass->dataChange($res);
  428. //echo $res;
  429. Render($dat, '1', 'success');
  430. }
  431. /**
  432. * PC投注记录和追号记录
  433. * @return [type] [description]
  434. */
  435. public function PcSixlotteryDetails() {
  436. $moneyClass = new \Biz\Money\MoneyQuery;
  437. $data = array();
  438. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  439. $data['game'] = isset($_POST['game']) ? $_POST['game'] : "";
  440. $data['money_time'] = isset($_POST['money_time']) ? $_POST['money_time'] : "";
  441. $data['time1'] = isset($_POST['time1']) ? $_POST['time1'] : "";
  442. $data['time2'] = isset($_POST['time2']) ? $_POST['time2'] : "";
  443. $data['no'] = isset($_POST['no']) ? $_POST['no'] : "";
  444. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  445. $data['status'] = isset($_POST['status']) ? $_POST['status'] : "";
  446. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  447. $data['order_id'] = isset($_POST['order_id']) ? $_POST['order_id'] : "";
  448. $res = $moneyClass->PcSixlotteryDetails($data);
  449. $dat = $moneyClass->dataChange($res);
  450. //echo $res;
  451. Render($dat, '1', 'success');
  452. }
  453. /**
  454. * PC塞子投注详情
  455. * @return [type] [description]
  456. */
  457. public function PcDiceBettingDetails() {
  458. $moneyClass = new \Biz\Money\MoneyQuery;
  459. $data = array();
  460. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  461. $data['game'] = isset($_POST['game']) ? $_POST['game'] : "";
  462. $data['game_name'] = isset($_POST['game_name']) ? $_POST['game_name'] : "";
  463. $data['id'] = isset($_POST['id']) ? $_POST['id'] : "";
  464. if ($data['game'] == 'dice') {
  465. $res = $moneyClass->DiceSdataChange($data);
  466. } else {
  467. $res = $moneyClass->DicedataChange($data);
  468. }
  469. Render($res, '1', 'success');
  470. }
  471. /*交易类型对应键值*/
  472. public function GetTradeType() {
  473. $child = array(
  474. '1' => '投注',
  475. '2' => '追号',
  476. '3' => '撤单',
  477. '4' => '中奖',
  478. '5' => '提现',
  479. '6' => '在线充值',
  480. '7' => '返水',
  481. '8' => '回水',
  482. '9' => '管理员扣款',
  483. '10' => '佣金提成',
  484. '11' => '后台充值',
  485. '12' => '活动',
  486. '13' => '充值赠送',
  487. '14' => '汇款',
  488. '15' => '提现冻结',
  489. '16' => '红包打赏',
  490. '19-1' => '额度转入',
  491. '19-2' => '额度转出',
  492. );
  493. $arr = array(
  494. '1' => array(
  495. 'name' => '全部',
  496. 'child' => $child,
  497. ),
  498. '2' => array(
  499. 'name' => '充值',
  500. 'child' => array(
  501. '11' => $child['11'],
  502. '6' => $child['6'],
  503. '14' => $child['14'],
  504. ),
  505. ),
  506. '3' => array(
  507. 'name' => '投注',
  508. 'child' => array(
  509. '1' => $child['1'],
  510. '2' => $child['2'],
  511. '3' => $child['3'],
  512. ),
  513. ),
  514. '4' => array(
  515. 'name' => '中奖',
  516. 'child' => array(
  517. '4' => $child['4'],
  518. ),
  519. ),
  520. '5' => array(
  521. 'name' => '提现',
  522. 'child' => array(
  523. '5' => $child['5'],
  524. '9' => $child['9'],
  525. ),
  526. ),
  527. '6' => array(
  528. 'name' => '额度转账',
  529. 'child' => array(
  530. '19-1' => $child['19-1'],
  531. '19-2' => $child['19-2'],
  532. ),
  533. ),
  534. '7' => array(
  535. 'name' => '活动优惠',
  536. 'child' => array(
  537. '7' => $child['7'],
  538. '8' => $child['8'],
  539. '10' => $child['10'],
  540. '13' => $child['13'],
  541. '12' => $child['12'],
  542. '16' => $child['16'],
  543. ),
  544. ),
  545. );
  546. Render($arr, '1', lang()->get('success'));
  547. }
  548. /**
  549. * 查询不同资金类型列表
  550. */
  551. public function Querry() {
  552. $status = isset($_POST['status']) ? $_POST['status'] : '';
  553. $trade_type = isset($_REQUEST['trade_type']) ? $_REQUEST['trade_type'] : '';
  554. $account_identity = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  555. $page = isset($_POST['page']) ? $_POST['page'] : '1';
  556. $money_time = isset($_REQUEST['money_time']) ? $_REQUEST['money_time'] : '';
  557. $field = isset($_POST['field']) ? $_POST['field'] : 'otime';
  558. $orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : '2';
  559. $moneyClass = new \Biz\Money\MoneyQuery;
  560. if(empty($money_time)){//qtx 2018-12-25
  561. $prevmonth = date("Y-m-d", strtotime("-1 month"));
  562. $money_time = $prevmonth.'~'.date('Y-m-d');
  563. }
  564. $mtime = explode('~', $money_time);
  565. $data = array(
  566. 'account_identity' => $account_identity,
  567. 'status' => $status,
  568. 'trade_type' => $trade_type,
  569. 'page' => $page,
  570. 'field' => ($field == 'otime') ? 'money_time' : 'money',
  571. 'orderby' => ($orderby == 1) ? 'asc' : 'desc',
  572. 'money_time' => substr($money_time, '0', '19'),
  573. );
  574. if (count($mtime > 1)) {
  575. $data['money_time'] = $mtime;
  576. }
  577. $res = $moneyClass->Winning($data);
  578. //var_dump( $res);
  579. if (is_array($res)) {
  580. Render($res, '1', lang()->get('success'));
  581. } else {
  582. Render('', '-400', lang()->get('fail'));
  583. }
  584. }
  585. /*统计账户明细汇总*/
  586. public function AccountSum() {
  587. $trade_type = isset($_REQUEST['trade_type']) ? $_REQUEST['trade_type'] : '';
  588. $account_identity = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  589. $page = isset($_POST['page']) ? $_POST['page'] : '1';
  590. $field = isset($_POST['field']) ? $_POST['field'] : 'otime';
  591. $orderby = isset($_POST['orderby']) ? $_POST['orderby'] : '2';
  592. $money_time = isset($_REQUEST['money_time']) ? $_REQUEST['money_time'] : '';
  593. $moneyClass = new \Biz\Money\MoneyQuery;
  594. $mtime = explode('~', $money_time);
  595. $data = array(
  596. 'account_identity' => $account_identity,
  597. 'trade_type' => $trade_type,
  598. 'page' => $page,
  599. 'money_time' => substr($money_time, '0', '19'),
  600. );
  601. if (count($mtime > 1)) {
  602. $data['money_time'] = $mtime;
  603. }
  604. $res = $moneyClass->AccountSum($data);
  605. //var_dump( $res);
  606. if (is_array($res)) {
  607. Render($res, '1', lang()->get('success'));
  608. } else {
  609. Render('', '-400', lang()->get('fail'));
  610. }
  611. }
  612. /**
  613. * 资金详情
  614. * @return [type] [description]
  615. */
  616. public function details() {
  617. $data['identity'] = isset($_GET['identity']) ? $_GET['identity'] : '';
  618. $moneyClass = new \Biz\Money\MoneyQuery;
  619. $res = $moneyClass->Lists($data);
  620. Render($res, '1', lang()->get('success'));
  621. }
  622. /**
  623. * 走势图
  624. * @return [type] [description]
  625. */
  626. public function TrendChart() {
  627. $nums = new \Biz\Game\GameQuery();
  628. $name = isset($_GET['name']) ? $_GET['name'] : '';
  629. $num1 = isset($_POST['num1']) ? $_POST['num1'] : '';
  630. $num2 = isset($_POST['num2']) ? $_POST['num2'] : '';
  631. $time = isset($_POST['time']) ? $_POST['time'] : '';
  632. $page = isset($_POST['page']) ? $_POST['page'] : '1'; //资金类型
  633. $limit = isset($_POST['limit']) ? $_POST['limit'] : '20';
  634. $datat = [
  635. 'name' => $name,
  636. 'num1' => $num1,
  637. 'num2' => $num2,
  638. 'time' => $time,
  639. 'page' => $page,
  640. 'limit' => $limit,
  641. ];
  642. $data = $nums->TrendChart($datat);
  643. $data['page']=$page;
  644. //dump(21);
  645. Render($data, '1', lang()->get('success'));
  646. }
  647. /**
  648. * 投注状态查询
  649. * @return [type] [description]
  650. */
  651. public function BetChart() {
  652. $nums = new \Biz\Money\MoneyQuery;
  653. $account_identity = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  654. $game_name = isset($_GET['game_name']) ? $_GET['game_name'] : '';
  655. $no = isset($_POST['no']) ? $_POST['no'] : '';
  656. $status = isset($_POST['status']) ? $_POST['status'] : '0';
  657. $datat = [
  658. 'account_identity' => $account_identity,
  659. 'game_name' => $game_name,
  660. 'no' => $no,
  661. 'status' => $status,
  662. ];
  663. if (in_array($game_name, $this->curPrizeGame())) {
  664. $data = $nums->CurBetRecord($datat);
  665. } else {
  666. $data = $nums->NotBetRecord($datat);
  667. }
  668. //dump($data);
  669. Render($data, '1', lang()->get('success'));
  670. }
  671. //即时开奖游戏
  672. private function curPrizeGame() {
  673. return array(
  674. 'diceone',
  675. );
  676. }
  677. /**
  678. * 个人盈亏
  679. * @return [type] [description]
  680. */
  681. public function Personal() {
  682. $now_times = isset($_POST['now_time']) ? $_POST['now_time'] : '';
  683. //var_dump($now_times);
  684. $account_identity = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  685. $data = array(
  686. 'account_identity' => $account_identity,
  687. 'now_times' => $now_times,
  688. );
  689. $moneyClass = new \Biz\Money\MoneyQuery;
  690. $res = $moneyClass->Personal($data);
  691. Render($res, '1', lang()->get('success'));
  692. }
  693. public function test() {
  694. $money_type = isset($_POST['money_type']) ? $_POST['money_type'] : '';
  695. $status = isset($_POST['status']) ? $_POST['status'] : '1';
  696. $moneyClass = new \Biz\Money\MoneyQuery;
  697. $data = [
  698. 'account_identity' => 'ec4ad43d-6105-e90c-5f3e-38141676c3b6',
  699. //'money_type'=>$money_type,
  700. //'status'=>$status
  701. ];
  702. $res = $moneyClass->Winning($data);
  703. // dump($res);
  704. if (is_array($res)) {
  705. Render($res, '1', lang()->get('success'));
  706. } else {
  707. Render('', '-400', lang()->get('fail'));
  708. }
  709. }
  710. //快乐赛宝
  711. public function DiceDetails() {
  712. $moneyClass = new \Biz\Money\MoneyQuery;
  713. $moneyd = new \App\Api\Controller\Specgame;
  714. $data = array();
  715. $ta = $moneyd->GetOtherUser();
  716. $data['account_identity'] = isset($ta['other_user']['account_identity']) ? $ta['other_user']['account_identity'] : $_SESSION['uinfo']['account_identity'];
  717. $dat = $moneyClass->DiceBettingDetails($data);
  718. Render($dat, '1', 'success');
  719. }
  720. public function DiceOneDetails() {
  721. $moneyClass = new \Biz\Money\MoneyQuery;
  722. $data = array();
  723. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : $_SESSION['uinfo']['account_identity'];
  724. $dat = $moneyClass->DiceBettingDetails($data);
  725. Render($dat, '1', 'success');
  726. }
  727. //PC用户有效投注统计
  728. public function BettingRecord() {
  729. $moneyClass = new \Biz\Money\MoneyQuery;
  730. $data['account_identity'] = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  731. $data['start'] = isset($_POST['start']) ? $_POST['start'] : "";
  732. $data['end'] = isset($_POST['end']) ? $_POST['end'] : "";
  733. $data['page'] = isset($_POST['page']) ? $_POST['page'] : "1";
  734. $res = $moneyClass->EffectiveBetting($data);
  735. //echo $res;
  736. Render($res, '1', 'success');
  737. }
  738. public function getFav() {
  739. $uuid = $_SESSION['uinfo']['identity'];
  740. $obj = lm('UserSetting', 'api')->where('account_identity', $uuid)->first(['fav_info']);
  741. $in = $obj ? json_decode($obj->fav_info) : [];
  742. $favs = lm('Game_type', 'commons')->whereIn('table_name', $in)->get(['name', 'table_name', 'icon']);
  743. Render($favs, 1);
  744. }
  745. public function setFav() {
  746. $uuid = $_SESSION['uinfo']['identity'];
  747. $type = intval($_POST['type'] ?? 1);
  748. $game_name = trim($_POST['game_name']);
  749. $obj = lm('UserSetting', 'api')->where('account_identity', $uuid)->first(['fav_info']);
  750. $data = $obj && $obj->fav_info != 'null' ? json_decode($obj->fav_info, 1) : [];
  751. if (intval($type) === 0) {
  752. if ($key = array_search($game_name, $data)) {
  753. array_splice($data, $key, 1);
  754. }
  755. } elseif ($type === 1) {
  756. if (!array_search($game_name, $data)) {
  757. array_push($data, $game_name);
  758. }
  759. }
  760. $ret = lm('UserSetting', 'api')->where('account_identity', $uuid)->update(['fav_info' => json_encode($data)]);
  761. if ($ret === 1) {
  762. $this->getFav();
  763. }
  764. Render('', -888, '操作失败');
  765. }
  766. }