Merge branch 'master' of 47.111.118.107:wmtx/platform into feature/finance_statement_three

master
chenzhi 4 years ago
commit f5ad1a6d0c

@ -9,6 +9,23 @@ namespace Admin\Controller;
*/
class OldCountController extends \Think\Controller
{
public function changeCompanyGameidToPromoteGameid()
{
//默认设为
$Promote = M("Promote","tab_");
$PromoteCompany = M("promote_company","tab_");
$p_res = $PromoteCompany->field("id,game_ids")->select();
foreach ($p_res as $k => $v) {
if(!empty($v['game_ids'])){
$savedata['game_ids'] = $this->changeRelationGameidToGameid($v['game_ids']);
$Promote->where(["company_id"=>$v['id']])->save($savedata);
}
}
echo "changeCompanyGameidToPromoteGameid success";
}
/**
* 公会关系及游戏迁移
* 1. 迁移 公会company_relation到公司
@ -50,6 +67,16 @@ class OldCountController extends \Think\Controller
return implode(",",array_column($rid,'relation_game_id'));
}
}
protected function changeRelationGameidToGameid($ids,$type=false)
{
$rid = M('game', 'tab_')->field('id')->where(["relation_game_id"=>["in",$ids]])->select();
if($type){
return array_column($rid,'id');
}else{
return implode(",",array_column($rid,'id'));
}
}
/**
* 优化旧表数值,新表需要将 开票税点及渠道费 * 100

@ -165,6 +165,8 @@ class PartnerController extends ThinkController
$value['cooperation_status'] = $value['cooperation_status'] ? '合作中' : '暂停合作';
$value['company_type'] = $value['company_type'] == 2 ? '个人' : '公司';
$value['has_game_evidence'] = $value['has_game_evidence'] ? '是' : '否';
$contract_start_time = $value['contract_start_time'] ? time_format($value['contract_start_time'], 'Y/m/d') : '-';
if($value['contract_start_time']){
$contract_end_time = $value['contract_end_time'] ? date('Y/m/d', $value['contract_end_time']) : '永久';

@ -890,9 +890,9 @@ class PromoteCompanyController extends ThinkController
} else {
$game_ids = '';
}
$this->changePromoteGameids($id,$game_ids);
$res = M('promote_company', 'tab_')->where(['id'=>$id])->save(['game_ids'=>$game_ids]);
if ($res) {
$this->changePromoteGameids($id,$game_ids);
$this->ajaxReturn(['code'=>1,'msg'=>'更新成功']);
} else {
$this->ajaxReturn(['code'=>0,'msg'=>'数据未发生变化']);
@ -1029,41 +1029,48 @@ class PromoteCompanyController extends ThinkController
$save['last_up_time'] = $time;
}
protected function changePromoteGameids($company_id,$game_ids){
$is_change_game = false;
$old_info = M("PromoteCompany","tab_")->field("company_belong,develop_type,game_ids")->where("id = {$company_id}")->find();
$is_change_game = false;
$Promote = M("Promote", "tab_");
if($old_info['game_ids'] != $game_ids){
// $is_change_game = true;
$oids = explode(',', $old_info['game_ids']);
$nids = explode(',', $save['game_ids']);
$diff_ids = [];
if(count($oids) == 0){
$is_change_game = false;
}elseif(count($nids) == 0){
$diff_ids = $oids;
if($old_info['company_belong'] == 1 || $old_info['company_belong'] == 2){
//外团跟随公司
$new_game_ids = D("Game")->changeRelationGameidToGameid($game_ids,true);
$new_game_ids = implode(',',$new_game_ids);
$save = [
"game_ids"=>$new_game_ids
];
$dbres = $Promote->where("company_id = '{$company_id}'")->save($save);
}else{
foreach ($oids as $k => $v) {
if(!in_array($v,$nids)){
$diff_ids[] = $v;
$oids = explode(',', $old_info['game_ids']);
$nids = explode(',',$game_ids);
$diff_ids = [];
if(empty($old_info['game_ids'])){
$is_change_game = false;
}elseif(empty($game_ids)){
$is_change_game = true;
$diff_ids = $oids;
}else{
$is_change_game = true;
foreach ($oids as $k => $v) {
if(!in_array($v,$nids)){
$diff_ids[] = $v;
}
}
}
}
if(count($diff_ids) > 0){
$is_change_game = true;
$diff_ids = $this->changeRelationGameidToGameid($diff_ids,true);
}
if ($is_change_game) {
$Promote = M("Promote", "tab_");
$dbres = $Promote->field("id,game_ids,company_belong,company_relation")->where("company_id = '{$company_id}'")->select();
foreach ($dbres as $k=>&$v) {
$temp_ids = explode(',', $v['game_ids']);
$v['game_ids'] = implode(',', array_diff($temp_ids, $diff_ids));
$v['company_belong'] = $save['company_belong'];
$v['company_relation'] = $save['develop_type'];
$Promote->save($v);
if(count($diff_ids) > 0){
$diff_ids = D("Game")->changeRelationGameidToGameid($diff_ids,true);
}
if($is_change_game){
$dbres = $Promote->field("id,game_ids")->where("company_id = '{$company_id}'")->select();
foreach ($dbres as $k=>&$v) {
$temp_ids = explode(',', $v['game_ids']);
$v['game_ids'] = implode(',', array_diff($temp_ids, $diff_ids));
$Promote->save($v);
}
}
}
}
}
/**
* 由于修改公司信息引起的会长信息修改
@ -1271,7 +1278,7 @@ class PromoteCompanyController extends ThinkController
}else{
$v['list'] = [];
$v['row']=0;
$v['game_ids'] = $this->changeGameidToRelationGameid($v['game_ids']);
$v['game_ids'] = D("Game")->changeGameidToRelationGameid($v['game_ids']);
$game_arr = array_flip(explode(",",$v['game_ids']));
foreach($game_arr as $ke=>$va){
if(isset($ratio[$ke])){
@ -1351,37 +1358,14 @@ class PromoteCompanyController extends ThinkController
}
return $gameinfo;
}
//普通游戏id转唯一游戏id
protected function changeGameidToRelationGameid($ids,$type=false)
{
$rid = M('game', 'tab_')->field('relation_game_id')->where(["id"=>["in",$ids]])->group("relation_game_id")->select();
if($type){
return array_column($rid,'relation_game_id');
}else{
return implode(",",array_column($rid,'relation_game_id'));
}
}
//唯一游戏id转普通游戏id
protected function changeRelationGameidToGameid($ids,$type=false)
{
$rid = M('game', 'tab_')->field('id')->where(["relation_game_id"=>["in",$ids]])->select();
if($type){
return array_column($rid,'id');
}else{
return implode(",",array_column($rid,'id'));
}
}
protected function promoteCompanyIsCanDel($company_id){
//判断公司是否能被删除
protected function promoteCompanyIsCanDel($company_id){
$r = M("Promote","tab_")->where("company_id={$company_id}")->count();
if($r > 0){
return false;
}else{
return true;
}
}
}
}

@ -453,6 +453,39 @@ class GameModel extends Model{
return $this->field($field)->where($where)->group("relation_game_id")->select();
}
/**
* 关联游戏id转普通游戏id
*
* @param [string/array] $ids
* @param boolean $type false:返回字符串 true:返回数组
* @return void
*/
public function changeRelationGameidToGameid($ids,$type=false)
{
$rid = $this->field('id')->where(["relation_game_id"=>["in",$ids]])->select();
if($type){
return array_column($rid,'id');
}else{
return implode(",",array_column($rid,'id'));
}
}
/**
* 普通游戏id转关联游戏id
*
* @param [string/array] $ids
* @param boolean $type false:返回字符串 true:返回数组
* @return void
*/
public function changeGameidToRelationGameid($ids,$type=false)
{
$rid = $this->field('relation_game_id')->where(["id"=>["in",$ids]])->group("relation_game_id")->select();
if($type){
return array_column($rid,'relation_game_id');
}else{
return implode(",",array_column($rid,'relation_game_id'));
}
}
}

@ -77,7 +77,6 @@
<th>发票类型</th>
<th>税费费率</th>
<th>渠道费率</th>
<th>注册地址</th>
<th>注册电话</th>
@ -129,17 +128,17 @@
<td rowspan="{$data.row}">{$data.is_collection|default="--"}</td>
<td rowspan="{$data.row}">{$data.advance_amount|default="--"}</td>
<td rowspan="{$data.row}">{$data.has_advance_charge|default="--"}</td>
<td rowspan="{$data.row}">{$data.has_game_evidence|default="--"}</td>
<td rowspan="{$data.row}">{$data.is_sign_contract|default="--"}</td>
<td rowspan="{$data.row}">{$data.contract_time}</td>
<td rowspan="{$data.row}">{$data.validity_time}</td>
<td rowspan="{$data.row}">{$data.company_tax_no|default="--"}</td>
<td rowspan="{$data.row}">{$data.invoice_rate|showPercent}</td>
<td rowspan="{$data.row}">{$data.invoice_type|default="--"}</td>
<td rowspan="{$data.row}">{$data.taxation_rate|showPercent}</td>
<td rowspan="{$data.row}">{$data.channel_rate|showPercent}</td>
<td rowspan="{$data.row}">{$data.reg_address|default="--"}</td>
<td rowspan="{$data.row}">{$data.reg_phone|default="--"}</td>
@ -147,7 +146,6 @@
<td rowspan="{$data.row}">{$data.link_phone|default="--"}</td>
<td rowspan="{$data.row}">{$data.address|default="--"}</td>
<td rowspan="{$data.row}">{$data.has_server_fee|default="--"}</td>
<td rowspan="{$data.row}">{$data.server_fee|default="--"}</td>
<td rowspan="{$data.row}">{$data.cooperation_status|default="--"}</td>

Loading…
Cancel
Save