<?php
/**
 * Created by PhpStorm.
 * User: chouchou
 * Date: 2019-6-10
 * Time: 19:33
 */

namespace app\admin\controller;

use think\Controller;
use think\Request;
class Stationview extends  Base
{      
     //业务线列表
     public function selectBusinessList(){
      $url=config('database.geturl')."v1/business_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('business');
       }
     }
     //添加业务线
     public function addBusiness(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/business_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加业务线成功');
          }else{
             return  jsonErr('添加业务线失败');
          }
      }else{
           return $this->fetch('businessadd');
      }
     }
     //修改业务线
     public function editBusiness(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/business_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改业务线成功');
          }else{
             return  jsonErr('修改业务线失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取业务线单条数据信息
    public function getEditBusiness($id){
          $url=config('database.geturl')."v1/geteditbusiness";
          $data['business_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
          $this->assign('data',$result['data']);
          return $this->fetch('businessupd');
         }
     }
   //删除业务线
   public function delBusiness(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/business_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除业务线成功');
          }else{
             return  jsonErr('删除业务线失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }



         //需求类型列表
     public function demandtype_list(){
      $url=config('database.geturl')."v1/demandtype_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('demandtype_list');
       }
     }
     //添加需求类型
     public function demandtype_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/demandtype_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加需求类型成功');
          }else{
             return  jsonErr('添加需求类型失败');
          }
      }else{
           return $this->fetch('demandtype_add');
      }
     }
     //修改需求类型
     public function demandtype_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/demandtype_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改需求类型成功');
          }else{
             return  jsonErr('修改需求类型失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取需求类型单条数据信息
    public function geteditdemandtype($id){
          $url=config('database.geturl')."v1/geteditdemandtype";
          $data['demandtype_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('demandtype_edit');
           }
     }
   //删除需求类型
   public function demandtype_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/demandtype_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除需求类型成功');
          }else{
             return  jsonErr('删除需求类型失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }


        //频段列表
     public function frequencyband_list(){
      $url=config('database.geturl')."v1/frequencyband_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('frequencyband_list');
       }
     }
     //添加频段
     public function frequencyband_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/frequencyband_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加频段成功');
          }else{
             return  jsonErr('添加频段失败');
          }
      }else{
           return $this->fetch('frequencyband_add');
      }
     }
     //修改频段
     public function frequencyband_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/frequencyband_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改频段成功');
          }else{
             return  jsonErr('修改频段失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取频段单条数据信息
    public function geteditfrequencyband($id){
          $url=config('database.geturl')."v1/geteditfrequencyband";
          $data['frequencyband_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('frequencyband_edit');
           }
     }
   //删除频段
   public function frequencyband_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/frequencyband_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除频段成功');
          }else{
             return  jsonErr('删除频段失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }


         //区域列表
     public function region_list(){
      $url=config('database.geturl')."v1/region_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('region_list');
       }
     }
     //添加区域
     public function region_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/region_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加区域成功');
          }else{
             return  jsonErr('添加区域失败');
          }
      }else{
           return $this->fetch('region_add');
      }
     }
     //修改区域
     public function region_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/region_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改区域成功');
          }else{
             return  jsonErr('修改区域失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取区域单条数据信息
    public function geteditregion($id){
          $url=config('database.geturl')."v1/geteditregion";
          $data['id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('region_edit');
           }
     }
   //删除区域
   public function region_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/region_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除区域成功');
          }else{
             return  jsonErr('删除区域失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }


       //运营商列表
     public function operator_list(){
      $url=config('database.geturl')."v1/operator_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('operator_list');
       }
     }
     //添加运营商
     public function operator_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/operator_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加运营商成功');
          }else{
             return  jsonErr('添加运营商失败');
          }
      }else{
           return $this->fetch('operator_add');
      }
     }
     //修改运营商
     public function operator_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/operator_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改运营商成功');
          }else{
             return  jsonErr('修改运营商失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取运营商单条数据信息
    public function geteditoperator($id){
          $url=config('database.geturl')."v1/geteditoperator";
          $data['operator_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('operator_edit');
           }
     }
   //删除运营商
   public function operator_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/operator_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除运营商成功');
          }else{
             return  jsonErr('删除运营商失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }


         //基站状态列表
     public function baseStationStatus_list(){
      $url=config('database.geturl')."v1/baseStationStatus_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('basestatus_list');
       }
     }
     //添加基站状态
     public function baseStationStatus_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/baseStationStatus_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加基站状态成功');
          }else{
             return  jsonErr('添加基站状态失败');
          }
      }else{
           return $this->fetch('basestatus_add');
      }
     }
     //修改基站状态
     public function baseStationStatus_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/baseStationStatus_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改基站状态成功');
          }else{
             return  jsonErr('修改基站状态失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取基站状态单条数据信息
    public function geteditBaseStationStatus($id){
          $url=config('database.geturl')."v1/geteditBaseStationStatus";
          $data['cate_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('basestatus_edit');
           }
     }
   //删除基站状态
   public function baseStationStatus_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/baseStationStatus_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除基站状态成功');
          }else{
             return  jsonErr('删除基站状态失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }

           //需求来源列表
     public function demandSource_list(){
      $url=config('database.geturl')."v1/demandSource_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('demandsource_list');
       }
     }
     //添加需求来源
     public function demandSource_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/demandSource_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加需求来源成功');
          }else{
             return  jsonErr('添加需求来源失败');
          }
      }else{
           return $this->fetch('demandsource_add');
      }
     }
     //修改需求来源
     public function demandSource_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/demandSource_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改需需求来源成功');
          }else{
             return  jsonErr('修改需求来源失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取需求来源单条数据信息
    public function geteditdemandSource($id){
          $url=config('database.geturl')."v1/geteditdemandSource";
          $data['sources_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('demandsource_edit');
           }
     }
   //删除需求来源
   public function demandSource_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/demandSource_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除需求来源成功');
          }else{
             return  jsonErr('删除需求来源失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }



         //上游客户列表
     public function customers_list(){
      $url=config('database.geturl')."v1/upstreamCustomers_list";
      $data= curlGet($url);
      $result =json_decode($data,true);
      if($result['code']==200){
        $this->assign('data',$result['data']);
        return $this->fetch('upstreamcustomers_list');
       }
     }
     //添加上游客户
     public function customers_add(Request $request){
         if($request->isAjax()){
          $data=$request->post();
          $url=config('database.geturl')."v1/upstreamCustomers_add";
          $result=json_decode(httpPOST($url,$data),true);
          if($result['code']==200){
             return  jsonSuc('添加上游客户成功');
          }else{
             return  jsonErr('添加上游客户失败');
          }
      }else{
           return $this->fetch('upstreamcustomers_add');
      }
     }
     //修改上游客户
     public function customers_edit(Request $request){
         if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/upstreamCustomers_edit";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('修改上游客户成功');
          }else{
             return  jsonErr('修改上游客户失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
    //获取上游客户单条数据信息
    public function geteditcustomers($id){
          $url=config('database.geturl')."v1/getCustomers";
          $data['customers_id']=$id;
          $result=json_decode(httpPOST($url,$data),true);
           if($result['code']==200){
            $this->assign('data',$result['data']);
            return $this->fetch('upstreamcustomers_edit');
           }
     }
   //删除上游客户
   public function customers_del(Request $request){
      if($request->isAjax()){
             $data=$request->post();
             $url=config('database.geturl')."v1/upstreamCustomers_del";
             $result=json_decode(httpPOST($url,$data),true);
             if($result['code']==200){
             return  jsonSuc('删除上游客户成功');
          }else{
             return  jsonErr('删除上游客户失败');
          }
         }else{
           return jsonErr('非法提交');
         }
     }
}