diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 121f5b719..ecbb4c51d 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -3297,4 +3297,14 @@ function array_repeat($array,$keyid="id",$desc=false) $c = array_rsort($c,true); } return $c; +} + +function getShiftingMends(array $userIds = null) +{ + $map = ['status' => 0]; + if (!is_null($userIds)) { + $map['user_id'] = ['in', $userIds]; + } + $mends = M('mend', 'tab_')->field(['id', 'user_id'])->where($map)->select(); + return index_by_column('user_id', $mends); } \ No newline at end of file diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index f43863e4c..76176d0ac 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -572,7 +572,7 @@ class AuthManagerController extends AdminController{ $promoteData = ''; } - if ($AuthGroup->where("id = {$gid}")->syncSave(array( + if ($AuthGroup->where("id = {$gid}")->save(array( 'data_empower_type' => $data_empower_type, 'data_president' => $promoteData, 'show_data' => $show_data, diff --git a/Application/Admin/Controller/CompanyStatementOfflineController.class.php b/Application/Admin/Controller/CompanyStatementOfflineController.class.php index 062711b1f..87d5e9f8f 100644 --- a/Application/Admin/Controller/CompanyStatementOfflineController.class.php +++ b/Application/Admin/Controller/CompanyStatementOfflineController.class.php @@ -293,8 +293,9 @@ class CompanyStatementOfflineController extends ThinkController M("company_statement_info_part","tab_")->save($savedata); } else { - $ydata = $CompanyInfo->where("id= '{$keys[1]}'")->find(); + $ydata = $CompanyInfo->where("id= '{$k}'")->find(); $company_info = json_decode($ydata['company_info'],true); + if($ydata['verify_status'] == 2){ $company_info['payee_name'] = $v['payee_name']; $company_info['bank_account'] = $v['bank_account']; diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 2fd65a85e..45f3f9828 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -278,6 +278,20 @@ class CompanyStatementPoolController extends ThinkController }else{ $pool_info["payment"] = '--'; } + + //获取基本信息 + $payedData = SM("company_statement_info","tab_") + ->field("SUM(CASE WHEN verify_status = 2 THEN statement_money ELSE 0 END) as offline_amount,SUM(CASE WHEN verify_status != 2 THEN statement_money ELSE 0 END) as online_amount") + ->where("pool_id = '{$id}'")->find(); + +// $payedData = SM("company_statement_info","tab_") +// ->field("*") +// ->where("pool_id = '{$id}' and verify_status = 2")->select(); +// +// dump($payedData);die(); + + $this->assign("payed_data",$payedData); + // dump($pool_info);die(); $statement_num = $pool_info['statement_num']; $this->assign("pool_data",$pool_info); @@ -312,11 +326,11 @@ class CompanyStatementPoolController extends ThinkController $infolist = SM("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}' and pay_status!=1")->select(); //获取母单 $pool_info = SM("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time')->where("id={$id}")->find(); - if(!empty($pool_info['create_lack_ids'])){ - $l_ids = $pool_info['create_lack_ids']; - $lack_info = SM("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select(); - $infolist =array_merge($infolist,$lack_info); - } +// if(!empty($pool_info['create_lack_ids'])){ +// $l_ids = $pool_info['create_lack_ids']; +// $lack_info = SM("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select(); +// $infolist =array_merge($infolist,$lack_info); +// } // dump($infolist);die(); diff --git a/Application/Admin/Controller/CompanySystemRatioController.class.php b/Application/Admin/Controller/CompanySystemRatioController.class.php new file mode 100644 index 000000000..7fc39dfa3 --- /dev/null +++ b/Application/Admin/Controller/CompanySystemRatioController.class.php @@ -0,0 +1,369 @@ +admininfo = $_SESSION['onethink_admin']['user_auth']; + parent::_initialize(); + } + + //比例类型 0-内团 1-外团 2-分发联盟 3上游游戏 4聚合比例 + private $checkRatio = [0,1,2,3,4]; + + public function index() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + //权限分配 + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + + $map = []; + + + + $data = M("game_ratio_mould","tab_")->where($map)->select(); + + $handleData=[]; + $handleData = $this->getAggregateData(); + + foreach ($data as $key => $value) { + $handleData[$value['relation_game_id']][$value['company_belong']][] = ['turnover'=>"0.00",'ratio'=>$value['ratio'],'instanceof'=>1]; + + $handleData[$value['relation_game_id']][$value['company_belong']]=array_merge($handleData[$value['relation_game_id']][$value['company_belong']],json_decode($value['turnover_ratio'],true)??[]); + } + + $handleData = $this->getCpGameRatio($handleData); + $data = $this->handleRatio($handleData); + + $checkData = $handleData; + +// dump($data);die(); + + $gameData = M("game","tab_")->field("original_package_name,relation_game_name game_name,game_type_name,relation_game_id game_id") + ->where($map) + ->group("original_package_name") + ->select(); + $gameOriginData = M("game","tab_")->field("original_package_name,relation_game_name game_name,relation_game_id")->where($map)->group("relation_game_id")->select(); + //类型区分 + $handleGameData = []; + foreach ($gameData as $key => $value) { + if ($value['game_type_name']) { + $handleGameData[$value['game_type_name']][] = $value; + } + } + //游戏原包名区分 + $handleOriginData = []; + foreach ($gameOriginData as $key => $value) { + if ($value['original_package_name']) { + $handleOriginData[$value['original_package_name']][] = $value; + } + } + + //将比例打进游戏中 + foreach ($handleOriginData as $key => $value) { + foreach ($value as $k => $v) { + $handleOriginData[$key][$k]['ratio_data'] = $data[$v['relation_game_id']]; + + } + } + + //处理数据 + $data = []; + foreach ($handleGameData as $key => $value) { + + $handleData = []; + + foreach ($value as $k => $v) { +// unset($handleGameData[$key][$k]['original_package_name']); + $handleGameData[$key][$k]['game_data'] = $handleOriginData[$v['original_package_name']]; + + } + $handleData['game_type'] = $key; + $handleData['data'] = $handleGameData[$key]; + $data[] = $handleData; + + } +// dump($data);die(); + foreach ($data as $key => $value) { + + foreach ($value['data'] as $k => $v) { + + if (!$v['game_data']) { + $data[$key]['data'][$k]['row'] = 1; + $data[$key]['row'] += 1; + } + + foreach ($v['game_data'] as $vk => $vv) { + $data[$key]['data'][$k]['game_data'][$vk]['row'] = $vv['ratio_data']?count($vv['ratio_data']):1; + $data[$key]['data'][$k]['row'] += $vv['ratio_data']?count($vv['ratio_data']):1; + $data[$key]['row'] += $vv['ratio_data']?count($vv['ratio_data']):1; + +// if (!$vv['ratio_data']) { +// $data[$key]['data'][$k]['game_data'][$vk]['row']=1; +// } + + foreach($vv['ratio_data'] as $vvk=>$vvv) { + if (count($data[$key]['data'][$k]['game_data'][$vk]['ratio_data']) == 1) { + $data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk]['turnover'] = '无阶梯'; + break; + } else { + + if ($vvv['is_equal'] != 1) { + + if (($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover'] == $vvv['turnover'] && !$data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+2]['turnover']) + ||!($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover'])) { + $end = '∞'; + } elseif($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover'] == $vvv['turnover'] && $data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+2]['turnover']) { + $end = floatval($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+2]['turnover']); + } else { + $end = floatval($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover']); + } + + $data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk]['turnover'] + = floatval($vvv['turnover']).($vvv['instanceof']==1?'<=':'<').'月流水'. + ('<'). + ($end); + } else { + + if ($vvv['instanceof'] != 1) { + foreach ($this->checkRatio as $ck => $cv) { +// if($v['game_id'] == 187) { +// +// dump($checkData[$v['game_id']][$cv]); +// dump($vvv); +// } + foreach ($checkData[$v['game_id']][$cv] as $gk=> $gv){ +// if($cv == 2){ +// dump($gv); +// dump($vvv['turnover']); +// die(); + if($gv['turnover'] < $vvv['turnover']) { + $checkInstanceof = array_column($checkData[$v['game_id']][$cv],'instanceof'); +// if($v['game_id'] == 187 && $cv == 2) { +// dump($checkData[$v['game_id']][$cv]); +// dump($vvv['turnover']); +// dump(in_array(3,$checkInstanceof)); +// } +// in_array($checkInstanceof,2); + +// die(); + if (in_array(2,$checkInstanceof)) { + $data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk][$cv] = $gv['ratio']; + } + } else { + break; + } +// } + + } + } + } + + $data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk]['turnover']= + '月流水='.$vvv['turnover']; + } + + } + + } + + } + } + } +// die(); + + if ($_REQUEST['export']) { + $this->assign("is_export",true); + $this->assign("data",$data); + + $time = date("Y-m-d",time()); + + $this->assign('title',"海南万盟天下产品分成比例体系[{$time}]"); + $this->display("export");die(); + } + + $count = count($data); + $page = set_pagination($count, $row,$params); + if($page) { + $this->assign('_page', $page); + } + + $size = $row;//每页显示的记录数 + + $data = array_slice($data, (($params['p']??1) - 1) * $size, $size); + +// dump($data);die(); + + $this->assign("data",$data); + $this->display(); + + } + + + //获取上游游戏比例 + function getCpGameRatio($handleData = []) { + $cpGameData = M('cp_game_ratio', 'tab_')->where(['is_del'=>"0"])->order('id asc')->select(); + + foreach ($cpGameData as $key => $value) { + + $cpRatio['turnover'] = $value['begin_total_amount']; + $cpRatio['instanceof'] = $value['instanceof']; + $cpRatio['ratio'] = $value['ratio']; + + $handleData[$value['game_id']][3][] =$cpRatio; + + } + + return $handleData; + } + + //将比例整合 + function handleRatio($handleData = []) { + $finalData = []; +// dump($handleData);die(); + foreach ($handleData as $key => $value) { + foreach ($value as $vk => $vv) { + foreach ($vv as $k => $v) { + + if ($finalData[$key][$v['turnover']]) { + $finalData[$key][$v['turnover']][$vk] = $v["ratio"]; +// if($v["instanceof"] != 0 && ($vk==0||$vk==1||$vk==2) && $handleData[$key][$vk][$k-1]["ratio"]) { +// $finalData[$key][$v['turnover']][$vk] = $handleData[$key][$vk][$k-1]["ratio"]; +// } + //判断是否有相同值且一个是>=另一个是>的情况 + if ($finalData[$key][$v['turnover']]["instanceof"] != $v["instanceof"]) { + $finalData[$key][$v['turnover']]["instanceof"] = 0; + + $finalData[$key][$v['turnover']."ed"] = $finalData[$key][$v['turnover']]; + $finalData[$key][$v['turnover']."ed"]['is_equal'] = 1; + } + + continue; + } + $v['is_equal'] = 0; + $v[$vk] = $v["ratio"]; + unset($v["ratio"]); + $finalData[$key][$v['turnover']] = $v; + + } + } + } + + foreach ($finalData as $key => $value) { + + $last_names = array_column($finalData[$key],'turnover'); + array_multisort($last_names,SORT_ASC,$finalData[$key]); + + } + +// dump($finalData);die(); + $data = []; + foreach ($finalData as $key => $value) { + + foreach ($value as $k => $v) { + + foreach ($this->checkRatio as $ck=>$cv) { + if ($k == "0.00" && !$finalData[$key][$k][$cv]) { + $finalData[$key][$k][$cv] = "0.00"; + } + + if ($k != "0.00" && !$finalData[$key][$k][$cv]) { + //查找上一个比例 + $finalData[$key][$k][$cv] = $data[$key][count($data[$key])-1][$cv]; + } + } +// dump($finalData[$key]); + + $data[$key][] = $finalData[$key][$k]; + + } + + } +// dump($data);die(); + +// foreach ($data as $key => $value) { +// +// $last_names = array_column($data[$key],'turnover'); +// array_multisort($last_names,SORT_ASC,$data[$key]); +// +// } +// dump($data); + + + return $data; + } + + function getAggregateData() { + $request = []; + $request['remote'] = 1; + + $aggregateData = json_decode(curl_post($this->api,$request),true); + +// dump($aggregateData); + + $gameData = M("game","tab_") + ->field("unique_code,relation_game_id game_id") + ->where('unique_code is not null or unique_code!=""') + ->group("unique_code") + ->select(); + +// dump($gameData); + + $gameUniqueData = []; + foreach ($gameData as $key => $value ) { + + $gameUniqueData[$value['unique_code']] = $value['game_id']; + + } + + $handleAggregateData = []; + foreach ($aggregateData as $key => $value) { + + if ($value['unique_code']) { + + $explodeData = explode('|',$value['exploitation_rate']); + $explodeDefauleData = explode('|',$value['default_exploitation_rate']); + + $temporaryNum = 100; + $temporaryData = []; + + foreach ($explodeDefauleData as $k => $v) { +// dump($v); + if ($v<$temporaryNum && $v>0) { + $temporaryData = []; + $temporaryNum = $v; + + $temporaryData[] = ['turnover'=>'0.00','instanceof'=>1,'ratio'=>number_format(100.00-$v,2,'.','')]; + + $defauleData = json_decode($explodeData[$k],true); + + foreach ($defauleData as $ek => $ev) { + $temporaryData[] = ['turnover'=>number_format($ev['money'],2,'.',''),'instanceof'=>$ev['symbol'],'ratio'=>number_format(100.00-$ev['rate'],2,'.','')]; + } +// dump($temporaryData); + + } + + } + + if($temporaryData) { + $handleAggregateData[$gameUniqueData[$value['unique_code']]][4] = $temporaryData; + } + + } + } + + return $handleAggregateData; + } + + +} \ No newline at end of file diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 6929e92b7..c3a3791be 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -4,6 +4,7 @@ namespace Admin\Controller; use Think\Controller; use GuzzleHttp\Client; use Admin\Model\PromoteModel; +use Base\Repository\UserRepository; use Base\Tool\AggregateClient; class ExportController extends Controller @@ -4193,8 +4194,10 @@ class ExportController extends Controller } $gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name']; $promoteName = '全部'; + $promote = null; if ($promoteId) { - $promoteName = get_promote_account($promoteId); + $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); + $promoteName = $promote['account']; } $data = $result['data']['records']; $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; @@ -4210,6 +4213,18 @@ class ExportController extends Controller } $data[$key] = $item; } + + $repository = new UserRepository(); + $deviceKey = 0; + if ($deviceType) { + $deviceKey = $deviceType == 'android' ? 1 : 2; + } + $otherResult = $repository->getUserRetention($baseGameId, [$start, $end], $deviceKey, $promote, [60, 90]); + foreach ($data as $key => $item) { + $otherItem = $otherResult[$item['date']]; + $data[$key]['retention_day60'] = $otherItem['retention_rate'][60]; + $data[$key]['retention_day90'] = $otherItem['retention_rate'][90]; + } } else { $this->error($error); } @@ -4582,14 +4597,12 @@ class ExportController extends Controller array('total_amt','充值金额'), array('user_count','活跃用户'), array('ltv_1','LTV1'), - array('ltv_2','LTV2'), - array('ltv_3','LTV3'), - array('ltv_4','LTV4'), - array('ltv_5','LTV5'), - array('ltv_6','LTV6'), array('ltv_7','LTV7'), array('ltv_14','LTV14'), array('ltv_30','LTV30'), + array('ltv_60','LTV60'), + array('ltv_90','LTV90'), + array('ltv_180','LTV180'), ); $start_time = $start = strtotime($start); @@ -4635,18 +4648,16 @@ class ExportController extends Controller $result = []; foreach ($users as $index => $item) { $ltv_start = strtotime($item['reg_date']); - $ltv_end = strtotime($item['reg_date']) + 30 * 86400; + $ltv_end = strtotime($item['reg_date']) + 180 * 86400; $ltv = M()->query(" SELECT ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 1).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_1, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 2).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_2, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 3).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_3, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 4).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_4, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 5).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_5, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 6).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_6, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 7).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_7, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 14).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_14, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_30, + ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 60).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_60, + ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 90).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_90, + ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 180).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_180, SUM(if (pay_time BETWEEN {$start_time} and ".($end_time).", pay_amount, 0)) as total_amt FROM tab_spend @@ -4661,14 +4672,12 @@ class ExportController extends Controller 'total_amt'=>$ltv[0]['total_amt'] ?: 0, 'user_count'=>$item['total_count'] ?: 0, 'ltv_1'=>$ltv[0]['ltv_1'] ?: 0, - 'ltv_2'=>$ltv[0]['ltv_2'] ?: 0, - 'ltv_3'=>$ltv[0]['ltv_3'] ?: 0, - 'ltv_4'=>$ltv[0]['ltv_4'] ?: 0, - 'ltv_5'=>$ltv[0]['ltv_5'] ?: 0, - 'ltv_6'=>$ltv[0]['ltv_6'] ?: 0, - 'ltv_7'=>$ltv[0]['ltv_7'] ?: 0, + 'ltv_7'=>$ltv[0]['ltv_7'] ?: 0, 'ltv_14'=>$ltv[0]['ltv_14'] ?: 0, - 'ltv_30'=>$ltv[0]['ltv_30'] ?: 0 + 'ltv_30'=>$ltv[0]['ltv_30'] ?: 0, + 'ltv_60'=>$ltv[0]['ltv_60'] ?: 0, + 'ltv_90'=>$ltv[0]['ltv_90'] ?: 0, + 'ltv_180'=>$ltv[0]['ltv_180'] ?: 0, ]; unset($user[$index]); } @@ -4683,15 +4692,13 @@ class ExportController extends Controller 'date'=>date("Y-m-d", $i), 'total_amt'=> 0, 'user_count'=> 0, - 'ltv_1'=> 0, - 'ltv_2'=> 0, - 'ltv_3'=> 0, - 'ltv_4'=> 0, - 'ltv_5'=> 0, - 'ltv_6'=> 0, - 'ltv_7'=> 0, + 'ltv_1'=> 0, + 'ltv_7'=> 0, 'ltv_14'=> 0, - 'ltv_30'=> 0 + 'ltv_30'=> 0, + 'ltv_60'=> 0, + 'ltv_90'=> 0, + 'ltv_180'=> 0, ]; } } diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index b4a37a725..24751d655 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -355,6 +355,11 @@ class GameController extends ThinkController if ($invalid || $inv == '') { $this->error('关联数据错误'); } + + if ($_GET['type'] != 2) { + $this->assign('show_status', 1); + } + $suffix = $inv['sdk_version'] == 1 ? "PGB" : "AZB"; $inv['short'] = substr($inv['short'], 0, -3) . $suffix; $this->assign('data', $inv); diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 6b4bf9ca6..2705ede07 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -1,8 +1,11 @@ field("user_account,promote_account,pay_amount,promote_account_to,order_time,create_time,op_account,remark") + ->field("user_account,promote_account,pay_amount,promote_account_to,order_time,create_time,op_account,remark,status") ->where($map) ->order("create_time desc"); @@ -79,6 +82,7 @@ class MendController extends ThinkController { $data = $data->page($page, $row)->select(); } //格式化信息 + $mendService = new MendService(); foreach ($data as $key => $value) { ($data[$key]['promote_account']=='官方渠道')?($data[$key]['promote_account']=C('OFFICIEL_CHANNEL')):''; @@ -88,9 +92,10 @@ class MendController extends ThinkController { if(!$show_data_power){ $data[$key]['user_account'] = encryptStr($data[$key]['user_account']); } + $data[$key]['status'] = $mendService->getStatusText($value['status']); } - if($export) db2csv($data,"推广员管理_推广补链_补链记录",["玩家账号","补链前渠道","补链前归属金额","补链后渠道","切分时间","补链时间","操作人员","备注"]); + if($export) db2csv($data,"推广员管理_推广补链_补链记录",["玩家账号","补链前渠道","补链前归属金额","补链后渠道","切分时间","补链时间","操作人员","备注","处理状态"]); if(IS_POST){ $page = set_pagination($_REQUEST['row_count'],$row); @@ -112,73 +117,31 @@ class MendController extends ThinkController { $this->assign('show_data_power', $show_data_power); $this->display(); - // parent::lists("Mend",$p,$map); } public function edit($id = null) { if (IS_POST) { - $promoteService = new PromoteService(); - if ($_POST['prmoote_id_to'] == -1){ - $_POST['prmoote_id_to'] = 0; - } - if ($_POST['prmoote_id_to'] === ''){ - $this->error('请选择需要变更的渠道'); - } - if ($_POST['promote_id'] == $_POST['prmoote_id_to']) { - $this->error('没有变更数据'); - } - if ($_POST['order_time'] == '') { - $this->error('没有订单日期'); - } - //判断是否已经结算 - // if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){ - // $this->error('在订单日期内含有已经结算的订单,无法补链'); - // } - - // if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){ - // $this->error("在订单日期内含有已经结算的订单,无法补链。"); - // } - if(self::checkOrderTime(strtotime($_POST['order_time']))){ - $this->error('仅能补链本周数据,请重新选择补链时间'); - } - if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){ - $this->error('在订单日期内含有多个推广员,无法补链'); - } - - $create = $_REQUEST; - $create['order_time'] = date($create['order_time']); - $params = array( - "from_promote_id"=>$create['promote_id'], - "to_promote_id"=>$create['prmoote_id_to'], - "order_time"=>$create['order_time'], - "type"=>2, - "shift_ids"=>[$create['user_id']], - "creator_type"=>0, - "creator_id"=>$_SESSION["onethink_admin"]["user_auth"]["uid"] - ); - if(!empty($create['remark'])){ - $params['remark'] = $create['remark']; - } - -// dump($create);die(); - - $res = $promoteService->addShiftTask($params); - if($res['status']){ - - $userData = M('user','tab_')->field('account')->where(['id'=>$create['user_id']])->find(); - $promoteToData = M('promote','tab_')->field('account')->where(['id'=>$create['prmoote_id_to']])->find(); - $promoteFromData = M('promote','tab_')->field('account')->where(['id'=>$create['promote_id']])->find(); - if ($create['promote_id'] == '0') { - $promoteFromData['account'] = '官方渠道'; - } - - addOperationLog(['op_type'=>1,'key'=>$userData['account'].'/'.$promoteFromData['account'].'/'.$promoteToData['account'],'op_name'=>'编辑推广补链','url'=>U('Mend/edit',['id'=>$create['user_id']]),'menu'=>'推广员-推广员管理-推广补链-编辑推广补链']); + $params = I('post.'); + $service = new MendService(); + try { + + $service->addMendTask($params); + + $userData = M('user','tab_')->field(['account', 'promote_id', 'promote_account'])->where(['id' => $params['user_id']])->find(); + $promoteToData = M('promote','tab_')->field('account')->where(['id'=> $params['prmoote_id_to']])->find(); + addOperationLog([ + 'op_type' => 1, + 'key' => $userData['account'].'/'.$userData['promote_account'].'/'.$promoteToData['account'], + 'op_name' => '编辑推广补链', + 'url' => U('Mend/edit', ['id' => $userData['id']]), + 'menu' => '推广员-推广员管理-推广补链-编辑推广补链' + ]); $this->success('补链成功', U('lists'), 2); - }else{ - $this->error($res['msg']); + } catch (\Exception $e) { + $this->error($e->getMessage()); } } else { // echo 1;die(); @@ -300,17 +263,11 @@ class MendController extends ThinkController { public function shiftInfo() { $id = I('id'); - $info = M("shift_task")->where("id = {$id} and status = 0")->find(); - - if(empty($info)){ + $info = M("mend", 'tab_')->where("id = {$id} and status = 0")->find(); + if(empty($mend)){ $this->error("补链不存在或已处理"); } - - - $info['user_id'] = json_decode($info['shift_ids'])[0]; $info['order_time'] = date("Y-m-d",$info['order_time']); - $userid = $info['user_id']; - $info['account'] = M("User","tab_")->field("account")->where("id = '{$userid}'")->find()['account']; $this->assign('data',$info); $this->display(); } @@ -318,11 +275,16 @@ class MendController extends ThinkController { public function cancelShift() { $id = I('id'); - $status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]); - if ($status) { - addOperationLog(['op_type'=>1,'key'=>$id,'op_name'=>'取消补链','url'=>U('Mend/shiftInfo',['id'=>$id]),'menu'=>'推广员-推广员管理-推广补链-取消补链']); + $model = new Model(); + $model->startTrans(); + $status1 = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]); + $status2 = M('mend', 'tab_')->where(['task_id' => $id, 'status' => 0])->save(['status' => 2, 'update_time' => time()]); + + if ($status1 && $status2) { + $model->commit(); + addOperationLog(['op_type'=>1,'key'=>$id,'op_name'=>'取消补链','url'=>U('Mend/shiftInfo',['id'=>$id]),'menu'=>'推广员-推广员管理-推广补链-取消补链']); $this->ajaxReturn(array("status"=>1,"url"=> U('lists'))); } else { $this->ajaxReturn(array("status"=>0,"url"=> U('lists'))); diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 0ab31c840..b38df25ba 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -110,7 +110,21 @@ class PromoteCompanyController extends ThinkController // $where["_string"] = "begin_time <= {$time_end}"; // } // dd($map); - + if (I('ali_user', 0)) { + $map['ali_user'] = I('ali_user'); + } + if (I('ali_account', 0)) { + $map['ali_account'] = I('ali_account'); + } + if (I('bank_address', 0)) { + $map['bank_address'] = I('bank_address'); + } + if (I('settlement_contact', 0)) { + $map['settlement_contact'] = I('settlement_contact'); + } + if (I('contact_phone', 0)) { + $map['contact_phone'] = I('contact_phone'); + } $page = intval(I('get.p', 0)); $page = $page ? $page : 1; //默认显示第一页数据 diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 76e2b3537..2fbc5ad0e 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -444,6 +444,7 @@ class PromoteController extends ThinkController $data['withdraw_done'] = $_POST['withdraw_done']; $data['can_view_recharge'] = $_POST['can_view_recharge']; $data['ts_over_apply'] = $_POST['ts_over_apply'] ?? 0; + $data['shift_over_apply'] = $_POST['shift_over_apply'] ?? 0; if (empty($pwd)) { unset($data['password']); } diff --git a/Application/Admin/Controller/SocietyInfoController.class.php b/Application/Admin/Controller/SocietyInfoController.class.php index a1167be06..a103e12cd 100644 --- a/Application/Admin/Controller/SocietyInfoController.class.php +++ b/Application/Admin/Controller/SocietyInfoController.class.php @@ -71,6 +71,9 @@ class SocietyInfoController extends ThinkController $map['communication_time'] = array('elt', time() - $gap * 86400); } if (I('sociaty_level') && I('sociaty_level') != '0') $map['sociaty_level'] = I('sociaty_level'); + if (I('num')) { + $map['id'] = substr(I('num'), 8); + } //获取分页数据 $query = $model->where($map)->order("communication_time desc"); @@ -122,7 +125,7 @@ class SocietyInfoController extends ThinkController return ; } else { $societyInfos = $order_query->page($page,$row)->field("*")->select(); -// dump($societyInfos);die(); +// dump($order_query->_sql());die(); } //分页 @@ -136,7 +139,7 @@ class SocietyInfoController extends ThinkController foreach ($societyInfos as $k => &$v) { - $v['num'] = $k+1+intval((I('get.p', 0)?I('get.p', 0):1)-1)*$row; + $v['num'] = date('Ymd', $v['create_time']).$v['id']; $v['sociaty_level_str'] = $this->level[$v['sociaty_level']]; if (time() - $v['communication_time'] > $gap * 86400 diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index f63b9f943..bdde203d9 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -4,6 +4,7 @@ namespace Admin\Controller; use Admin\Model\SpendModel; use Open\Model\UserLoginRecordModel; use Admin\Model\UserPlayModel; +use Base\Repository\UserRepository; use User\Api\UserApi as UserApi; use GuzzleHttp\Client; @@ -208,8 +209,10 @@ class StatController extends ThinkController $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; $gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name']; $promoteName = '全部'; + $promote = null; if ($promoteId) { - $promoteName = get_promote_account($promoteId); + $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); + $promoteName = $promote['account']; } foreach ($data as $key => $item) { $item['promote_name'] = $promoteName; @@ -223,6 +226,18 @@ class StatController extends ThinkController } $data[$key] = $item; } + + $repository = new UserRepository(); + $deviceKey = 0; + if ($deviceType) { + $deviceKey = $deviceType == 'android' ? 1 : 2; + } + $otherResult = $repository->getUserRetention($baseGameId, [$start, $end], $deviceKey, $promote, [60, 90]); + foreach ($data as $key => $item) { + $otherItem = $otherResult[$item['date']]; + $data[$key]['retention_day60'] = $otherItem['retention_rate'][60]; + $data[$key]['retention_day90'] = $otherItem['retention_rate'][90]; + } if ($dataOrder) { $data = $this->multisort($data, $orderColumn, $orderType); } diff --git a/Application/Admin/Controller/StatisticsController.class.php b/Application/Admin/Controller/StatisticsController.class.php index cb6cf5db7..fa9c73f43 100644 --- a/Application/Admin/Controller/StatisticsController.class.php +++ b/Application/Admin/Controller/StatisticsController.class.php @@ -1068,18 +1068,16 @@ class StatisticsController extends ThinkController { $result = []; foreach ($users as $index => $item) { $ltv_start = strtotime($item['reg_date']); - $ltv_end = strtotime($item['reg_date']) + 30 * 86400; + $ltv_end = strtotime($item['reg_date']) + 180 * 86400; $ltv = M()->query(" SELECT ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 1).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_1, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 2).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_2, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 3).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_3, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 4).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_4, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 5).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_5, - ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 6).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_6, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 7).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_7, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 14).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_14, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_30, + ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 60).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_60, + ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 90).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_90, + ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 180).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_180, SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0)) as total_amt FROM tab_spend @@ -1094,14 +1092,12 @@ class StatisticsController extends ThinkController { 'total_amt'=>$ltv[0]['total_amt'] ?: 0, 'user_count'=>$item['total_count'] ?: 0, 'ltv_1'=>$ltv[0]['ltv_1'] ?: 0, - 'ltv_2'=>$ltv[0]['ltv_2'] ?: 0, - 'ltv_3'=>$ltv[0]['ltv_3'] ?: 0, - 'ltv_4'=>$ltv[0]['ltv_4'] ?: 0, - 'ltv_5'=>$ltv[0]['ltv_5'] ?: 0, - 'ltv_6'=>$ltv[0]['ltv_6'] ?: 0, 'ltv_7'=>$ltv[0]['ltv_7'] ?: 0, 'ltv_14'=>$ltv[0]['ltv_14'] ?: 0, - 'ltv_30'=>$ltv[0]['ltv_30'] ?: 0 + 'ltv_30'=>$ltv[0]['ltv_30'] ?: 0, + 'ltv_60'=>$ltv[0]['ltv_60'] ?: 0, + 'ltv_90'=>$ltv[0]['ltv_90'] ?: 0, + 'ltv_180'=>$ltv[0]['ltv_180'] ?: 0, ]; unset($user[$index]); } @@ -1117,14 +1113,12 @@ class StatisticsController extends ThinkController { 'total_amt'=> 0, 'user_count'=> 0, 'ltv_1'=> 0, - 'ltv_2'=> 0, - 'ltv_3'=> 0, - 'ltv_4'=> 0, - 'ltv_5'=> 0, - 'ltv_6'=> 0, 'ltv_7'=> 0, 'ltv_14'=> 0, - 'ltv_30'=> 0 + 'ltv_30'=> 0, + 'ltv_60'=> 0, + 'ltv_90'=> 0, + 'ltv_180'=> 0, ]; } } diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index ab6d28ccf..55a3f4f52 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -293,7 +293,7 @@ class UserController extends AdminController $moblieUser = SM('UcenterMember', 'sys_')->field('id')->where(['mobile' => $_POST['mobile']])->find(); - if (!empty($moblieUser)) { + if (!empty($moblieUser)&&$_POST['mobile']) { $this->error('手机号码已存在!'); } diff --git a/Application/Admin/View/CompanyStatementPool/viewCpPool.html b/Application/Admin/View/CompanyStatementPool/viewCpPool.html index c4268d24f..824655697 100644 --- a/Application/Admin/View/CompanyStatementPool/viewCpPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewCpPool.html @@ -300,7 +300,9 @@ - + + 线下打款:{$payed_data.offline_amount}    线上打款:{$payed_data.online_amount} + diff --git a/Application/Admin/View/CompanyStatementPool/viewPcPool.html b/Application/Admin/View/CompanyStatementPool/viewPcPool.html index 40a9e3ad7..6b51861c5 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPcPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPcPool.html @@ -288,6 +288,9 @@ + + 线下打款:{$payed_data.offline_amount}    线上打款:{$payed_data.online_amount} + diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html index 8053495e7..e008db558 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html @@ -424,6 +424,10 @@ --> + + + 线下打款:{$payed_data.offline_amount}    线上打款:{$payed_data.online_amount} + diff --git a/Application/Admin/View/CompanySystemRatio/export.html b/Application/Admin/View/CompanySystemRatio/export.html new file mode 100644 index 000000000..5f36a76ce --- /dev/null +++ b/Application/Admin/View/CompanySystemRatio/export.html @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ style="display:none"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
产品类型原包名现包名比例等级标准cp合作方下游内团下游外团下游外团分发聚合方
aOh! 暂时还没有内容!
{$data['game_type']|default='无'}{$data['data'][0]['original_package_name']|default='无'}{$data['data'][0]['game_data'][0]['game_name']|default='无'}{$data['data'][0]['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}{$data['data'][0]['game_data'][0]['ratio_data'][0][3]|default='0.00'}%{$data['data'][0]['game_data'][0]['ratio_data'][0][0]|default='0.00'}%{$data['data'][0]['game_data'][0]['ratio_data'][0][1]|default='0.00'}%{$data['data'][0]['game_data'][0]['ratio_data'][0][2]|default='0.00'}%{$data['data'][0]['game_data'][0]['ratio_data'][0][4]|default='0.00'}%
{$ratio_data['turnover']|default='无阶梯'}{$ratio_data[3]|default='0.00'}%{$ratio_data[0]|default='0.00'}%{$ratio_data[1]|default='0.00'}%{$ratio_data[2]|default='0.00'}%{$ratio_data[4]|default='0.00'}%
{$game_data['game_name']}
{$game_data_other['turnover']|default='无阶梯'}{$game_data_other['3']|default='0.00'}%{$game_data_other['0']|default='0.00'}%{$game_data_other['1']|default='0.00'}%{$game_data_other['2']|default='0.00'}%{$game_data_other['4']|default='0.00'}%
{$sun_data['original_package_name']|default='无'}{$sun_data['game_data'][0]['game_name']|default='无'}{$sun_data['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}{$sun_data['game_data'][0]['ratio_data'][0]['3']|default='0.00'}%{$sun_data['game_data'][0]['ratio_data'][0]['0']|default='0.00'}%{$sun_data['game_data'][0]['ratio_data'][0]['1']|default='0.00'}%{$sun_data['game_data'][0]['ratio_data'][0]['2']|default='0.00'}%{$sun_data['game_data'][0]['ratio_data'][0]['4']|default='0.00'}%
{$game_datas['turnover']|default='无阶梯'}{$game_datas['3']|default='0.00'}%{$game_datas['0']|default='0.00'}%{$game_datas['1']|default='0.00'}%{$game_datas['2']|default='0.00'}%{$game_datas['4']|default='0.00'}%
{$game_datas['game_name']|default='无'}{$game_datas['ratio_data'][0]['turnover']|default='无阶梯'}{$game_datas['ratio_data'][0][3]|default='0.00'}%{$game_datas['ratio_data'][0][0]|default='0.00'}%{$game_datas['ratio_data'][0][1]|default='0.00'}%{$game_datas['ratio_data'][0][2]|default='0.00'}%{$game_datas['ratio_data'][0][4]|default='0.00'}%
{$game_data_others['turnover']|default='无阶梯'}{$game_data_others['3']|default='0.00'}%{$game_data_others['0']|default='0.00'}%{$game_data_others['1']|default='0.00'}%{$game_data_others['2']|default='0.00'}%{$game_data_others['4']|default='0.00'}%
+
+
+
+ 导出 + {$_page|default=''} +
+ + + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + diff --git a/Application/Admin/View/CompanySystemRatio/index.html b/Application/Admin/View/CompanySystemRatio/index.html new file mode 100644 index 000000000..bc7bea523 --- /dev/null +++ b/Application/Admin/View/CompanySystemRatio/index.html @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + +
+
+ style="display:none"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
产品类型原包名现包名比例等级标准分成比例
cp合作方下游内团下游外团下游外团分发聚合方
aOh! 暂时还没有内容!
{$data['game_type']|default='无'}{$data['data'][0]['original_package_name']|default='无'}{$data['data'][0]['game_data'][0]['game_name']|default='无'}{$data['data'][0]['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}{$data['data'][0]['game_data'][0]['ratio_data'][0][3]|floatval}%{$data['data'][0]['game_data'][0]['ratio_data'][0][0]|floatval}%{$data['data'][0]['game_data'][0]['ratio_data'][0][1]|floatval}%{$data['data'][0]['game_data'][0]['ratio_data'][0][2]|floatval}%{$data['data'][0]['game_data'][0]['ratio_data'][0][4]|floatval}%
{$ratio_data['turnover']|default='无阶梯'}{$ratio_data[3]|floatval}%{$ratio_data[0]|floatval}%{$ratio_data[1]|floatval}%{$ratio_data[2]|floatval}%{$ratio_data[4]|floatval}%
{$game_data['game_name']}
{$game_data_other['turnover']|default='无阶梯'}{$game_data_other['3']|floatval}%{$game_data_other['0']|floatval}%{$game_data_other['1']|floatval}%{$game_data_other['2']|floatval}%{$game_data_other['4']|floatval}%
{$sun_data['original_package_name']|default='无'}{$sun_data['game_data'][0]['game_name']|default='无'}{$sun_data['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}{$sun_data['game_data'][0]['ratio_data'][0]['3']|floatval}%{$sun_data['game_data'][0]['ratio_data'][0]['0']|floatval}%{$sun_data['game_data'][0]['ratio_data'][0]['1']|floatval}%{$sun_data['game_data'][0]['ratio_data'][0]['2']|floatval}%{$sun_data['game_data'][0]['ratio_data'][0]['4']|floatval}%
{$game_datas['turnover']|default='无阶梯'}{$game_datas['3']|floatval}%{$game_datas['0']|floatval}%{$game_datas['1']|floatval}%{$game_datas['2']|floatval}%{$game_datas['4']|floatval}%
{$game_datas['game_name']|default='无'}{$game_datas['ratio_data'][0]['turnover']|default='无阶梯'}{$game_datas['ratio_data'][0][3]|floatval}%{$game_datas['ratio_data'][0][0]|floatval}%{$game_datas['ratio_data'][0][1]|floatval}%{$game_datas['ratio_data'][0][2]|floatval}%{$game_datas['ratio_data'][0][4]|floatval}%
{$game_data_others['turnover']|default='无阶梯'}{$game_data_others['3']|floatval}%{$game_data_others['0']|floatval}%{$game_data_others['1']|floatval}%{$game_data_others['2']|floatval}%{$game_data_others['4']|floatval}%
+
+
+
+ 导出 + {$_page|default=''} +
+ +
+ + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + + diff --git a/Application/Admin/View/Game/relation.html b/Application/Admin/View/Game/relation.html index a4922054a..e6e03be02 100644 --- a/Application/Admin/View/Game/relation.html +++ b/Application/Admin/View/Game/relation.html @@ -39,10 +39,17 @@ + + 游戏原包名称: + + + + + 游戏类型: - @@ -173,33 +180,56 @@ + + 一句话简介: + + + + + + + 一句话简介: + + + + + + 游戏开发商: + + + + + + - 游戏简介: - - - - - - - 游戏简介: + 合作方: - + - 游戏开发商: - - + 游戏简介: + + - - + - 详细介绍: + 游戏资料中心: - + + {:hook('adminArticleEdit', array('name'=>'detail_content','value'=>$field['value']))} + + 游戏图标 @@ -264,6 +294,15 @@ (尺寸:210*350px)上传游戏的截图信息,此处截图在游戏详情页显示 + + + 落地页图片 + + {:hook('UploadImages', array('name'=>'flooring_page_imgs','value'=>$data['flooring_page_imgs']))} + (尺寸:210*350px)上传游戏的截图信息,此处截图在游戏详情页显示 + + + diff --git a/Application/Admin/View/Mend/edit.html b/Application/Admin/View/Mend/edit.html index 16f777fc6..07e05226d 100644 --- a/Application/Admin/View/Mend/edit.html +++ b/Application/Admin/View/Mend/edit.html @@ -72,7 +72,7 @@ 补链后渠道 - @@ -152,7 +152,7 @@ $(".select_gallery").select2(); //导航高亮 highlight_subnav('{:U('Mend/lists')}'); -Think.setValue("prmoote_id_to", {$data.promote_id|default = "''"}); +Think.setValue("promote_id_to", {$data.promote_id|default = "''"}); $('#submit').click(function(){ $('#form').submit(); }); diff --git a/Application/Admin/View/Mend/lists.html b/Application/Admin/View/Mend/lists.html index f84c816b9..4cc6f4019 100644 --- a/Application/Admin/View/Mend/lists.html +++ b/Application/Admin/View/Mend/lists.html @@ -65,7 +65,9 @@ aOh! 暂时还没有内容! + + @@ -96,12 +98,11 @@ - - 补链 - - 补链中 - - + + 补链 + + 补链中 + diff --git a/Application/Admin/View/Mend/recordList.html b/Application/Admin/View/Mend/recordList.html index 14bf92805..6e1fe62f8 100644 --- a/Application/Admin/View/Mend/recordList.html +++ b/Application/Admin/View/Mend/recordList.html @@ -75,6 +75,7 @@ 备注 切分时间 补链时间 + 处理状态 操作人员 @@ -115,6 +116,7 @@ {$data.order_time} {$data.create_time} + {$data.status} {$data.op_account} diff --git a/Application/Admin/View/Mend/shiftInfo.html b/Application/Admin/View/Mend/shiftInfo.html index c8a272de3..c37ffb375 100644 --- a/Application/Admin/View/Mend/shiftInfo.html +++ b/Application/Admin/View/Mend/shiftInfo.html @@ -57,20 +57,20 @@ 用户账号 - + 修改前渠道 - + 补链后渠道 - + @@ -102,7 +102,7 @@ +
+   +
+
+   +
+
+   +
+
+   +
+
+   +
搜索 diff --git a/Application/Admin/View/SocietyInfo/lists.html b/Application/Admin/View/SocietyInfo/lists.html index 60652ab17..420c8359c 100644 --- a/Application/Admin/View/SocietyInfo/lists.html +++ b/Application/Admin/View/SocietyInfo/lists.html @@ -88,6 +88,9 @@
 
+
+   +
diff --git a/Application/Admin/View/Stat/userretention.html b/Application/Admin/View/Stat/userretention.html index fabef79ec..39a6e27d1 100644 --- a/Application/Admin/View/Stat/userretention.html +++ b/Application/Admin/View/Stat/userretention.html @@ -108,13 +108,17 @@ 15日留存 30日留存 + + 60日留存 + + 90日留存 - ' . $error . '': 'aOh! 暂时还没有内容!' ?> + ' . $error . '': 'aOh! 暂时还没有内容!' ?> @@ -135,6 +139,8 @@ {$vo['retention_day7']}% {$vo['retention_day15']}% {$vo['retention_day30']}% + {$vo['retention_day60']}% + {$vo['retention_day90']}% -- -- @@ -145,6 +151,8 @@ -- -- -- + -- + -- diff --git a/Application/Admin/View/Statistics/ltv.html b/Application/Admin/View/Statistics/ltv.html index 35d99e86b..b19711b07 100644 --- a/Application/Admin/View/Statistics/ltv.html +++ b/Application/Admin/View/Statistics/ltv.html @@ -86,20 +86,18 @@ 充值金额 活跃用户 LTV1 - LTV2 - LTV3 - LTV4 - LTV5 - LTV6 LTV7 LTV14 LTV30 + LTV60 + LTV90 + LTV180 - aOh! 暂时还没有内容! + aOh! 暂时还没有内容! @@ -107,14 +105,12 @@ {$vo.total_amt} {$vo.user_count} {$vo.ltv_1} - {$vo.ltv_2} - {$vo.ltv_3} - {$vo.ltv_4} - {$vo.ltv_5} - {$vo.ltv_6} {$vo.ltv_7} {$vo.ltv_14} {$vo.ltv_30} + {$vo.ltv_60} + {$vo.ltv_90} + {$vo.ltv_180} @@ -176,8 +172,8 @@ $(function(){ if(interval < 0 || start == ''){ layer.msg('请选择搜索时间'); return false; - }else if(interval>90){ - layer.msg('请选择90日内的时间段'); + }else if(interval>180){ + layer.msg('请选择180日内的时间段'); return false; } diff --git a/Application/Base/Repository/GameRepository.class.php b/Application/Base/Repository/GameRepository.class.php index 3e358037e..d05539c13 100644 --- a/Application/Base/Repository/GameRepository.class.php +++ b/Application/Base/Repository/GameRepository.class.php @@ -2,6 +2,7 @@ namespace Base\Repository; +use Base\Service\PromoteService; use Base\Tool\Registry; class GameRepository @@ -68,7 +69,7 @@ class GameRepository return $gameIds; } - public function getUserRegisterCount($baseGame, $date, $deviceType = 0) + public function getUserRegisterCount($baseGame, $date, $deviceType = 0, $promote = null) { $gameIds = $this->getGameIdsByBaseGame($baseGame, $deviceType); $timeBegin = strtotime($date . ' 00:00:00'); @@ -76,17 +77,25 @@ class GameRepository $subCondition = [ 'game_id' => ['in', $gameIds], - '_string' => 'tab_user.id=tab_user_play_info.user_id' + '_string' => 'tab_user_play.user_id=tab_user_play_info.user_id' ]; $subSql = M('user_play_info', 'tab_')->field('1')->where($subCondition)->select(false); - return M('user', 'tab_')->where([ - 'register_time' => ['between', [$timeBegin, $timeEnd]], - '_string' => 'exists (' . $subSql . ')' + $sqlStr = 'exists (' . $subSql . ')'; + + if ($promote) { + $promoteService = new PromoteService(); + $sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')'; + } + + return M('user_play', 'tab_')->where([ + // 'register_time' => ['between', [$timeBegin, $timeEnd]], + 'create_time' => ['between', [$timeBegin, $timeEnd]], + '_string' => $sqlStr ])->count(); } - public function getUserRetentionCount($baseGame, $date, $day, $deviceType = 0) + public function getUserRetentionCount($baseGame, $date, $day, $deviceType = 0, $promote = null) { $gameIds = $this->getGameIdsByBaseGame($baseGame, $deviceType); @@ -96,14 +105,21 @@ class GameRepository $subCondition = [ 'game_id' => ['in', $gameIds], - '_string' => 'tab_user.id=tab_user_play_info.user_id', + '_string' => 'tab_user_play.user_id=tab_user_play_info.user_id', 'play_time' => ['egt', $retentionTime], ]; $subSql = M('user_play_info', 'tab_')->field('1')->where($subCondition)->select(false); - return M('user', 'tab_')->where([ - 'register_time' => ['between', [$timeBegin, $timeEnd]], - '_string' => 'exists (' . $subSql . ')' + $sqlStr = 'exists (' . $subSql . ')'; + if ($promote) { + $promoteService = new PromoteService(); + $sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')'; + } + + return M('user_play', 'tab_')->where([ + // 'register_time' => ['between', [$timeBegin, $timeEnd]], + 'create_time' => ['between', [$timeBegin, $timeEnd]], + '_string' => $sqlStr ])->count(); } } \ No newline at end of file diff --git a/Application/Base/Repository/UserRepository.class.php b/Application/Base/Repository/UserRepository.class.php index 1d85ae130..a46ca6446 100644 --- a/Application/Base/Repository/UserRepository.class.php +++ b/Application/Base/Repository/UserRepository.class.php @@ -565,4 +565,35 @@ class UserRepository ->find(); return $item['count']; } + + public function getUserRetention($baseGameId, $dateRange, $deviceType, $promote = null, $dayList = [60, 90]) + { + $begin = $dateRange[0]; + $end = $dateRange[1]; + + $repository = new GameRepository(); + $baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find(); + + $beginDate = strtotime($begin); + $endDate = strtotime($end); + $dayTime = 24 * 3600; + + $records = []; + for ($date = $beginDate; $date <= $endDate; $date = $date + $dayTime) { + $dateStr = date('Y-m-d', $date); + $userRegisterCount = $repository->getUserRegisterCount($baseGame, $dateStr, $deviceType, $promote); + + $retentionRates = []; + foreach ($dayList as $day) { + $retentionCount = $repository->getUserRetentionCount($baseGame, $dateStr, $day, $deviceType, $promote); + $retentionRates[$day] = $userRegisterCount == 0 ? '--' : round($retentionCount / $userRegisterCount * 100, 2); + } + $records[$dateStr] = [ + 'date' => $dateStr, + 'register_count' => $userRegisterCount, + 'retention_rate' => $retentionRates, + ]; + } + return $records; + } } \ No newline at end of file diff --git a/Application/Base/Service/MendService.class.php b/Application/Base/Service/MendService.class.php new file mode 100644 index 000000000..40e65b580 --- /dev/null +++ b/Application/Base/Service/MendService.class.php @@ -0,0 +1,101 @@ + '处理中', + 1 => '处理成功', + 2 => '处理失败', + ]; + + public function getStatusText($status) + { + return self::$statusList[$status] ?? '未知'; + } + + public function addMendTask($params, $permPromote = null, $handlePromote = null) + { + $userId = $params['user_id'] ?? 0; + $remark = $params['remark'] ?? ''; + $orderTime = $params['order_time'] ?? ''; + $toPromoteId = $params['promote_id_to'] ?? ''; + + $promoteService = new PromoteService(); + if ($toPromoteId == -1) { + $toPromoteId = 0; + } + if ($toPromoteId === '') { + throw new \Exception('请选择需要变更的渠道'); + } + + $user = M('user', 'tab_')->where(['id' => $userId])->find(); + if (!$user) { + throw new \Exception('用户不存在'); + } + if ($user['promote_id'] == $toPromoteId) { + throw new \Exception('没有变更数据'); + } + if ($orderTime == '') { + throw new \Exception('没有订单日期'); + } + + if ($permPromote) { + $levelColumn = 'level'. $permPromote['level'] . '_id'; + $promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $permPromote['id']])->find(); + if (!$promote) { + throw new \Exception('所属推广员异常'); + } + } + + if ($this->checkOrderTime(strtotime($orderTime))) { + throw new \Exception('仅能补链本周数据,请重新选择补链时间'); + } + + if ($this->checkPromote(strtotime($orderTime), $user['account'])) { + throw new \Exception('在订单日期内含有多个推广员,无法补链'); + } + + $data = [ + 'from_promote_id' => $user['promote_id'], + 'to_promote_id' => $toPromoteId, + 'order_time' => $orderTime, + 'type' => 2, + 'shift_ids' => [$userId], + 'creator_type' => $handlePromote ? 1 : 0, + 'creator_id' => $handlePromote ? $handlePromote['id'] : $_SESSION["onethink_admin"]["user_auth"]["uid"] + ]; + + if(!empty($params['remark'])){ + $data['remark'] = $params['remark']; + } + + $result = $promoteService->addShiftTask($data); + if (!$result['status']) { + throw new \Exception($result['msg']); + } + } + + private function checkOrderTime($orderTime) + { + $sdefaultDate = date('Y-m-d'); + $first = 1; //周一开始 + $w = date('w',strtotime($sdefaultDate)); + $checktime = strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) .' days'); //本周开始时间 + if($orderTime >= $checktime){ + //在本周允许换绑 + return false; + } + return true; + } + + private function checkPromote($orderTime, $account) + { + $res = M('Spend','tab_')->field('promote_id')->where(['pay_time' => array('EGT', $orderTime), 'user_account' => $account])->group('promote_id')->select(); + if(count($res)>1) { + return true; + } + return false; + } + +} \ No newline at end of file diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 885fd2019..cf9eb1c73 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -134,11 +134,6 @@ class PromoteService { ]; } - $isFuture = false; - if (strtotime($orderTime) > strtotime(date('Y-m-d 23:59:59'))) { - $isFuture = true; - } - $data = [ 'from_promote_id' => $fromPromoteId, 'to_promote_id' => $toPromoteId, @@ -154,6 +149,10 @@ class PromoteService { ]; if (M('shift_task', 'sys_')->add($data)) { + if ($type == 2) { + $data['id'] = M()->getLastInsID(); + $this->addMendsByTask($data); + } return [ 'status' => true, 'msg'=>'迁移任务创建成功' @@ -166,6 +165,49 @@ class PromoteService { } } + public function addMendsByTask($task) + { + $userIds = json_decode($task['shift_ids'], true); + $users = M('user', 'tab_')->field(['id', 'account', 'nickname'])->where(['id' => ['in', $userIds]])->select(); + $users = index_by_column('id', $users); + $toPromote = M('promote','tab_')->field(['id', 'account'])->where(['id' => $task['to_promote_id']])->find(); + $fromPromote = M('promote','tab_')->field(['id', 'account'])->where(['id' => $task['from_promote_id']])->find(); + + $creator = null; + $opAccount = ''; + if ($task['creator_type'] == 1) { + $creator = M('promote', 'tab_')->where(['id' => $task['creator_id']])->find(); + $opAccount = $creator ? $creator['account'] : ''; + } else { + $creator = M('ucenter_member', 'sys_')->where(['id' => $task['creator_id']])->find(); + $opAccount = $creator ? $creator['username'] : ''; + } + + $mends = []; + foreach ($userIds as $userId) { + $user = $users[$userId]; + $mends[] = [ + 'task_id' => $task['id'], + 'user_id' => $userId, + 'user_account' => $user['account'], + 'user_nickname' => $user['nickname'], + 'promote_id' => $fromPromote ? $fromPromote['id'] : 0, + 'promote_account' => $fromPromote ? $fromPromote['account'] : C('OFFICIEL_CHANNEL'), + 'promote_id_to' => $toPromote ? $toPromote['id'] : 0, + 'promote_account_to' => $toPromote ? $toPromote['account'] : C('OFFICIEL_CHANNEL'), + 'remark' => $task['remark'] == '' ? ($task['creator_type'] == 0 ? '后台补链' : '玩家迁移') : $task['remark'], + 'order_time' => $task['order_time'], + 'create_time' => time(), + 'pay_amount' => 0, + 'op_id' => $task['creator_id'], + 'op_account' => $opAccount, + 'op_type' => $task['creator_type'], + 'bind_type' => 1, + ]; + } + M('mend', 'tab_')->addAll($mends); + } + public function shiftPromote($task) { $model = new Model(); @@ -309,17 +351,6 @@ class PromoteService { $fromPromoteId = $task['from_promote_id']; $orderTime = $task['order_time']; $shiftIds = json_decode($task['shift_ids'], true) ?? []; - $remark = $task['remark'] ?? ''; - - $creator = null; - $opAccount = ''; - if ($task['creator_type'] == 1) { - $creator = M('promote', 'tab_')->where(['id' => $task['creator_id']])->find(); - $opAccount = $creator ? $creator['account'] : ''; - } else { - $creator = M('ucenter_member', 'sys_')->where(['id' => $task['creator_id']])->find(); - $opAccount = $creator ? $creator['username'] : ''; - } $toPromote = M('promote', 'tab_')->where(['id' => $toPromoteId])->find(); $fromPromote = M('promote', 'tab_')->where(['id' => $fromPromoteId])->find(); @@ -357,26 +388,17 @@ class PromoteService { $formConpany = M('promote_company', 'tab_')->field(['company_name', 'company_belong'])->where(['id' => $fromPromote['company_id']])->find(); $toConpany = M('promote_company', 'tab_')->field(['company_name', 'company_belong'])->where(['id' => $toPromote['company_id']])->find(); $belongs = PromoteCompanyService::$belongs; - $mends = []; + + $model = new Model(); + $model->startTrans(); + + $hasError = false; foreach ($users as $item) { $amount = isset($payAmountRows[$item['id']]) ? round(floatval($payAmountRows[$item['id']]['pay_amount']), 2) : 0; - $mends[] = [ - 'user_id' => $item['id'], - 'user_account' => $item['account'], - 'user_nickname' => $item['nickname'], - 'promote_id' => $fromPromote['id'], - 'promote_account' => $fromPromote['account'], - 'promote_id_to' => $toPromote['id'], - 'promote_account_to' => $toPromote['account'], - 'remark' => $remark == '' ? ($task['creator_type'] == 0 ? '后台补链' : '玩家迁移') : $remark, - 'order_time' => $orderTime, - 'create_time' => time(), - 'pay_amount' => $amount, - 'op_id' => $creator ? $creator['id'] : 0, - 'op_account' => $opAccount, - 'op_type' => $task['creator_type'], - 'bind_type' => 1, - ]; + $status = M('mend', 'tab_')->where(['task_id' => $task['id'], 'user_id' => $item['id']])->save(['status' => 1, 'pay_amount' => $amount, 'update_time' => time()]); + if (!$status) { + $hasError = true; + } if ($amount > 500) { $userWord = '玩家账号' . $item['account']; $fromWord = $fromPromote['account'] . ($formConpany ? '(' . $belongs[$formConpany['company_belong']] . '-' . $formConpany['company_name'] : ''); @@ -395,20 +417,16 @@ class PromoteService { } } + if ($hasError) { + $model->rollback(); + return ['status' => false, 'msg' => '系统异常,修改补链记录失败']; + } + $toTopPromote = $this->getTopPromote($toPromote); $hasGameIds = $toTopPromote['game_ids'] == '' ? [] : explode(',', $toTopPromote['game_ids']); $hasNotGameIds = M('game', 'tab_')->where(['game_id' => ['not in', $hasGameIds]])->getField('id', true); $hasNotGameIds = $hasNotGameIds ?? []; - $model = new Model(); - $model->startTrans(); - - $status = M('mend', 'tab_')->addAll($mends); - if (!$status) { - $model->rollback(); - return ['status' => false, 'msg' => '系统异常,添加变更记录失败']; - } - if (count($notices) > 0) { M('admin_notice', 'tab_')->addAll($notices); } diff --git a/Application/Base/Tool/GameResource.class.php b/Application/Base/Tool/GameResource.class.php index 28f52881d..f267e6c53 100644 --- a/Application/Base/Tool/GameResource.class.php +++ b/Application/Base/Tool/GameResource.class.php @@ -28,6 +28,8 @@ class GameResource 240 => LeyouClient::class, // 剑仙诀(苹果版) 247 => LeyouClient::class, // 剑破长空(安卓版) 248 => LeyouClient::class, // 剑破长空(苹果版) + 275 => LeyouClient::class, // 一梦仙境(安卓版) + 276 => LeyouClient::class, // 一梦仙境(苹果版) ]; public function __construct($game) diff --git a/Application/Base/Tool/GameResource/LeyouClient.class.php b/Application/Base/Tool/GameResource/LeyouClient.class.php index 316ef6050..3158f8844 100644 --- a/Application/Base/Tool/GameResource/LeyouClient.class.php +++ b/Application/Base/Tool/GameResource/LeyouClient.class.php @@ -146,6 +146,9 @@ class LeyouClient 121249 => ['ref_id' => 121249, 'name' => '私人定制198元激活卡', 'amount' => 198], 121250 => ['ref_id' => 121250, 'name' => '私人定制328元激活卡', 'amount' => 328], 121251 => ['ref_id' => 121251, 'name' => '私人定制648元激活卡', 'amount' => 648], + 121228 => ['ref_id' => 121228, 'name' => '1元礼包激活卡', 'amount' => 1], + 121229 => ['ref_id' => 121229, 'name' => '6元礼包激活卡', 'amount' => 6], + 121230 => ['ref_id' => 121230, 'name' => '30元礼包激活卡', 'amount' => 30], 121252 => ['ref_id' => 121252, 'name' => '68元礼包激活卡', 'amount' => 68], 121253 => ['ref_id' => 121253, 'name' => '98元礼包激活卡', 'amount' => 98], 121254 => ['ref_id' => 121254, 'name' => '128元礼包激活卡', 'amount' => 128], diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 415a862d5..e9041ef69 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -3057,4 +3057,9 @@ function getAggExceptIds($gameSettings) } } return $exceptIds; +} + +function getHideAccount($account) +{ + return substr($account, 0, 2) . '******' . substr($account, 8); } \ No newline at end of file diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index 4d848315d..dc48af7c0 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -442,14 +442,19 @@ class BaseController extends HomeController { $url = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME; $urlKey = substr(md5($url), 8, 16); - $key = $loginer['id'] . ':' . $urlKey; + $key = 'promote_access_limit:' . $loginer['id'] . ':' . $urlKey; $check = Redis::exists($key); if ($check) { $count = Redis::incr($key); if ($count > 60) { - Log::write('user_access_limit:' . date('Y-m-d H:i:s') . ' ' . $key . '[' . $url . ']', 'INFO'); - $this->assign("ttl",Redis::ttl($key)); - $this->display("Index/accessLimit"); + Log::write('promote_access_limit:' . date('Y-m-d H:i:s') . ' ' . $key . '[' . $url . ']', 'INFO'); + $ttl = Redis::ttl($key); + if ($ttl == -1) { + Redis::incr($key); + Redis::expire($key, 60); + } + $this->assign('ttl', $ttl); + $this->display('Index/accessLimit'); die(); } } else { diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 51adae6ff..046040c6b 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -4436,7 +4436,7 @@ public function iosDetailExcelInfo($id,$map) { $now = date('Y-m-d'); $now = strtotime($now); $nowTimeEnd = $now + 3600 * 24 - 1; - $spendMap['_string'] = 'today.user_id = uc.user_id and today.game_id = uc.game_id and today.server_id = uc.server_id and today.game_player_id = uc.game_player_id and today.promote_id = uc.promote_id'; + $spendMap['_string'] = 'today.user_id = uc.user_id and today.game_id = uc.game_id and today.server_id = uc.server_id and today.game_player_id = uc.game_player_id'; // and today.promote_id = uc.promote_id'; $spendMap['today.pay_status'] = 1; $spendMap['today.pay_time'] = ['between', [$now, $nowTimeEnd]]; diff --git a/Application/Home/Controller/MendController.class.php b/Application/Home/Controller/MendController.class.php new file mode 100644 index 000000000..d03fdcecd --- /dev/null +++ b/Application/Home/Controller/MendController.class.php @@ -0,0 +1,128 @@ +getLoginPromote(); + $promoteService = new PromoteService(); + + $permPromote = $loginer; + if ($loginer['shift_over_apply'] == 1) { + $permPromote = $promoteService->getTopPromote($loginer); + } + + $map = ['op_type' => 1, '_string' => '1=1']; + if(isset($params['account'])) { + $map['user_account']= ['like', '%' . $params['account'] . '%']; + } + if(!empty($params['promote_id'])) { + $map['promote_id']= $params['promote_id']; + } + if(!empty($params['promote_id_to'])) { + $map['promote_id_to'] = $params['promote_id_to']; + } + if(!empty($params['op_id'])) { + $map['op_id'] = $params['op_id']; + } + if (!empty($params['time_start'])) { + $map['order_time'] = ['egt', strtotime($params['time_start'])]; + } + if (!empty($params['time_end'])) { + $map['order_time'] = ['elt', strtotime($params['time_end']) + 86399]; + } + + $subInSql = $promoteService->subInSql($permPromote); + $map['_string'] .= ' and (promote_id in (' . $subInSql . ') or promote_id_to in (' . $subInSql . '))'; + + $records = M('mend', 'tab_')->where($map)->order('create_time desc')->page($page, $row)->select(); + $count = M('mend', 'tab_')->where($map)->count(); + + $mendService = new MendService(); + foreach ($records as $key => $record) { + $record['status_text'] = $mendService->getStatusText($record['status']); + $records[$key] = $record; + } + + + $page = set_pagination($count, $row, $params); + if ($page) { + $this->assign('_page', $page); + } + + $levelColumn = 'level'. $permPromote['level'] . '_id'; + $promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select(); + + $this->assign('promotes', $promotes); + $this->assign('count', $count); + $this->assign('records', $records); + $this->meta_title = '补链记录'; + $this->display(); + } + + public function add() + { + $userId = I('user_id', 0); + $user = M('user', 'tab_')->where(['id' => $userId])->find(); + if (!$user) { + return $this->error('用户不存在'); + } + + $loginer = $this->getLoginPromote(); + $permPromote = $loginer; + $promoteService = new PromoteService(); + if ($loginer['shift_over_apply'] == 1) { + $permPromote = $promoteService->getTopPromote($loginer); + } + + $levelColumn = 'level'. $permPromote['level'] . '_id'; + $promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $permPromote['id']])->find(); + if (!$promote) { + return $this->error('所属推广员异常'); + } + + $promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select(); + + $this->meta_title = '玩家补链'; + $this->assign('user', $user); + $this->assign('promotes', $promotes); + $this->display(); + } + + public function save() + { + $params = I('post.'); + $loginer = $this->getLoginPromote(); + + $permPromote = $loginer; + $promoteService = new PromoteService(); + if ($loginer['shift_over_apply'] == 1) { + $permPromote = $promoteService->getTopPromote($loginer); + } + + $service = new MendService(); + try { + $service->addMendTask($params, $permPromote, $loginer); + $this->ajaxReturn(['status' => 1, 'msg' => '补链申请成功']); + } catch (\Exception $e) { + $this->ajaxReturn(['status' => 0, 'msg' => $e->getMessage()]); + } + } +} diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index ec413f8b3..43bac5a69 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -341,7 +341,7 @@ class QueryController extends BaseController $list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']); $list['new_login_ip'] = $newLoginData['login_ip']; - $list['account'] = substr($list['account'], 0, 2) . '******' . substr($list['account'], 8); + $list['account'] = getHideAccount($list['account']); if(!empty($list['device_number'])) { $list['device_number'] = encryption($list['device_number']); } @@ -1681,7 +1681,7 @@ class QueryController extends BaseController return $levelPromote; } - private function getQueryPromote($levelPromote) + private function getQueryPromote($levelPromote, \Closure $whenNotSearch = null) { $queryPromote = null; $promote = $this->getLoginPromote(); @@ -1693,6 +1693,11 @@ class QueryController extends BaseController } if ($queryPromoteId == 0) { $queryPromote = $this->getLoginPromote(); + if ($whenNotSearch) { + $queryPromote = $whenNotSearch(); + } else { + $queryPromote = $this->getLoginPromote(); + } } else { $queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find(); } @@ -1717,9 +1722,17 @@ class QueryController extends BaseController $sortName = trim(I('sort_name', '')); $sort = intval(I('sort', 1)); + $promote = $this->getLoginPromote(); $levelPromote = $this->getLevelPromote(); - $queryPromote = $this->getQueryPromote($levelPromote); + $queryPromote = $this->getQueryPromote($levelPromote, function() use ($promote) { + if ($promote['shift_over_apply'] == 1) { + $promoteService = new PromoteService(); + return $promoteService->getTopPromote($promote); + } else { + return $promote; + } + }); $promoteService = new PromoteService(); $subInSql = $promoteService->subInSql($queryPromote); @@ -1786,6 +1799,7 @@ class QueryController extends BaseController } $columns = [ + 'role.user_id', 'user_account', 'role.promote_account', 'role.game_name', @@ -1876,7 +1890,6 @@ class QueryController extends BaseController $this->assign('unique_user_count', $uniqueCountRow['user_count']); $this->assign('unique_count', $uniqueCountRow['count']); $this->assign('sort', $sort); - $this->assign('setdate', date('Y-m-d', $nowTime)); $this->assign('games', $games); $this->assign('records', $records); $this->assign('pagination', $pagination); @@ -1980,8 +1993,8 @@ class QueryController extends BaseController $map['s.pay_time'] = ['between', [$begTime, $endTime - 1]]; $fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_id, s.promote_account, s.game_name, s.sdk_version, s.server_name, SUBSTRING_INDEX(GROUP_CONCAT(s.game_player_name order by s.id desc), ',', 1) as game_player_name"; $fieldUser = 'u.register_time, u.login_time'; - - $spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id and today.promote_id = s.promote_id'; + + $spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id'; // and today.promote_id = s.promote_id'; $spendMap['today.pay_status'] = 1; $spendMap['today.pay_time'] = ['between', [$nowTime, $nowTimeEnd]]; diff --git a/Application/Home/View/default/Home/landingPage.html b/Application/Home/View/default/Home/landingPage.html index 3f5b55187..d3d3ec7b1 100644 --- a/Application/Home/View/default/Home/landingPage.html +++ b/Application/Home/View/default/Home/landingPage.html @@ -133,7 +133,7 @@
-
14.48K个评分
+
14,480个评分
-
14.48K个评分
+
14,480个评分
diff --git a/Application/Home/View/default/Mend/add.html b/Application/Home/View/default/Mend/add.html new file mode 100644 index 000000000..f3d024184 --- /dev/null +++ b/Application/Home/View/default/Mend/add.html @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/Mend/index.html b/Application/Home/View/default/Mend/index.html new file mode 100644 index 000000000..9334c5bf0 --- /dev/null +++ b/Application/Home/View/default/Mend/index.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index eec420a4b..f76fba722 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -89,6 +89,7 @@ IOS下载数统计 用户留存率 游戏分区数据汇总 + 补链记录 diff --git a/Application/Home/View/default/Query/userRoles.html b/Application/Home/View/default/Query/userRoles.html index 31f4a578a..ba6c0e25f 100644 --- a/Application/Home/View/default/Query/userRoles.html +++ b/Application/Home/View/default/Query/userRoles.html @@ -157,6 +157,7 @@
+ 操作

暂无数据

@@ -179,6 +180,8 @@ {$record.role_name} {$record.role_level} {$record.create_time} + 补链
diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index a38362616..b4c339c3c 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -1261,7 +1261,7 @@ class PaymentController extends BaseController } $count = M("pay_statement_info","tab_")->field("sum(final_statement_money) statement_money")->where("id in ({$ids})")->find(); - $paymentInfo = D("Admin/TransferMerchant")->getUnderPaymentInfo(); + $paymentInfo = D("Admin/TransferMerchant")->getStatementPaymentInfo(); $this->getAccountMoney(); // dd($CompanyInfo);