From 5fc03a14a478127f439ddcd990d6d89a240247ae Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 30 Jun 2020 18:02:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96cp=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/function.php | 7 + .../Controller/PartnerController.class.php | 231 +++++++----------- Application/Admin/View/Partner/add.html | 122 ++++++++- Application/Admin/View/Partner/edit.html | 121 ++++++++- Application/Admin/View/Partner/show.html | 80 +++++- Data/update.sql | 16 +- 6 files changed, 409 insertions(+), 168 deletions(-) diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 0e0c82c80..aebb55f6f 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -868,6 +868,13 @@ function convertAmountToCn($num) { function checkPhone($phone) { return preg_match("/^1[3456789]\d{9}$/",$phone); } +/** + * @param $num + * @return false|int + */ +function checkNumber($num) { + return preg_match("/^([1-9][0-9]*)+(.[0-9]{1,2})?$/",$num); +} //获取sdk类型名称 function getSDKTypeName($sdkType, $chinese = false) diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index 08bf4be26..9dae6b23d 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -97,7 +97,7 @@ class PartnerController extends ThinkController ->group('relation_game_id,begin_total_amount') ->select(); -// dd($cp_game_ratio_map); + // dd($cp_game_ratio_map); $parseGameRadiores = array();//合作方分成比例 foreach ($gameradiores as $key =>$val) { $val['row'] = 1; @@ -188,7 +188,7 @@ class PartnerController extends ThinkController $this->assign('_page', $page); } $this->checkListOrCountAuthRestMap($map,[]); -// dd($parseData[0]); + // dd($parseData[0]); $this->assign('listData', $parseData[0]); $this->assign('count', $count); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find()); @@ -200,82 +200,19 @@ class PartnerController extends ThinkController public function add() { if ($_POST) { - $partner = trim(I('post.partner', '')); - $status = intval(I('post.status', 1)); - - if (empty($partner)) { - $this->error('请输入合作方名称'); - } - if (!strlen(I('is_sign_contract'))) { - $this->error('请选择是否签署合同'); - } - if (empty(I('company_type'))) { - $this->error('请输入公司性质'); - } - if (!strlen(I('has_game_evidence'))) { - $this->error('请选择是否有游戏资质'); - } - - - - $model = M($this->modelName, 'tab_'); - $map['partner'] = $partner; - $res = $model->where($map)->getField('id'); - if ($res) { - $this->error('合作方已存在'); - } - - if(!empty(I('link_phone')) && !checkPhone(I('link_phone'))) { - $this->error('联系电话格式不正确'); - } - if(!empty(I('link_phone'))){ - $res2 = $model->where(['link_phone' => I('link_phone')])->getField('id'); - if ($res2) { - $this->error('已存在此联系电话'); - } - } - - $time = time(); - $save['partner'] = $partner; - $save['status'] = $status; - - $save['link_man'] = I('link_man'); - $save['link_phone'] = I('link_phone'); - $save['address'] = I('address'); - $save['company_tax_no'] = I('company_tax_no'); - $save['payee_name'] = I('payee_name'); - $save['bank_account'] = I('bank_account'); - $save['opening_bank'] = I('opening_bank'); - - $save['ali_user'] = I('ali_user'); - $save['ali_account'] = I('ali_account'); - - $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')/100; - $save['invoice_rate'] = (I('invoice_rate') ?: 0)/100; - $save['is_sign_contract'] = I('is_sign_contract'); - $save['settlement_type'] = I('settlement_type'); - $save['has_game_evidence'] = I('has_game_evidence'); - $save['company_type'] = I('company_type'); - $save['remark'] = I('remark'); - if (!empty(I('file_info'))) { - $save['file_info'] = I('file_info'); - } + $save = I("post."); + $this->checkData($save); $save['uid'] = UID; - $save['create_time'] = $time; - $save['last_up_time'] = $time; - + $save['create_time'] = time(); $res = $model->add($save); if ($res) { \Think\Log::actionLog('Partner/add', 'partner', $res); //操作日志 addOperationLog(array( "op_type"=>0, - "key"=>$partner, - "url"=>U("Partner/lists",array("partner"=>$partner)) + "key"=>$save['partner'], + "url"=>U("Partner/lists",array("partner"=>$save['partner'])) )); $this->success('保存成功', U('lists')); } else { @@ -294,80 +231,8 @@ class PartnerController extends ThinkController $model = M($this->modelName, 'tab_'); if ($_POST) { - $partner = trim(I('post.partner', '')); - $status = intval(I('post.status', 1)); - $id = intval(I('post.id', 0)); - - if (empty($partner)) { - $this->error('请输入合作方名称'); - } - if (!strlen(I('is_sign_contract'))) { - $this->error('请选择是否签署合同'); - } - if (empty(I('company_type'))) { - $this->error('请输入公司性质'); - } - if (!strlen(I('has_game_evidence'))) { - $this->error('请选择是否有游戏资质'); - } - - $data = $model - ->field('id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank') - ->find($id); - if (empty($data)) { - $this->error('数据异常'); - } - - $map['partner'] = $partner; - $res = $model->where($map)->getField('id'); - if ($res && $res != $id) { - $this->error('合作方已存在'); - } - - if(!empty(I('link_phone')) && !checkPhone(I('link_phone'))) { - $this->error('联系电话格式不正确'); - } - if(!empty(I('link_phone'))){ - $res2 = $model->where([ - 'link_phone' => I('link_phone'), - 'id' => ['neq', $id] - ])->getField('id'); - - if ($res2) { - $this->error('已存在此联系电话'); - } - } - - $time = time(); - $save['id'] = $id; - $save['partner'] = $partner; - - $save['link_man'] = I('link_man'); - $save['link_phone'] = I('link_phone'); - $save['address'] = I('address'); - $save['company_tax_no'] = I('company_tax_no'); - $save['payee_name'] = I('payee_name'); - $save['bank_account'] = I('bank_account'); - $save['opening_bank'] = I('opening_bank'); - - $save['ali_user'] = I('ali_user'); - $save['ali_account'] = I('ali_account'); - - $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')/100; - $save['invoice_rate'] = (I('invoice_rate') ?: 0)/100; - - $save['is_sign_contract'] = I('is_sign_contract'); - $save['settlement_type'] = I('settlement_type'); - $save['has_game_evidence'] = I('has_game_evidence'); - $save['company_type'] = I('company_type'); - $save['remark'] = I('remark'); - $save['file_info'] = I('file_info'); - - $save['status'] = $status; - $save['last_up_time'] = $time; + $save = I("post."); + $this->checkData($save); $res = $model->save($save); if ($res === false) { $this->error('保存失败'); @@ -375,8 +240,8 @@ class PartnerController extends ThinkController \Think\Log::actionLog('Partner/edit', 'partner', $id); addOperationLog(array( "op_type"=>1, - "key"=>$partner, - "url"=>U("Partner/lists",array("partner"=>$partner)) + "key"=>$save['partner'], + "url"=>U("Partner/lists",array("partner"=>$save['partner'])) )); $this->success('保存成功', U('lists')); } @@ -400,6 +265,19 @@ class PartnerController extends ThinkController }else{ $data['contract_end_time']=''; } + + if ($data['validity_start_time']) { + $data['validity_start_time'] = date('Y-m-d', $data['validity_start_time']); + }else{ + $data['validity_start_time']=''; + } + + if ($data['validity_end_time']) { + $data['validity_end_time'] = date('Y-m-d', $data['validity_end_time']); + }else{ + $data['validity_end_time']=''; + } + $data['channel_rate'] *= 100;//存的是小数,显示百分比 $data['invoice_rate'] *= 100;//存的是小数,显示百分比 // dd($data); @@ -439,7 +317,68 @@ class PartnerController extends ThinkController )); $this->success('删除成功', U('lists')); } + protected function checkData(&$save) + { + $partner = trim($save['partner']); + $status = intval($save['status']); + + if (empty($partner)) { + $this->error('请输入合作方名称'); + } + if (!strlen(I('is_sign_contract'))) { + $this->error('请选择是否签署合同'); + } + if (empty(I('company_type'))) { + $this->error('请输入公司性质'); + } + if (!strlen(I('has_game_evidence'))) { + $this->error('请选择是否有游戏资质'); + } + + $model = M($this->modelName, 'tab_'); + $map['partner'] = $partner; + $res = $model->where($map)->field("id")->find(); + + if ($res) { + if(isset($save['id'])){ + if($save['id'] !=$res['id']){ + $this->error('合作方已存在'); + } + }else{ + $this->error('合作方已存在'); + } + } + if(!empty(I('link_phone')) && !checkPhone(I('link_phone'))) { + $this->error('联系电话格式不正确'); + } + if(!empty(I('reg_phone')) && !checkPhone(I('reg_phone'))) { + $this->error('注册电话格式不正确'); + } + if(!empty(I('channel_rate'))) { + if(!checkNumber(I('channel_rate'))){ + $this->error('渠道费率格式不对'); + }else{ + $save['channel_rate'] = ($save['channel_rate'] ?: 0)/100; + } + } + if(!empty(I('invoice_rate'))) { + if(!checkNumber(I('invoice_rate'))){ + $this->error('开票税点格式不对'); + }else{ + $save['invoice_rate'] = ($save['invoice_rate'] ?: 0)/100; + } + } + if(!empty(I('server_fee')) && !checkNumber(I('server_fee'))) { + $this->error('服务器费用格式不对'); + } + $time = time(); + $save['contract_start_time'] = strtotime($save['contract_start_time']); + $save['contract_end_time'] = strtotime($save['contract_end_time']); + $save['validity_start_time'] = strtotime($save['validity_start_time']); + $save['validity_end_time'] = strtotime($save['validity_end_time']); + $save['last_up_time'] = $time; + } } diff --git a/Application/Admin/View/Partner/add.html b/Application/Admin/View/Partner/add.html index dced66cc6..639f45e88 100644 --- a/Application/Admin/View/Partner/add.html +++ b/Application/Admin/View/Partner/add.html @@ -24,7 +24,7 @@
-
+
@@ -51,6 +51,15 @@ + + + + + + - + @@ -123,6 +132,20 @@ + + + + + + + + + + - + @@ -153,7 +176,7 @@ - + @@ -180,6 +203,53 @@ + + + + + + + + + + + + + + + +
结算生效期限: + + - +
渠道费率: @@ -77,7 +86,7 @@
公司性质:
注册地址: + +
注册电话: + +
邮寄地址: @@ -138,7 +161,7 @@
收款方名称:账户名:
开户行:收款银行:
*是否有预付款: + + + + + +
*承担服务费: + + + + + +
*合作关系: + + + + + +
*显示状态: @@ -255,11 +325,18 @@ diff --git a/Application/Admin/View/Partner/edit.html b/Application/Admin/View/Partner/edit.html index 9de6f0b70..b6c1dcda2 100644 --- a/Application/Admin/View/Partner/edit.html +++ b/Application/Admin/View/Partner/edit.html @@ -24,7 +24,7 @@
- +
@@ -51,6 +51,14 @@ + + + + + - + @@ -124,6 +132,19 @@ + + + + + + + + + - + @@ -154,7 +175,7 @@ - + @@ -181,15 +202,61 @@ + + + + + + + + + + + + + + + + + + + + - + @@ -113,6 +121,18 @@ + + + + + + + + @@ -129,7 +149,7 @@ - + @@ -144,7 +164,7 @@ - + @@ -172,14 +192,60 @@ - + + + + + + + + + + + + + + + +
结算生效期限: + + - +
渠道费率: @@ -78,7 +86,7 @@
公司性质:
注册地址: + +
注册电话: + +
邮寄地址: @@ -139,7 +160,7 @@
收款方名称:账户名:
开户行:收款银行:
*是否有预付款: + + + + + +
*承担服务费: + + + + + display: none;">  元 +
*合作关系: + + + + + +
*显示状态: @@ -257,6 +324,14 @@ diff --git a/Application/Admin/View/Partner/show.html b/Application/Admin/View/Partner/show.html index bfbd47ce7..2ecfc478a 100644 --- a/Application/Admin/View/Partner/show.html +++ b/Application/Admin/View/Partner/show.html @@ -51,6 +51,14 @@
结算生效期限: + + - +
渠道费率: @@ -78,7 +86,7 @@
是否有游戏资质:
注册地址: + +
注册电话: + +
邮寄地址:
收款方名称:账户名:
开户行:收款银行:
显示状态:*是否有预付款: + + + + + +
*承担服务费: + + + + + display: none;">  元 +
*合作关系: + + + + + +
*显示状态: diff --git a/Data/update.sql b/Data/update.sql index 98ed05d96..60f8072f8 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2074,4 +2074,18 @@ ADD COLUMN `fax_ratio` varchar(20) NULL COMMENT '开票税率' AFTER `ali_accou --20200630 cz ALTER TABLE `tab_promote_company` -ADD COLUMN `game_ids` varchar(300) NOT NULL DEFAULT '' COMMENT '可申请游戏 空值表示没有' AFTER `marketing_director_show`; \ No newline at end of file +ADD COLUMN `game_ids` varchar(300) NOT NULL DEFAULT '' COMMENT '可申请游戏 空值表示没有' AFTER `marketing_director_show`; + + +ALTER TABLE `tab_partner` +ADD COLUMN `validity_start_time` int(11) NOT NULL DEFAULT 0 COMMENT '生效开始时间' AFTER `company_type`, +ADD COLUMN `validity_end_time` int(11) NOT NULL DEFAULT 0 COMMENT '生效结算时间' AFTER `validity_start_time`, +ADD COLUMN `reg_address` varchar(255) NULL DEFAULT NULL COMMENT '注册地址' AFTER `validity_end_time`, +ADD COLUMN `reg_phone` varchar(24) NULL DEFAULT NULL COMMENT '注册电话' AFTER `reg_address`, +ADD COLUMN `has_advance_charge` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否有预付款 1是 0否' AFTER `reg_phone`, +ADD COLUMN `has_server_fee` tinyint(1) NOT NULL DEFAULT 0 COMMENT '承担服务费1是 0否' AFTER `has_advance_charge`, +ADD COLUMN `server_fee` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '服务器费用' AFTER `has_server_fee`, +ADD COLUMN `cooperation_status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '合作关系1合作中 0暂停合作' AFTER `server_fee`; + +ALTER TABLE `tab_partner` +MODIFY COLUMN `settlement_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '结算方式(作废,请查看tab_company_relation表)' AFTER `is_sign_contract`; \ No newline at end of file