From b5e49e850da409995898b349c4adebfeca7f05e4 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 19 Aug 2020 09:12:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=B8=B8=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=89=93=E6=AC=BE=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...regateFinanceStatementController.class.php | 6 +- .../AggregateRelationController.class.php | 745 ++++++++++++++++++ .../View/AggregateRelation/addRelation.html | 464 +++++++++++ .../Admin/View/AggregateRelation/edit.html | 302 +++++++ .../View/AggregateRelation/editRelation.html | 302 +++++++ .../Admin/View/AggregateRelation/index.html | 270 +++++++ .../Admin/View/AggregateRelation/lists.html | 388 +++++++++ .../Base/Tool/AggregateClient.class.php | 3 +- 8 files changed, 2478 insertions(+), 2 deletions(-) create mode 100644 Application/Admin/Controller/AggregateRelationController.class.php create mode 100644 Application/Admin/View/AggregateRelation/addRelation.html create mode 100644 Application/Admin/View/AggregateRelation/edit.html create mode 100644 Application/Admin/View/AggregateRelation/editRelation.html create mode 100644 Application/Admin/View/AggregateRelation/index.html create mode 100644 Application/Admin/View/AggregateRelation/lists.html diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index 3a71b06a4..e7307bb34 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -142,8 +142,12 @@ class AggregateFinanceStatementController extends ThinkController }else{ $this->error("参数错误"); } - $info = M("aggregate_statement","tab_")->field("statement_info,pay_money,ratio_money")->where("id={$id}")->find(); + $info = M("aggregate_statement","tab_")->field("statement_info,pay_money,ratio_money,channel_id")->where("id={$id}")->find(); + + $company_info = M("company_relation","tab_")->field("first_company_id,second_company_id,first_company_type")->where("first_company_id={$info['channel_id']} or second_company_id={$info['channel_id']}")->find(); + $statement_info = json_decode($info['statement_info'],true); + $this->assign('company_info',$company_info); $this->assign('data',$statement_info); $this->assign('data_count',["pay_money"=>$info['pay_money'],"ratio_money"=>$info['ratio_money']]); $this->assign('id',$id); diff --git a/Application/Admin/Controller/AggregateRelationController.class.php b/Application/Admin/Controller/AggregateRelationController.class.php new file mode 100644 index 000000000..4ece94f56 --- /dev/null +++ b/Application/Admin/Controller/AggregateRelationController.class.php @@ -0,0 +1,745 @@ +"管理员拒绝", + "-1"=>"市场部拒绝", + "0"=>"待审核", + "1"=>"市场部通过", + "2"=>"管理员通过" + ]; + public $CompanyType = [ + "0"=>"己方公司", + "3"=>"聚合下游渠道公司" + ]; + public $SettlementType=[ + "0"=>"无", + "1"=>"周结", + "2"=>"月结" + ]; + public $InvoiceType=[ + "0"=>"无", + "1"=>"专票", + "2"=>"普票" + ]; + public $IsPayment=[ + "1"=>"是", + "2"=>"否" + ]; + public $Collection=[ + "1"=>"甲方", + "2"=>"乙方" + ]; + public function _initialize() + { + $this->admininfo = $_SESSION['onethink_admin']['user_auth']; + $this->DBlogModel = M("company_relation_log","tab_"); + $this->DBModel = M("company_relation","tab_"); + parent::_initialize(); + } + //生效列表 + public function index() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + + //权限分配 + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + + $where['_string'] = '1 = 1'; + if(isset($params['company_type'])){ + $where['_string'] .= " AND (first_company_type='{$params['company_type']}' OR second_company_type='{$params['company_type']}')"; + } + if(isset($params['company_name'])){ + $where['_string'] .= " AND (first_company_name LIKE '%{$params['company_name']}%' OR second_company_name LIKE '%{$params['company_name']}%')"; + } + + if(isset($params['settlement_type'])){ + $where['settlement_type'] = $params['settlement_type']; + } + if(isset($params['invoice_type'])){ + $where['invoice_type'] = $params['invoice_type']; + } + if(isset($params['is_payment'])){ + $where['is_payment'] = $params['is_payment']; + } + + $dbres = $this->DBModel->where($where)->where("first_company_type = 3 or second_company_type = 3")->order("id desc");; + if(isset($params['export'])){ + $dbres = $dbres->select(); + }else{ + $dbres = $dbres->page($page, $row)->select(); + } + foreach($dbres as $k=>&$v){ + $v['settlement_type'] =$this->SettlementType[$v['settlement_type']]; + $v['first_company_type'] =$this->CompanyType[$v['first_company_type']]; + $v['second_company_type'] =$this->CompanyType[$v['second_company_type']]; + $v['invoice_type'] =$this->InvoiceType[$v['invoice_type']]; + $v['is_payment'] =$this->IsPayment[$v['is_payment']]; + $v['collection'] =$this->Collection[$v['collection']]; + $v['oplist'] = $this->listOpAuth($v); + } + + if(isset($_REQUEST['export'])){ + $GetData = $_GET; + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),"op_name"=>"导出",'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData)]); + data2csv($dbres,'公司绑定生效列表',array( + "first_company_name"=>"甲方公司类型", + "first_company_type"=>"甲方公司", + "second_company_name"=>"乙方公司", + "second_company_type"=>"乙方公司类型", + "settlement_type"=>"结算周期", + "invoice_type"=>"开票类型", + "invoice_content"=>"开票内容", + "is_payment"=>"打款流程", + "collection"=>"收款方" + )); + } + + $count = $this->DBModel->field("count(id) count")->where($where)->where("first_company_type = 3 or second_company_type = 3")->find()['count']; + $this->assign('data', $dbres); + $page = set_pagination($count, $row,$params); + if($page) { + $this->assign('_page', $page); + } + $this->assign('Status',$this->Status); + $this->assign('SettlementType',$this->SettlementType); + $this->assign('CompanyType',$this->CompanyType); + $this->assign('InvoiceType',$this->InvoiceType); + $this->assign('IsPayment',$this->IsPayment); + $this->assign('menubtn',$this->listMenuAuth()); + $this->display(); + } + //审核列表 + public function lists() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + //权限分配 + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + $where['_string'] = '1 = 1'; + if(isset($params['company_type'])){ + $where['_string'] .= " AND (first_company_type='{$params['company_type']}' OR second_company_type='{$params['company_type']}')"; + } + if(isset($params['company_name'])){ + $where['_string'] .= " AND (first_company_name LIKE '%{$params['company_name']}%' OR second_company_name LIKE '%{$params['company_name']}%')"; + } + + if(isset($params['settlement_type'])){ + $where['settlement_type'] = $params['settlement_type']; + } + if(isset($params['invoice_type'])){ + $where['invoice_type'] = $params['invoice_type']; + } + if(isset($params['is_payment'])){ + $where['is_payment'] = $params['is_payment']; + } + if(isset($params['status'])){ + $where['status'] = $params['status']; + } + + // $this->checkListOrCountAuthRestMap($where);//导出权限 + $dbres = $this->DBlogModel->where($where)->where("first_company_type = 3 or second_company_type = 3")->order("FIELD(status,0,1,-1,-2,2),id desc");; + if(isset($params['export'])){ + $dbres = $dbres->select(); + }else{ + $dbres = $dbres->page($page, $row)->select(); + } + foreach($dbres as $k=>&$v){ + $v['settlement_type'] =$this->SettlementType[$v['settlement_type']]; + $v['first_company_type'] =$this->CompanyType[$v['first_company_type']]; + $v['second_company_type'] =$this->CompanyType[$v['second_company_type']]; + $v['invoice_type'] =$this->InvoiceType[$v['invoice_type']]; + $v['is_payment'] =$this->IsPayment[$v['is_payment']]; + $v['collection'] =$this->Collection[$v['collection']]; + $v['verify_log'] = json_decode($v['verify_log'], true); + if (isset($params['export'])) { + $symbol = "\n"; + } else { + $symbol = "
"; + } + + $v["create"]= "{$v['verify_log']['create_user']} {$symbol} {$v['verify_log']['create_time']}"; + if(isset($v['verify_log']['market_user'])){ + if($v['status'] == -1){ + $ts = "审核拒绝"; + }else{ + $ts = "审核通过"; + } + $v["market"]= "{$ts}({$v['verify_log']['market_user']}) {$symbol} {$v['verify_log']['market_time']}"; + }else{ + $v["market"] = '--'; + } + + if(isset($v['verify_log']['admin_user'])){ + if($v['status'] == -2){ + $ts = "审核拒绝"; + }else{ + $ts = "审核通过"; + } + $v["admin"]= "{$ts}({$v['verify_log']['admin_user']}) {$symbol} {$v['verify_log']['admin_time']}"; + }else{ + $v["admin"] = '--'; + } + $v['oplist'] = $this->OpAuth($v); + + } + + if(isset($_REQUEST['export'])){ + $GetData = $_GET; + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),"op_name"=>"导出",'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData)]); + data2csv($dbres,'公司绑定审核列表',array( + "first_company_name"=>"甲方公司类型", + "first_company_type"=>"甲方公司", + "second_company_name"=>"乙方公司", + "second_company_type"=>"乙方公司类型", + "settlement_type"=>"结算周期", + "invoice_type"=>"开票类型", + "invoice_content"=>"开票内容", + "is_payment"=>"打款流程", + "collection"=>"收款方", + "create"=>"创建记录", + "market"=>"市场部审批", + "admin"=>"管理员审批", + "remark"=>"备注" + )); + } + + $count = $this->DBlogModel->field("count(id) count")->where($where)->where("first_company_type = 3 or second_company_type = 3")->find()['count']; + $this->assign('data', $dbres); + $page = set_pagination($count, $row,$params); + if($page) { + $this->assign('_page', $page); + } + $this->assign('Status',$this->Status); + $this->assign('SettlementType',$this->SettlementType); + $this->assign('CompanyType',$this->CompanyType); + $this->assign('InvoiceType',$this->InvoiceType); + $this->assign('IsPayment',$this->IsPayment); + $this->assign('menubtn',$this->menuAuth()); + $this->display(); + } + + public function marketAgree(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = $this->DBlogModel->field("id,status,verify_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['status'] != 0) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['market_user']=$this->admininfo["username"]; + $v['verify_log']['market_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['status']=1; + $this->DBlogModel->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"市场部审核通过成功" + )); + } + public function marketRefuse(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = $this->DBlogModel->field("id,status,verify_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['status'] != 0) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['market_user']=$this->admininfo["username"]; + $v['verify_log']['market_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['status']=-1; + $this->DBlogModel->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"市场部审核拒绝成功" + )); + } + public function adminRefuse(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = $this->DBlogModel->field("id,status,verify_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['status'] != 1) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['admin_user']=$this->admininfo["username"]; + $v['verify_log']['admin_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['status']=-2; + $this->DBlogModel->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"管理员审核拒绝成功" + )); + } + //管理员成功 + public function adminAgree(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = $this->DBlogModel->field("*")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['status'] != 1) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['admin_user']=$this->admininfo["username"]; + $v['verify_log']['admin_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['status']=2; + $this->DBlogModel->save($v); + $id = $v['id']; + //保存到其他表 + //查找是否存在 + unset($v['id']); + unset($v['remark']); + unset($v['status']); + unset($v['verify_log']); + //判断公司id及类型 + if($v['first_company_type'] == 0){ + $t_company_id = $v['second_company_id']; + $t_company_type = $v['second_company_type']; + }else{ + $t_company_id = $v['first_company_id']; + $t_company_type = $v['first_company_type']; + } + $where = " + (first_company_type ='{$t_company_type}' and first_company_id = '{$t_company_id}') + OR + (second_company_type ='{$t_company_type}' and second_company_id = '{$t_company_id}') + "; + $hasdb = $this->DBModel->where($where)->find(); + if(isset($hasdb['id'])){ + $v['id'] = $hasdb['id']; + $this->DBModel->save($v); + }else{ + $this->DBModel->add($v); + } + addOperationLog(['op_type'=>1,'key'=>$id,"op_name"=>"管理员审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"管理员审核通过成功" + )); + } + + public function addRelation() + { + if ($_POST) { + $params = I('post.'); + if ($params['first_company_type'] == $params['second_company_type']) { + $this->error('合作甲乙双方不能是同类型公司'); + } + if ($params['first_company_type']!=0 && $params['second_company_type']!=0) { + $this->error('合作甲乙双方必须有个是己方公司'); + } + $params['remark'] = $params['remark'] ?? ''; + $params['status'] = 0; + + $verify_log = [ + "create_user"=>$this->admininfo["username"], + "create_time"=>date("Y-m-d H:i:s") + ]; + if($params['first_company_type'] == 1 || $params['second_company_type'] == 1){ + //上游公司 + $verify_log['market_user']= "AUTO"; + $verify_log['market_time']= date("Y-m-d H:i:s"); + $params['status'] = 1; + } + + $params['verify_log']=json_encode($verify_log); + //判断哪方是非官方 + if($params['first_company_type'] > 0){ + $where = " + (first_company_type ='{$params['first_company_type']}' and first_company_id = '{$params['first_company_id']}') + OR + (second_company_type ='{$params['first_company_type']}' and second_company_id = '{$params['first_company_id']}') + "; + }else{ + $where = " + (first_company_type ='{$params['second_company_type']}' and first_company_id = '{$params['second_company_id']}') + OR + (second_company_type ='{$params['second_company_type']}' and second_company_id = '{$params['second_company_id']}') + "; + } + $r_res = $this->DBModel->where($where)->find(); + if(!empty($r_res)){ + $this->error('当前合作方已有绑定关系'); + } + + $hasdb = $this->DBlogModel->where($where)->find(); + if(!empty($hasdb)){ + //覆盖 + $params['id'] = $hasdb['id']; + $this->DBlogModel->save($params); + $id = $hasdb['id']; + }else{ + //新增 + $id = $this->DBlogModel->add($params); + } + addOperationLog(['op_type'=>0,'key'=>$id,'op_name'=>'新增','url'=>U('index')]); + $this->ajaxReturn(["msg"=>"添加成功,请联系管理员尽快审核","code"=>1,"url"=>U("index")]); + + } else { + $this->assign('defaultCompanyTypeA', self::COMPANY_TYPE_DEFAULT_A); + $this->assign('defaultCompanyTypeB', self::COMPANY_TYPE_DEFAULT_B); + $this->assign('companyType', $this->CompanyType); + $this->display(); + } + } + // public function editRelation() + // { + // if ($_POST) { + // $p= I('post.'); + // if(!isset($p['id'])){ + // $this->error('参数错误'); + // } + // //查询 + // $y = $this->DBlogModel->where("id='{$p['id']}'")->find(); + // $p['remark'] = $p['remark'] ?? ''; + // if($y['settlement_type'] != $p['settlement_type'] || $y['invoice_type'] != $p['invoice_type'] || $y['invoice_content'] != $p['invoice_content'] || $y['is_payment'] != $p['is_payment'] || $y['collection'] != $p['collection']){ + // $p['status'] = 0; + // $p['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]); + // } + // $this->DBlogModel->save($p); + // addOperationLog(['op_type'=>1,'key'=>$p['id'],'op_name'=>'修改','url'=>U('lists')]); + // $this->ajaxReturn(["msg"=>"修改成功","code"=>1,"url"=>U("lists")]); + // } else { + // $params = I('get.'); + // $id = $params['id'] ?? 0; + // $id = intval($id); + // $map['id'] = $id; + // $dbres = $this->DBlogModel->where($map)->find(); + // $this->assign('first_company_info',$this->getCompanyInfo($dbres['first_company_type'],$dbres['first_company_id'])); + // $this->assign('second_company_info',$this->getCompanyInfo($dbres['second_company_type'],$dbres['second_company_id'])); + + // $dbres['first_company_type'] =$this->CompanyType[$dbres['first_company_type']]; + // $dbres['second_company_type'] =$this->CompanyType[$dbres['second_company_type']]; + + // $this->assign('data', $dbres); + // $this->display(); + // } + // } + public function edit() + { + if ($_POST) { + $p= I('post.'); + if(!isset($p['id'])){ + $this->error('参数错误'); + } + + //查询 + $y = $this->DBModel->where("id='{$p['id']}'")->find(); + if($y['settlement_type'] != $p['settlement_type'] || $y['invoice_type'] != $p['invoice_type'] || $y['invoice_content'] != $p['invoice_content'] || $y['is_payment'] != $p['is_payment'] || $y['collection'] != $p['collection']){ + //修改了进行审核 + $p['status'] = 0; + $verify_log = [ + "create_user"=>$this->admininfo["username"], + "create_time"=>date("Y-m-d H:i:s") + ]; + if($y['first_company_type'] == 1 || $y['second_company_type'] == 1){ + //上游公司 + $verify_log['market_user']= "AUTO"; + $verify_log['market_time']= date("Y-m-d H:i:s"); + $p['status'] = 1; + } + $p['verify_log'] = json_encode($verify_log); + //其他信息 + $p['first_company_id'] = $y['first_company_id']; + $p['first_company_name'] = $y['first_company_name']; + $p['first_company_type'] = $y['first_company_type']; + $p['second_company_id'] = $y['second_company_id']; + $p['second_company_name'] = $y['second_company_name']; + $p['second_company_type'] = $y['second_company_type']; + } + if($p['first_company_type'] > 0){ + $where = " + (first_company_type ='{$p['first_company_type']}' and first_company_id = '{$p['first_company_id']}') + OR + (second_company_type ='{$p['first_company_type']}' and second_company_id = '{$p['first_company_id']}') + "; + }else{ + $where = " + (first_company_type ='{$p['second_company_type']}' and first_company_id = '{$p['second_company_id']}') + OR + (second_company_type ='{$p['second_company_type']}' and second_company_id = '{$p['second_company_id']}') + "; + } + $hasdb = $this->DBlogModel->where($where)->find(); + if(!empty($hasdb)){ + //覆盖 + $p['id'] = $hasdb['id']; + $this->DBlogModel->save($p); + $id = $hasdb['id']; + }else{ + //新增 + $id = $this->DBlogModel->add($p); + } + addOperationLog(['op_type'=>1,'key'=>$p['id'],'op_name'=>'修改','url'=>U('index')]); + $this->ajaxReturn(["msg"=>"修改成功,请联系管理员尽快审核","code"=>1,"url"=>U("index")]); + + } else { + $params = I('get.'); + $id = $params['id'] ?? 0; + $id = intval($id); + $map['id'] = $id; + $dbres = $this->DBModel->where($map)->find(); + $this->assign('first_company_info',$this->getCompanyInfo($dbres['first_company_type'],$dbres['first_company_id'])); + $this->assign('second_company_info',$this->getCompanyInfo($dbres['second_company_type'],$dbres['second_company_id'])); + + $dbres['first_company_type'] =$this->CompanyType[$dbres['first_company_type']]; + $dbres['second_company_type'] =$this->CompanyType[$dbres['second_company_type']]; + + $this->assign('data', $dbres); + $this->display(); + } + } + + public function del() + { + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $res = $this->DBModel->where("id='{$id}'")->delete(); + if($res !== false){ + addOperationLog(['op_type'=>2,'key'=>$id,'op_name'=>'删除','url'=>U('index')]); + $this->ajaxReturn(["msg"=>"删除成功","code"=>1,"url"=>U("index")]); + }else{ + $this->error('删除错误'); + } + } + + public function delRelation() + { + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $res = $this->DBlogModel->where("id='{$id}'")->delete(); + if($res !== false){ + addOperationLog(['op_type'=>2,'key'=>$id,'op_name'=>'删除','url'=>U('lists')]); + $this->ajaxReturn(["msg"=>"删除成功","code"=>1,"url"=>U("lists")]); + }else{ + $this->error('删除错误'); + } + } + + public function getAggegateCompanyList($b = '') { + + $client = new AggregateClient(); + + $result = $client->api('aggregate-companylist', ['id'=>$b]); + + $this->aggregateCompanyList = $result['data']; + + } + + public function getCompanyList($type) + { + if($type ==''){ + $this->success([],'',true); + } + $companyInfo = []; + if($type == 0){ + //己方公司 + $companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone")->where("status='1'")->select(); + } + $b = $this->getBindCompanyId($type); + + if($type == 3){ + //获取聚合下游公司 + $this->getAggegateCompanyList($b); + //聚合下游 + $companyInfo = $this->aggregateCompanyList; + } + foreach($companyInfo as $k=>&$v){ + if(isset($v['company_belong'])){ + $v['company_belong'] = getCompanyBlong($v['company_belong']); + } + if(isset($v['company_type'])){ + $v['company_type'] = ($v['company_type'] == 1 ?"公司" :'个人'); + } + if(isset($v['link_phone']) && $v['link_phone']==0){ + $v['link_phone'] = ''; + } + } + $this->success($companyInfo,'',true); + } + public function getCompanyInfo($type,$id) + { + $companyInfo = []; + if($type == 0){ + //己方公司 + $companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone")->where("status='1' AND id='{$id}'")->find(); + } + if($type == 1){ + //上游 + $companyInfo = M("Partner","tab_")->field("id,partner company_name,company_type,link_man,link_phone")->where("status='1' AND id='{$id}'")->find(); + } + if($type == 2){ + //下游游 + $companyInfo = M("PromoteCompany","tab_")->field("id,company_belong,company_name,company_type,settlement_contact link_man,contact_phone link_phone")->where("status='1' AND id='{$id}'")->find(); + } + if(isset($companyInfo['company_belong'])){ + $companyInfo['company_belong'] = getCompanyBlong($companyInfo['company_belong']); + } + if(isset($companyInfo['company_type'])){ + $companyInfo['company_type'] = ($companyInfo['company_type'] == 1 ? "公司" :'个人'); + } + if(isset($companyInfo['link_phone']) && $companyInfo['link_phone']==0){ + $companyInfo['link_phone'] = ''; + } + return $companyInfo; + } + /** + * 获取已绑定公司id + * @param [type] $type 1 上游 /2下游 + * @return void + */ + protected function getBindCompanyId($type){ + $dbres = M("CompanyRelation","tab_")->where("first_company_type = {$type} OR second_company_type = {$type}")->field("first_company_id,second_company_id")->select(); + if(empty($dbres)){ + return false; + }else{ + $sendid = []; + foreach ($dbres as $k => $v) { + if($v['first_company_type'] == $type){ + $sendid[] = $v['first_company_id']; + }else{ + $sendid[] = $v['second_company_id']; + } + } + return implode(",",$sendid); + } + } + + protected function listMenuAuth(){ + $addurl = U("addRelation"); + $mentBtn = [ + "addRelation"=>"新增公司绑定" + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } + protected function listOpAuth($info){ + $id = $info['id']; + //原始列表 + $opBtn = [ + "edit"=>"编辑", + "del"=>"删除", + ]; + //操作对应菜单 + $optist = ["edit","del"]; + $resarr = []; + foreach ($optist as $k => $v) { + if(IS_ROOT){ + $resarr[] = $opBtn[$v]; + }else{ + if(in_array($v,$this->OpAuthList)){ + $resarr[] = $opBtn[$v]; + } + } + } + return $resarr; + } + + protected function menuAuth() + { + + $mentBtn = [ + "marketAgree"=>"市场部审批通过", + "marketRefuse"=>"市场部审核拒绝", + "adminAgree"=>"管理员审核通过", + "adminRefuse"=>"管理员审核拒绝" + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } + protected function OpAuth($info) + { + $id = $info['id']; + //原始列表 + $opBtn = [ + "editRelation"=>"编辑", + "delRelation"=>"删除", + ]; + //操作对应菜单 + + if($info['status'] == 2){ + $optist = []; + }else{ + $optist = ["delRelation"]; + } + // + $resarr = []; + foreach ($optist as $k => $v) { + if(IS_ROOT){ + $resarr[] = $opBtn[$v]; + }else{ + if(in_array($v,$this->OpAuthList)){ + $resarr[] = $opBtn[$v]; + } + } + } + return $resarr; + } + + protected function error($data) + { + header('Content-Type:application/json; charset=utf-8'); + $data =json_encode(['msg'=>$data,"code"=>4000],JSON_UNESCAPED_UNICODE); + exit($data); + } + + +} \ No newline at end of file diff --git a/Application/Admin/View/AggregateRelation/addRelation.html b/Application/Admin/View/AggregateRelation/addRelation.html new file mode 100644 index 000000000..4326e1ee2 --- /dev/null +++ b/Application/Admin/View/AggregateRelation/addRelation.html @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + +
*甲方公司类型: + + +
*甲方公司: + +
+
+ +
+ + + + + + + + + + + + + + + + + + +
*乙方公司类型: + + +
*乙方公司: + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
*结算周期: + + +
*开票类型: + + +
开票内容: + +
*收款方: + + +
备注: + + +
+
+
+ + + 返回 + +
+
+
+
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + diff --git a/Application/Admin/View/AggregateRelation/edit.html b/Application/Admin/View/AggregateRelation/edit.html new file mode 100644 index 000000000..e12db552e --- /dev/null +++ b/Application/Admin/View/AggregateRelation/edit.html @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+ + + + + + + + + + + + + + + +
甲方公司类型: + {$data.first_company_type} +
甲方公司: + {$data.first_company_name} +
+
+ +
+ + + + + + + + + + + + + + + +
乙方公司类型: + {$data.second_company_type} +
乙方公司: + {$data.second_company_name} +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*结算周期: + + +
*开票类型: + + +
开票内容: + +
是否有打款流程: + + + + + 选择否将不能进行线上打款 +
*收款方: + + +
备注: + + +
+
+ +
+ + + 返回 + +
+
+
+
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + diff --git a/Application/Admin/View/AggregateRelation/editRelation.html b/Application/Admin/View/AggregateRelation/editRelation.html new file mode 100644 index 000000000..b19c13115 --- /dev/null +++ b/Application/Admin/View/AggregateRelation/editRelation.html @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+ + + + + + + + + + + + + + + +
甲方公司类型: + {$data.first_company_type} +
甲方公司: + {$data.first_company_name} +
+
+ +
+ + + + + + + + + + + + + + + +
乙方公司类型: + {$data.second_company_type} +
乙方公司: + {$data.second_company_name} +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*结算周期: + + +
*开票类型: + + +
开票内容: + +
是否有打款流程: + + + + + 选择否将不能进行线上打款 +
*收款方: + + +
备注: + + +
+
+ +
+ + + 返回 + +
+
+
+
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + diff --git a/Application/Admin/View/AggregateRelation/index.html b/Application/Admin/View/AggregateRelation/index.html new file mode 100644 index 000000000..e8d2b277c --- /dev/null +++ b/Application/Admin/View/AggregateRelation/index.html @@ -0,0 +1,270 @@ + + + + + + + + + + + + + +
+ + +
+
+ +
+ +
+ +
+ +
+   +
+ + + +
+ +
+
+ +
+
+ 搜索 +
+
+ +
+
+
+ + {$vo} + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
甲方公司甲方公司类型乙方公司乙方公司类型结算周期开票类型开票内容收款方操作
aOh! 暂时还没有内容!
{$data.first_company_name}{$data.first_company_type}{$data.second_company_name}{$data.second_company_type}{$data.settlement_type}{$data.invoice_type}{$data.invoice_content}{$data.collection} + + {$vo} + +
+
+ +
+ +
+ 导出 + {$_page|default=''} +
+ +
+ + + + + + diff --git a/Application/Admin/View/AggregateRelation/lists.html b/Application/Admin/View/AggregateRelation/lists.html new file mode 100644 index 000000000..1aef9b512 --- /dev/null +++ b/Application/Admin/View/AggregateRelation/lists.html @@ -0,0 +1,388 @@ + + + + + + + + + + + + + +
+ + + +
+
+ +
+ +
+ +
+
+   +
+ + + +
+ +
+
+ +
+ +
+ +
+ +
+ 搜索 +
+
+ +
+
+
+ + {$vo} + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 甲方公司甲方公司类型乙方公司乙方公司类型结算周期开票类型开票内容收款方创建记录市场部审批管理员审批备注操作
aOh! 暂时还没有内容!
+ + {$data.first_company_name}{$data.first_company_type}{$data.second_company_name}{$data.second_company_type}{$data.settlement_type}{$data.invoice_type}{$data.invoice_content}{$data.collection} +
+ {$data.create} +
+
+ +
+ {$data.market} +
+ +
+ {$data.market} +
+
+
+ +
+ {$data.admin} +
+ +
+ {$data.admin} +
+
+
+ {$data.remark} + + + {$vo} + +
+
+ +
+ +
+ {$_page|default=''} +
+ +
+ + + + + + diff --git a/Application/Base/Tool/AggregateClient.class.php b/Application/Base/Tool/AggregateClient.class.php index 278dd9b33..b9208f39d 100644 --- a/Application/Base/Tool/AggregateClient.class.php +++ b/Application/Base/Tool/AggregateClient.class.php @@ -13,7 +13,8 @@ class AggregateClient private $apis = [ 'game-data' => '/index.php?g=api&m=Game&a=rechargeData', - 'aggregate-gamename' => '/index.php?g=api&m=Game&a=getAggregatePacket' + 'aggregate-gamename' => '/index.php?g=api&m=Game&a=getAggregatePacket', + 'aggregate-companylist' => '/index.php?g=api&m=Game&a=getAggregateCompanyList' ]; public function __construct()