master
chenzhi 4 years ago
parent f731a417bd
commit d662c89b7e

@ -239,12 +239,12 @@ class PromoteCompanyController extends ThinkController
$this->checkData($save);
$save['create_time'] = $time;
$save['turnover_ratio'] = $this->setTurnoverRatio($save);
$res = M("promote_company","tab_")->add($save);
$res = D("PromoteCompanyVerify")->add_db($save);
if ($res) {
addOperationLog(['op_type'=>0,'key'=>$save['company_name'],'op_name'=>'新增推广公司','url'=>U('PromoteCompany/lists')]);
\Think\Log::actionLog('PromoteCompany/add', 'partner', $res);
$array=array(
"info"=>"添加成功",
"info"=>"添加成功,请联系管理员尽快审核",
"status"=>1
);
$this->ajaxReturn($array);
@ -298,49 +298,15 @@ class PromoteCompanyController extends ThinkController
//编辑
public function edit()
{
$model = M($this->modelName, 'tab_');
if ($_POST) {
$save = I('post.');//前端已经验证
$this->checkData($save);
$save['turnover_ratio'] = $this->setTurnoverRatio($save);
// dd($save);
//判断内外团是否修改
$is_change_belong = false;
$company_id = $save['id'];
$y_belong = $model->field("company_belong")->where("id = {$save['id']}")->find()['company_belong'];
if(isset($save['company_belong']) && ($y_belong != $save['company_belong'])){
$is_change_belong = true;
}
if(empty($save['contact_phone'])){
$save['contact_phone'] = 0;
}
$res = M("promote_company","tab_")->save($save);
$res = D("PromoteCompanyVerify")->edit_db($save);
if ($res) {
//处理底下所有会长的公会属性
if($is_change_belong){
$savedata = array(
"company_belong"=>$save['company_belong']
);
// 权限跟随
$authGroup = M('sys_auth_group')->where(['title'=>'市场总监'])->find();
$subPromoteIds = M('promote', 'tab_')->where(['level' => 1, 'company_id' => $company_id])->getField('id', true);
$dataPresident = explode(',', $authGroup['data_president']);
if ($save['company_belong'] == 1 || $save['company_belong'] == 2) {
$dataPresident = array_unique(array_merge($dataPresident, $subPromoteIds));
} else {
$dataPresident = array_diff($dataPresident, $subPromoteIds);
}
M('sys_auth_group')->where(['title'=>'市场总监'])->save(['data_president'=>implode(',', $dataPresident)]);
M("Promote","tab_")->where("company_id = '{$company_id}'")->save($savedata);
}
addOperationLog(['op_type'=>1,'key'=>$_POST['company_name'],'op_name'=>'编辑推广公司','url'=>U('PromoteCompany/lists'),'menu'=>'推广员-推广员管理-推广公司管理-编辑推广公司']);
$array=array(
"info"=>"修改成功",
"info"=>"修改成功,请联系管理员尽快审核",
"status"=>1
);
$this->ajaxReturn($array);
@ -351,6 +317,7 @@ class PromoteCompanyController extends ThinkController
));
}
} else {
$model = M($this->modelName, 'tab_');
$id = $_REQUEST['id'] ?: 0;
$map['id'] = $id;
$data = $model->field('*')->find($id);
@ -808,6 +775,48 @@ class PromoteCompanyController extends ThinkController
$save['validity_end_time'] = strtotime($save['validity_end_time']);
$save['last_up_time'] = $time;
}
/**
* 由于修改公司信息引起的会长信息修改
* @param [type] $save
* @return void
*/
protected function changePromote(&$save){
$is_change_belong = false;
$is_change_relation =false;
if(empty($save['id'])){
return false;
}
$company_id = $save['id'];
$old_info = M("PromoteCompany","tab_")->field("company_belong,develop_type")->where("id = {$save['id']}")->find();
if(isset($save['company_belong']) && ($old_info['company_belong'] != $save['company_belong'])){
$is_change_belong = true;
}
if(isset($save['develop_type']) && ($old_info['develop_type'] != $save['develop_type'])){
$is_change_relation = true;
}
//处理底下所有会长的公会属性
if($is_change_belong || $is_change_relation){
$savedata = array(
"company_belong"=>$save['company_belong'],
"company_relation"=>$save['develop_type']
);
M("Promote","tab_")->where("company_id = '{$company_id}'")->save($savedata);
// 权限跟随
if($is_change_belong){
$authGroup = M('auth_group',"sys_")->where(['title'=>'市场总监'])->find();
$subPromoteIds = M('promote', 'tab_')->where(['level' => 1, 'company_id' => $company_id])->getField('id', true);
$dataPresident = explode(',', $authGroup['data_president']);
if ($save['company_belong'] == 1 || $save['company_belong'] == 2) {
$dataPresident = array_unique(array_merge($dataPresident, $subPromoteIds));
} else {
$dataPresident = array_diff($dataPresident, $subPromoteIds);
}
M('auth_group',"sys_")->where(['title'=>'市场总监'])->save(['data_president'=>implode(',', $dataPresident)]);
}
}
}
}

@ -0,0 +1,64 @@
<?php
namespace Admin\Model;
use Think\Model;
class PromoteCompanyVerifyModel extends Model
{
protected $tablePrefix = 'tab_';
public $VerifyStatus=[
"-1"=>"审核拒绝",
"0"=>"未审核",
"1"=>"审核通过"
];
/**
* 新增
* @param [array]] $info 公司信息
* @return void
*/
public function add_db($info)
{
$verifydata = [
"company_id"=>0,
"company_name"=>$info['company_name'],
"verify_status"=>0,
"create_time"=>time(),
'verify_log'=>json_encode(["create_user"=>$_SESSION['onethink_admin']['user_auth']['username'],"create_time"=>date("Y-m-d H:i:s")])
];
if(isset($info['instanceof'])) unset($info['instanceof']);
if(isset($info['turnover'])) unset($info['turnover']);
$verifydata['company_info'] = json_encode($info,JSON_UNESCAPED_UNICODE);
return $this->add($verifydata);
}
public function edit_db($info)
{
if(!isset($info['id'])){
return false;
}
$p_id = $info['id'];
$verifydata = [
"company_id"=>$p_id,
"company_name"=>$info['partner'],
"verify_status"=>0,
"create_time"=>time(),
'verify_log'=>json_encode(["create_user"=>$_SESSION['onethink_admin']['user_auth']['username'],"create_time"=>date("Y-m-d H:i:s")])
];
if(isset($info['instanceof'])) unset($info['instanceof']);
if(isset($info['turnover'])) unset($info['turnover']);
$verifydata['company_info'] = json_encode($info,JSON_UNESCAPED_UNICODE);
//判断是否存在
$has = $this->where("company_id = {$p_id}")->find();
if($has){
//存在
$verifydata['id'] = $has['id'];
$res = $this->save($verifydata);
}else{
$res = $this->add($verifydata);
}
return $res;
}
}

@ -3,6 +3,7 @@
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<style>
@ -288,7 +289,12 @@
<input type="text" class="txt " name="content" value="" placeholder="">
</td>
</tr>
<tr>
<td class="l">推广游戏:</td>
<td class="r" >
<a class="ajax-view">查看</a>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>承担服务费:</td>
<td class="r table_radio">
@ -405,13 +411,69 @@
</form>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/add">
<div class="pro_promot" style="display:none">
<form action="{:U('saveCompanyGame')}" id="ajaxForm" method="post" />
<input type="hidden" name="promote_id" id="se_promote_id" value="" />
<div class="pro_promot_main">
<div class="pro_promot_title">
<div class="fl pro_promot_title_text">
<div class="fl pro_promot_title_bigtext"> 可申请游戏</div> 选中的游戏将在对应的推广员后台进行展示,推广员可进行游戏申请</div>
<div class="pro_promot_close fr"><img src="__IMG__/icon_close.png"></div>
</div>
<div class="pro_promot_con">
<div class="pro_promot_account">推广公司:<span class="pro_promot_number"></span></div>
<div class="pro_promot_select">
<div class="pro_promot_select_title fl">选择游戏:</div>
<div class="pro_promot_select_list fl">
<a class="pro_promot_select_list_con fl active pro_promot_all pro_promot_mr20">全部 </a>
<a class="pro_promot_select_list_con fl" data-index="A">A</a>
<a class="pro_promot_select_list_con fl" data-index="B">B</a>
<a class="pro_promot_select_list_con fl" data-index="C">C</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="D">D</a>
<a class="pro_promot_select_list_con fl" data-index="E">E</a>
<a class="pro_promot_select_list_con fl" data-index="F">F</a>
<a class="pro_promot_select_list_con fl" data-index="G">G</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="H">H</a>
<a class="pro_promot_select_list_con fl" data-index="I">I</a>
<a class="pro_promot_select_list_con fl" data-index="J">J</a>
<a class="pro_promot_select_list_con fl" data-index="K">K</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="L">L</a>
<a class="pro_promot_select_list_con fl" data-index="M">M</a>
<a class="pro_promot_select_list_con fl" data-index="N">N</a>
<a class="pro_promot_select_list_con fl" data-index="O">O</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="P">P</a>
<a class="pro_promot_select_list_con fl" data-index="Q">Q</a>
<a class="pro_promot_select_list_con fl" data-index="R">R</a>
<a class="pro_promot_select_list_con fl" data-index="S">S</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="T">T</a>
<a class="pro_promot_select_list_con fl" data-index="U">U</a>
<a class="pro_promot_select_list_con fl" data-index="V">V</a>
<a class="pro_promot_select_list_con fl" data-index="W">W</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="X">X</a>
<a class="pro_promot_select_list_con fl" data-index="Y">Y</a>
<a class="pro_promot_select_list_con fl" data-index="Z">Z</a>
</div>
</div>
<div class="clear"></div>
<div class="pro_promot_game">
<div class="jsgamecheckallbox z_clearfix" >
<label class="custom-label">
<input type="checkbox" class="form_control jsgamecheckall" >
<i class="label_icon"></i>
<span class="label_text">全选</span></label>
</div>
<ul id="game_list" class="z_clearfix game_list" style="clear: both;">
</ul>
</div>
<div class="clear"></div>
<div class="pro_promot_btn">
<div class="fl pro_promot_btn_confirm">确定</div>
<div class="fr pro_promot_btn_cancel">取消</div>
</div>
</div>
</div>
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
<script type="text/html" id="doctpl">
@ -579,7 +641,6 @@
}
if(!flag) return false;
console.log(senddata);
//添加
$.ajax({
url:"{:U('add')}",
@ -761,6 +822,120 @@
})
}
}
</script>
<script type="text/javascript">
//点击字母按照条件按钮筛选
$(".pro_promot_select_list_con").click(function(){
//选中高亮样式
$(this).addClass('active');
$(this).siblings().removeClass('active');
var that = $(this);
var index = $(this).attr("data-index");
$("#game_list li").each(function(index,ele){
var short = $(this).attr('data-short');
$(this).show();
if(that.attr('data-index')){
if(that.attr('data-index')!=short.charAt(0)){
$(this).hide();
}
}
})
});
//打开弹窗
$(".ajax-view").click(function(){
//获取游戏列表
var url = "{:U('getCompanyGame')}";
var checked = 'checked';
$.post(url,{},function(res){
console.log(res);
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var promote_info = res.data.promote_info;
var lis = [];
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
ele.game_name = ele.game_name .substring(0,6)+"..."
}
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(promote_info == ''){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
}else{
if(promote_info['game_ids'].indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}
}
lis.push('<label for="gameCheck'+index+'" class="fl"></label>');
lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>');
lis.push('</li>');
});
$(".jsgamecheckall").attr('checked',checked);
$("#game_list").html(lis.join(''));
$(".pro_promot_number").text(res.data.promote_info.company_name);
$("#se_promote_id").val(res.data.promote_info.id);
$(".pro_promot").css("display","block");
jsgameid();
}else{
var tip_msg = res.info ? res.info : '操作失败';
layer.msg(tip_msg);
}
});
});
//保存修改
$(".pro_promot_btn_confirm").click(function(){
$("#ajaxForm").ajaxSubmit(function(res){
layer.msg(res.msg);
$(".pro_promot").hide();
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".jsgamecheckall").click(function(){
$(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked);
});
function jsgameid(){
$(".jsgameid").click(function(){
var option = $(this).closest('ul').find(".jsgameid"),
checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall');
option.each(function(i){
if(!this.checked){
checkall.prop("checked", false);
return false;
}else{
checkall.prop("checked", true);
}
});
});
}
</script>
</block>

@ -2109,7 +2109,7 @@ CREATE TABLE `tab_partner_verify` (
KEY `partner_id` (`partner_id`) USING BTREE,
KEY `partner_name` (`partner_name`) USING BTREE,
KEY `verify_status` (`verify_status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='CP公司审核';
-- 新增推广公司字段及审核
ALTER TABLE `tab_promote_company`
@ -2132,3 +2132,19 @@ ADD COLUMN `channel_rate` decimal(5,2) NOT NULL DEFAULT '0' COMMENT '渠道费
ALTER TABLE `tab_promote_company`
MODIFY COLUMN `contact_phone` varchar(24) NOT NULL DEFAULT '' COMMENT '联系电话' AFTER `settlement_contact`;
CREATE TABLE `tab_promote_company_verify` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`company_id` int(11) NOT NULL COMMENT '0新增,其他修改',
`company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '上游公司名称',
`company_info` text COMMENT '公司信息',
`verify_status` tinyint(3) DEFAULT '0' COMMENT '状态 -1拒绝 0未审核 1审核通过',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '操作时间',
`verify_log` text COMMENT '审批相关信息json',
PRIMARY KEY (`id`),
KEY `company_id` (`company_id`) USING BTREE,
KEY `company_name` (`company_name`) USING BTREE,
KEY `verify_status` (`verify_status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='推广公司审核';
Loading…
Cancel
Save