Merge pull request 'feature/change_group_auth' (#582) from feature/change_group_auth into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/582
master
廖金灵 3 years ago
commit ce404c8368

@ -1621,7 +1621,7 @@ function getGameList($partner_id) {
function getAdminData ($uid) { function getAdminData ($uid) {
$adminData = SM('auth_group_access','sys_') $adminData = SM('auth_group_access','sys_')
->field('data_empower_type,data_president,show_data,show_market_admin,show_promote,allow_over_week') ->field('data_empower_type,data_president,show_data,show_market_admin,show_promote,allow_over_week,show_merchant')
->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id') ->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id')
->where(array('uid'=>$uid))->find(); ->where(array('uid'=>$uid))->find();
@ -3286,7 +3286,7 @@ function getCpCompanySelect($type = 1){
* @return mixed * @return mixed
*/ */
function getMerchantList($type = 1){ function getMerchantList($type = 1){
if(A('Market','Event')->getConfig('isMarket')) return []; if(session('user_auth')['show_merchant'] == 0) return [];
$data = M("payment_merchant","tab_")->field("id,name,ways")->select(); $data = M("payment_merchant","tab_")->field("id,name,ways")->select();
return $data; return $data;
@ -3299,7 +3299,7 @@ function getMerchantList($type = 1){
* @return mixed * @return mixed
*/ */
function getMerchantName($id = 1){ function getMerchantName($id = 1){
if(A('Market','Event')->getConfig('isMarket')) return '--'; if(session('user_auth')['show_merchant'] == 0) return '--';
$data = M("payment_merchant","tab_")->field("name")->where(['id'=>$id])->find(); $data = M("payment_merchant","tab_")->field("name")->where(['id'=>$id])->find();
return $data['name']?$data['name']:'无'; return $data['name']?$data['name']:'无';

@ -536,7 +536,7 @@ class AuthManagerController extends AdminController{
$auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) $auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) )
->getfield('id,id,title,rules'); ->getfield('id,id,title,rules');
// var_dump($auth_group);die(); // var_dump($auth_group);die();
$empower_type = M('AuthGroup')->field('data_empower_type,show_data,show_market_admin,show_promote,allow_over_week')->where(array('id'=>$_GET['group_id']))->find(); $empower_type = M('AuthGroup')->field('data_empower_type,show_data,show_merchant,show_market_admin,show_promote,allow_over_week')->where(array('id'=>$_GET['group_id']))->find();
// var_dump($empower_type);die(); // var_dump($empower_type);die();
$this->assign('data_empower_type', $empower_type['data_empower_type']); $this->assign('data_empower_type', $empower_type['data_empower_type']);
@ -544,6 +544,7 @@ class AuthManagerController extends AdminController{
$this->assign('auth_group', $auth_group); $this->assign('auth_group', $auth_group);
$this->assign('show_market_admin', $empower_type['show_market_admin']); $this->assign('show_market_admin', $empower_type['show_market_admin']);
$this->assign('show_promote', $empower_type['show_promote']); $this->assign('show_promote', $empower_type['show_promote']);
$this->assign('show_merchant', $empower_type['show_merchant']);
$this->assign('allow_over_week', $empower_type['allow_over_week']); $this->assign('allow_over_week', $empower_type['allow_over_week']);
$this->display(); $this->display();
@ -558,6 +559,7 @@ class AuthManagerController extends AdminController{
$allow_over_week = I('allow_over_week'); $allow_over_week = I('allow_over_week');
$show_promote = I('show_promote'); $show_promote = I('show_promote');
$promoteData = I('promote_data'); $promoteData = I('promote_data');
$show_merchant = I('show_merchant');
// dump(json_decode($promoteData,true)); // dump(json_decode($promoteData,true));
// var_dump($promoteData);die(); // var_dump($promoteData);die();
@ -581,6 +583,10 @@ class AuthManagerController extends AdminController{
$promoteData = ''; $promoteData = '';
} }
if($data_empower_type == 2 && empty($promoteData)){
$this->error('部分数据必须选择1个会长');
}
if ($AuthGroup->where("id = {$gid}")->save(array( if ($AuthGroup->where("id = {$gid}")->save(array(
'data_empower_type' => $data_empower_type, 'data_empower_type' => $data_empower_type,
'data_president' => $promoteData, 'data_president' => $promoteData,
@ -588,6 +594,7 @@ class AuthManagerController extends AdminController{
'show_market_admin' => $show_market_admin, 'show_market_admin' => $show_market_admin,
'allow_over_week' => $allow_over_week, 'allow_over_week' => $allow_over_week,
'show_promote' => $show_promote, 'show_promote' => $show_promote,
'show_merchant'=>$show_merchant
))) { ))) {
resetUserAuth(); resetUserAuth();

@ -894,8 +894,8 @@ class FinancePromoteController extends AdminController
$marketAdmins = getAdminUsernameList($marketAdminIds); $marketAdmins = getAdminUsernameList($marketAdminIds);
$adminDepartments = getAdminDepartmentList($marketAdminIds); $adminDepartments = getAdminDepartmentList($marketAdminIds);
} }
$isMarketAdmin = A('Market','Event')->getConfig('isMarket'); $show_merchant = (session('user_auth')['show_merchant'] == 1) ? true : false;
if(!$isMarketAdmin){ if($show_merchant){
$merchant_data = M("payment_merchant","tab_") $merchant_data = M("payment_merchant","tab_")
->field("id,name") ->field("id,name")
->where("1=1") ->where("1=1")
@ -908,7 +908,7 @@ class FinancePromoteController extends AdminController
} }
foreach($data as $key => $value) { foreach($data as $key => $value) {
$data[$key]['merchant_name'] = $isMarketAdmin ? "--" : $handle_merchant[$value['merchant_id']]; $data[$key]['merchant_name'] = $show_merchant ? $handle_merchant[$value['merchant_id']] : "--";
$data[$key]['pay_way'] = getPayType($value['pay_way']); $data[$key]['pay_way'] = getPayType($value['pay_way']);
$data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']); $data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']);
$data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']); $data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']);

@ -4,759 +4,22 @@
namespace Admin\Controller; namespace Admin\Controller;
/** /**
* 新功能之后还未来的急跑的脚本初始化数据 * 新功能之后脚本初始化数据
* @author chenzhi
*/ */
class OldCountController extends \Think\Controller class OldCountController extends \Think\Controller
{ {
/**
* 奖惩初始化
*/
public function rewardResetInit()
{
$dbres = M('reward_detail', 'tab_')->alias('rd')
->field('rd.*,r.is_verify,r.verify_detail')
->join('tab_reward_record as r on rd.record_id = r.id', 'LEFT')
->select();
foreach ($dbres as $k => $v) {
# code...
$v['is_check'] = $v['is_verify'];
$v['check_detail'] = $v['verify_detail'];
unset($v['is_verify'],$v['verify_detail']);
$res = M('reward_detail', 'tab_')->save($v);
var_dump($res);
}
}
public function showMerchantInit()
/**
* 新增市场部其他用户组
*/
public function moreDepartment()
{
//1.新增组
$dbres = M('auth_group','sys_')->where("department_id = 2 and department_level != 5")->select();
// $ids = '32,33,34,35';
$ids = '';
foreach ($dbres as &$v) {
unset($v['id']);
$v['title'] = str_replace("二部","长沙",$v['title']);
$v['department_id'] = 3;
$v['department_name'] = '长沙分部';
$ids .= ( M('auth_group','sys_')->add($v) . ",");
}
$ids = rtrim($ids,',');
//3.增加部门表数据
M("department")->add([
'id'=>3,
'name'=>'长沙分部',
'group_ids'=>$ids,
'leader_group'=>'14',
'create_time'=>time(),
'update_time'=>time()
]);
}
public function setDataPresidentInit()
{
$marketEvent = A("Market","Event");
//获取所有二部公司
$uids = $marketEvent->getDepartmentUserId(2);
$promoteids = M("Promote","tab_")->where(["admin_id"=>['in',$uids],"level"=>1])->getField("id",true);
$marketEvent->removePresident($promoteids);
$save = [
"id"=>28,
"data_president"=>implode(",",$promoteids)
];
M('auth_group','sys_')->save($save);
}
//删除吴宏还是高级时候的数据
public function deleteWuhongAltogether()
{ {
//全部市场部不允许查看
$Event = A("Market","Event");
$gids = $Event->getMarketGroupId();
$where = [ $where = [
'level'=>12, 'id'=>['in',$gids]
'admin_id'=>34
]; ];
$res = M("market_altogether","tab_")->where($where)->delete(); echo M("auth_group","sys_")->where($where)->save(['show_merchant'=>0]);
var_dump($res);
} }
public function setLackStatementInfo() {
$arrkey = [
'A'=>'num',
'B'=>'company_name',
'C'=>'account',
'D'=>'company_belong_str',
'E'=>'company_relation_str',
'F'=>'nickname',
'G'=>'company_type',
'H'=>'game_name',
'I'=>'game_type_name',
'J'=>'time',
'K'=>'platform_amount',
'L'=>'refund',
'M'=>'ratio',
'N'=>'increment_ratio',
'O'=>'sum_money',
'P'=>'reward',
'Q'=>'fine',
'R'=>'withhold',
'S'=>'week_amount',
'T'=>'sum_money_s',
'U'=>'payee_name',
'V'=>'bank_account',
'W'=>'opening_bank',
'X'=>'is_payment',
'Y'=>'is_pay',
'Z'=>'remark'
];
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Asia/Shanghai');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel2007');
//设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/set_info.xls");
$objWriter = new \PHPExcel_Writer_Excel5($objPHPExcel);
$currentSheet = $objPHPExcel->getSheet(0); //读取excel文件中的第一个工作表
$allColumn = 90; //取得最大的列号
$allRow = $currentSheet->getHighestRow(); //取得一共有多少行
$excelResult = []; //声明数组
// dump($allColumn);die();
$startRow = 3;
for ($j = $startRow; $j <= $allRow; $j++) {
//从A列读取数据
for ($k = 65; $k <= $allColumn; $k++) {
// 读取单元格
$excelResult[$j][$arrkey[chr($k)]] = (string)$objPHPExcel->getActiveSheet()->getCell(chr($k)."$j")->getValue();
}
}
$handle_data = [];
$pool_data = [];
// dump($excelResult);
foreach ($excelResult as $key => $value) {
$is_continue = 0;
$company_info = M("promote_company","tab_")->field("id company_id,company_type,bank_card,bank_cardname,bank_name,bank_address,ali_user,ali_account")->where(['company_name'=>$value['company_name']])->find();
if(!$company_info) {
continue;
}
$lack_data = M("company_lack_statement_info","tab_")
->where([
'company_id'=>$company_info['company_id']
])
->select();
$time = explode('-',$value['time']);
$game_data = M("game","tab_")->where(['relation_game_name'=>$value['game_name']])->find();
foreach ($lack_data as $lkey => $lvalue) {
$statement_info = json_decode($lvalue['statement_info'],true);
// dump($statement_info);
foreach ($statement_info as $skey => $svalue) {
$game_list = $svalue['game_list'];
foreach ($game_list as $gkey => $gvalue) {
// if($company_info['company_id'] == 73&&$gvalue['pay_amount']=='12.00' ) {
// dump($svalue);
// dump($gvalue['statement_begin_time'] == $time['0']);
// dump($gvalue['statement_end_time'] == $time['1']);
// dump($gvalue['relation_game_id'] == $game_data['relation_game_id']);
// dump($gvalue['pay_amount'] == number_format($value['platform_amount'],2,'.',''));
// }
//存在的游戏流水内部条件,如果存在不进行下列操作
if ($gvalue['statement_begin_time'] == $time['0']
&&$gvalue['statement_end_time'] == $time['1']
&&$gvalue['relation_game_id'] == $game_data['relation_game_id']
&&$gvalue['pay_amount'] == number_format($value['platform_amount'],2,'.','')) {
$is_continue = 1;
}
}
}
}
//已经存在的单子结算
if ($is_continue) {
continue;
}
$handle_data[$value['time'].$company_info['company_id']]['company_id'] = $company_info['company_id'];
$handle_data[$value['time'].$company_info['company_id']]['company_type'] = $company_info['company_type'];
$handle_data[$value['time'].$company_info['company_id']]['company_name'] = $value['company_name'];
$companyInfo = [
'account'=>$value['account'],
'company_relation_str'=>$value['company_relation_str'],
'company_belong_str'=>$value['company_belong_str'],
'company_type_str'=>$value['company_type'],
'nickname'=>'nickname',
];
$relation = M("company_relation","tab_")
->where("(first_company_id = {$company_info['company_id']} and first_company_type!=3) or (second_company_id = {$company_info['company_id']} and second_company_type!=3)")
->find();
if ($relation['is_payment'] == 1) {
$companyInfo['ali_user'] = $company_info['ali_user'];
$companyInfo['ali_account'] = $company_info['ali_account'];
} else {
$companyInfo['payee_name'] = $company_info['bank_address'];
$companyInfo['bank_account'] = $company_info['bank_card'];
$companyInfo['opening_bank'] = $company_info['bank_name'];
}
$handle_data[$value['time'].$company_info['company_id']]['statement_money'] += $value['sum_money']-$value['fine']+$value['reward']-$value['withhold'];
$handle_data[$value['time'].$company_info['company_id']]['pay_amount'] += $value['sum_money']-$value['fine']+$value['reward']-$value['withhold'];
$handle_data[$value['time'].$company_info['company_id']]['company_info'] = json_encode($companyInfo);
$handle_data[$value['time'].$company_info['company_id']]['platform_amount'] += $value['platform_amount'];
$handle_data[$value['time'].$company_info['company_id']]['fine'] += $value['fine'];
$handle_data[$value['time'].$company_info['company_id']]['reward'] += $value['reward'];
$handle_data[$value['time'].$company_info['company_id']]['statement_begin_time'] = strtotime(str_replace('.','-',$time['0']));
$handle_data[$value['time'].$company_info['company_id']]['statement_end_time'] = strtotime(str_replace('.','-',$time['1']))+86399;
$p_id = M("promote","tab_")->field("id")->where(['account'=>$value['account']])->find();
if ($handle_data[$value['time'].$company_info['company_id']]['statement_info']) {
$handle_data[$value['time'].$company_info['company_id']]['statement_info'][0]['game_list'][] =
[
'pay_amount'=>$value['platform_amount'],
'relation_game_id'=>$game_data['relation_game_id'],
'game_name'=>$game_data['relation_game_name'],
'p_id'=>$p_id['id'],
'all_pay_amount'=>$value['platform_amount'],
'game_type_name'=>$game_data['game_type_name'],
'ratio'=>$value['ratio']*100,
'sum_money'=>number_format($value['sum_money'],2,'.',''),
'fax_ratio'=>0,
'statement_begin_time'=>$time['0'],
'statement_end_time'=>$time['1'],
'fine'=>$value['fine'],
'reward'=>$value['reward'],
'statement_type'=>0,
'refund'=>$value['refund'],
'withhold'=>$value['withhold'],
'increment_ratio'=>$value['increment_ratio']*100
];
} else {
$handle_data[$value['time'].$company_info['company_id']]['statement_info'][] = [
"account"=>$value['account'],
"game_list"=>[
[
'pay_amount'=>$value['platform_amount'],
'relation_game_id'=>$game_data['relation_game_id'],
'game_name'=>$game_data['relation_game_name'],
'p_id'=>$p_id['id'],
'all_pay_amount'=>$value['platform_amount'],
'game_type_name'=>$game_data['game_type_name'],
'ratio'=>$value['ratio']*100,
'sum_money'=>number_format($value['sum_money'],2,'.',''),
'fax_ratio'=>0,
'statement_begin_time'=>$time['0'],
'statement_end_time'=>$time['1'],
'fine'=>$value['fine'],
'reward'=>$value['reward'],
'statement_type'=>0,
'refund'=>$value['refund'],
'withhold'=>$value['withhold'],
'increment_ratio'=>$value['increment_ratio']*100
]
]
];
}
// $handle_data[$value['time'].$company_info['company_id']]['statement_info'] = $statement_info;
// del_lack_ids
$company_statement_pool = M("company_statement_pool","tab_")
->field("statement_num,del_lack_ids")
->where([
'statement_begin_time'=>$handle_data[$value['time'].$company_info['company_id']]['statement_begin_time'],
'statement_end_time'=>$handle_data[$value['time'].$company_info['company_id']]['statement_end_time'],
'company_type'=>2,
'withdraw_type'=>['neq',3]
])
->find();
$handle_data[$value['time'].$company_info['company_id']]['statement_pool_num'] = $company_statement_pool['statement_num']?$company_statement_pool['statement_num']:"";
$handle_data[$value['time'].$company_info['company_id']]['is_payment'] = $relation['is_payment'];
$handle_data[$value['time'].$company_info['company_id']]['remark'] = $company_statement_pool['remark'];
}
$handle_data = array_values($handle_data);
// dump($handle_data);
foreach ($handle_data as $key => $value) {
$value['statement_info'] = json_encode($value['statement_info']);
$lack_id = M("company_lack_statement_info","tab_")->add($value);
$pool_data[$value['statement_pool_num']]['del_lack_ids'][] = $lack_id;
}
$lack_data324 = M("company_lack_statement_info","tab_")
->where([
'id'=>324
])
->find();
$lack_data324['fine'] = 5000;
$lack_data324['statement_money'] = $lack_data324['statement_money']-5000;
$lack_data324['pay_amount'] = $lack_data324['pay_amount']-5000;
$statement_info324 = json_decode($lack_data324['statement_info'],true);
$statement_info324[0]['game_list'][0]['fine'] = 5000;
$lack_data324['statement_info'] = json_encode($statement_info324);
M("company_lack_statement_info","tab_")
->where([
'id'=>324
])->save($lack_data324);
$lack_data334 = M("company_lack_statement_info","tab_")
->where([
'id'=>334
])
->find();
$lack_data334['fine'] = 2000;
$lack_data334['statement_money'] = $lack_data334['statement_money']-2000;
$lack_data334['pay_amount'] = $lack_data334['pay_amount']-2000;
$statement_info334 = json_decode($lack_data334['statement_info'],true);
$statement_info334[0]['game_list'][0]['fine'] = 2000;
$lack_data334['statement_info'] = json_encode($statement_info334);
M("company_lack_statement_info","tab_")
->where([
'id'=>334
])->save($lack_data334);
echo "success";
// foreach ($pool_data as $key => $value) {
//
// $pool_info = M("company_statement_pool","tab_")
// ->where(['statement_num'=>$key])
// ->find();
//
// $del_lack_ids = $pool_info['del_lack_ids'].','.implode(',',$value['del_lack_ids']);
// M("company_statement_pool","tab_")
// ->where(['statement_num'=>$key])
// ->save(['del_lack_ids'=>$del_lack_ids]);
//
// }
// M("company_lack_statement_info","tab_")->addAll($handle_data);
// dump($handle_data);
}
public function updateStatementInfo() {
$data = M("company_statement_info","tab_")
->where(['pay_status'=>['neq',0]])
->select();
foreach ($data as $key => $value) {
M("company_statement_info","tab_")
->where(['id'=>$value['id']])
->save([
'pay_verify_status'=>1,
'verify_time'=>$value['pay_time'],
'verify_member_id'=>1
]);
}
$data = M("excel_statement_info","tab_")
->where("1=1")
->select();
foreach ($data as $key => $value) {
$statement_info = json_decode($value['statement_info'],true);
$time = explode('-',$statement_info[0]['game_list'][0]['statement_time']);
$start = strtotime(str_replace('.','-',$time[0]));
$end = strtotime(str_replace('.','-',$time[1]));
M("excel_statement_info","tab_")
->where(['id'=>$value['id']])
->save([
'statement_begin_time'=>$start,
'statement_end_time'=>$end
]);
// dump($statement_info);
}
$data = M("excel_statement_info","tab_")
->where(['pay_status'=>['neq',0]])
->select();
foreach ($data as $key => $value) {
M("excel_statement_info","tab_")
->where(['id'=>$value['id']])
->save([
'verify_status'=>1,
'verify_time'=>$value['pay_time'],
'verify_member_id'=>1
]);
}
echo "success";
}
public function oldRewardChange() {
$data = M("company_lack_statement_info","tab_")
->where("(fine > 0 or reward > 0) and company_type != 2")
->select();
foreach ($data as $key => $value) {
$statement_info = json_decode($value['statement_info'],true);
$statement_info[0]['fine'] = $value['fine'];
$statement_info[0]['reward'] = $value['reward'];
$statement_info = json_encode($statement_info);
M("company_lack_statement_info","tab_")->where(['id'=>$value['id']])->save(['statement_info'=>$statement_info]);
}
$data = M("company_statement_info","tab_")
->where("(fine > 0 or reward > 0) and company_type != 2")
->select();
foreach ($data as $key => $value) {
$statement_info = json_decode($value['statement_info'],true);
$statement_info[0]['fine'] = $value['fine'];
$statement_info[0]['reward'] = $value['reward'];
$statement_info = json_encode($statement_info);
M("company_statement_info","tab_")->where(['id'=>$value['id']])->save(['statement_info'=>$statement_info]);
}
echo "success";
}
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";
}
public function changeDevelopTypeData() {
$is_save = M("promote","tab_")->where(['company_relation'=>2])->save(['company_relation'=>1]);
$is_save = M("promote_company","tab_")->where(['develop_type'=>2])->save(['develop_type'=>1]);
//更新tab_company_statement_info表的数据
$company_statement = M("company_statement_info","tab_")->field("id,company_info")->where(['company_info'=>['like',"%自主开发及维护%"]])->select();
foreach ($company_statement as $key => $value) {
$replace_statement = str_replace('自主开发及维护','自主开发',$value['company_info']);
M("company_statement_info","tab_")->where(['id'=>$value['id']])->save(['company_info'=>$replace_statement]);
}
//更新tab_company_lack_statement_info表的数据
$company_statement = M("company_lack_statement_info","tab_")->field("id,company_info")->where(['company_info'=>['like',"%自主开发及维护%"]])->select();
foreach ($company_statement as $key => $value) {
$replace_statement = str_replace('自主开发及维护','自主开发',$value['company_info']);
M("company_lack_statement_info","tab_")->where(['id'=>$value['id']])->save(['company_info'=>$replace_statement]);
}
echo "success\n";
}
/**
* 公会关系及游戏迁移
* 1. 迁移 公会company_relation到公司
* 2. 游戏 game_ids
* 3. 同步公司develop_type到公会
*/
public function changeOldCompanyRelation()
{
//默认设为
$Promote = M("Promote","tab_");
$PromoteCompany = M("promote_company","tab_");
$p_res = $Promote->field("id,account,game_ids,company_relation,company_id")->where("level = 1")->group("company_id")->select();
foreach ($p_res as $k => $v) {
if($v['id'] < 1) continue;
$savedata =[ "id"=>$v['company_id'] ];
if($v['company_relation'] == 1){
$savedata['develop_type'] = 3;
}else{
$savedata['develop_type'] = 2;
}
$savedata['game_ids'] = $this->changeGameidToRelationGameid($v['game_ids']);
$PromoteCompany->save($savedata);
$p_data = [
"company_relation"=>$savedata['develop_type']
];
$Promote->where("company_id = {$v['company_id']}")->save($p_data);
}
echo "changeOldCompanyRelation success";
}
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'));
}
}
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
*/
public function ChangePartnerField_ChannelRateInvoiceRate()
{
if(time() > 1596211200){
die("该函数已失效");
}
$Partner = M("Partner","tab_");
$dbres = $Partner->field("id,channel_rate,invoice_rate")->select();
foreach ($dbres as $k => &$v) {
$v['channel_rate'] = $v['channel_rate']*100;
$v['invoice_rate'] = $v['invoice_rate']*100;
$Partner->save($v);
}
echo "ChangePartnerField_ChannelRateInvoiceRate success";
}
/**
* 新的游戏比例后的数据迁移
* 重复执行将会叠加数据,请勿重复执行
*/
public function PromoteToCompanyRatioInit()
{
//获取旧数据
$oldres = M("promote_game_ratio","tab_")->field("promote_id,relation_game_id,ratio,turnover_ratio,begin_time,end_time")->group("promote_id,relation_game_id")->select();
$adddata = [];
$CompanyGameRatio = M("company_game_ratio","tab_");
foreach ($oldres as $k => &$v) {
$comoany_id = $this->promoteIdToCompanyId($v['promote_id']);
unset($v['promote_id']);
$v['company_id'] = $comoany_id ;
$adddata[$comoany_id] = $v;
}
foreach($adddata as $k => &$v){
$map = [
"company_id"=>$v['company_id'],
"relation_game_id"=>$v['relation_game_id']
];
$cres = $CompanyGameRatio->where($map)->find();
if(empty($cres)){
$CompanyGameRatio->add($v);
}
}
echo "PromoteToCompanyRatioInit success";
}
protected function promoteIdToCompanyId($promote_id)
{
return M("promote","tab_")->field("company_id")->where("id='{$promote_id}'")->find()['company_id'];
}
/**
* 财务分类汇总统计旧数据聚合
*/
public function FinancialSummaryInit()
{
$sql = "truncate table tab_financial_summary";
if(IS_SUBSITE){
$res =M()->db(1,SUBSITE_DB)->execute($sql);
}else {
//清空数据库
$res = M()->execute($sql);
}
echo "tab_financial_summary 清空成功".PHP_EOL;
//获取19年9月到上个月的所有月份
$monthList = $this->getMonthsList();
$Financial = new FinancialSummarySetController();
foreach ($monthList as $k => $v) {
$Financial->setMonthFinancialSummary($v);
}
}
/*
*超级签订单新增识别微信或者支付宝2019-12-11
*/
public function gameSupersignPaywayInit()
{
$map = array(
"pay_status"=>1,
"pay_way"=>0
);
$GameSupersign = M("GameSupersign","tab_");
$dbres = $GameSupersign->field("id,trade_id")->where($map)->select();
$countdb = count($dbres);
if($countdb < 1){
die("No initialization required");
}
foreach ($dbres as $key => $value) {
$savedata = array(
"id"=>$value['id']
);
$tmp = (int)substr($value['trade_id'],0,4);
if($tmp > 3000){
$savedata['pay_way'] = 2; //微信
}else{
$savedata['pay_way'] = 1;//支付宝
}
$tres = $GameSupersign->save($savedata);
if($tres === false){
die("DB ERROR");
}
}
die("init ok");
}
/**
* mend表新增paymount字段用于统计补链前归属金额
*/
public function mendPayamountInit()
{
//获取符合条件的
$map = array("pay_amount"=>0);
$Mend = M("mend","tab_");
$Spend = M("Spend","tab_");
$Mend->where($map)->select();
$dbres = $Mend->field("id,user_account,promote_account,order_time,create_time")->where($map)->select();
$countdb = count($dbres);
if($countdb < 1) die("No initialization required");
echo "总需要统计数:{$countdb}".PHP_EOL;
foreach ($dbres as $key => $value) {
$savedata = array("id"=>$value['id']);
$saveflag = false;
//设置订单时间
$order_time = $value['order_time'];
if($value['order_time'] == 0){
$saveflag = true;
$savedata['order_time'] = $value['create_time'];
$order_time = $savedata['create_time'];
}
//获取金额
$smap = array(
"user_account"=>$value['user_account'],
"promote_account"=>$value['promote_account'],
"pay_time"=>array("LT",$order_time),
"pay_status"=>1
);
$pay_amount = $Spend->field("IFNULL(sum(pay_amount),0) pay_amount")->where($smap)->find()["pay_amount"];
if($pay_amount > 0){
$saveflag = true;
$savedata['pay_amount'] = $pay_amount;
}
if($saveflag){
$tres = $Mend->save($savedata);
if($tres === false){
die("DB ERROR");
}
}
if( $key % 20 == 0){
$j = (floor)($key/$countdb*100);
echo "当前进度:{$j}%".PHP_EOL;
}
}
die("init ok");
}
/**
* 修改公会内外团关系跟随公司 旧数据跟随 20200318
*/
public function promoteCompanyBelongInit()
{
//获取所有公司
$comoany = M("PromoteCompany","tab_")->field("id,company_belong,develop_type")->select();
$comoany[] = ["id"=>0,"company_belong"=>0,"develop_type"=>0]; //海南万盟
$count = count($comoany);
$promote = M("Promote","tab_");
for ($i=0; $i < $count; $i++) {
$savedata = array(
"company_belong"=>$comoany[$i]['company_belong'],
"company_relation"=>$comoany[$i]['develop_type'],
);
$tmpid = $comoany[$i]['id'];
$promote->where("company_id ='{$tmpid}'")->save($savedata);
}
die("promoteCompanyBelongInit success");
}
//获取公司月结所需要的所有月份截止至上个月
public function getMonthsList()
{
$start_month = "2019-09";
$temp = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month')));
$end_month = date('Y',$temp)."-".date('m',$temp);
$time_arr = [];
$begin = new \DateTime($start_month);
$end = new \DateTime($end_month);
$end = $end->modify('+1 month');
$interval = new \DateInterval('P1M');
$daterange = new \DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
$time_arr[] = $date->format("Y-m");
}
return $time_arr;
}
public function eventTest($event,$action,$arg = false) public function eventTest($event,$action,$arg = false)
{ {
$Event = A($event,"Event"); $Event = A($event,"Event");

@ -117,6 +117,7 @@ class PublicController extends \Think\Controller
'data_empower_type'=>$adminData['data_empower_type'], 'data_empower_type'=>$adminData['data_empower_type'],
'data_president'=>$adminData['data_president'], 'data_president'=>$adminData['data_president'],
'show_data'=>$adminData['show_data'], 'show_data'=>$adminData['show_data'],
'show_merchant'=>$adminData['show_merchant']
); );
//登录有效时间改为6小时 //登录有效时间改为6小时
$expireTime = 3600; $expireTime = 3600;

@ -384,7 +384,7 @@ class StatementMangementController extends ThinkController
$list = SM('reward_record', 'tab_')->alias('r') $list = SM('reward_record', 'tab_')->alias('r')
->field(' ->field('
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,r.is_verify,rd.is_check,rd.check_detail,IFNULL(pc.company_belong,0) company_belong, r.id, r.relation_game_id, r.reward_time,r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,r.is_verify,rd.is_check,rd.check_detail,IFNULL(pc.company_belong,0) company_belong,
rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount
') ')
->where($map) ->where($map)
@ -413,6 +413,7 @@ class StatementMangementController extends ThinkController
'relation_game_partner' => $companys[1][$games[$item['relation_game_id']]['partner_id']] ?? '无', 'relation_game_partner' => $companys[1][$games[$item['relation_game_id']]['partner_id']] ?? '无',
'settlement_time' => $item['settlement_time'] ? date('Y年m月', $item['settlement_time']) : '-', 'settlement_time' => $item['settlement_time'] ? date('Y年m月', $item['settlement_time']) : '-',
'confirm_time' => $item['confirm_time'] ? date('Y-m-d', $item['confirm_time']) : '-', 'confirm_time' => $item['confirm_time'] ? date('Y-m-d', $item['confirm_time']) : '-',
'reward_time' => $item['reward_time'] ? date('Y-m-d', $item['reward_time']) : '-',
'content' => $item['content'], 'content' => $item['content'],
'reward_type_text' => RewardModel::$rewardTypes[$item['reward_type']], 'reward_type_text' => RewardModel::$rewardTypes[$item['reward_type']],
'maxCount' => 0, 'maxCount' => 0,
@ -478,6 +479,7 @@ class StatementMangementController extends ThinkController
// ksort($record); // ksort($record);
// dd($record); // dd($record);
$this->assign('list', $record); $this->assign('list', $record);
// dd($record);
$this->assign('promoters', array_column(SM('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id')); $this->assign('promoters', array_column(SM('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id'));
$this->assign('company_belong',getCompanyBlong()); $this->assign('company_belong',getCompanyBlong());

@ -83,6 +83,7 @@ class MemberModel extends Model {
'show_market_admin'=>$adminData['show_market_admin'], 'show_market_admin'=>$adminData['show_market_admin'],
'allow_over_week' => $adminData['allow_over_week'], 'allow_over_week' => $adminData['allow_over_week'],
'show_promote'=>$adminData['show_promote'], 'show_promote'=>$adminData['show_promote'],
'show_merchant'=>$adminData['show_merchant']
); );
session('user_group_id',$groupId); session('user_group_id',$groupId);
session('user_auth', $auth); session('user_auth', $auth);

@ -130,6 +130,25 @@
</td> </td>
</tr> </tr>
<tr>
<td class="l noticeinfo" style="padding-left: 15px;">是否展示商户:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="show_merchant"
<if condition="$show_merchant==1"> checked </if>> 是
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="show_merchant"
<if condition="$show_merchant==0"> checked </if>> 否
</label>
</span>
<span class="notice-text">游戏充值,公会统计中订单统计商户列展示</span>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -174,106 +193,107 @@
<script> <script>
var dataTransfer = ''; var dataTransfer = '';
$.ajax({ $(function () {
url: "{:U('getRootPromote')}", layui.use(['transfer', 'layer', 'util'], function(){
type: "post", var $ = layui.$ ,transfer = layui.transfer,layer = layui.layer ,util = layui.util;
data: {group_id: $('#group_id').val()}, $.ajax({
dataType: 'json', url: "{:U('getRootPromote')}",
success: function (data) { type: "post",
// datas = data; data: {group_id: $('#group_id').val()},
layui.use(['transfer', 'layer', 'util'], function(){ dataType: 'json',
var $ = layui.$ success: function (data) {
,transfer = layui.transfer // datas = data;
,layer = layui.layer var data1 =data;
,util = layui.util; var data2 = [];
if (JSON.parse(data1).data_president) {
var data1 =data; data2 = JSON.parse(data1).data_president.split(",");
var data2 = []; }
if (JSON.parse(data1).data_president) { // var dataTransfers = transfer.getData('key123');
data2 = JSON.parse(data1).data_president.split(","); // $('#promote_data').val(JSON.stringify(dataTransfers));
} //显示搜索框
// var dataTransfers = transfer.getData('key123'); transfer.render({
// $('#promote_data').val(JSON.stringify(dataTransfers)); elem: '#test4'
//显示搜索框 ,data: JSON.parse(data1).list
transfer.render({ ,title: ['全部成员', '选中成员']
elem: '#test4' ,showSearch: true,
,data: JSON.parse(data1).list value: data2,
,title: ['全部成员', '选中成员'] id: 'key123',
,showSearch: true, onchange: function(data, index){
value: data2,
id: 'key123',
onchange: function(data, index){
dataTransfer = transfer.getData('key123'); //获取右侧数据 dataTransfer = transfer.getData('key123'); //获取右侧数据
if (index == 0) { if (index == 0) {
for (var i=0;i<data.length;i++) { for (var i=0;i<data.length;i++) {
data2.push(data[i]['value']); data2.push(data[i]['value']);
} }
$('#promote_data').val(JSON.stringify(dataTransfer)); $('#promote_data').val(JSON.stringify(dataTransfer));
return; return;
} else if (index == 1){ } else if (index == 1){
for(var i=0;i<data2.length;i++) for(var i=0;i<data2.length;i++)
{ {
console.log(data2[i]) console.log(data2[i])
for(var j=0;j<data.length;j++) { for(var j=0;j<data.length;j++) {
if (data2[i]==data[j]['value']) { if (data2[i]==data[j]['value']) {
data2.splice(i,1); data2.splice(i,1);
i=i-1; i=i-1;
}
} }
} }
// data2.push(data[0]['value']);
transfer.reload('key123',{elem: '#test4',data: JSON.parse(data1).list,title: ['全部成员', '选中成员'],showSearch: true,value: data2,id: 'key123'});
dataTransfer = transfer.getData('key123');
$('#promote_data').val(JSON.stringify(dataTransfer));
return;
} }
// data2.push(data[0]['value']);
transfer.reload('key123',{elem: '#test4',data: JSON.parse(data1).list,title: ['全部成员', '选中成员'],showSearch: true,value: data2,id: 'key123'});
dataTransfer = transfer.getData('key123');
$('#promote_data').val(JSON.stringify(dataTransfer));
return;
} }
})
} var dataTransfers = transfer.getData('key123');
}) $('#promote_data').val(JSON.stringify(dataTransfers));
transfets = transfer;
var dataTransfers = transfer.getData('key123'); //批量办法定事件
$('#promote_data').val(JSON.stringify(dataTransfers)); util.event('lay-demoTransferActive', {
transfets = transfer; getData: function(othis){
//批量办法定事件 var getData = transfer.getData('key123'); //获取右侧数据
util.event('lay-demoTransferActive', { layer.alert(JSON.stringify(getData));
getData: function(othis){ }
var getData = transfer.getData('key123'); //获取右侧数据 ,reload:function(){
layer.alert(JSON.stringify(getData)); //实例重载
} transfer.reload('key123', {
,reload:function(){ title: ['文人', '喜欢的文人']
//实例重载 ,value: ['2', '5', '9']
transfer.reload('key123', { ,showSearch: true
title: ['文人', '喜欢的文人'] })
,value: ['2', '5', '9'] }
,showSearch: true });
})
}
});
});
}
});
$(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val(); }
$('#status').val(status); });
});
$(":radio").click(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val(); var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status); $('#status').val(status);
if (status != 2) { ajaxPostCallback(function(){
$("#test4").css('display','none'); dataTransfer = transfer.getData('key123');
$('#promote_data').val('[]');
} else {
$("#test4").css('display','block');
$('#promote_data').val(JSON.stringify(dataTransfer)); $('#promote_data').val(JSON.stringify(dataTransfer));
} })
})
$(":radio").click(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status);
if (status != 2) {
$("#test4").css('display','none');
$('#promote_data').val('[]');
} else {
$("#test4").css('display','block');
$('#promote_data').val(JSON.stringify(dataTransfer));
}
})
});
});
</script> </script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
@ -281,7 +301,7 @@
location.href = this.value; location.href = this.value;
}); });
//导航高亮 //导航高亮
highlight_subnav('{:U('AuthManager/index')}'); highlight_subnav("{:U('AuthManager/index')}");
</script> </script>
<style> <style>

@ -35,8 +35,8 @@
<th rowspan="2">序号</th> <th rowspan="2">序号</th>
<th>游戏名</th> <th>游戏名</th>
<th>游戏合作方</th> <th>游戏合作方</th>
<th>奖惩时间~确认时间</th>
<th >结算时间</th> <th >结算时间</th>
<th>奖惩确认时间</th>
<th style="width: 350px;">事件说明</th> <th style="width: 350px;">事件说明</th>
<th>奖惩性质</th> <th>奖惩性质</th>
<th>添加人</th> <th>添加人</th>
@ -68,8 +68,8 @@
<td rowspan="{$data['row']}">{$k}</td> <td rowspan="{$data['row']}">{$k}</td>
<td>{$data['relation_game_name']}</td> <td>{$data['relation_game_name']}</td>
<td>{$data['relation_game_partner']}</td> <td>{$data['relation_game_partner']}</td>
<td>{$data['reward_time']}~{$data['confirm_time']}</td>
<td>{$data['settlement_time']}</td> <td>{$data['settlement_time']}</td>
<td>{$data['confirm_time']}</td>
<td>{$data['content']}</td> <td>{$data['content']}</td>
<td>{$data['reward_type_text']}</td> <td>{$data['reward_type_text']}</td>
<td>{:get_admin_name($data['creater_id'])}</td> <td>{:get_admin_name($data['creater_id'])}</td>

@ -199,8 +199,8 @@
<th rowspan="2"><input class="check-all" type="checkbox"></th> <th rowspan="2"><input class="check-all" type="checkbox"></th>
<th>游戏名</th> <th>游戏名</th>
<th>游戏合作方</th> <th>游戏合作方</th>
<th>奖惩时间~确认时间</th>
<th >结算时间</th> <th >结算时间</th>
<th>奖惩确认时间</th>
<th style="width: 350px;">事件说明</th> <th style="width: 350px;">事件说明</th>
<th>奖惩性质</th> <th>奖惩性质</th>
<th>添加人</th> <th>添加人</th>
@ -233,8 +233,8 @@
<td rowspan="{$data['row']}"><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td> <td rowspan="{$data['row']}"><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data['relation_game_name']}</td> <td>{$data['relation_game_name']}</td>
<td>{$data['relation_game_partner']}</td> <td>{$data['relation_game_partner']}</td>
<td>{$data['reward_time']}~{$data['confirm_time']}</td>
<td>{$data['settlement_time']}</td> <td>{$data['settlement_time']}</td>
<td>{$data['confirm_time']}</td>
<td>{$data['content']}</td> <td>{$data['content']}</td>
<td>{$data['reward_type_text']}</td> <td>{$data['reward_type_text']}</td>
<td>{:get_admin_name($data['creater_id'])}</td> <td>{:get_admin_name($data['creater_id'])}</td>

@ -406,6 +406,36 @@ function showTab() {
$("." + target).addClass("in"); $("." + target).addClass("in");
}).filter("[data-tab=tab" + window.location.hash.substr(1) + "]").click(); }).filter("[data-tab=tab" + window.location.hash.substr(1) + "]").click();
} }
function ajaxPostCallback(callback){
$('.ajax-post').off("click");
$('.ajax-post').click(function(){
callback();
var that = $(this);
if(check_post_submit(that)) {
if ( that.hasClass('confirm') ) {
post_delnotic(that);
} else if(that.hasClass('confirm_dialog')){
post_confirm_dialog(that);
} else if(that.hasClass('pack')) {
post_submit(that);
} else if(that.hasClass('ajax-loading')) {
updateAlert('正在提交');
post_submit(that);
} else {
post_submit(that);
}
} else {
updateAlert('请选择需要操作的数据','tip_error');
setTimeout(function(){
$('#tip').find('.tipclose').click();
},1500);
}
return false;
});
}
function oldshowTab() { function oldshowTab() {
$(".tab-nav li").click(function(){ $(".tab-nav li").click(function(){
var self = $(this), target = self.data("tab"); var self = $(this), target = self.data("tab");

Loading…
Cancel
Save