You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.5 KiB
PHP

<?php
// 公司关系绑定
namespace Admin\Controller;
class CompanyRelationController extends AdminController
{
public $admininfo;
public $DBModel;
public $DBlogModel;
public $OpAuthList=[];
public $Status = [
"-2"=>"管理员拒绝",
"-1"=>"市场部拒绝",
"0"=>"待审核",
"1"=>"市场部通过",
"2"=>"管理员通过"
];
public $CompanyType = [
"0"=>"己方公司",
"1"=>"上游cp公司",
"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()
{
}
//审核列表
public function lists()
{
$this->display();
}
public function marketAgree(){
}
public function marketRefuse(){
}
public function adminRefuse(){
}
//管理员成功
public function adminAgree(){
}
public function addRelation()
{
$this->assign('companyType',$this->CompanyType);
$this->display();
}
public function editRelation()
{
}
public function delRelation()
{
}
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();
}
if($type == 1){
//上游
$companyInfo = M("Partner","tab_")->field("id,partner company_name,company_type,link_man,link_phone")->where("status='1'")->select();
}
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'")->select();
}
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 menuAuth()
{
$addurl = U("addRelation");
$mentBtn = [
"addRelation"=>"<a class='butn' href='{$addurl}'>新增推广游戏分成</a>",
"marketAgree"=>"<a class='butn' id='marketAgree'>市场部审批通过</a>",
"marketRefuse"=>"<a class='butn' id='marketRefuse' style='background-color: red;'>市场部审核拒绝</a>",
"adminAgree"=>"<a class='butn' id='adminAgree'>管理员审核通过</a>",
"adminRefuse"=>"<a class='butn' id='marketRefuse' style='background-color: red;'>管理员审核拒绝</a>"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){
$resarr[] = $v;
}else{
if(in_array($k,$this->OpAuthList)){
$resarr[] = $v;
}
}
}
return $resarr;
}
public function OpAuth($info)
{
$id = $info['id'];
//原始列表
$opBtn = [
"editRelation"=>"<a class='confirm editRelation' data-id='{$id}'>编辑</a>",
"delRelation"=>"<a class='confirm delRelation' data-id='{$id}' style='color: red;'>删除</a>",
];
//操作对应菜单
if($info['status'] == 2){
$optist = [];
}else{
$optist = ["editRatio","delRatio"];
}
//
$resarr = [];
foreach ($optist as $k => $v) {
if(IS_ROOT){
$resarr[] = $opBtn[$v];
}else{
if(in_array($v,$this->OpAuthList)){
$resarr[] = $opBtn[$v];
}
}
}
return $resarr;
}
public function error($data)
{
header('Content-Type:application/json; charset=utf-8');
$data =json_encode(['msg'=>$data,"code"=>4000],JSON_UNESCAPED_UNICODE);
exit($data);
}
}