|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|