123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <?php
- namespace Admin\Controller;
- class FinanceController extends AdminController
- {
- protected function _initialize(){
- parent::_initialize();
- $allow_action=array("index","myzr","myzc","adopttb","reject","adoptzr","rejectzr","taxlist","adopttax","rejecttax");
- if(!in_array(ACTION_NAME,$allow_action)){
- $this->error("页面不存在!");
- }
- }
-
- //驳回税金缴纳
- public function rejecttax($id = null){
- if($id <= 0){
- $this->error("缺少重要参数");exit();
- }
- $info = M("recharge")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->error("充币订单不存在");exit();
- }
- if($info['status'] != 1){
- $this->error("此订单已处理");exit();
- }
- //修改订单状态
- $save['updatetime'] = date("Y-m-d H:i:s",time());
- $save['status'] = 3;
- $upre = M("taxlist")->where(array('id'=>$id))->save($save);
- if($upre){
- $data['uid'] = $info['uid'];
- $data['account'] = $info['username'];
- $data['title'] = L('税金审核');
- $data['content'] = L('缴纳税金审核被驳回,请联系客服');
- $data['addtime'] = date("Y-m-d H:i:s",time());
- $data['status'] = 1;
- M("taxlist")->add($data);
- $this->success("税金审核驳回成功");
- }else{
- $this->error("税金审核驳回失败");
- }
- }
-
- //确认税金
- public function adopttax($id = null){
- if($id <= 0){
- $this->error("缺少重要参数");exit();
- }
- $info = M("taxlist")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->error("记录不存在");exit();
- }
- if($info['status'] != 1){
- $this->error("记录已处理");exit();
- }
- $uid = $info['uid'];
-
- $save['updatetime'] = date("Y-m-d H:i:s",time());
- $save['status'] = 2;
- $upre = M("taxlist")->where(array('id'=>$id))->save($save);
-
- if($upre){
- $notice['uid'] = $info['uid'];
- $notice['account'] = $info['username'];
- $notice['title'] = L('税金审核');
- $notice['content'] = L('缴纳税金审核成功');
- $notice['addtime'] = date("Y-m-d H:i:s",time());
- $notice['status'] = 1;
- M("notice")->add($notice);
- M("user")->where(array('id'=>$uid))->save(array('taxstatus'=>1));
- $this->success("操作成功");
- }else{
- $this->error("操作失败");
- }
- }
-
- //税金列表
- public function taxlist($name=null){
- if($name != ''){
- $where['username'] = $name;
- }
- $count = M('taxlist')->where($where)->count();
- $Page = new \Think\Page($count, 15);
- $show = $Page->show();
- $list = M('taxlist')->where($where)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
- $this->assign('list', $list);
- $this->assign('page', $show);
- $this->display();
- }
-
- //驳回充币
- public function rejectzr($id = null){
- if($id <= 0){
- $this->error("缺少重要参数");exit();
- }
- $info = M("recharge")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->error("充币订单不存在");exit();
- }
- if($info['status'] != 1){
- $this->error("此订单已处理");exit();
- }
- //修改订单状态
- $save['updatetime'] = date("Y-m-d H:i:s",time());
- $save['status'] = 3;
- $upre = M("recharge")->where(array('id'=>$id))->save($save);
- if($upre){
-
- $data['uid'] = $info['uid'];
- $data['account'] = $info['username'];
- $data['title'] = L('充币审核');
- $data['content'] = L('您的充币记录被系统驳回,请联系客服');
- $data['addtime'] = date("Y-m-d H:i:s",time());
- $data['status'] = 1;
- M("notice")->add($data);
-
- $this->success("充值驳回成功");
- }else{
- $this->error("驳回失败");
- }
- }
-
- //确认充币
- public function adoptzr($id = null){
- if($id <= 0){
- $this->error("缺少重要参数");exit();
- }
- $info = M("recharge")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->error("充币订单不存在");exit();
- }
- if($info['status'] != 1){
- $this->error("此订单已处理");exit();
- }
- $uid = $info['uid'];
- $num = $info['num'];
- if ($info['coin'] == 'TRC20-USDT' || $info['coin'] == 'ERC20-USDT'){
- $info['coin'] = 'USDT';
- }
- $coinname = strtolower(trim($info['coin']));
- $minfo = M("user_coin")->where(array('userid'=>$uid))->find();
- //修改订单状态
- $save['updatetime'] = date("Y-m-d H:i:s",time());
- $save['status'] = 2;
- $upre = M("recharge")->where(array('id'=>$id))->save($save);
- //增加会员资产
- $incre = M("user_coin")->where(array('userid'=>$uid))->setInc($coinname,$num);
- //增加充值日志
- $data['uid'] = $info['uid'];
- $data['username'] = $info['username'];
- $data['num'] = $num;
- $data['coinname'] = $coinname;
- $data['afternum'] = $minfo[$coinname] + $num;
- $data['type'] = 17;
- $data['addtime'] = date("Y-m-d H:i:s",time());
- $data['st'] = 1;
- $data['remark'] = L('充幣到賬');
- $addre = M("bill")->add($data);
- if($upre && $incre && $addre){
- $notice['uid'] = $info['uid'];
- $notice['account'] = $info['username'];
- $notice['title'] = L('充币审核');
- $notice['content'] = L('您的充值金额已到账,请注意查收');
- $notice['addtime'] = date("Y-m-d H:i:s",time());
- $notice['status'] = 1;
- M("notice")->add($notice);
-
- $this->success("处理成功");
- }else{
- $this->error("处理失败");
- }
- }
-
-
- //驳回提币记录
- public function reject($id = null){
- if($id <= 0){
- $this->error("缺少重要参数");exit();
- }
- $info = M("myzc")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->error("提币订单不存在");exit();
- }
- if($info['status'] != 1){
- $this->error("此订单已处理");exit();
- }
-
- $uid = $info['userid'];
- $num = $info['num'];
- $coinname = strtolower(trim($info['coinname']));
- //修改记录状态
- $save['endtime'] = date("Y-m-d H:i:s",time());
- $save['status'] = 3;
- $upre = M("myzc")->where(array('id'=>$id))->save($save);
- //把提币的数量返回给账号户,并写入日志
- $minfo = M("user_coin")->where(array('userid'=>$uid))->find();
- $incre = M("user_coin")->where(array('userid'=>$uid))->setInc($coinname,$num);
- $bill['uid'] = $uid;
- $bill['username'] = $info['username'];
- $bill['num'] =$num;
- $bill['coinname'] = $info['coinname'];
- $bill['afternum'] = $minfo[$coinname] + $num;
- $bill['type'] = 16;
- $bill['addtime'] = date("Y-m-d H:i:s",time());
- $bill['st'] = 1;
- $bill['remark'] = L('提币驳回,退回资金');;
- $billre = M("bill")->add($bill);
- if($upre && $incre && $billre){
-
- $notice['uid'] = $uid;
- $notice['account'] = $info['username'];
- $notice['title'] = L('提币审核');
- $notice['content'] = L('您的提币申请被驳回,请联系管理员');
- $notice['addtime'] = date("Y-m-d H:i:s",time());
- $notice['status'] = 1;
- M("notice")->add($notice);
-
- $this->success("操作成功");exit();
- }else{
- $this->error("操作失败");exit();
- }
-
- }
-
- //通过提币处理
- public function adopttb($id = null){
- if($id <= 0){
- $this->error("缺少重要参数");exit();
- }
- $info = M("myzc")->where(array('id'=>$id))->find();
- if(empty($info)){
- $this->error("提币订单不存在");exit();
- }
- if($info['status'] != 1){
- $this->error("此订单已处理");exit();
- }
- $save['endtime'] = date("Y-m-d H:i:s",time());
- $save['status'] = 2;
- $result = M("myzc")->where(array('id'=>$id))->save($save);
- if($result){
-
- $notice['uid'] = $info['userid'];
- $notice['account'] = $info['username'];
- $notice['title'] = L('提币审核');
- $notice['content'] = L('您的提币申请已通过,请及时查询');
- $notice['addtime'] = date("Y-m-d H:i:s",time());
- $notice['status'] = 1;
- M("notice")->add($notice);
-
- $this->success('处理成功!',U('Finance/myzc'));
- }else{
- $this->error("处理失败");exit();
- }
- }
-
- //账务明细
- public function index($name=null){
- if($name != ''){
- $where['username'] = $name;
- }
- $count = M('bill')->where($where)->count();
- $Page = new \Think\Page($count, 15);
- $show = $Page->show();
- $list = M('bill')->where($where)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
- $this->assign('list', $list);
- $this->assign('page', $show);
- $this->display();
- }
-
- //充币列表
- public function myzr($name=null){
- if($name != ''){
- $where['username'] = $name;
- }
- $count = M('recharge')->where($where)->count();
- $Page = new \Think\Page($count, 15);
- $show = $Page->show();
- $list = M('recharge')->where($where)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
- $this->assign('list', $list);
- $this->assign('page', $show);
- $this->display();
- }
-
- //提币列表
- public function myzc($name=null){
- if($name != ''){
- $where['username'] = $name;
- }
- $count = M('myzc')->where($where)->count();
- $Page = new \Think\Page($count, 15);
- $show = $Page->show();
- $list = M('myzc')->where($where)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
- $this->assign('list', $list);
- $this->assign('page', $show);
-
- $this->display();
- }
- }
- ?>
|