IndexController.class.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <?php
  2. namespace Agent\Controller;
  3. class IndexController extends AgentController
  4. {
  5. //代理中心会员管理
  6. public function index($name=NULL){
  7. if (!session('agent_id')) {
  8. $this->redirect('Agent/Login/index');
  9. }
  10. $uid = session('agent_id');
  11. $where = "";
  12. if ($name != '') {
  13. $map_3 = "username like '%{$name}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  14. }else{
  15. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  16. }
  17. $count = M('User')->where($map_3)->count();
  18. $Page = new \Think\Page($count, 15);
  19. $show = $Page->show();
  20. $list = M('User')->where($map_3)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
  21. foreach ($list as $k => $v) {
  22. $list[$k]['invit_1'] = M('User')->where(array('id' => $v['invit_1']))->getField('username');
  23. $list[$k]['invit_2'] = M('User')->where(array('id' => $v['invit_2']))->getField('username');
  24. $list[$k]['invit_3'] = M('User')->where(array('id' => $v['invit_3']))->getField('username');
  25. }
  26. $this->assign('list', $list);
  27. $this->assign('page', $show);
  28. $this->display();
  29. }
  30. //代理中心建仓订单
  31. public function tyjclist($username=NULL){
  32. if (!session('agent_id')) {
  33. $this->redirect('Agent/Login/index');
  34. }
  35. $uid = session('agent_id');
  36. if ($username != '') {
  37. $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  38. }else{
  39. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  40. }
  41. $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
  42. if(!empty($ulist)){
  43. $list = array();
  44. foreach($ulist as $key=>$vo){
  45. $map['uid'] = $vo['id'];
  46. $map['status'] = 1;
  47. $orderlist = M("tyhyorder")->where($map)->select();
  48. if(!empty($orderlist)){
  49. foreach($orderlist as $k=>$v){
  50. $list[$key][$k]['id'] = $v['id'];
  51. $list[$key][$k]['username'] = $v['username'];
  52. $list[$key][$k]['num'] = $v['num'];
  53. $list[$key][$k]['hybl'] = $v['hybl'];
  54. $list[$key][$k]['hyzd'] = $v['hyzd'];
  55. $list[$key][$k]['coinname'] = $v['coinname'];
  56. $list[$key][$k]['status'] = $v['status'];
  57. $list[$key][$k]['is_win'] = $v['is_win'];
  58. $list[$key][$k]['buytime'] = $v['buytime'];
  59. $list[$key][$k]['selltime'] = $v['selltime'];
  60. $list[$key][$k]['intselltime'] = $v['intselltime'];
  61. $list[$key][$k]['buyprice'] = $v['buyprice'];
  62. $list[$key][$k]['sellprice'] = $v['sellprice'];
  63. $list[$key][$k]['ploss'] = $v['ploss'];
  64. $list[$key][$k]['time'] = $v['time'];
  65. $list[$key][$k]['kongyk'] = $v['kongyk'];
  66. }
  67. }
  68. }
  69. }else{
  70. $list = '';
  71. }
  72. if(!empty($list)){
  73. $arr[] = array();
  74. foreach($list as $key=>$vo){
  75. foreach($vo as $a=>$b){
  76. $arr_1['id'] = $b['id'];
  77. $arr_1['username'] = $b['username'];
  78. $arr_1['num'] = $b['num'];
  79. $arr_1['hybl'] = $b['hybl'];
  80. $arr_1['hyzd'] = $b['hyzd'];
  81. $arr_1['coinname'] = $b['coinname'];
  82. $arr_1['status'] = $b['status'];
  83. $arr_1['is_win'] = $b['is_win'];
  84. $arr_1['buytime'] = $b['buytime'];
  85. $arr_1['selltime'] = $b['selltime'];
  86. $arr_1['intselltime'] = $b['intselltime'];
  87. $arr_1['buyprice'] = $b['buyprice'];
  88. $arr_1['sellprice'] = $b['sellprice'];
  89. $arr_1['ploss'] = $b['ploss'];
  90. $arr_1['time'] = $b['time'];
  91. $arr_1['kongyk'] = $b['kongyk'];
  92. $arr[] = $arr_1;
  93. }
  94. }
  95. }
  96. $arr = array_filter($arr);
  97. $this->assign('list', $arr);
  98. $this->assign('page', $show);
  99. $this->display();
  100. }
  101. //代理中心建仓订单
  102. public function jclist($username=NULL){
  103. if (!session('agent_id')) {
  104. $this->redirect('Agent/Login/index');
  105. }
  106. $uid = session('agent_id');
  107. if ($username != '') {
  108. $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  109. }else{
  110. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  111. }
  112. $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
  113. if(!empty($ulist)){
  114. $list = array();
  115. foreach($ulist as $key=>$vo){
  116. $map['uid'] = $vo['id'];
  117. $map['status'] = 1;
  118. $orderlist = M("hyorder")->where($map)->select();
  119. if(!empty($orderlist)){
  120. foreach($orderlist as $k=>$v){
  121. $list[$key][$k]['id'] = $v['id'];
  122. $list[$key][$k]['username'] = $v['username'];
  123. $list[$key][$k]['num'] = $v['num'];
  124. $list[$key][$k]['hybl'] = $v['hybl'];
  125. $list[$key][$k]['hyzd'] = $v['hyzd'];
  126. $list[$key][$k]['coinname'] = $v['coinname'];
  127. $list[$key][$k]['status'] = $v['status'];
  128. $list[$key][$k]['is_win'] = $v['is_win'];
  129. $list[$key][$k]['buytime'] = $v['buytime'];
  130. $list[$key][$k]['selltime'] = $v['selltime'];
  131. $list[$key][$k]['intselltime'] = $v['intselltime'];
  132. $list[$key][$k]['buyprice'] = $v['buyprice'];
  133. $list[$key][$k]['sellprice'] = $v['sellprice'];
  134. $list[$key][$k]['ploss'] = $v['ploss'];
  135. $list[$key][$k]['time'] = $v['time'];
  136. $list[$key][$k]['kongyk'] = $v['kongyk'];
  137. }
  138. }
  139. }
  140. }else{
  141. $list = '';
  142. }
  143. if(!empty($list)){
  144. $arr[] = array();
  145. foreach($list as $key=>$vo){
  146. foreach($vo as $a=>$b){
  147. $arr_1['id'] = $b['id'];
  148. $arr_1['username'] = $b['username'];
  149. $arr_1['num'] = $b['num'];
  150. $arr_1['hybl'] = $b['hybl'];
  151. $arr_1['hyzd'] = $b['hyzd'];
  152. $arr_1['coinname'] = $b['coinname'];
  153. $arr_1['status'] = $b['status'];
  154. $arr_1['is_win'] = $b['is_win'];
  155. $arr_1['buytime'] = $b['buytime'];
  156. $arr_1['selltime'] = $b['selltime'];
  157. $arr_1['intselltime'] = $b['intselltime'];
  158. $arr_1['buyprice'] = $b['buyprice'];
  159. $arr_1['sellprice'] = $b['sellprice'];
  160. $arr_1['ploss'] = $b['ploss'];
  161. $arr_1['time'] = $b['time'];
  162. $arr_1['kongyk'] = $b['kongyk'];
  163. $arr[] = $arr_1;
  164. }
  165. }
  166. }
  167. $arr = array_filter($arr);
  168. $this->assign('list', $arr);
  169. $this->assign('page', $show);
  170. $this->display();
  171. }
  172. //单控盈亏
  173. public function setwinloss(){
  174. if($_POST){
  175. $id = trim(I('post.id'));
  176. $kongyk = trim(I('post.kongyk'));
  177. $info = M("hyorder")->where(array('id'=>$id))->find();
  178. if(empty($info)){
  179. $this->ajaxReturn(['code'=>0,'info'=>"参少重要参数"]);
  180. }
  181. $result = M("hyorder")->where(array('id'=>$id))->save(array('kongyk'=>$kongyk));
  182. if($result){
  183. $this->ajaxReturn(['code'=>1,'info'=>"操作成功"]);
  184. }else{
  185. $this->ajaxReturn(['code'=>0,'info'=>"操作失败"]);
  186. }
  187. }else{
  188. $this->ajaxReturn(['code'=>0,'info'=>"网络错误"]);
  189. }
  190. }
  191. //代理中心充值记录
  192. public function czlist(){
  193. if (!session('agent_id')) {
  194. $this->redirect('Agent/Login/index');
  195. }
  196. $uid = session('agent_id');
  197. if ($username != '') {
  198. $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  199. }else{
  200. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  201. }
  202. $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
  203. if(!empty($ulist)){
  204. $list = array();
  205. foreach($ulist as $k=>$v){
  206. $uid = $v['id'];
  207. $corder = M("recharge")->where(array('uid'=>$uid))->select();
  208. if(!empty($corder)){
  209. foreach($corder as $key=>$vo){
  210. $list[$key]['id'] = $vo['id'];
  211. $list[$key]['username'] = $vo['username'];
  212. $list[$key]['coin'] = $vo['coin'];
  213. $list[$key]['num'] = $vo['num'];
  214. $list[$key]['addtime'] = $vo['addtime'];
  215. $list[$key]['updatetime'] = $vo['updatetime'];
  216. $list[$key]['status'] = $vo['status'];
  217. $list[$key]['payimg'] = $vo['payimg'];
  218. }
  219. }
  220. }
  221. }
  222. $this->assign("list",$list);
  223. $this->display();
  224. }
  225. //代理中心提现记录
  226. public function txlist(){
  227. if (!session('agent_id')) {
  228. $this->redirect('Agent/Login/index');
  229. }
  230. $uid = session('agent_id');
  231. if ($username != '') {
  232. $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  233. }else{
  234. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  235. }
  236. $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
  237. if(!empty($ulist)){
  238. $list = array();
  239. foreach($ulist as $k=>$v){
  240. $uid = $v['id'];
  241. $corder = M("myzc")->where(array('userid'=>$uid))->select();
  242. if(!empty($corder)){
  243. foreach($corder as $key=>$vo){
  244. $list[$key]['id'] = $vo['id'];
  245. $list[$key]['userid'] = $vo['userid'];
  246. $list[$key]['username'] = $vo['username'];
  247. $list[$key]['coinname'] = $vo['coinname'];
  248. $list[$key]['num'] = $vo['num'];
  249. $list[$key]['fee'] = $vo['fee'];
  250. $list[$key]['mum'] = $vo['mum'];
  251. $list[$key]['address'] = $vo['address'];
  252. $list[$key]['addtime'] = $vo['addtime'];
  253. $list[$key]['endtime'] = $vo['endtime'];
  254. $list[$key]['status'] = $vo['status'];
  255. }
  256. }
  257. }
  258. }
  259. $this->assign("list",$list);
  260. $this->display();
  261. }
  262. //代理中心平仓订单
  263. public function pclist($username=NULL){
  264. if (!session('agent_id')) {
  265. $this->redirect('Agent/Login/index');
  266. }
  267. $uid = session('agent_id');
  268. if ($username != '') {
  269. $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  270. }else{
  271. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  272. }
  273. $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
  274. if(!empty($ulist)){
  275. $list = array();
  276. foreach($ulist as $key=>$vo){
  277. $uid = $vo['id'];
  278. $orderlist = M("hyorder")->where("uid = $uid and (status = 2 or status = 3)")->select();
  279. if(!empty($orderlist)){
  280. foreach($orderlist as $k=>$v){
  281. $list[$key][$k]['id'] = $v['id'];
  282. $list[$key][$k]['username'] = $v['username'];
  283. $list[$key][$k]['num'] = $v['num'];
  284. $list[$key][$k]['hybl'] = $v['hybl'];
  285. $list[$key][$k]['hyzd'] = $v['hyzd'];
  286. $list[$key][$k]['coinname'] = $v['coinname'];
  287. $list[$key][$k]['status'] = $v['status'];
  288. $list[$key][$k]['is_win'] = $v['is_win'];
  289. $list[$key][$k]['buytime'] = $v['buytime'];
  290. $list[$key][$k]['selltime'] = $v['selltime'];
  291. $list[$key][$k]['intselltime'] = $v['intselltime'];
  292. $list[$key][$k]['buyprice'] = $v['buyprice'];
  293. $list[$key][$k]['sellprice'] = $v['sellprice'];
  294. $list[$key][$k]['ploss'] = $v['ploss'];
  295. $list[$key][$k]['time'] = $v['time'];
  296. $list[$key][$k]['kongyk'] = $v['kongyk'];
  297. }
  298. }
  299. }
  300. }else{
  301. $list = '';
  302. }
  303. if(!empty($list)){
  304. $arr[] = array();
  305. foreach($list as $key=>$vo){
  306. foreach($vo as $a=>$b){
  307. $arr_1['id'] = $b['id'];
  308. $arr_1['username'] = $b['username'];
  309. $arr_1['num'] = $b['num'];
  310. $arr_1['hybl'] = $b['hybl'];
  311. $arr_1['hyzd'] = $b['hyzd'];
  312. $arr_1['coinname'] = $b['coinname'];
  313. $arr_1['status'] = $b['status'];
  314. $arr_1['is_win'] = $b['is_win'];
  315. $arr_1['buytime'] = $b['buytime'];
  316. $arr_1['selltime'] = $b['selltime'];
  317. $arr_1['intselltime'] = $b['intselltime'];
  318. $arr_1['buyprice'] = $b['buyprice'];
  319. $arr_1['sellprice'] = $b['sellprice'];
  320. $arr_1['ploss'] = $b['ploss'];
  321. $arr_1['time'] = $b['time'];
  322. $arr_1['kongyk'] = $b['kongyk'];
  323. $arr[] = $arr_1;
  324. }
  325. }
  326. }
  327. $arr = array_filter($arr);
  328. $this->assign('list', $arr);
  329. $this->assign('page', $show);
  330. $this->display();
  331. }
  332. //代理中心平仓订单
  333. public function typclist($username=NULL){
  334. if (!session('agent_id')) {
  335. $this->redirect('Agent/Login/index');
  336. }
  337. $uid = session('agent_id');
  338. if ($username != '') {
  339. $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
  340. }else{
  341. $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
  342. }
  343. $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
  344. if(!empty($ulist)){
  345. $list = array();
  346. foreach($ulist as $key=>$vo){
  347. $uid = $vo['id'];
  348. $orderlist = M("tyhyorder")->where("uid = $uid and (status = 2 or status = 3)")->select();
  349. if(!empty($orderlist)){
  350. foreach($orderlist as $k=>$v){
  351. $list[$key][$k]['id'] = $v['id'];
  352. $list[$key][$k]['username'] = $v['username'];
  353. $list[$key][$k]['num'] = $v['num'];
  354. $list[$key][$k]['hybl'] = $v['hybl'];
  355. $list[$key][$k]['hyzd'] = $v['hyzd'];
  356. $list[$key][$k]['coinname'] = $v['coinname'];
  357. $list[$key][$k]['status'] = $v['status'];
  358. $list[$key][$k]['is_win'] = $v['is_win'];
  359. $list[$key][$k]['buytime'] = $v['buytime'];
  360. $list[$key][$k]['selltime'] = $v['selltime'];
  361. $list[$key][$k]['intselltime'] = $v['intselltime'];
  362. $list[$key][$k]['buyprice'] = $v['buyprice'];
  363. $list[$key][$k]['sellprice'] = $v['sellprice'];
  364. $list[$key][$k]['ploss'] = $v['ploss'];
  365. $list[$key][$k]['time'] = $v['time'];
  366. $list[$key][$k]['kongyk'] = $v['kongyk'];
  367. }
  368. }
  369. }
  370. }else{
  371. $list = '';
  372. }
  373. if(!empty($list)){
  374. $arr[] = array();
  375. foreach($list as $key=>$vo){
  376. foreach($vo as $a=>$b){
  377. $arr_1['id'] = $b['id'];
  378. $arr_1['username'] = $b['username'];
  379. $arr_1['num'] = $b['num'];
  380. $arr_1['hybl'] = $b['hybl'];
  381. $arr_1['hyzd'] = $b['hyzd'];
  382. $arr_1['coinname'] = $b['coinname'];
  383. $arr_1['status'] = $b['status'];
  384. $arr_1['is_win'] = $b['is_win'];
  385. $arr_1['buytime'] = $b['buytime'];
  386. $arr_1['selltime'] = $b['selltime'];
  387. $arr_1['intselltime'] = $b['intselltime'];
  388. $arr_1['buyprice'] = $b['buyprice'];
  389. $arr_1['sellprice'] = $b['sellprice'];
  390. $arr_1['ploss'] = $b['ploss'];
  391. $arr_1['time'] = $b['time'];
  392. $arr_1['kongyk'] = $b['kongyk'];
  393. $arr[] = $arr_1;
  394. }
  395. }
  396. }
  397. $arr = array_filter($arr);
  398. $this->assign('list', $arr);
  399. $this->assign('page', $show);
  400. $this->display();
  401. }
  402. }
  403. ?>