@ -14,6 +14,13 @@ class SocietyInfoController extends ThinkController
{
private $modelName = 'SocietyInfo';
private $admininfo = '';
private $level = [
0=>'无',
1=>'S',
2=>'A',
3=>'B',
4=>'其他'
];
public function _initialize()
{
@ -32,6 +39,14 @@ class SocietyInfoController extends ThinkController
$map['create_account'] = $this->admininfo['username'];
}
if ($_REQUEST['text']) {
$map['_string'] = "province like '%{$_REQUEST['text']}%' or city like '%{$_REQUEST['text']}%'
or company_name like '%{$_REQUEST['text']}%' or register_capital like '%{$_REQUEST['text']}%' or functionary like '%{$_REQUEST['text']}%'
or phone like '%{$_REQUEST['text']}%' or wechat like '%{$_REQUEST['text']}%' or qq like '%{$_REQUEST['text']}%' or game_type like '%{$_REQUEST['text']}%'
or game_name like '%{$_REQUEST['text']}%' or join_platform like '%{$_REQUEST['text']}%' or promote_scale like '%{$_REQUEST['text']}%' or turnover= '{$_REQUEST['text']}'
or address like '%{$_REQUEST['text']}%' or league_info like '%{$_REQUEST['text']}%' or remark like '%{$_REQUEST['text']}%' or interface_person like '%{$_REQUEST['text']}%'";
}
$page = intval(I('get.p', 0));
$page = $page ? $page : 1; //默认显示第一页数据
$row = intval(I('row', 0));
@ -56,14 +71,17 @@ class SocietyInfoController extends ThinkController
if (I('time_gap', -1) == 0) {
$map['communication_time'] = array('elt', time() - $gap * 86400);
}
if (I('sociaty_level') & & I('sociaty_level') != '0') $map['sociaty_level'] = I('sociaty_level');
//获取分页数据
$query = $model->where($map)->order("id desc");
$count = $query->count();
if($is_export){
$parseData = $query->field("province, city, company_name, register_capital, functionary, phone, wechat, qq, game_type, game_name, join_platform, promote_scale, turnover, address, league_info, is_potential, remark, interface_person, create_time, communication_time, create_account")
$parseData = $query->field("province, city, company_name, register_capital, functionary, phone, wechat, qq, game_type, game_name, join_platform, promote_scale,sociaty_level, turnover, address, league_info, is_potential, remark, interface_person, create_time, communication_time, create_account")
->where($map)
->order("id desc")
->select();
foreach ($parseData as & $v) {
$v['sociaty_level'] = $this->level[$v['sociaty_level']];
if ($v['is_potential'] == 1) $v['is_potential'] = "是";
else $v['is_potential'] = "否";
$v['communication_time'] = date('Y-m-d H:i:s', $v['communication_time']);
@ -74,11 +92,12 @@ class SocietyInfoController extends ThinkController
}
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME, I('get.*')),'menu'=>"推广-公会信息-导出"]);
$head = ["省份", "城市", "公司", "注册资本", "负责人", "电话", "微信", "QQ", "游戏类型", "所做游戏",
"合作平台", "推广规模", "流水", "地址", "联盟信息", "是否为意向客户", "备注信息", "对接人", "录入时间", "最后沟通时间", "录入员"];
"合作平台", "推广规模", "公会等级", " 流水", "地址", "联盟信息", "是否为意向客户", "备注信息", "对接人", "录入时间", "最后沟通时间", "录入员"];
$this->export($head, $parseData, "公会信息-".date('Ymd'));
return ;
} else {
$societyInfos = $model->where($map)->order("id desc")->field("*")->page($page,$row)->select();
// dump($societyInfos);die();
}
//分页
@ -90,13 +109,25 @@ class SocietyInfoController extends ThinkController
$this->assign('_page', $page);
}
foreach ($societyInfos as & $v) {
foreach ($societyInfos as $k => & $v) {
$v['num'] = $k+1+intval((I('get.p', 0)?I('get.p', 0):1)-1)*$row;
$v['sociaty_level_str'] = $this->level[$v['sociaty_level']];
if (time() - $v['communication_time'] > $gap * 86400)
$v['is_gap_time'] = 1;
}
$this->checkListOrCountAuthRestMap($map,[]);
$this->assign('timeset_check',$this->checkRule("Admin/SocietyInfo/timeset" ,array('in','1,2')));
if (IS_ROOT) {
$this->assign('timeset_check',true);
$this->assign('delset_check',true);
} else {
$this->assign('timeset_check',$this->checkRule("Admin/SocietyInfo/timeset" ,array('in','1,2')));
$this->assign('delset_check',$this->checkRule("Admin/SocietyInfo/delset" ,array('in','1,2')));
}
// $this->assign('time_gap', $config['value']);
$gameTypes = M('game_type', 'tab_')->field("id, type_name")->select();
@ -212,7 +243,6 @@ class SocietyInfoController extends ThinkController
}
$v['partner_info']['company_type'] = $v['partner_info']['company_type'] == 2 ? '个人' : '公司';
$contract_start_time = $v['partner_info']['contract_start_time'] ? time_format($v['partner_info']['contract_start_time'], 'Y/m/d') : '-';
if($v['partner_info']['contract_start_time']){
$contract_end_time = $v['partner_info']['contract_end_time'] ? date('Y/m/d', $v['partner_info']['contract_end_time']) : '永久';
@ -344,6 +374,35 @@ class SocietyInfoController extends ThinkController
}
}
//查看
public function view()
{
$model = M($this->modelName, 'tab_');
$id = intval(I('get.id', 0));
$map['id'] = $id;
$data = $model->find($id);
if (empty($data)) {
$this->error('数据异常', U('lists'));
}
$gameTypes = M('game_type', 'tab_')->field("id, type_name")->select();
$myGameTypes = explode('/', $data['game_type']);
foreach ($gameTypes as & $v) {
$v['check'] = 0;
foreach ($myGameTypes as $item) {
if ($item == $v['type_name']) {
$v['check'] = 1;
}
}
}
$this->assign("game_types", $gameTypes);
$this->assign('data', $data);
$this->meta_title = '编辑';
$this->display();
}
//删除
public function del()
{
@ -371,6 +430,37 @@ class SocietyInfoController extends ThinkController
$this->success('删除成功', U('lists'));
}
//批量删除
public function del_check() {
if (!empty($_POST['ids'])) {
if (!is_array($_POST['ids'])) {
$this->ajaxReturn(['status'=>0,'info'=>'参数异常']);
// $this->error('参数异常');
}
$id = implode(',', $_POST['ids']);
} else {
$id = intval(I('get.id', 0));
if ($id == 0) {
$this->ajaxReturn(['status'=>0,'info'=>'参数异常']);
// $this->error('参数异常');
}
}
$res = M($this->modelName, 'tab_')->delete($id);
if ($res === false) {
// $this->error('删除失败');
$this->ajaxReturn(['status'=>0,'info'=>'删除失败']);
}
addOperationLog(array(
"op_type"=>2,
"key"=>$id,
"url"=>U("Society/lists")
));
$this->ajaxReturn(['status'=>1,'info'=>'删除成功']);
}
// 导入
public function excelImport() {
header("Content-Type:text/html;charset=utf-8");