123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <?php
- namespace Agent\Controller;
- class IndexController extends AgentController
- {
- //代理中心会员管理
- public function index($name=NULL){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
- $uid = session('agent_id');
- $where = "";
- if ($name != '') {
- $map_3 = "username like '%{$name}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
-
- $count = M('User')->where($map_3)->count();
- $Page = new \Think\Page($count, 15);
- $show = $Page->show();
- $list = M('User')->where($map_3)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
- foreach ($list as $k => $v) {
- $list[$k]['invit_1'] = M('User')->where(array('id' => $v['invit_1']))->getField('username');
- $list[$k]['invit_2'] = M('User')->where(array('id' => $v['invit_2']))->getField('username');
- $list[$k]['invit_3'] = M('User')->where(array('id' => $v['invit_3']))->getField('username');
- }
-
-
- $this->assign('list', $list);
- $this->assign('page', $show);
-
- $this->display();
- }
-
- //代理中心建仓订单
- public function tyjclist($username=NULL){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
- $uid = session('agent_id');
- if ($username != '') {
- $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
-
-
- $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
- if(!empty($ulist)){
- $list = array();
- foreach($ulist as $key=>$vo){
- $map['uid'] = $vo['id'];
- $map['status'] = 1;
- $orderlist = M("tyhyorder")->where($map)->select();
- if(!empty($orderlist)){
- foreach($orderlist as $k=>$v){
- $list[$key][$k]['id'] = $v['id'];
- $list[$key][$k]['username'] = $v['username'];
- $list[$key][$k]['num'] = $v['num'];
- $list[$key][$k]['hybl'] = $v['hybl'];
- $list[$key][$k]['hyzd'] = $v['hyzd'];
- $list[$key][$k]['coinname'] = $v['coinname'];
- $list[$key][$k]['status'] = $v['status'];
- $list[$key][$k]['is_win'] = $v['is_win'];
- $list[$key][$k]['buytime'] = $v['buytime'];
- $list[$key][$k]['selltime'] = $v['selltime'];
- $list[$key][$k]['intselltime'] = $v['intselltime'];
- $list[$key][$k]['buyprice'] = $v['buyprice'];
- $list[$key][$k]['sellprice'] = $v['sellprice'];
- $list[$key][$k]['ploss'] = $v['ploss'];
- $list[$key][$k]['time'] = $v['time'];
- $list[$key][$k]['kongyk'] = $v['kongyk'];
- }
- }
- }
- }else{
- $list = '';
- }
-
- if(!empty($list)){
- $arr[] = array();
- foreach($list as $key=>$vo){
- foreach($vo as $a=>$b){
- $arr_1['id'] = $b['id'];
- $arr_1['username'] = $b['username'];
- $arr_1['num'] = $b['num'];
- $arr_1['hybl'] = $b['hybl'];
- $arr_1['hyzd'] = $b['hyzd'];
- $arr_1['coinname'] = $b['coinname'];
- $arr_1['status'] = $b['status'];
- $arr_1['is_win'] = $b['is_win'];
- $arr_1['buytime'] = $b['buytime'];
- $arr_1['selltime'] = $b['selltime'];
- $arr_1['intselltime'] = $b['intselltime'];
- $arr_1['buyprice'] = $b['buyprice'];
- $arr_1['sellprice'] = $b['sellprice'];
- $arr_1['ploss'] = $b['ploss'];
- $arr_1['time'] = $b['time'];
- $arr_1['kongyk'] = $b['kongyk'];
- $arr[] = $arr_1;
- }
- }
- }
-
- $arr = array_filter($arr);
-
- $this->assign('list', $arr);
- $this->assign('page', $show);
-
-
- $this->display();
- }
-
- //代理中心建仓订单
- public function jclist($username=NULL){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
- $uid = session('agent_id');
- if ($username != '') {
- $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
-
-
- $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
- if(!empty($ulist)){
- $list = array();
- foreach($ulist as $key=>$vo){
- $map['uid'] = $vo['id'];
- $map['status'] = 1;
- $orderlist = M("hyorder")->where($map)->select();
- if(!empty($orderlist)){
- foreach($orderlist as $k=>$v){
- $list[$key][$k]['id'] = $v['id'];
- $list[$key][$k]['username'] = $v['username'];
- $list[$key][$k]['num'] = $v['num'];
- $list[$key][$k]['hybl'] = $v['hybl'];
- $list[$key][$k]['hyzd'] = $v['hyzd'];
- $list[$key][$k]['coinname'] = $v['coinname'];
- $list[$key][$k]['status'] = $v['status'];
- $list[$key][$k]['is_win'] = $v['is_win'];
- $list[$key][$k]['buytime'] = $v['buytime'];
- $list[$key][$k]['selltime'] = $v['selltime'];
- $list[$key][$k]['intselltime'] = $v['intselltime'];
- $list[$key][$k]['buyprice'] = $v['buyprice'];
- $list[$key][$k]['sellprice'] = $v['sellprice'];
- $list[$key][$k]['ploss'] = $v['ploss'];
- $list[$key][$k]['time'] = $v['time'];
- $list[$key][$k]['kongyk'] = $v['kongyk'];
- }
- }
- }
- }else{
- $list = '';
- }
-
- if(!empty($list)){
- $arr[] = array();
- foreach($list as $key=>$vo){
- foreach($vo as $a=>$b){
- $arr_1['id'] = $b['id'];
- $arr_1['username'] = $b['username'];
- $arr_1['num'] = $b['num'];
- $arr_1['hybl'] = $b['hybl'];
- $arr_1['hyzd'] = $b['hyzd'];
- $arr_1['coinname'] = $b['coinname'];
- $arr_1['status'] = $b['status'];
- $arr_1['is_win'] = $b['is_win'];
- $arr_1['buytime'] = $b['buytime'];
- $arr_1['selltime'] = $b['selltime'];
- $arr_1['intselltime'] = $b['intselltime'];
- $arr_1['buyprice'] = $b['buyprice'];
- $arr_1['sellprice'] = $b['sellprice'];
- $arr_1['ploss'] = $b['ploss'];
- $arr_1['time'] = $b['time'];
- $arr_1['kongyk'] = $b['kongyk'];
- $arr[] = $arr_1;
- }
- }
- }
-
- $arr = array_filter($arr);
-
- $this->assign('list', $arr);
- $this->assign('page', $show);
-
-
- $this->display();
- }
-
-
-
- //单控盈亏
- public function setwinloss(){
- if($_POST){
- $id = trim(I('post.id'));
- $kongyk = trim(I('post.kongyk'));
- $info = M("hyorder")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->ajaxReturn(['code'=>0,'info'=>"参少重要参数"]);
- }
-
- $result = M("hyorder")->where(array('id'=>$id))->save(array('kongyk'=>$kongyk));
- if($result){
- $this->ajaxReturn(['code'=>1,'info'=>"操作成功"]);
- }else{
- $this->ajaxReturn(['code'=>0,'info'=>"操作失败"]);
- }
- }else{
- $this->ajaxReturn(['code'=>0,'info'=>"网络错误"]);
- }
- }
-
- //代理中心充值记录
- public function czlist(){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
-
- $uid = session('agent_id');
-
- if ($username != '') {
- $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
- $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
- if(!empty($ulist)){
- $list = array();
- foreach($ulist as $k=>$v){
- $uid = $v['id'];
- $corder = M("recharge")->where(array('uid'=>$uid))->select();
- if(!empty($corder)){
- foreach($corder as $key=>$vo){
- $list[$key]['id'] = $vo['id'];
- $list[$key]['username'] = $vo['username'];
- $list[$key]['coin'] = $vo['coin'];
- $list[$key]['num'] = $vo['num'];
- $list[$key]['addtime'] = $vo['addtime'];
- $list[$key]['updatetime'] = $vo['updatetime'];
- $list[$key]['status'] = $vo['status'];
- $list[$key]['payimg'] = $vo['payimg'];
- }
- }
-
- }
- }
- $this->assign("list",$list);
- $this->display();
-
- }
-
- //代理中心提现记录
- public function txlist(){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
-
- $uid = session('agent_id');
-
- if ($username != '') {
- $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
- $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
- if(!empty($ulist)){
- $list = array();
- foreach($ulist as $k=>$v){
- $uid = $v['id'];
- $corder = M("myzc")->where(array('userid'=>$uid))->select();
- if(!empty($corder)){
- foreach($corder as $key=>$vo){
- $list[$key]['id'] = $vo['id'];
- $list[$key]['userid'] = $vo['userid'];
- $list[$key]['username'] = $vo['username'];
- $list[$key]['coinname'] = $vo['coinname'];
- $list[$key]['num'] = $vo['num'];
- $list[$key]['fee'] = $vo['fee'];
- $list[$key]['mum'] = $vo['mum'];
- $list[$key]['address'] = $vo['address'];
- $list[$key]['addtime'] = $vo['addtime'];
- $list[$key]['endtime'] = $vo['endtime'];
- $list[$key]['status'] = $vo['status'];
- }
- }
-
- }
- }
- $this->assign("list",$list);
- $this->display();
-
- }
-
-
- //代理中心平仓订单
- public function pclist($username=NULL){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
-
- $uid = session('agent_id');
- if ($username != '') {
- $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
-
-
- $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
- if(!empty($ulist)){
- $list = array();
- foreach($ulist as $key=>$vo){
- $uid = $vo['id'];
- $orderlist = M("hyorder")->where("uid = $uid and (status = 2 or status = 3)")->select();
- if(!empty($orderlist)){
- foreach($orderlist as $k=>$v){
- $list[$key][$k]['id'] = $v['id'];
- $list[$key][$k]['username'] = $v['username'];
- $list[$key][$k]['num'] = $v['num'];
- $list[$key][$k]['hybl'] = $v['hybl'];
- $list[$key][$k]['hyzd'] = $v['hyzd'];
- $list[$key][$k]['coinname'] = $v['coinname'];
- $list[$key][$k]['status'] = $v['status'];
- $list[$key][$k]['is_win'] = $v['is_win'];
- $list[$key][$k]['buytime'] = $v['buytime'];
- $list[$key][$k]['selltime'] = $v['selltime'];
- $list[$key][$k]['intselltime'] = $v['intselltime'];
- $list[$key][$k]['buyprice'] = $v['buyprice'];
- $list[$key][$k]['sellprice'] = $v['sellprice'];
- $list[$key][$k]['ploss'] = $v['ploss'];
- $list[$key][$k]['time'] = $v['time'];
- $list[$key][$k]['kongyk'] = $v['kongyk'];
- }
- }
- }
- }else{
- $list = '';
- }
-
- if(!empty($list)){
- $arr[] = array();
- foreach($list as $key=>$vo){
- foreach($vo as $a=>$b){
- $arr_1['id'] = $b['id'];
- $arr_1['username'] = $b['username'];
- $arr_1['num'] = $b['num'];
- $arr_1['hybl'] = $b['hybl'];
- $arr_1['hyzd'] = $b['hyzd'];
- $arr_1['coinname'] = $b['coinname'];
- $arr_1['status'] = $b['status'];
- $arr_1['is_win'] = $b['is_win'];
- $arr_1['buytime'] = $b['buytime'];
- $arr_1['selltime'] = $b['selltime'];
- $arr_1['intselltime'] = $b['intselltime'];
- $arr_1['buyprice'] = $b['buyprice'];
- $arr_1['sellprice'] = $b['sellprice'];
- $arr_1['ploss'] = $b['ploss'];
- $arr_1['time'] = $b['time'];
- $arr_1['kongyk'] = $b['kongyk'];
- $arr[] = $arr_1;
- }
- }
- }
-
- $arr = array_filter($arr);
-
-
-
-
-
- $this->assign('list', $arr);
- $this->assign('page', $show);
-
-
-
-
- $this->display();
- }
-
-
- //代理中心平仓订单
- public function typclist($username=NULL){
- if (!session('agent_id')) {
- $this->redirect('Agent/Login/index');
- }
-
- $uid = session('agent_id');
- if ($username != '') {
- $map_3 = "username like '%{$username}%' and (invit_1 = $uid or invit_2 = $uid or invit_3 = $uid)";
-
- }else{
- $map_3 = "invit_1 = $uid or invit_2 = $uid or invit_3 = $uid";
- }
-
-
- $ulist = M('User')->where($map_3)->order('id desc')->field('id')->select();
- if(!empty($ulist)){
- $list = array();
- foreach($ulist as $key=>$vo){
- $uid = $vo['id'];
- $orderlist = M("tyhyorder")->where("uid = $uid and (status = 2 or status = 3)")->select();
- if(!empty($orderlist)){
- foreach($orderlist as $k=>$v){
- $list[$key][$k]['id'] = $v['id'];
- $list[$key][$k]['username'] = $v['username'];
- $list[$key][$k]['num'] = $v['num'];
- $list[$key][$k]['hybl'] = $v['hybl'];
- $list[$key][$k]['hyzd'] = $v['hyzd'];
- $list[$key][$k]['coinname'] = $v['coinname'];
- $list[$key][$k]['status'] = $v['status'];
- $list[$key][$k]['is_win'] = $v['is_win'];
- $list[$key][$k]['buytime'] = $v['buytime'];
- $list[$key][$k]['selltime'] = $v['selltime'];
- $list[$key][$k]['intselltime'] = $v['intselltime'];
- $list[$key][$k]['buyprice'] = $v['buyprice'];
- $list[$key][$k]['sellprice'] = $v['sellprice'];
- $list[$key][$k]['ploss'] = $v['ploss'];
- $list[$key][$k]['time'] = $v['time'];
- $list[$key][$k]['kongyk'] = $v['kongyk'];
- }
- }
- }
- }else{
- $list = '';
- }
-
- if(!empty($list)){
- $arr[] = array();
- foreach($list as $key=>$vo){
- foreach($vo as $a=>$b){
- $arr_1['id'] = $b['id'];
- $arr_1['username'] = $b['username'];
- $arr_1['num'] = $b['num'];
- $arr_1['hybl'] = $b['hybl'];
- $arr_1['hyzd'] = $b['hyzd'];
- $arr_1['coinname'] = $b['coinname'];
- $arr_1['status'] = $b['status'];
- $arr_1['is_win'] = $b['is_win'];
- $arr_1['buytime'] = $b['buytime'];
- $arr_1['selltime'] = $b['selltime'];
- $arr_1['intselltime'] = $b['intselltime'];
- $arr_1['buyprice'] = $b['buyprice'];
- $arr_1['sellprice'] = $b['sellprice'];
- $arr_1['ploss'] = $b['ploss'];
- $arr_1['time'] = $b['time'];
- $arr_1['kongyk'] = $b['kongyk'];
- $arr[] = $arr_1;
- }
- }
- }
-
- $arr = array_filter($arr);
-
-
-
-
-
- $this->assign('list', $arr);
- $this->assign('page', $show);
-
-
-
-
- $this->display();
- }
-
-
- }
- ?>
|