diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 7b6de2193..6cd6e4aa3 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1621,7 +1621,7 @@ function getGameList($partner_id) { function getAdminData ($uid) { $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') ->where(array('uid'=>$uid))->find(); @@ -3286,7 +3286,7 @@ function getCpCompanySelect($type = 1){ * @return mixed */ 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(); return $data; @@ -3299,7 +3299,7 @@ function getMerchantList($type = 1){ * @return mixed */ 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(); return $data['name']?$data['name']:'无'; diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index 586701fd3..64bb639fa 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -536,7 +536,7 @@ class AuthManagerController extends AdminController{ $auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) ->getfield('id,id,title,rules'); // 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(); $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('show_market_admin', $empower_type['show_market_admin']); $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->display(); @@ -558,6 +559,7 @@ class AuthManagerController extends AdminController{ $allow_over_week = I('allow_over_week'); $show_promote = I('show_promote'); $promoteData = I('promote_data'); + $show_merchant = I('show_merchant'); // dump(json_decode($promoteData,true)); // var_dump($promoteData);die(); @@ -581,6 +583,10 @@ class AuthManagerController extends AdminController{ $promoteData = ''; } + if($data_empower_type == 2 && empty($promoteData)){ + $this->error('部分数据,必须选择1个会长'); + } + if ($AuthGroup->where("id = {$gid}")->save(array( 'data_empower_type' => $data_empower_type, 'data_president' => $promoteData, @@ -588,6 +594,7 @@ class AuthManagerController extends AdminController{ 'show_market_admin' => $show_market_admin, 'allow_over_week' => $allow_over_week, 'show_promote' => $show_promote, + 'show_merchant'=>$show_merchant ))) { resetUserAuth(); diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index a9078a5d7..87a599552 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -894,8 +894,8 @@ class FinancePromoteController extends AdminController $marketAdmins = getAdminUsernameList($marketAdminIds); $adminDepartments = getAdminDepartmentList($marketAdminIds); } - $isMarketAdmin = A('Market','Event')->getConfig('isMarket'); - if(!$isMarketAdmin){ + $show_merchant = (session('user_auth')['show_merchant'] == 1) ? true : false; + if($show_merchant){ $merchant_data = M("payment_merchant","tab_") ->field("id,name") ->where("1=1") @@ -908,7 +908,7 @@ class FinancePromoteController extends AdminController } 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]['game_name'] =clearGameNameType($data[$key]['game_name']); $data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']); diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index d14322094..2ef39a203 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -4,759 +4,22 @@ namespace Admin\Controller; /** - * 新功能之后还未来的急跑的脚本初始化数据 - * @author chenzhi + * 新功能之后脚本初始化数据 */ 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 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() + public function showMerchantInit() { + //全部市场部不允许查看 + $Event = A("Market","Event"); + $gids = $Event->getMarketGroupId(); $where = [ - 'level'=>12, - 'admin_id'=>34 + 'id'=>['in',$gids] ]; - $res = M("market_altogether","tab_")->where($where)->delete(); - var_dump($res); + echo M("auth_group","sys_")->where($where)->save(['show_merchant'=>0]); } - 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 : '
'); - - 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) { $Event = A($event,"Event"); diff --git a/Application/Admin/Controller/PublicController.class.php b/Application/Admin/Controller/PublicController.class.php index b1a5c93e8..4a4d8528b 100644 --- a/Application/Admin/Controller/PublicController.class.php +++ b/Application/Admin/Controller/PublicController.class.php @@ -117,6 +117,7 @@ class PublicController extends \Think\Controller 'data_empower_type'=>$adminData['data_empower_type'], 'data_president'=>$adminData['data_president'], 'show_data'=>$adminData['show_data'], + 'show_merchant'=>$adminData['show_merchant'] ); //登录有效时间改为6小时 $expireTime = 3600; diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index cd937292b..dfabd0d8b 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -384,7 +384,7 @@ class StatementMangementController extends ThinkController $list = SM('reward_record', 'tab_')->alias('r') ->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 ') ->where($map) @@ -413,6 +413,7 @@ class StatementMangementController extends ThinkController 'relation_game_partner' => $companys[1][$games[$item['relation_game_id']]['partner_id']] ?? '无', 'settlement_time' => $item['settlement_time'] ? date('Y年m月', $item['settlement_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'], 'reward_type_text' => RewardModel::$rewardTypes[$item['reward_type']], 'maxCount' => 0, @@ -478,6 +479,7 @@ class StatementMangementController extends ThinkController // ksort($record); // dd($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('company_belong',getCompanyBlong()); diff --git a/Application/Admin/Model/MemberModel.class.php b/Application/Admin/Model/MemberModel.class.php index 4742829ee..90356e9e3 100644 --- a/Application/Admin/Model/MemberModel.class.php +++ b/Application/Admin/Model/MemberModel.class.php @@ -83,6 +83,7 @@ class MemberModel extends Model { 'show_market_admin'=>$adminData['show_market_admin'], 'allow_over_week' => $adminData['allow_over_week'], 'show_promote'=>$adminData['show_promote'], + 'show_merchant'=>$adminData['show_merchant'] ); session('user_group_id',$groupId); session('user_auth', $auth); diff --git a/Application/Admin/View/AuthManager/dataempower.html b/Application/Admin/View/AuthManager/dataempower.html index 5ee3d36fe..c25437a90 100644 --- a/Application/Admin/View/AuthManager/dataempower.html +++ b/Application/Admin/View/AuthManager/dataempower.html @@ -130,6 +130,25 @@ + + 是否展示商户: + + + + + + 游戏充值,公会统计中订单统计商户列展示 + + + + + @@ -174,106 +193,107 @@