error(L("非法操作")); } } //公告列表 public function gglist(){ $list = M("content")->where(array('status'=>1))->select(); $this->ajaxReturn(['code' => 1, 'data' => $list]); // $this->assign("list",$list); // $this->display(); } //公告详情 public function gginfo($id = null){ $info = M("content")->where(array('id'=>$id))->find(); $this->ajaxReturn(['code' => 1, 'data' => $info]); } //删除通知记录 public function delall(){ $uid = userid(); $list = M("notice")->where(array('uid'=>$uid))->select(); if(!empty($list)){ foreach($list as $k=>$v){ $id = $v['id']; $re = M("notice")->where(array('id'=>$id))->delete(); } $this->ajaxReturn(['code'=>1,'info'=> L("删除成功")]); }else{ $this->ajaxReturn(['code'=>0,'info'=> L("没有记录")]); } } //通知标记已读 public function readall(){ $uid = userid(); $list = M("notice")->where(array('uid'=>$uid,'status'=>1))->select(); if(!empty($list)){ foreach($list as $k=>$v){ $id = $v['id']; $re = M("notice")->where(array('id'=>$id))->save(array('status'=>2)); } $this->ajaxReturn(['code'=>1,'info'=> L("标注成功")]); }else{ $this->ajaxReturn(['code'=>0,'info'=> L("全部已读")]); } } //会员选项页面 public function uoption(){ $uid = userid(); $info = M("user")->where(array('id'=>$uid))->field("id,username,invit")->find(); $this->assign("info",$info); $count = M("notice")->where(array('uid'=>$uid,'status'=>1))->count(); $this->assign("count",$count); $this->display(); } //通知页面 public function notice(){ $uid = userid(); if($uid <= 0){ $this->redirect('Trade/tradelist'); } $list = M("notice")->where(array('uid'=>$uid))->order("id desc")->select(); $this->assign('list',$list); $this->display(); } //通知详情 public function noticeinfo($id){ $info = M("notice")->where(array('id'=>$id))->find(); M("notice")->where(array('id'=>$id))->save(array('status'=>2)); $this->assign('info',$info); $this->display(); } //修改密码 public function respwd(){ $this->display(); } //修改密码处理 public function sub_respwd($oldpwd,$newpwd){ // if($_POST){ if(checkstr($oldpwd) || checkstr($newpwd)){ $this->ajaxReturn(['code'=>0,'info'=>L('您输入的信息有误')]); } $uid = userid(); if($uid == ''){ $this->ajaxReturn(['code'=>0,'info'=>L('请先登陆')]); } $info = M("user")->where(array('id'=>$uid))->field("id,username,password")->find(); if(md5($oldpwd) != $info['password']){ $this->ajaxReturn(['code'=>0,'info'=>L('旧密码不正确')]); } $result = M("user")->where(array('id'=>$uid))->save(array('password'=>md5($newpwd),'stoptime'=>time())); if($result){ $this->ajaxReturn(['code'=>1,'info'=>L('密码修改成功')]); }else{ $this->ajaxReturn(['code'=>0,'info'=>L('密码修改失败')]); } // }else{ // $this->ajaxReturn(['code'=>0,'info'=>L('非法操作')]); // } } //推广页面 public function tgcode(){ header ( "Content-type: text/html; charset=utf-8" ); $uid = userid(); //三代会员统计 $count1_rz = M("user")->where("invit_1 = {$uid} and rzstatus = 2")->count(); if($count1_rz <= 0){ $count1_rz = 0; } $count1_nrz = M("user")->where("invit_1 = {$uid} and rzstatus != 2")->count(); if($count1_nrz <= 0){ $count1_nrz = 0; } $count2_rz = M("user")->where("invit_2 = {$uid} and rzstatus = 2")->count(); if($count2_rz <= 0){ $count2_rz = 0; } $count2_nrz = M("user")->where("invit_2 = {$uid} and rzstatus != 2")->count(); if($count2_nrz <= 0){ $count2_nrz = 0; } $count3_rz = M("user")->where("invit_3 = {$uid} and rzstatus = 2")->count(); if($count3_rz <= 0){ $count3_rz = 0; } $count3_nrz = M("user")->where("invit_3 = {$uid} and rzstatus != 2")->count(); if($count3_nrz <= 0){ $count3_nrz = 0; } $allcount_rz = $count1_rz + $count2_rz + $count3_rz; if($allcount_rz <= 0){ $allcount_rz = 0; } $allcount_nrz = $count1_nrz + $count2_nrz + $count3_nrz; if($allcount_nrz <= 0){ $allcount_nrz = 0; } $carr['one'] = $count1_rz; $carr['two'] = $count2_rz; $carr['three'] = $count3_rz; $carr['onen'] = $count1_nrz; $carr['twon'] = $count2_nrz; $carr['threen'] = $count3_nrz; $carr['allrz'] = $allcount_rz; $carr['allnrz'] = $allcount_nrz; $this->assign('carr',$carr); $uinfo = M("user")->where(array('id'=>$uid))->field("id,username,invit")->find(); $invit = $uinfo['invit']; $url = 'https://' . $_SERVER['HTTP_HOST'] . u('/Login/register', array('qr'=>$invit)); $drpath = './Public/Static/qrcode/'; $imgma = $invit . '.png'; $urel = './Public/Static/qrcode/' . $imgma; Vendor('phpqrcode.phpqrcode'); $object = new \QRcode(); $size = 3; $errorLevel = 16; $object->png($url, $drpath . '/' . $imgma, $errorLevel, $size); $object->scerweima1($url,$urel,$url); $this->assign('invit',$invit); $this->assign('url',$url); $clist = M("config")->where(array('id'=>1))->field("webtjimgs,tgtext")->find(); $this->assign('clist',$clist); $this->display(); } public function index() { $this->redirect('Trade/tradelist'); } public function history() { $instId = I('get.instId'); $bar = I('get.bar'); $limit = I('get.limit'); if (!$limit) $limit = 100; if (!$bar) $bar = '1m'; $after = I('get.after'); // $before = strtotime(I('get.before')); $url = 'https://aws.okx.com/api/v5/market/history-candles?instId='.$instId.'&bar='.$bar.'&limit='.$limit.'&after='.$after; $oy_list = do_request($url, []); if ($oy_list->code == 0){ $this->ajaxReturn(['code' => 1, 'data' => $oy_list->data]); }else{ $this->ajaxReturn(['code' => 0, 'info' => '网络请求错误']); } } public function deal() { $instId = I('get.instId'); $limit = I('get.limit'); if (!$limit) $limit = 100; $after = I('get.after'); // $before = strtotime(I('get.before')); $url = 'https://aws.okx.com/api/v5/market/history-trades?instId='.$instId.'&limit='.$limit.'&after='.$after; $oy_list = do_request($url, []); if ($oy_list->code == 0){ $this->ajaxReturn(['code' => 1, 'data' => $oy_list->data]); }else{ $this->ajaxReturn(['code' => 0, 'info' => '网络请求错误']); } } public function version() { $list = M('config')->where(['id' => 1])->find(); $data = [ 'app' => 'https://'.$_SERVER['HTTP_HOST'].$list['app'], 'version' => $list['version'], ]; $this->ajaxReturn(['code' => 1, 'data' => $data]); } }