From 7da5e25e161c0e4db32a7e8ce07797675ba5d5dd Mon Sep 17 00:00:00 2001 From: liuweiwen <529520975@qq.com> Date: Fri, 14 Feb 2020 14:45:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E4=BD=9C=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PartnerController.class.php | 240 ++++++++++-- Application/Admin/View/Member/user_info.html | 2 +- Application/Admin/View/Partner/add.html | 4 +- Application/Admin/View/Partner/edit.html | 260 ++++++++++++- Application/Admin/View/Partner/lists.html | 101 ++++-- Application/Admin/View/Partner/show.html | 341 ++++++++++++++++++ Data/update.sql | 31 +- 7 files changed, 908 insertions(+), 71 deletions(-) create mode 100644 Application/Admin/View/Partner/show.html diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index d33589800..896b5ab8f 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -37,27 +37,208 @@ class PartnerController extends ThinkController $row = intval(I('row', 0)); $row = empty($row) ? 10 : $row;//每页条数 - $data = $model->alias('p') - ->field('p.id,p.partner,p.status,p.create_time,link_man,link_phone,address,company_tax_no,payee_name, - bank_account,opening_bank,m.nickname') - ->join('left join sys_member as m on m.uid = p.uid') + //获取分页数据 + $partners = $model->alias('p') + ->field("p.partner,p.matche_platform,p.invoice_rate,p.settlement_type,p.bank_account, + p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark") ->where($map) - ->order('id desc') - ->page($page, $row) + ->order("id desc") + ->page($page,$row) ->select(); + //获取公司id + $partner_ids = array_column($partners, 'id'); + $game_map['partner_id'] = ["in",$partner_ids]; + $games = M("game","tab_")->alias('g') + ->field("g.game_type_name,g.relation_game_name,g.original_package_name,g.partner_id,g.id") + ->where($game_map) + ->select(); + + $game_ids = array_column($games, 'id'); + $cp_game_ratio_map['game_id'] = ["in", $game_ids]; + $cp_game_ratio_map['is_del'] = '0'; + //获取游戏比例 + $gameradiores = M("cp_game_ratio","tab_") + ->alias("cg") + ->field("cg.ratio,cg.instanceof,cg.game_id,cg.begin_total_amount") + ->where($cp_game_ratio_map) + ->select(); + +// dd($cp_game_ratio_map); + $parseGameRadiores = array(); + foreach ($gameradiores as $key =>$val) { + if ($val['begin_total_amount'] == 0) { + $val['name'] = '默认比例'; + } else { + if($val['instanceof']=='1'){ + $val['name']="月流水≥".$val['begin_total_amount']; + }else{ + $val['name']="月流水>".$val['begin_total_amount']; + } + } + $val['row'] = 1; + $parseGameRadiores[$val['game_id']][] = $val; + } +// dd($parseGameRadiores); + $parseGames = array(); + + foreach ($games as $key =>$val) { + $val['game_ratio'] = $parseGameRadiores[$val['id']]; + if(array_key_exists($val['id'],$parseGameRadiores)){//游戏有比例 + $row2 = array_sum(array_column($val['game_ratio'], 'row')) ; + $val['row'] = empty($row2) ? 1: $row2; + } else { + $val["row"] = 1; + } + + $parseGames[$val['partner_id']][] = $val; + } + + + + $parseData = array(); + foreach ($partners as $key =>$value) { + $value['game'] = $parseGames[$value['id']]; + $value['has_game_evidence'] = $parseGames['has_game_evidence'] ? '有' : '没有'; + $value['is_sign_contract'] = $parseGames['is_sign_contract'] ? '是' : '否'; + if ($value['settlement_type'] == 0) { + $value['settlement_type'] = '未配置'; + } elseif ($value['settlement_type'] == 1) { + $value['settlement_type'] = '周结'; + } elseif ($value['settlement_type'] == 2) { + $value['settlement_type'] = '月结'; + } + + $value['contract_time'] = time_format($value['contract_start_time'], 'Y/m/d') . '-' . + time_format($value['contract_end_time'], 'Y/m/d'); + $row2 = array_sum(array_column($value['game'], 'row')) ; + $value['row'] = empty($row2) ? 1: $row2; + $parseData[$value['partner_id']][] = $value; + } + $parseData = array_values($parseData); + + + /* 查询记录总数 */ $count = $model ->where($map) ->count(); + //分页 + $parameter['p'] = $page; + $parameter['row'] = $row; + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } +// dd($parseData[0]); + $this->assign('listData', $parseData[0]); + $this->assign('count', $count); + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find()); + $this->meta_title = '合作方管理'; + $this->display(); + } - if (!empty($data)) { - foreach ($data as &$list) { - $list['status'] = ($list['status'] == 0) ? '已关闭' : '已开启'; - $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); + //列表 + public function lists2() + { + $model = M($this->modelName, 'tab_'); + $map = []; + $id = intval(I('id', 0)); + if (!empty($id)) { + $map['tab_partner.id'] = $id; + $parameter['id'] = $id; + } + + if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') { + $status = intval($_REQUEST['status']); + $map['tab_partner.status'] = $status; + $parameter['status'] = $status; + } + + $page = intval(I('get.p', 0)); + $page = $page ? $page : 1; //默认显示第一页数据 + $row = intval(I('row', 0)); + $row = empty($row) ? 10 : $row;//每页条数 + + //获取分页数据 + $partners = $model->alias('p') + ->field("p.partner,p.matche_platform,p.invoice_rate,p.settlement_type,p.bank_account, + p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark") + ->where($map) + ->order("id desc") + ->page($page,$row) + ->select(); + + //获取公司id + $partner_ids = implode(',', array_column($partners, 'id')); + $game_map['partner_id'] = ["in",$partner_ids]; + $games = M("game","tab_")->alias('g') + ->field("g.game_type_name,g.relation_game_name,g.original_package_name,g.partner_id,g.id") + ->where($game_map) + ->select(); + + $game_ids = implode(',', array_column($games, 'id')); + $cp_game_ratio_map['game_id'] = ["in",$game_ids]; + //获取游戏比例 + $gameradiores = M("cp_game_ratio","tab_") + ->alias("cg") + ->field("cg.ratio,cg.instanceof,cg.game_id") + ->join("tab_game ga ON cg.game_id = ga.id") + ->where($cp_game_ratio_map) + ->where(['is_del' => 0]) + ->group("game_id") + ->select(); + + $parseGameRadiores = array(); + foreach ($gameradiores as $key =>$val) { + $val['row'] = 1; + $parseGameRadiores[$val['game_id']][] = $val; + } + + $parseGames = array(); + + foreach ($games as $key =>$val) { + $val['game_ratio'] = $parseGameRadiores[$val['id']]; + if(array_key_exists($val['id'],$parseGameRadiores)){//游戏有比例 + $row = array_sum(array_column($val['game_ratio'], 'row')) ; + $val['row'] = empty($row) ? 1: $row; + } else { + $val["row"] = 1; } + + $parseGames[$val['partner_id']][] = $val; } + + + $parseData = array(); + foreach ($partners as $key =>$value) { + $value['game'] = $parseGames[$value['id']]; + $value['has_game_evidence'] = $parseGames['has_game_evidence'] ? '有' : '没有'; + $value['is_sign_contract'] = $parseGames['is_sign_contract'] ? '是' : '否'; + if ($value['settlement_type'] == 0) { + $value['settlement_type'] = '未配置'; + } elseif ($value['settlement_type'] == 1) { + $value['settlement_type'] = '周结'; + } elseif ($value['settlement_type'] == 2) { + $value['settlement_type'] = '月结'; + } + + $value['contract_time'] = time_format($value['contract_start_time'], 'Y/m/d') . '-' . + time_format($value['contract_end_time'], 'Y/m/d'); + $row = array_sum(array_column($value['game'], 'row')) ; + $value['row'] = empty($row) ? 1: $row; + $parseData[$value['partner_id']][] = $value; + } + $parseData = array_values($parseData); + +// dd($parseData); + + /* 查询记录总数 */ + $count = $model + ->where($map) + ->count(); + //分页 $parameter['p'] = $page; $parameter['row'] = $row; @@ -66,7 +247,7 @@ class PartnerController extends ThinkController $this->assign('_page', $page); } - $this->assign('listData', $data); + $this->assign('listData', $parseData[0]); $this->assign('count', $count); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find()); $this->meta_title = '合作方管理'; @@ -77,7 +258,6 @@ class PartnerController extends ThinkController public function add() { if ($_POST) { - dd($_REQUEST); $partner = I('post.partner', ''); $status = intval(I('post.status', 1)); @@ -124,13 +304,13 @@ class PartnerController extends ThinkController $save['contract_start_time'] = strtotime(I('contract_start_time')); $save['contract_end_time'] = strtotime(I('contract_end_time')); $save['channel_rate'] = I('channel_rate'); - $save['invoice_rate'] = I('invoice_rate'); + $save['invoice_rate'] = I('invoice_rate') ?: 0; $save['is_sign_contract'] = I('is_sign_contract'); $save['settlement_type'] = I('settlement_type'); $save['has_game_evidence'] = I('has_game_evidence'); $save['remark'] = I('remark'); - if (isset($save['file_info'])) { - $save['file_info'] = json_encode($save['file_info'],JSON_UNESCAPED_UNICODE); + if (!empty(I('file_info'))) { + $save['file_info'] = I('file_info'); } $save['uid'] = UID; @@ -170,9 +350,6 @@ class PartnerController extends ThinkController if (empty(I('link_phone'))) { $this->error('请输入联系电话'); } - if (!in_array($status, [0, 1]) || $id == 0) { - $this->error('参数异常'); - } $data = $model ->field('id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank') @@ -183,6 +360,7 @@ class PartnerController extends ThinkController $map['partner'] = $partner; $res = $model->where($map)->getField('id'); + dd($res); if ($res && $res != $id) { $this->error('合作方已存在'); } @@ -210,6 +388,19 @@ class PartnerController extends ThinkController $save['bank_account'] = I('bank_account'); $save['opening_bank'] = I('opening_bank'); + $save['matche_platform'] = I('matche_platform'); + $save['contract_start_time'] = strtotime(I('contract_start_time')); + $save['contract_end_time'] = strtotime(I('contract_end_time')); + $save['channel_rate'] = I('channel_rate'); + $save['invoice_rate'] = I('invoice_rate') ?: 0; + $save['is_sign_contract'] = I('is_sign_contract'); + $save['settlement_type'] = I('settlement_type'); + $save['has_game_evidence'] = I('has_game_evidence'); + $save['remark'] = I('remark'); + if (!empty(I('file_info'))) { + $save['file_info'] = I('file_info'); + } + $save['status'] = $status; $save['last_up_time'] = $time; $res = $model->save($save); @@ -223,16 +414,19 @@ class PartnerController extends ThinkController $id = intval(I('get.id', 0)); $map['id'] = $id; $data = $model - ->field('id,partner,status,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank') ->find($id); if (empty($data)) { $this->error('数据异常', U('lists')); } - - $this->assign('config', $data); + $data['contract_start_time'] = date('Y-m-d', $data['contract_start_time']); + $data['contract_end_time'] = date('Y-m-d', $data['contract_end_time']); +// dd($data); + $this->assign('data', $data); + $action = I('action'); + $this->assign('action', $action); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/edit'])->find()); - $this->meta_title = '编辑合作方'; - $this->display(); + $this->meta_title = $action ? '查看合作方' : '编辑合作方'; + $this->display($action); } } diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html index e6d8076f7..5353a6e9c 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -245,7 +245,7 @@ {:get_registertype($data['register_type'])} - 渠道费率: - % + % 开票税点: - + diff --git a/Application/Admin/View/Partner/edit.html b/Application/Admin/View/Partner/edit.html index 755bf89a7..fcd0a5875 100644 --- a/Application/Admin/View/Partner/edit.html +++ b/Application/Admin/View/Partner/edit.html @@ -14,7 +14,7 @@ - +
@@ -30,12 +30,76 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*合作方名称:*合同合作方名称:
对应平台(简称): + +
合同期限: + + - +
渠道费率: + % +
开票税点: + +
*是否签署合同: + +
*结算方式: + +
*是否签署合同: + +
*联系人: @@ -86,30 +150,43 @@
备注: + +
*显示状态:
文档管理 + +
+ + +
- - + 返回 @@ -121,19 +198,176 @@
- +
已添加添加至常用设置
+ + + + + + + diff --git a/Application/Admin/View/Partner/lists.html b/Application/Admin/View/Partner/lists.html index 87d478aba..7c1b9f6a8 100644 --- a/Application/Admin/View/Partner/lists.html +++ b/Application/Admin/View/Partner/lists.html @@ -39,7 +39,7 @@
@@ -68,23 +68,24 @@ - - - - 合作方 - 显示状态 - - 联系人 - 联系电话 - 邮寄地址 - 公司税号 - 收款方名称 + 操作 + 合同合作方名称 + 对应平台 + 合同期限 + 开票税点 + 结算周期 银行账号 开户行 + 备注 + + 是否有游戏资质 + 是否签署合同 + + 产品类型 + 原包名 + 现包名 + 合作方分成比例 - 添加人 - 添加时间 - 操作 @@ -95,24 +96,64 @@ - - {$data.partner} - {$data.status} - - {$data.link_man} - {$data.link_phone} - {$data.address} - {$data.company_tax_no} - {$data.payee_name} - {$data.bank_account} - {$data.opening_bank} - - {$data.nickname} - {$data.create_time} - + 编辑 + 查看 删除 + {$data.partner} + {$data.matche_platform} + {$data.contract_time} + {$data.invoice_rate}% + {$data.settlement_type} + {$data.bank_account} + {$data.opening_bank} + {$data.remark} + {$data.has_game_evidence} + {$data.is_sign_contract} + + + + + + + {$game['game_type_name']} + {$game['original_package_name']} + {$game['relation_game_name']} + + + {$game['game_type_name']} + {$game['original_package_name']} + {$game['relation_game_name']} + + + + + + {$ratio['name']} + {$ratio['ratio']} + + + {$ratio['name']} + {$ratio['ratio']} + + + + + - + - + + + + + + - + - + - + - + - + + diff --git a/Application/Admin/View/Partner/show.html b/Application/Admin/View/Partner/show.html new file mode 100644 index 000000000..ffc13bd40 --- /dev/null +++ b/Application/Admin/View/Partner/show.html @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*合同合作方名称: + +
对应平台(简称): + +
合同期限: + + - +
渠道费率: + % +
开票税点: + +
*是否签署合同: + +
*结算方式: + +
*是否签署合同: + +
*联系人: + +
*联系电话: + +
邮寄地址: + +
公司税号: + +
收款方名称: + +
银行账号: + +
开户行: + +
备注: + +
*显示状态: + + + + + +
文档管理
+ + +
+
+ +
+
+
+ + + +
+ + + + + + + + + + diff --git a/Data/update.sql b/Data/update.sql index 38492529b..5f24a74fc 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1158,8 +1158,35 @@ ADD COLUMN `company_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '工 ALTER TABLE `tab_withdraw` ADD COLUMN `review_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '审核模式:1-人工审核 2-自动审核'; ---2020-02-12 liuweiwen 游戏-游戏有包名称 -ALTER TABLE tab_game ADD COLUMN `original_package_name` varchar(64) DEFAULT NULL COMMENT '游戏原包名称'; -- 2020-02-12 zyx 推广提现--新增审核模式 ALTER TABLE `tab_statement` MODIFY COLUMN `ext_field` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '扩展字段,如果是下游为提现单号' AFTER `pay_type`; + +--2020-02-12 liuweiwen 游戏-游戏有包名称 +ALTER TABLE tab_game +ADD COLUMN `original_package_name` varchar(64) DEFAULT NULL COMMENT '游戏原包名称'; +--2020-02-12 liuweiwen 是否展示权限 +ALTER TABLE sys_auth_group +ADD COLUMN `show_data` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否展示权限:1-是;0-否'; +--2020-02-12 liuweiwen 合作方新增字段 +ALTER TABLE tab_partner +ADD COLUMN `matche_platform` varchar(64) DEFAULT NULL COMMENT '对应平台(简称)'; +ALTER TABLE tab_partner +ADD COLUMN `contract_start_time` int(11) NOT NULL DEFAULT '0' COMMENT '合同开始时间'; +ALTER TABLE tab_partner +ADD COLUMN `contract_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '合同结束时间'; +ALTER TABLE tab_partner +ADD COLUMN `channel_rate` decimal(2,0) NOT NULL DEFAULT '0' COMMENT '渠道费率'; +ALTER TABLE tab_partner +ADD COLUMN `invoice_rate` decimal(2,0) NOT NULL DEFAULT '0' COMMENT '开票税点'; +ALTER TABLE tab_partner +ADD COLUMN `is_sign_contract` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否签署合同:0-未签;1-已签'; +ALTER TABLE tab_partner +ADD COLUMN `settlement_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '结算方式:0-未知;1-周结;2-月结'; +ALTER TABLE tab_partner +ADD COLUMN `has_game_evidence` tinyint(1) DEFAULT '0' COMMENT '是否有游戏资质:0-没有;1-有'; +ALTER TABLE tab_partner +ADD COLUMN `remark` varchar(255) DEFAULT NULL COMMENT '备注'; +ALTER TABLE tab_partner +ADD COLUMN `file_info` text COMMENT '文档信息,json格式'; +