From 4043cc04e675046588145312ec8320d29c8d9fd9 Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Fri, 10 Jan 2020 11:47:19 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=AE=BE=E7=BD=AE--?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98=E9=99=90=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/ToolController.class.php | 11 ++ Application/Admin/View/Tool/payset.html | 115 +++++++++++++++++- 2 files changed, 125 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/ToolController.class.php b/Application/Admin/Controller/ToolController.class.php index 638c75b80..c9aaa8419 100644 --- a/Application/Admin/Controller/ToolController.class.php +++ b/Application/Admin/Controller/ToolController.class.php @@ -16,6 +16,17 @@ class ToolController extends ThinkController { $config = I('config'); $data = array('config'=>json_encode($config),'template'=>$_POST['template'],'status'=>$_POST['status']); $map['name']=$name; + + $day_pay = $config['day_pay_limit']; + $month_pay = $config['month_pay_limit']; + if(!empty($day_pay) && !empty($month_pay)) { + if($month_pay / date('t') > $day_pay) { + $this->error('月支付限量较日支付限量过大'); + } elseif ($month_pay < $day_pay) { + $this->error('月支付限量不能小于日支付限量'); + } + } + if($_POST['status']==1&&$name=="weixin"){ $map_['name']=array("in",'wei_xin,wei_xin_app,weixin_gf'); M('tool','tab_')->where($map_)->setField('status','0'); diff --git a/Application/Admin/View/Tool/payset.html b/Application/Admin/View/Tool/payset.html index 6ce600f37..bd1b12822 100644 --- a/Application/Admin/View/Tool/payset.html +++ b/Application/Admin/View/Tool/payset.html @@ -215,6 +215,33 @@ 控制SDK内的支付宝支付方式,默认是APP支付,当选择WAP支付时,在SDK支付页面选择“支付宝”进行付款时,采用支付宝的WAP支付 + + + 日支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + + + + + 月支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + @@ -309,6 +336,36 @@ + + + + 日支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + + + + + 月支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + + + 启用状态 @@ -403,6 +460,8 @@ + + 启用状态 @@ -1253,7 +1312,33 @@ - + + + 日支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + + + + + 月支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + @@ -1345,6 +1430,34 @@ + + + 日支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + + + + + 月支付限量 + + + + + + 当额度达到限制额度时,隐藏支付方式 + + + + + 启用状态 From aba7ed22d1caeecc9279a52e83d2ef032b2a10e5 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 5 Feb 2020 16:41:37 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E8=84=9A=E6=9C=AC-=E6=8C=89=E6=94=B6?= =?UTF-8?q?=E5=85=A5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 511 ++++++++++++++++++ Data/update.sql | 16 + 2 files changed, 527 insertions(+) create mode 100644 Application/Admin/Controller/FinancialSummarySetController.class.php diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php new file mode 100644 index 000000000..438ddc116 --- /dev/null +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -0,0 +1,511 @@ +beginThismonth = mktime(0,0,0,date('m')-1,1,date('Y')); + $this->endThismonth = mktime(0,0,0,date('m'),1,date('Y'))-1; + $temp = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month'))); + $this->year= date('Y',$temp); + $this->month= date('m',$temp); + $this->date = $this->year."-".$this->month; + $this->nowdata =time(); + + $this->model =M(); + $this->FinancialSummaryModel =M("FinancialSummary",'tab_'); + $this->DepositModel =M("Deposit",'tab_'); + $this->SpendModel = M("Spend",'tab_'); + $this->GameSupersignModel = M("GameSupersign",'tab_'); + $this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表 + + + } + /** + * 更新某月数据 + */ + public function setMonthFinancialSummary() + { + $month = I("count_date"); + if(empty($month)) die("参数错误"); + + $this->date = $month; + $tarry = explode('-',$month); + $this->beginThismonth=mktime(0,0,0,$tarry[1],1,$tarry[0]); + $this->endThismonth=mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1; + $this->reCount(); + $this->setFinancialSummary(); + } + /** + * 强制重新聚合 + */ + public function reCount() + { + $recount = I("recount"); + if(empty($recount) || $recount != 1){return ;} + # code... + //清理之前的聚合 + $temp =array( + "count_date"=>$this->date + ); + + $this->gamemodel->where($temp)->delete(); + $this->usermodel->where($temp)->delete(); + $this->monthmodel->where($temp)->delete(); + echo "重置成功执行重新生成:"; + } + + + /** + * 每个月的统计接口 + */ + public function setFinancialSummary() + { + set_time_limit(0); + $t1 = microtime(true); + //判断是否已经聚合 + // $countRes = M("spend_count","tab_")->field("count(*) date_count")->where("count_date = '{$this->date}'")->find()['date_count']; + // $countUserRes = M("spend_user_count","tab_")->field("count(*) date_count")->where("count_date = '{$this->date}'")->find()['date_count']; + // if($countRes > 0 || $countUserRes >0){ + // die("error:Repeated statistics,msg:{$this->date}已经聚合过"); + // } + $this->model->startTrans(); + $this->continue =true; + + //获取类型为1的数据 + $this->setIncomeMoney(); + // // //执行用户表统计 + // $this->setUserCount(); + // // //执行月份统计 + // $this->setMonthCount(); + //执行 + $this->model->commit(); + $t2 = microtime(true); + die("success runtime:".round($t2-$t1,3).'s'); + } + /** + * 获取类型为1的数据 + */ + public function setIncomeMoney() + { + $this->getCashAndBalanCoinSpend(); + $this->getBalanceCoinIncome(); + $this->getGameSupersignIncome(); + dump($this->adddata); + # code... + } + //现金充值及平台币消耗 + protected function getCashAndBalanCoinSpend() + { + $temparr = array( + "type"=>1, + "count_month"=>$this->month, + "count_year"=>$this->year, + "create_time"=>$this->nowdata + ); + + + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $res = $this->SpendModel + ->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count") + ->where($map) + ->find(); + $cash_spend = $temparr; + $cash_spend["key_name"] = "cash_spend"; + $cash_spend["sort"] = "1"; + $cash_spend["sum_money"] = $res['cash_count']; + $this->adddata[]=$cash_spend; + + $balance_coin_spend = $temparr; + $balance_coin_spend["key_name"] = "balance_coin_spend"; + $balance_coin_spend["sort"] = "2"; + $balance_coin_spend["sum_money"] = $res['balance_coin_count']; + $this->adddata[]=$balance_coin_spend; + } + //平台币充值(deposit/CoinPayOrder)玩家及会长充值的平台币总额 + protected function getBalanceCoinIncome() + { + $temparr = array( + "key_name"=>'balance_coin_income', + "type"=>1, + "sort"=>3, + "count_month"=>$this->month, + "count_year"=>$this->year, + "create_time"=>$this->nowdata + ); + $map = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $temparr['sum_money'] = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map)->find()['pay_amount']; + //获取会长充值的平台币 + $map1= array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "order_status"=>1 + ); + $COMoney= $this->CoinPayOrderModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount']; + $temparr['sum_money'] = $temparr['sum_money']-0+$COMoney; + $this->adddata[]=$temparr; + } + //超级签购买收入 + protected function getGameSupersignIncome() + { + $temparr = array( + "key_name"=>'game_supersign_income', + "type"=>1, + "sort"=>4, + "count_month"=>$this->month, + "count_year"=>$this->year, + "create_time"=>$this->nowdata + ); + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $temparr['sum_money'] = $this->GameSupersignModel->field("IFNULL(sum(pay_price),0) pay_price")->where($map)->find()['pay_price']; + $this->adddata[]=$temparr; + } + + + + + + + + + /** + * 获取游戏聚合 + */ + public function setGameCount() + { + if(!$this->continue){ + die("api error"); + } + $this->getCashData(); + $this->getBalanceData(); + $this->getInsideData(); + # code... + } + //获取游戏现金流水 + protected function getCashData() + { + $this->createGameCount("cash_count"); + } + //获取平台币聚合 + protected function getBalanceData() + { + $this->createGameCount("balance_coin_count"); + } + //获取绑定币充值 + protected function getInsideData() + { + $this->createGameCount("inside_cash_count"); + + } + protected function createGameCount($type) + { + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "spend.pay_status"=>1 + ); + + if($type == "cash_count"){ + //现金统计 + $map['pay_way'] = array("GT",0); + }elseif($type == "balance_coin_count"){ + $map['pay_way']= array("EQ",0); + }elseif($type == "inside_cash_count"){ + $map['pay_way']= array("LT",0); + } + $field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name, + spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,sum(pay_amount) {$type}, + IFNULL(promote.level,0) level,IFNULL(promote.chain,'/') chain, + '{$this->date}' as count_date,'{$this->nowdata}' as create_time"; + $spendRes = M() + ->table("tab_spend spend") + ->field($field) + ->where($map) + ->join("tab_promote promote ON spend.promote_id = promote.id","left") + ->join("tab_game game ON spend.game_id = game.id","left") + ->join("tab_partner partner ON partner.id = game.partner_id","left") + ->group('spend.promote_id,spend.game_id') + ->select(); + if(empty($spendRes)){ + return ; + } + //集中两个表 + if($type == "cash_count"){ + $dbres = $this->gamemodel->addAll($spendRes); + if(!$dbres){ + $this->model->rollback(); + die("error"); + } + }else{ + for ($i=0; $i < count($spendRes); $i++) { + $spendRes[$i][$type] || $spendRes[$i][$type]=0; + # code... + $tempmap = array( + "game_id"=>$spendRes[$i]['game_id'], + "promote_id"=>$spendRes[$i]['promote_id'], + "count_date"=>$this->date + ); + $dbres = $this->gamemodel->where($tempmap)->find(); + if(empty($dbres)){ + //不存在 + $tempdbres = $this->gamemodel->add($spendRes[$i]); + if(!$tempdbres){ + $this->model->rollback(); + die("error"); + } + }else{ + $dbres[$type] = $dbres[$type]-0+$spendRes[$i][$type]; + $tempdbres = $this->gamemodel->save($dbres); + if($tempdbres === false){ + $this->model->rollback(); + die("error"); + } + } + } + } + # code... + } + + /** --------以下为设定角色聚合---------- **/ + + /** + * 获取角色聚合 + */ + public function setUserCount() + { + //获取会长信息 + $adddata=array(); + $userarr = array(); + $this->getUserCountInit($adddata,$userarr); + $this->getUserInsideData($adddata,$userarr); + $this->addUserDb($adddata); + } + //用户聚合 + public function getUserCountInit(&$adddata,&$userarr) + { + + $gameres = $this->gamemodel->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) bind_coin_count,chain,level,promote_id,promote_account") + ->where("count_date='{$this->date}'")->group("promote_id")->select(); + if(empty($gameres)){ + return; + } + $count = count($gameres); + $adddata=array(); + $userarr = array(); + //执行 + for ($i=0; $i < $count; $i++) { + $d = $gameres[$i]; + if($d['level'] < 2){ + $adddata[$d['promote_id']] = $d; + $userarr[] =$d['promote_id']; + }else{ + //获取所有链路 + $chain = trim($d['chain'],"/"); + $pid = explode("/", $chain); + $pid[] = $d['promote_id'];//添加自己 + for ($k=0; $k getChain($pid[$k]); + $temp['cash_count'] = $d['cash_count']; + $temp['balance_coin_count'] = $d['balance_coin_count']; + $temp['bind_coin_count'] = $d['bind_coin_count']; + + $adddata[$pid[$k]] = $temp; + $userarr[] =$pid[$k]; + } + } + } + } + } + //获取chain + protected function getChain($id){ + return M("Promote","tab_")->field("id promote_id,account promote_account,chain,level")->where("id='".$id."'")->find(); + } + //渠道角色统计仅计算推广员的平台币发放与收回 + protected function getUserInsideData(&$adddata,&$userarr) + { + $insideRes = M() + ->table("tab_promote_coin") + ->field("*") + ->where(array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "source_id"=>0, + "status"=>1 + )) + ->select(); + if(!empty($insideRes)){ + for ($i=0; $i < count($insideRes); $i++) { + # code... + if($insideRes[$i]['type'] > 1){ + $insideRes[$i]['num'] = ( 0- $insideRes[$i]['num']); + } + //获取链路 + $d = $this->getChain($insideRes[$i]['promote_id']); + + $chain = trim($d['chain'],"/"); + $pid = explode("/", $chain); + $pid[] = $d['promote_id'];//添加自己 + if($d['level'] < 2){ + if(in_array($d["promote_id"], $userarr)){ + //存在 + $adddata[$pid[$k]]["inside_cash_count"] += $insideRes[$i]['num']; + }else{ + $d['inside_cash_count'] = $insideRes[$i]['num']; + $adddata[$d['promote_id']] = $d; + $userarr[] =$d['promote_id']; + } + }else{ + for ($k=0; $k getChain($pid[$k]); + $temp['inside_cash_count'] = $insideRes[$i]['num']; + + $adddata[$pid[$k]] = $temp; + $userarr[] =$pid[$k]; + } + } + } + } + } + + } + //添加用户统计表 + protected function addUserDb(&$adddata){ + $count = count($adddata); + if($count < 1){return;} + foreach ($adddata as $k => $v) { + isset($v["cash_count"]) || $v["cash_count"]=0; + isset($v["balance_coin_count"]) || $v["balance_coin_count"]=0; + isset($v["bind_coin_count"]) || $v["bind_coin_count"]=0; + isset($v["inside_cash_count"]) || $v["inside_cash_count"]=0; + //设定时间 + $v["count_date"] = $this->date; + $v["create_time"] = $this->nowdata; + //聚合不含内充流水 + $v['all_count'] = $v["cash_count"]-0+$v["balance_coin_count"]-0+$v["bind_coin_count"]; + $tempdbres = $this->usermodel->add($v); + if($tempdbres === false){ + $this->model->rollback(); + die("addUserDb error"); + } + } + } + + /** --------以下为设定月份聚合---------- **/ + /** + * @param 现金流水 cash_count 游戏中充值的现金 + * @param 平台币流水 balance_coin_count 游戏中消耗的平台币 + * @param 绑定币流水 bind_coin_count 游戏中绑定币的消耗 + * @param 内充流水 inside_cash_count:(推广员的平台币发放-收回)+(后台发放给玩家平台币-回收平台币 )+ (后台发放绑币给玩家 -回收的绑币) + * @param 平台币充值 balance_coin_deposit + * @return void + */ + public function setMonthCount() + { + $initdata = $this->getMonthInit(); + $balance = $this->getBalanceUser(); + $bind = $this->getBindUser(); + $deposit = $this->getBalanceDeposit(); + $initdata["inside_cash_count"] = $initdata["inside_cash_count"]-0+$balance-0+$bind; + $initdata["balance_coin_deposit"] = $deposit; + $initdata["all_count"] = $initdata["inside_cash_count"]-0+$initdata["cash_count"]-0+$deposit; + $initdata["count_date"] = $this->date; + $initdata["create_time"] = $this->nowdata; + $tempdbres = $this->monthmodel->add($initdata); + if($tempdbres === false){ + $this->model->rollback(); + die("setMonthCount error"); + } + # code... + } + //获取除了内充的 + protected function getMonthInit() + { + $tempmap = array( + "count_date"=>$this->date, + "level"=>array("LT",2) + ); + return $this->usermodel->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(bind_coin_count) bind_coin_count,sum(inside_cash_count) inside_cash_count")->where($tempmap)->find(); + } + //获取平台币充值流水 + protected function getBalanceDeposit() + { + $map = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $deposit = M("deposit","tab_")->field("SUM(pay_amount) pay_amount")->where($map)->find()['pay_amount']; + $deposit || $deposit=0; + return $deposit; + } + //设置 后台发放平台币给玩家 及 回收玩家 的最终值 + protected function getBalanceUser() + { + $map = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "status"=>1 + ); + $add = M("provide_user","tab_")->field("sum(amount) amount")->where($map)->find()['amount']; + $add || $add=0; + + $jq = M("user_coin","tab_")->field("sum(num) num")->where(array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)) + ))->find()['num']; + $jq || $jq=0; + return $add-$jq; + } + //设置 后台发放绑币给玩家 及 回收玩家绑币 的最终值 + protected function getBindUser() + { + $map = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "status"=>1 + ); + $add = M("provide","tab_")->field("sum(amount) amount")->where($map)->find()['amount']; + $add || $add=0; + + + $jq = M("deduct_bind_record","tab_")->field("sum(quantity) quantity")->where(array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)) + ))->find()['quantity']; + $jq || $jq=0; + return $add-$jq; + } + +} diff --git a/Data/update.sql b/Data/update.sql index cf7f2f909..94b7a6ba0 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1101,3 +1101,19 @@ ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显 ALTER TABLE `tab_promote_belong` ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据 0否 1是'; + + +---财务每月分类汇总表 chenzhi---- +CREATE TABLE `tab_financial_summary` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '汇总分类:1按收入类型,2按合作方不包含绑币,3按合作方包含绑币,4按支付渠道,5支付类型', + `key_name` varchar(50) DEFAULT '' COMMENT '类型名称', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `sum_money` decimal(10,2) DEFAULT '0.00' COMMENT '流水', + `count_month` varchar(10) DEFAULT '' COMMENT '统计月份', + `count_year` varchar(10) DEFAULT '' COMMENT '统计年份', + `create_time` int(10) NOT NULL DEFAULT '0' COMMENT '最后更新时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `count_year` (`count_year`) USING BTREE, + KEY `key_name` (`key_name`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='财务分类汇总统计'; From 5eaadd974a49effccb96324fdcb34c906a086cff Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 5 Feb 2020 16:54:19 +0800 Subject: [PATCH 03/32] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=B1=87=E6=80=BB-=E6=8C=89=E6=94=B6=E5=85=A5=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 322 +----------------- 1 file changed, 3 insertions(+), 319 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index 438ddc116..5cee8525f 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -161,10 +161,10 @@ class FinancialSummarySetController extends \Think\Controller //获取会长充值的平台币 $map1= array( "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), - "order_status"=>1 + "order_status"=>array("EGT",1) ); $COMoney= $this->CoinPayOrderModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount']; - $temparr['sum_money'] = $temparr['sum_money']-0+$COMoney; + $temparr['sum_money'] = number_format(($temparr['sum_money']*100+$COMoney*100)/100, 2, '.', ''); ; $this->adddata[]=$temparr; } //超级签购买收入 @@ -191,321 +191,5 @@ class FinancialSummarySetController extends \Think\Controller - - - /** - * 获取游戏聚合 - */ - public function setGameCount() - { - if(!$this->continue){ - die("api error"); - } - $this->getCashData(); - $this->getBalanceData(); - $this->getInsideData(); - # code... - } - //获取游戏现金流水 - protected function getCashData() - { - $this->createGameCount("cash_count"); - } - //获取平台币聚合 - protected function getBalanceData() - { - $this->createGameCount("balance_coin_count"); - } - //获取绑定币充值 - protected function getInsideData() - { - $this->createGameCount("inside_cash_count"); - - } - protected function createGameCount($type) - { - $map = array( - "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), - "spend.pay_status"=>1 - ); - - if($type == "cash_count"){ - //现金统计 - $map['pay_way'] = array("GT",0); - }elseif($type == "balance_coin_count"){ - $map['pay_way']= array("EQ",0); - }elseif($type == "inside_cash_count"){ - $map['pay_way']= array("LT",0); - } - $field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name, - spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,sum(pay_amount) {$type}, - IFNULL(promote.level,0) level,IFNULL(promote.chain,'/') chain, - '{$this->date}' as count_date,'{$this->nowdata}' as create_time"; - $spendRes = M() - ->table("tab_spend spend") - ->field($field) - ->where($map) - ->join("tab_promote promote ON spend.promote_id = promote.id","left") - ->join("tab_game game ON spend.game_id = game.id","left") - ->join("tab_partner partner ON partner.id = game.partner_id","left") - ->group('spend.promote_id,spend.game_id') - ->select(); - if(empty($spendRes)){ - return ; - } - //集中两个表 - if($type == "cash_count"){ - $dbres = $this->gamemodel->addAll($spendRes); - if(!$dbres){ - $this->model->rollback(); - die("error"); - } - }else{ - for ($i=0; $i < count($spendRes); $i++) { - $spendRes[$i][$type] || $spendRes[$i][$type]=0; - # code... - $tempmap = array( - "game_id"=>$spendRes[$i]['game_id'], - "promote_id"=>$spendRes[$i]['promote_id'], - "count_date"=>$this->date - ); - $dbres = $this->gamemodel->where($tempmap)->find(); - if(empty($dbres)){ - //不存在 - $tempdbres = $this->gamemodel->add($spendRes[$i]); - if(!$tempdbres){ - $this->model->rollback(); - die("error"); - } - }else{ - $dbres[$type] = $dbres[$type]-0+$spendRes[$i][$type]; - $tempdbres = $this->gamemodel->save($dbres); - if($tempdbres === false){ - $this->model->rollback(); - die("error"); - } - } - } - } - # code... - } - - /** --------以下为设定角色聚合---------- **/ - - /** - * 获取角色聚合 - */ - public function setUserCount() - { - //获取会长信息 - $adddata=array(); - $userarr = array(); - $this->getUserCountInit($adddata,$userarr); - $this->getUserInsideData($adddata,$userarr); - $this->addUserDb($adddata); - } - //用户聚合 - public function getUserCountInit(&$adddata,&$userarr) - { - - $gameres = $this->gamemodel->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) bind_coin_count,chain,level,promote_id,promote_account") - ->where("count_date='{$this->date}'")->group("promote_id")->select(); - if(empty($gameres)){ - return; - } - $count = count($gameres); - $adddata=array(); - $userarr = array(); - //执行 - for ($i=0; $i < $count; $i++) { - $d = $gameres[$i]; - if($d['level'] < 2){ - $adddata[$d['promote_id']] = $d; - $userarr[] =$d['promote_id']; - }else{ - //获取所有链路 - $chain = trim($d['chain'],"/"); - $pid = explode("/", $chain); - $pid[] = $d['promote_id'];//添加自己 - for ($k=0; $k getChain($pid[$k]); - $temp['cash_count'] = $d['cash_count']; - $temp['balance_coin_count'] = $d['balance_coin_count']; - $temp['bind_coin_count'] = $d['bind_coin_count']; - - $adddata[$pid[$k]] = $temp; - $userarr[] =$pid[$k]; - } - } - } - } - } - //获取chain - protected function getChain($id){ - return M("Promote","tab_")->field("id promote_id,account promote_account,chain,level")->where("id='".$id."'")->find(); - } - //渠道角色统计仅计算推广员的平台币发放与收回 - protected function getUserInsideData(&$adddata,&$userarr) - { - $insideRes = M() - ->table("tab_promote_coin") - ->field("*") - ->where(array( - "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), - "source_id"=>0, - "status"=>1 - )) - ->select(); - if(!empty($insideRes)){ - for ($i=0; $i < count($insideRes); $i++) { - # code... - if($insideRes[$i]['type'] > 1){ - $insideRes[$i]['num'] = ( 0- $insideRes[$i]['num']); - } - //获取链路 - $d = $this->getChain($insideRes[$i]['promote_id']); - - $chain = trim($d['chain'],"/"); - $pid = explode("/", $chain); - $pid[] = $d['promote_id'];//添加自己 - if($d['level'] < 2){ - if(in_array($d["promote_id"], $userarr)){ - //存在 - $adddata[$pid[$k]]["inside_cash_count"] += $insideRes[$i]['num']; - }else{ - $d['inside_cash_count'] = $insideRes[$i]['num']; - $adddata[$d['promote_id']] = $d; - $userarr[] =$d['promote_id']; - } - }else{ - for ($k=0; $k getChain($pid[$k]); - $temp['inside_cash_count'] = $insideRes[$i]['num']; - - $adddata[$pid[$k]] = $temp; - $userarr[] =$pid[$k]; - } - } - } - } - } - - } - //添加用户统计表 - protected function addUserDb(&$adddata){ - $count = count($adddata); - if($count < 1){return;} - foreach ($adddata as $k => $v) { - isset($v["cash_count"]) || $v["cash_count"]=0; - isset($v["balance_coin_count"]) || $v["balance_coin_count"]=0; - isset($v["bind_coin_count"]) || $v["bind_coin_count"]=0; - isset($v["inside_cash_count"]) || $v["inside_cash_count"]=0; - //设定时间 - $v["count_date"] = $this->date; - $v["create_time"] = $this->nowdata; - //聚合不含内充流水 - $v['all_count'] = $v["cash_count"]-0+$v["balance_coin_count"]-0+$v["bind_coin_count"]; - $tempdbres = $this->usermodel->add($v); - if($tempdbres === false){ - $this->model->rollback(); - die("addUserDb error"); - } - } - } - - /** --------以下为设定月份聚合---------- **/ - /** - * @param 现金流水 cash_count 游戏中充值的现金 - * @param 平台币流水 balance_coin_count 游戏中消耗的平台币 - * @param 绑定币流水 bind_coin_count 游戏中绑定币的消耗 - * @param 内充流水 inside_cash_count:(推广员的平台币发放-收回)+(后台发放给玩家平台币-回收平台币 )+ (后台发放绑币给玩家 -回收的绑币) - * @param 平台币充值 balance_coin_deposit - * @return void - */ - public function setMonthCount() - { - $initdata = $this->getMonthInit(); - $balance = $this->getBalanceUser(); - $bind = $this->getBindUser(); - $deposit = $this->getBalanceDeposit(); - $initdata["inside_cash_count"] = $initdata["inside_cash_count"]-0+$balance-0+$bind; - $initdata["balance_coin_deposit"] = $deposit; - $initdata["all_count"] = $initdata["inside_cash_count"]-0+$initdata["cash_count"]-0+$deposit; - $initdata["count_date"] = $this->date; - $initdata["create_time"] = $this->nowdata; - $tempdbres = $this->monthmodel->add($initdata); - if($tempdbres === false){ - $this->model->rollback(); - die("setMonthCount error"); - } - # code... - } - //获取除了内充的 - protected function getMonthInit() - { - $tempmap = array( - "count_date"=>$this->date, - "level"=>array("LT",2) - ); - return $this->usermodel->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(bind_coin_count) bind_coin_count,sum(inside_cash_count) inside_cash_count")->where($tempmap)->find(); - } - //获取平台币充值流水 - protected function getBalanceDeposit() - { - $map = array( - "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), - "pay_status"=>1 - ); - $deposit = M("deposit","tab_")->field("SUM(pay_amount) pay_amount")->where($map)->find()['pay_amount']; - $deposit || $deposit=0; - return $deposit; - } - //设置 后台发放平台币给玩家 及 回收玩家 的最终值 - protected function getBalanceUser() - { - $map = array( - "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), - "status"=>1 - ); - $add = M("provide_user","tab_")->field("sum(amount) amount")->where($map)->find()['amount']; - $add || $add=0; - - $jq = M("user_coin","tab_")->field("sum(num) num")->where(array( - "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)) - ))->find()['num']; - $jq || $jq=0; - return $add-$jq; - } - //设置 后台发放绑币给玩家 及 回收玩家绑币 的最终值 - protected function getBindUser() - { - $map = array( - "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), - "status"=>1 - ); - $add = M("provide","tab_")->field("sum(amount) amount")->where($map)->find()['amount']; - $add || $add=0; - - - $jq = M("deduct_bind_record","tab_")->field("sum(quantity) quantity")->where(array( - "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)) - ))->find()['quantity']; - $jq || $jq=0; - return $add-$jq; - } - + } From 993bedc98fc13a9ecab793eb995b6aaf94769f91 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 5 Feb 2020 18:14:15 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E6=94=B6=E5=85=A5=E7=B1=BB=E5=9E=8B-?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=94=B6=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index 5cee8525f..096efdcc8 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -48,6 +48,9 @@ class FinancialSummarySetController extends \Think\Controller $this->date = $month; $tarry = explode('-',$month); + $this->year= $tarry[0]; + $this->month= $tarry[1]; + $this->beginThismonth=mktime(0,0,0,$tarry[1],1,$tarry[0]); $this->endThismonth=mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1; $this->reCount(); @@ -108,6 +111,7 @@ class FinancialSummarySetController extends \Think\Controller $this->getCashAndBalanCoinSpend(); $this->getBalanceCoinIncome(); $this->getGameSupersignIncome(); + $this->getTestUserIncome(); dump($this->adddata); # code... } @@ -164,7 +168,7 @@ class FinancialSummarySetController extends \Think\Controller "order_status"=>array("EGT",1) ); $COMoney= $this->CoinPayOrderModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount']; - $temparr['sum_money'] = number_format(($temparr['sum_money']*100+$COMoney*100)/100, 2, '.', ''); ; + $temparr['sum_money'] = number_format(($temparr['sum_money']*100+$COMoney*100)/100, 2, '.', ''); $this->adddata[]=$temparr; } //超级签购买收入 @@ -185,7 +189,45 @@ class FinancialSummarySetController extends \Think\Controller $temparr['sum_money'] = $this->GameSupersignModel->field("IFNULL(sum(pay_price),0) pay_price")->where($map)->find()['pay_price']; $this->adddata[]=$temparr; } - + //测试账号收入 + protected function getTestUserIncome() + { + $temparr = array( + "key_name"=>'test_user_income', + "type"=>1, + "sort"=>4, + "count_month"=>$this->month, + "count_year"=>$this->year, + "create_time"=>$this->nowdata + ); + //获取测试白名单 + $testlist = M("TestWhiteList",'tab_')->field("user_id")->select(); + if($testlist){ + $testlist = implode(",",array_column($testlist, 'user_id')); + }else{ + $testlist = false; + } + //获取现金充值 + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1, + "pay_way"=>array("GT",0) + ); + if($testlist) $map['user_id']=array("in",$testlist); + $cash_spend = $this->SpendModel + ->field("IFNULL(SUM(pay_amount),0) as pay_amount") + ->where($map) + ->find()['pay_amount']; + //获取平台币充值 + $map1 = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + if($testlist) $map1['user_id']=array("in",$testlist); + $deposit = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount']; + $temparr['sum_money'] = number_format(($cash_spend*100+$deposit*100)/100, 2, '.', ''); + $this->adddata[]=$temparr; + } From cb4e457acec8011bda2922b4d139e9a1a5a4b286 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 6 Feb 2020 13:04:24 +0800 Subject: [PATCH 05/32] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=B1=87=E6=80=BB-?= =?UTF-8?q?=E6=8C=89=E5=90=88=E4=BD=9C=E6=96=B9=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 73 +++++++++++++++++-- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index 096efdcc8..595435e80 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -92,19 +92,20 @@ class FinancialSummarySetController extends \Think\Controller $this->model->startTrans(); $this->continue =true; - //获取类型为1的数据 + //按收入类型 $this->setIncomeMoney(); - // // //执行用户表统计 - // $this->setUserCount(); + //按合作方类型 + $this->setPromoteMoney(); // // //执行月份统计 // $this->setMonthCount(); //执行 + dump($this->adddata); $this->model->commit(); $t2 = microtime(true); die("success runtime:".round($t2-$t1,3).'s'); } /** - * 获取类型为1的数据 + * 获取类型为1的数据,按收入类型 */ public function setIncomeMoney() { @@ -112,7 +113,7 @@ class FinancialSummarySetController extends \Think\Controller $this->getBalanceCoinIncome(); $this->getGameSupersignIncome(); $this->getTestUserIncome(); - dump($this->adddata); + # code... } //现金充值及平台币消耗 @@ -136,13 +137,13 @@ class FinancialSummarySetController extends \Think\Controller ->find(); $cash_spend = $temparr; $cash_spend["key_name"] = "cash_spend"; - $cash_spend["sort"] = "1"; + $cash_spend["sort"] = 1; $cash_spend["sum_money"] = $res['cash_count']; $this->adddata[]=$cash_spend; $balance_coin_spend = $temparr; $balance_coin_spend["key_name"] = "balance_coin_spend"; - $balance_coin_spend["sort"] = "2"; + $balance_coin_spend["sort"] = 2; $balance_coin_spend["sum_money"] = $res['balance_coin_count']; $this->adddata[]=$balance_coin_spend; } @@ -195,7 +196,7 @@ class FinancialSummarySetController extends \Think\Controller $temparr = array( "key_name"=>'test_user_income', "type"=>1, - "sort"=>4, + "sort"=>5, "count_month"=>$this->month, "count_year"=>$this->year, "create_time"=>$this->nowdata @@ -228,6 +229,62 @@ class FinancialSummarySetController extends \Think\Controller $temparr['sum_money'] = number_format(($cash_spend*100+$deposit*100)/100, 2, '.', ''); $this->adddata[]=$temparr; } + /** + * 获取类型为2,3的数据/按合作方类型 + */ + public function setPromoteMoney() + { + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $res = $this->SpendModel + ->alias('s') + ->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count, + IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count, + IFNULL(SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END),0) as bind_coin_count, + promote.company_belong") + ->where($map) + ->join("tab_promote promote ON s.promote_id = promote.id", "left") + ->group("company_belong") + ->select(); + $inside_count = 0; + $outer_count = 0; + $inside_nobind_count = 0; + $outer_nobind_count = 0; + foreach ($res as $k => $v) { + if($v['company_belong'] == 1){ + $outer_count = $v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100; + $outer_nobind_count = $v['cash_count']*100+$v['balance_coin_count']*100; + }else{ + //有可能存在官方渠道,company_belong=null + $inside_count += ($v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100); + $inside_nobind_count += ($v['cash_count']*100+$v['balance_coin_count']*100); + } + } + //处理数据 + $this->adddata[] = array( + "key_name"=>'inside_count', + "type"=>2,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($inside_count/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'outer_count', + "type"=>2,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($outer_count/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'inside_count', + "type"=>3,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($inside_nobind_count/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'outer_count', + "type"=>3,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($outer_nobind_count/100, 2, '.', '') + ); + } + From 7657db3b180ed9dbd3c89720af56b9f7f6a9cf03 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 6 Feb 2020 15:05:06 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E5=88=86=E7=B1=BB-?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=B8=A0=E9=81=93/=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 145 ++++++++++++++++-- 1 file changed, 136 insertions(+), 9 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index 595435e80..a71d04f64 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -96,8 +96,8 @@ class FinancialSummarySetController extends \Think\Controller $this->setIncomeMoney(); //按合作方类型 $this->setPromoteMoney(); - // // //执行月份统计 - // $this->setMonthCount(); + //支付渠道/支付类型 + $this->setPayWayMoney(); //执行 dump($this->adddata); $this->model->commit(); @@ -284,11 +284,138 @@ class FinancialSummarySetController extends \Think\Controller "sum_money"=>number_format($outer_nobind_count/100, 2, '.', '') ); } - - - - - - - + /** + * 获取类型为4,5的数据/按支付渠道类型,支付类型类型 + */ + public function setPayWayMoney() + { + $moneyarry=[ + "wx"=>0, + "zfb"=>0, + "gfzfb"=>0, + "sqzfb"=>0, + "sqkj"=>0 + ]; + $this->getSpendPayWay($moneyarry); + $this->getGameSupersignPayWay($moneyarry); + $this->getDepositPayWay($moneyarry); + $this->getCoinPayOrderPayWay($moneyarry); + //统计数据 + $moneyarry['zfb'] = ($moneyarry['gfzfb']-0+$moneyarry['sqzfb']); + $this->adddata[] = array( + "key_name"=>'gfwx_count', + "type"=>4,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'gfzfb_count', + "type"=>4,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['gfzfb']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'sqzfb_count', + "type"=>4,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['sqzfb']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'sqkj_count', + "type"=>4,"sort"=>4,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'wx_count', + "type"=>5,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'zfb_count', + "type"=>5,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['zfb']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'kj_count', + "type"=>5,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '') + ); + } + //获取spend表 + protected function getSpendPayWay(&$moneyarry){ + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1, + "pay_way"=>array("IN","1,2,3,9,15") + ); + $dbres=$this->SpendModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count, + IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count, + IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count, + IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100); + $moneyarry['gfzfb'] += $dbres['zfbgf_count']*100; + $moneyarry['sqzfb'] += $dbres['zfbsq_count']*100; + $moneyarry['sqkj'] += $dbres['kjsq_count']*100; + } + //获取超级签购买 + protected function getGameSupersignPayWay(&$moneyarry) + { + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $dbres=$this->GameSupersignModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_price ELSE 0 END),0) as wx_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_price ELSE 0 END),0) as zfb_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += $dbres['wx_count']; + $moneyarry['gfzfb'] += $dbres['zfb_count']; + } + //玩家购买平台币 + protected function getDepositPayWay(&$moneyarry) + { + $map = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1, + "pay_way"=>array("IN","1,2,3,9,15") + ); + $dbres=$this->DepositModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count, + IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count, + IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count, + IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100); + $moneyarry['gfzfb'] += $dbres['zfbgf_count']*100; + $moneyarry['sqzfb'] += $dbres['zfbsq_count']*100; + $moneyarry['sqkj'] += $dbres['kjsq_count']*100; + } + //会长充值平台币 + protected function getCoinPayOrderPayWay(&$moneyarry) + { + $map= array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "order_status"=>array("EGT",1) + ); + $dbres= $this->CoinPayOrderModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wx_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfb_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += $dbres['wx_count']; + $moneyarry['gfzfb'] += $dbres['zfb_count']; + } + } From 3703d7040b48dba88acd82e1b4d18e1f5a067f37 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 7 Feb 2020 13:48:28 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=84=9A=E6=9C=AC1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 119 ++++++++++-------- 1 file changed, 67 insertions(+), 52 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index a71d04f64..b00f4a819 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -15,10 +15,7 @@ class FinancialSummarySetController extends \Think\Controller public $year;//年份 public $adddata;//要添加的数据 //数据库 - public $model; public $FinancialSummaryModel; - - public $continue=false;//单元测试,开启后可访问独立函数测试 public function _initialize(){ //初始化 $this->beginThismonth = mktime(0,0,0,date('m')-1,1,date('Y')); @@ -29,7 +26,6 @@ class FinancialSummarySetController extends \Think\Controller $this->date = $this->year."-".$this->month; $this->nowdata =time(); - $this->model =M(); $this->FinancialSummaryModel =M("FinancialSummary",'tab_'); $this->DepositModel =M("Deposit",'tab_'); $this->SpendModel = M("Spend",'tab_'); @@ -49,8 +45,9 @@ class FinancialSummarySetController extends \Think\Controller $this->date = $month; $tarry = explode('-',$month); $this->year= $tarry[0]; - $this->month= $tarry[1]; + if(strlen($tarry[1]) < 2) $tarry[1]="0".$tarry[1]; + $this->month= $tarry[1]; $this->beginThismonth=mktime(0,0,0,$tarry[1],1,$tarry[0]); $this->endThismonth=mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1; $this->reCount(); @@ -66,12 +63,10 @@ class FinancialSummarySetController extends \Think\Controller # code... //清理之前的聚合 $temp =array( - "count_date"=>$this->date + "count_year"=>$this->year, + "count_month"=>$this->month ); - - $this->gamemodel->where($temp)->delete(); - $this->usermodel->where($temp)->delete(); - $this->monthmodel->where($temp)->delete(); + $this->FinancialSummaryModel->where($temp)->delete(); echo "重置成功执行重新生成:"; } @@ -84,13 +79,10 @@ class FinancialSummarySetController extends \Think\Controller set_time_limit(0); $t1 = microtime(true); //判断是否已经聚合 - // $countRes = M("spend_count","tab_")->field("count(*) date_count")->where("count_date = '{$this->date}'")->find()['date_count']; - // $countUserRes = M("spend_user_count","tab_")->field("count(*) date_count")->where("count_date = '{$this->date}'")->find()['date_count']; - // if($countRes > 0 || $countUserRes >0){ - // die("error:Repeated statistics,msg:{$this->date}已经聚合过"); - // } - $this->model->startTrans(); - $this->continue =true; + $countRes = $this->FinancialSummaryModel->field("IFNULL(COUNT(*),0) count")->where("count_year = '{$this->year}' and count_month= '{$this->month}'")->find()['count']; + if($countRes > 0){ + die("error:Repeated statistics,msg:{$this->date}已经聚合过"); + } //按收入类型 $this->setIncomeMoney(); @@ -98,9 +90,9 @@ class FinancialSummarySetController extends \Think\Controller $this->setPromoteMoney(); //支付渠道/支付类型 $this->setPayWayMoney(); - //执行 - dump($this->adddata); - $this->model->commit(); + //存入数据 + $this->addDb(); + $t2 = microtime(true); die("success runtime:".round($t2-$t1,3).'s'); } @@ -113,19 +105,11 @@ class FinancialSummarySetController extends \Think\Controller $this->getBalanceCoinIncome(); $this->getGameSupersignIncome(); $this->getTestUserIncome(); - - # code... + $this->getRewardRecordIncome(); } //现金充值及平台币消耗 protected function getCashAndBalanCoinSpend() { - $temparr = array( - "type"=>1, - "count_month"=>$this->month, - "count_year"=>$this->year, - "create_time"=>$this->nowdata - ); - $map = array( "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), @@ -135,14 +119,15 @@ class FinancialSummarySetController extends \Think\Controller ->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count") ->where($map) ->find(); - $cash_spend = $temparr; $cash_spend["key_name"] = "cash_spend"; + $cash_spend["type"] = 1; + $cash_spend["sort"] = 1; $cash_spend["sum_money"] = $res['cash_count']; $this->adddata[]=$cash_spend; - $balance_coin_spend = $temparr; $balance_coin_spend["key_name"] = "balance_coin_spend"; + $balance_coin_spend["type"] = 1; $balance_coin_spend["sort"] = 2; $balance_coin_spend["sum_money"] = $res['balance_coin_count']; $this->adddata[]=$balance_coin_spend; @@ -154,9 +139,6 @@ class FinancialSummarySetController extends \Think\Controller "key_name"=>'balance_coin_income', "type"=>1, "sort"=>3, - "count_month"=>$this->month, - "count_year"=>$this->year, - "create_time"=>$this->nowdata ); $map = array( "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), @@ -179,9 +161,6 @@ class FinancialSummarySetController extends \Think\Controller "key_name"=>'game_supersign_income', "type"=>1, "sort"=>4, - "count_month"=>$this->month, - "count_year"=>$this->year, - "create_time"=>$this->nowdata ); $map = array( "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), @@ -196,10 +175,7 @@ class FinancialSummarySetController extends \Think\Controller $temparr = array( "key_name"=>'test_user_income', "type"=>1, - "sort"=>5, - "count_month"=>$this->month, - "count_year"=>$this->year, - "create_time"=>$this->nowdata + "sort"=>5 ); //获取测试白名单 $testlist = M("TestWhiteList",'tab_')->field("user_id")->select(); @@ -229,6 +205,33 @@ class FinancialSummarySetController extends \Think\Controller $temparr['sum_money'] = number_format(($cash_spend*100+$deposit*100)/100, 2, '.', ''); $this->adddata[]=$temparr; } + //奖罚收入 + protected function getRewardRecordIncome() + { + $map = array( + "reward_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + ); + $rrres = M("RewardRecord","tab_") + ->field(" + IFNULL(SUM(CASE WHEN reward_type = 1 THEN money ELSE 0 END),0) as reward_count, + IFNULL(SUM(CASE WHEN reward_type = 2 THEN money ELSE 0 END),0) as fine_count + ") + ->where($map) + ->find(); + //奖励负,惩罚正 + $this->adddata[] = array( + "key_name"=>'reward_count', + "type"=>1, + "sort"=>6, + 'sum_money'=>$rrres['reward_count'] + ); + $this->adddata[] = array( + "key_name"=>'fine_count', + "type"=>1, + "sort"=>7, + 'sum_money'=>$rrres['fine_count'] + ); + } /** * 获取类型为2,3的数据/按合作方类型 */ @@ -265,22 +268,22 @@ class FinancialSummarySetController extends \Think\Controller //处理数据 $this->adddata[] = array( "key_name"=>'inside_count', - "type"=>2,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>2,"sort"=>1, "sum_money"=>number_format($inside_count/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'outer_count', - "type"=>2,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>2,"sort"=>2, "sum_money"=>number_format($outer_count/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'inside_count', - "type"=>3,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>3,"sort"=>1, "sum_money"=>number_format($inside_nobind_count/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'outer_count', - "type"=>3,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>3,"sort"=>2, "sum_money"=>number_format($outer_nobind_count/100, 2, '.', '') ); } @@ -304,37 +307,37 @@ class FinancialSummarySetController extends \Think\Controller $moneyarry['zfb'] = ($moneyarry['gfzfb']-0+$moneyarry['sqzfb']); $this->adddata[] = array( "key_name"=>'gfwx_count', - "type"=>4,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>4,"sort"=>1, "sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'gfzfb_count', - "type"=>4,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>4,"sort"=>2, "sum_money"=>number_format($moneyarry['gfzfb']/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'sqzfb_count', - "type"=>4,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>4,"sort"=>3, "sum_money"=>number_format($moneyarry['sqzfb']/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'sqkj_count', - "type"=>4,"sort"=>4,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>4,"sort"=>4, "sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'wx_count', - "type"=>5,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>5,"sort"=>1, "sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'zfb_count', - "type"=>5,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>5,"sort"=>2, "sum_money"=>number_format($moneyarry['zfb']/100, 2, '.', '') ); $this->adddata[] = array( "key_name"=>'kj_count', - "type"=>5,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "type"=>5,"sort"=>3, "sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '') ); } @@ -417,5 +420,17 @@ class FinancialSummarySetController extends \Think\Controller $moneyarry['wx'] += $dbres['wx_count']; $moneyarry['gfzfb'] += $dbres['zfb_count']; } + public function addDb() + { + foreach ($this->adddata as $k=> &$v) { + $v["count_month"] = $this->month; + $v["count_year"] = $this->year; + $v["create_time"] = $this->nowdata; + } + $res = $this->FinancialSummaryModel->addAll($this->adddata); + if(!$res){ + echo "DB save error"; + } + } } From aaf67b85cc5604d23963cf8461f7df41341171aa Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 7 Feb 2020 15:03:59 +0800 Subject: [PATCH 08/32] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=A7=E6=9C=88?= =?UTF-8?q?=E4=BB=BD=E7=BB=9F=E8=AE=A1=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 12 ++++--- .../Controller/OldCountController.class.php | 35 +++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index b00f4a819..bb342eb10 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -17,6 +17,7 @@ class FinancialSummarySetController extends \Think\Controller //数据库 public $FinancialSummaryModel; public function _initialize(){ + //初始化 $this->beginThismonth = mktime(0,0,0,date('m')-1,1,date('Y')); $this->endThismonth = mktime(0,0,0,date('m'),1,date('Y'))-1; @@ -25,7 +26,7 @@ class FinancialSummarySetController extends \Think\Controller $this->month= date('m',$temp); $this->date = $this->year."-".$this->month; $this->nowdata =time(); - + $this->FinancialSummaryModel =M("FinancialSummary",'tab_'); $this->DepositModel =M("Deposit",'tab_'); $this->SpendModel = M("Spend",'tab_'); @@ -37,11 +38,12 @@ class FinancialSummarySetController extends \Think\Controller /** * 更新某月数据 */ - public function setMonthFinancialSummary() + public function setMonthFinancialSummary($count_date) { - $month = I("count_date"); + $month = $count_date; if(empty($month)) die("参数错误"); + $this->adddata = [];//置空否者会脚本进来会重复计算 $this->date = $month; $tarry = explode('-',$month); $this->year= $tarry[0]; @@ -94,7 +96,7 @@ class FinancialSummarySetController extends \Think\Controller $this->addDb(); $t2 = microtime(true); - die("success runtime:".round($t2-$t1,3).'s'); + echo ("success {$this->date}:ok runtime:".round($t2-$t1,3).'s'.PHP_EOL); } /** * 获取类型为1的数据,按收入类型 @@ -430,6 +432,8 @@ class FinancialSummarySetController extends \Think\Controller $res = $this->FinancialSummaryModel->addAll($this->adddata); if(!$res){ echo "DB save error"; + }else{ + } } diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index 37283c3ce..30e95b003 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -1,4 +1,5 @@ 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() { @@ -87,5 +102,25 @@ class OldCountController extends \Think\Controller } die("init ok"); } + //获取公司月结所需要的所有月份截止至上个月 + 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; + } + } From 2fe965749e6ce3cdc58d4daf7b420d0a05512bca Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 11 Feb 2020 13:58:29 +0800 Subject: [PATCH 09/32] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=B1=87=E6=80=BBok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummaryController.class.php | 126 +++++ .../Admin/View/FinancialSummary/index.html | 442 ++++++++++++++++++ 2 files changed, 568 insertions(+) create mode 100644 Application/Admin/Controller/FinancialSummaryController.class.php create mode 100644 Application/Admin/View/FinancialSummary/index.html diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php new file mode 100644 index 000000000..14e43755b --- /dev/null +++ b/Application/Admin/Controller/FinancialSummaryController.class.php @@ -0,0 +1,126 @@ +"现金充值收入", + "balance_coin_spend"=>"平台币充值收入", + "balance_coin_income"=>"平台币消耗", + "game_supersign_income"=>"超级签购买收入", + "test_user_income"=>"测试收入", + "reward_count"=>"奖励", + "fine_count"=>"违规处罚", + "inside_count"=>"内团", + "outer_count"=>"外团", + "inside_count"=>"内团", + "outer_count"=>"外团", + "gfwx_count"=>"官方-微信", + "gfzfb_count"=>"官方-支付宝", + "sqzfb_count"=>"双乾-支付宝", + "sqkj_count"=>"双乾-快捷", + "wx_count"=>"微信", + "zfb_count"=>"支付宝", + "kj_count"=>"快捷" + ); + public function _initialize() + { + parent::_initialize(); + // echo "
";
+    }
+    public function index($p=1)
+    {
+        if(!array_key_exists("year",$_REQUEST) || !array_key_exists("type",$_REQUEST)){
+            $this->redirect(ACTION_NAME, array('year' => date('Y',time()),"type"=>2));
+        }
+        $this->getYearList();
+        $this->getYearData();
+        $this->display();
+
+    }
+    //获取指定年份数据
+    public function getYearData()
+    {
+        $senddata = array(
+            "income"=>[
+                "count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
+            ],
+            "promote"=>[
+                "count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
+            ],
+            "channel"=>[
+                "count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
+            ],
+            "payway"=>[
+                "count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
+            ]
+        );
+        $data = [];
+        //初始化数据
+        foreach ($this->keyname as $k => $v) {
+            $data[$k] = array("name"=>$v,"money"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]);
+        }
+        $map = array(
+            "count_year"=>$_REQUEST['year'],
+            "type"=>array("IN","1,{$_REQUEST['type']},4,5")
+        );
+        $dbres = M("FinancialSummary","tab_")->field("*")->where($map)->select();
+        foreach ($dbres as $k => $v) {
+            if($v['type'] == 1){
+                if(!in_array($v['key_name'],$senddata['income']['list'])){
+                    $senddata['income']['list'][] = $v['key_name'];
+                }
+            }
+            if($v['type'] == 4){
+                if(!in_array($v['key_name'],$senddata['channel']['list'])){
+                    $senddata['channel']['list'][] = $v['key_name'];
+                }
+            }
+            if($v['type'] == 5){
+                if(!in_array($v['key_name'],$senddata['payway']['list'])){
+                    $senddata['payway']['list'][] = $v['key_name'];
+                }
+            }
+            if($v['type'] == $_REQUEST['type']){
+                if(!in_array($v['key_name'],$senddata['promote']['list'])){
+                    $senddata['promote']['list'][] = $v['key_name'];
+                }
+            }
+            $data[$v['key_name']]["money"][((int)$v['count_month']-1)] = $v['sum_money'];
+            # code...
+        }
+        foreach ($senddata as $k => $v) {
+            foreach ($v as $ke => $va) {
+                if($ke !='count'){
+                    foreach ($va as $key => $val) {
+                        for ($i=0; $i < 12; $i++) { 
+                            $data[$val]["money"][12] += $data[$val]["money"][$i];
+                            $senddata[$k]['count'][$i] += $data[$val]["money"][$i];
+                            $senddata[$k]['count'][12] +=$data[$val]["money"][$i];
+                        }
+                        $senddata[$k][$ke][$key] = $data[$val];
+                    }
+                }
+                
+            }
+        }
+        $this->assign('data', $senddata);
+    }
+    //获取历史年份
+    public function getYearList()
+    {
+        $star = 2019;
+        $end = date("Y",time());
+        $list = [];
+        for ($i=$star; $i <= $end; $i++) { 
+            $temp = array(
+                "value"=>$i,
+                "name"=>"{$i}年"
+            );
+            $list[] = $temp ;
+        }
+        $this->assign('YearList', $list);
+    }
+
+    
+    
+}
\ No newline at end of file
diff --git a/Application/Admin/View/FinancialSummary/index.html b/Application/Admin/View/FinancialSummary/index.html
new file mode 100644
index 000000000..a94577f7d
--- /dev/null
+++ b/Application/Admin/View/FinancialSummary/index.html
@@ -0,0 +1,442 @@
+
+
+
+    
+    
+    
+    
+
+    
+    
+    
+    
+    
+ +
+
+ +
+
+ +
+
+ +
+ + + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
按收入类型
序号流水类型1月2月3月4月5月6月7月8月9月10月11月12月年度合计
{$incomekey}{$income.name}{$incomemoney}
合计:{$incomecount}
+ + + + + + + + + + + + + + + + + + + + + + + + +
按合作方类型
序号流水类型1月2月3月4月5月6月7月8月9月10月11月12月年度合计
{$promotekey}{$promote.name}{$promotemoney}
合计:{$promotecount}
+ + + + + + + + + + + + + + + + + + + + + + + + +
按支付渠道类型
序号流水类型1月2月3月4月5月6月7月8月9月10月11月12月年度合计
{$channelkey}{$channel.name}{$channelmoney}
合计:{$channelcount}
+ + + + + + + + + + + + + + + + + + + + + + + + +
支付类型类型
序号流水类型1月2月3月4月5月6月7月8月9月10月11月12月年度合计
{$paywaykey}{$payway.name}{$paywaymoney}
合计:{$paywaycount}
+
+
+ +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + '; + + + + + + + + \ No newline at end of file From 58aefd29979993e5f22abc391111493924157600 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Mon, 17 Feb 2020 16:33:27 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/PartnerController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index 563f7f621..8db76e51e 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -126,7 +126,7 @@ class PartnerController extends ThinkController } else { $val["row"] = 1; } - + $val['original_package_name'] = $val['original_package_name'] ?: '-'; $parseGames[$val['partner_id']][] = $val; } From 3bb3a8b45d309d5011d096af0e6aa0ddbf159007 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Mon, 17 Feb 2020 16:59:35 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/Partner/add.html | 2 +- Application/Admin/View/Partner/edit.html | 2 +- Application/Admin/View/Partner/show.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Application/Admin/View/Partner/add.html b/Application/Admin/View/Partner/add.html index f5c1eee72..23b709497 100644 --- a/Application/Admin/View/Partner/add.html +++ b/Application/Admin/View/Partner/add.html @@ -61,7 +61,7 @@ 开票税点: - + % diff --git a/Application/Admin/View/Partner/edit.html b/Application/Admin/View/Partner/edit.html index f0b4f5915..5bec25994 100644 --- a/Application/Admin/View/Partner/edit.html +++ b/Application/Admin/View/Partner/edit.html @@ -61,7 +61,7 @@ 开票税点: - + % diff --git a/Application/Admin/View/Partner/show.html b/Application/Admin/View/Partner/show.html index ffc13bd40..5492ed73b 100644 --- a/Application/Admin/View/Partner/show.html +++ b/Application/Admin/View/Partner/show.html @@ -61,7 +61,7 @@ 开票税点: - + % From cbbbcfd8ffecb7b3352acc40ff5cfa1a2024daca Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 17 Feb 2020 17:04:26 +0800 Subject: [PATCH 12/32] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=96=E5=9B=A2?= =?UTF-8?q?=E5=88=86=E5=8F=91=E5=92=8C=E5=85=B6=E4=BB=96=E5=9B=A2=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummaryController.class.php | 6 ++- .../FinancialSummarySetController.class.php | 39 ++++++++++++++++++- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php index 14e43755b..381f8bc09 100644 --- a/Application/Admin/Controller/FinancialSummaryController.class.php +++ b/Application/Admin/Controller/FinancialSummaryController.class.php @@ -12,8 +12,10 @@ class FinancialSummaryController extends AdminController "fine_count"=>"违规处罚", "inside_count"=>"内团", "outer_count"=>"外团", - "inside_count"=>"内团", - "outer_count"=>"外团", + "outer_branch_count"=>"外团-分发", + "other_group_count"=>"无归属团", + // "inside_count"=>"内团", + // "outer_count"=>"外团", "gfwx_count"=>"官方-微信", "gfzfb_count"=>"官方-支付宝", "sqzfb_count"=>"双乾-支付宝", diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index bb342eb10..6d08cb495 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -253,14 +253,28 @@ class FinancialSummarySetController extends \Think\Controller ->join("tab_promote promote ON s.promote_id = promote.id", "left") ->group("company_belong") ->select(); - $inside_count = 0; - $outer_count = 0; + $inside_count = 0;//内团 + $outer_count = 0;//外团 + $outer_branch_count = 0;//外团分发 + $other_group_count = 0;//其他 + + $inside_nobind_count = 0; $outer_nobind_count = 0; + $outer_branch_nobind_count = 0; + $other_group_nobind_count = 0;//其他 foreach ($res as $k => $v) { if($v['company_belong'] == 1){ $outer_count = $v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100; $outer_nobind_count = $v['cash_count']*100+$v['balance_coin_count']*100; + }elseif($v['company_belong'] == 2){ + //外团分发 + $outer_branch_count = $v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100; + $outer_branch_nobind_count = $v['cash_count']*100+$v['balance_coin_count']*100; + }elseif($v['company_belong'] == 3){ + //其他 + $other_group_count = $v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100; + $other_group_nobind_count = $v['cash_count']*100+$v['balance_coin_count']*100; }else{ //有可能存在官方渠道,company_belong=null $inside_count += ($v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100); @@ -278,6 +292,17 @@ class FinancialSummarySetController extends \Think\Controller "type"=>2,"sort"=>2, "sum_money"=>number_format($outer_count/100, 2, '.', '') ); + $this->adddata[] = array( + "key_name"=>'outer_branch_count', + "type"=>2,"sort"=>3, + "sum_money"=>number_format($outer_branch_count/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'other_group_count', + "type"=>2,"sort"=>4, + "sum_money"=>number_format($other_group_count/100, 2, '.', '') + ); + //不含绑定币 $this->adddata[] = array( "key_name"=>'inside_count', "type"=>3,"sort"=>1, @@ -288,6 +313,16 @@ class FinancialSummarySetController extends \Think\Controller "type"=>3,"sort"=>2, "sum_money"=>number_format($outer_nobind_count/100, 2, '.', '') ); + $this->adddata[] = array( + "key_name"=>'outer_branch_count', + "type"=>3,"sort"=>3, + "sum_money"=>number_format($outer_branch_nobind_count/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'other_group_count', + "type"=>3,"sort"=>4, + "sum_money"=>number_format($other_group_nobind_count/100, 2, '.', '') + ); } /** * 获取类型为4,5的数据/按支付渠道类型,支付类型类型 From ec4bc4d46ecc867096a77d8b5b7e25578065e2a2 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 17 Feb 2020 17:14:26 +0800 Subject: [PATCH 13/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=81=E9=80=9F?= =?UTF-8?q?=E7=89=88=E4=B8=8B=E8=BD=BD=E6=8F=8F=E8=BF=B0=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/GameController.class.php | 8 ++++---- Application/Home/View/default/Home/landingPage.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index cd6962103..3d92891c0 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -174,10 +174,10 @@ class GameController extends ThinkController $downloadWays = $_POST['download_ways'] ?? []; if (in_array(GameService::DOWNLOAD_BETA, $downloadWays)) { if (empty($_POST['beta_url'])) { - return $this->error("请在Beta按钮开启的情况填写Beta链接"); + return $this->error("请在极速版下载按钮开启的情况填写极速版下载链接"); } if (!preg_match("/^((https|http|itms-beta)?:\/\/)[^\s]+/i", $_POST['beta_url'])) { - return $this->error("请填写正确的Beta链接"); + return $this->error("请填写正确的极速版下载链接"); } } $_POST['relation_game_name'] = $_POST['game_name']; @@ -316,10 +316,10 @@ class GameController extends ThinkController $downloadWays = $_POST['download_ways'] ?? []; if (in_array(GameService::DOWNLOAD_BETA, $downloadWays)) { if (empty($_POST['beta_url'])) { - return $this->error("请在Beta按钮开启的情况填写Beta链接"); + return $this->error("请在极速版下载按钮开启的情况填写极速版下载链接"); } if (!preg_match("/^((https|http|itms-beta)?:\/\/)[^\s]+/i", $_POST['beta_url'])) { - return $this->error("请填写正确的Beta链接"); + return $this->error("请填写正确的极速版下载链接"); } } /*if($_POST['apply_status']==0&&$_POST['game_status']==1){ diff --git a/Application/Home/View/default/Home/landingPage.html b/Application/Home/View/default/Home/landingPage.html index 5f33d9a21..35674dc43 100644 --- a/Application/Home/View/default/Home/landingPage.html +++ b/Application/Home/View/default/Home/landingPage.html @@ -258,7 +258,7 @@
-
极速下载:畅享稳定游戏,拒绝频繁掉签,极速下载,不丢游戏,不丢数据,高端定制,仅针对IOS用户免费开放!
+
极速下载:免费极速下载,高端定制,游戏稳定,仅针对IOS用户开放!
至尊下载:10元购买,永不闪退、不丢数据稳定与保障。同意设备安装一次可在一年内无限次下载重装,并赠送限量至尊超级礼包!
From 8dedae55877fb5d5a944d4f2eb0c683baca13338 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Mon, 17 Feb 2020 17:56:27 +0800 Subject: [PATCH 14/32] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E6=80=A7=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/PartnerController.class.php | 2 +- Application/Admin/View/Partner/lists.html | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index 8db76e51e..b0d91fac1 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -146,7 +146,7 @@ class PartnerController extends ThinkController } elseif ($value['settlement_type'] == 2) { $value['settlement_type'] = '月结'; } - + $value['company_type'] = $value['company_type'] == 2 ? '个人' : '公司'; $value['contract_time'] = time_format($value['contract_start_time'], 'Y/m/d') . '-' . time_format($value['contract_end_time'], 'Y/m/d'); $row2 = array_sum(array_column($value['game'], 'row')) ; diff --git a/Application/Admin/View/Partner/lists.html b/Application/Admin/View/Partner/lists.html index 73ed574a6..4c82b2082 100644 --- a/Application/Admin/View/Partner/lists.html +++ b/Application/Admin/View/Partner/lists.html @@ -90,6 +90,7 @@ 操作 合同合作方名称 + 公司性质 对应平台 合同期限 开票税点 @@ -122,6 +123,7 @@ 删除 {$data.partner} + {$data.company_type} {$data.matche_platform} {$data.contract_time} {$data.invoice_rate}% From 3efe7167f21006b74ae2920677e933afd5bea04e Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Mon, 17 Feb 2020 18:01:59 +0800 Subject: [PATCH 15/32] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E6=80=A7=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/PartnerController.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index b0d91fac1..e33d3a61b 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -62,7 +62,7 @@ class PartnerController extends ThinkController //获取分页数据 $query = $model->alias('p') ->field("p.partner,p.matche_platform,p.invoice_rate,p.settlement_type,p.bank_account, - p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark") + p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark,p.company_type") ->where($map) ->order("id desc"); if($is_export){ @@ -154,7 +154,6 @@ class PartnerController extends ThinkController $parseData[$value['partner_id']][] = $value; } $parseData = array_values($parseData); - if($is_export){ $this->assign('listData', $parseData[0]); $this->display("export"); From bb276f2bcc60f207a00ebe1b7fa132f759b77f70 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 17 Feb 2020 18:32:22 +0800 Subject: [PATCH 16/32] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteCompanyController.class.php | 29 ++- .../Admin/View/PromoteCompany/export.html | 182 +++++++++--------- .../Admin/View/PromoteCompany/lists.html | 10 + 3 files changed, 125 insertions(+), 96 deletions(-) diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 1cc6d854c..29f49cf76 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -59,6 +59,8 @@ class PromoteCompanyController extends ThinkController $companyids = implode(',', array_column($companyres, 'id')); //获取所属会长及其游戏分成 $promotemap['company_id']=["in",$companyids]; + $promotemap['level'] = 1; + $promoteres = M("Promote","tab_") ->field("id,company_id,account,settlement_type") ->where($promotemap) @@ -177,20 +179,29 @@ class PromoteCompanyController extends ThinkController if($v['platform_name'] == '' || $v['platform_name'] == "0"){ $v['platform_name'] = "--"; } - $v["is_sign_contact"] = ($v["is_sign_contact"]=="1" ? "是" :'否'); - + $v["is_sign_contact"] = ($v["is_sign_contact"]=="1" ? "是" :'否'); + $v["company_type"] = ($v["company_type"]=="1" ? "公司" :'个人'); + $v["company_belong"] = ($v["company_belong"]=="0" ? "内团" : ($v["company_belong"]=="1" ? "外团" : ($v["company_belong"]=="2" ? "外团分发" : '无'))); } // dd($companyres); + + + //公司及会长数量统计 + $companycount = $model->field("id")->where($map)->select(); + $count = count($companycount); + $companyallids = implode(',', array_column($companycount, 'id')); + $promotemap['company_id']=["in",$companyallids]; + $promotecount = M("Promote","tab_")->where($promotemap)->count(); + + $this->assign('listData', $companyres); + $this->assign('count', $count); + $this->assign('promotecount', $promotecount); if($is_export){ - $this->assign('listData', $companyres); + //导出 $this->display("export"); die(); } - /* 查询记录总数 */ - $count = $model - ->where($map) - ->count(); //分页 $parameter['p'] = $page; $parameter['row'] = $row; @@ -198,9 +209,7 @@ class PromoteCompanyController extends ThinkController if ($page) { $this->assign('_page', $page); } - - $this->assign('listData', $companyres); - $this->assign('count', $count); + //分配其他页面需要参数 $this->assign('promoteList', getPromoteByLevel(1)); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find()); $this->meta_title = '推广公司'; diff --git a/Application/Admin/View/PromoteCompany/export.html b/Application/Admin/View/PromoteCompany/export.html index d358bf1af..7232a461c 100644 --- a/Application/Admin/View/PromoteCompany/export.html +++ b/Application/Admin/View/PromoteCompany/export.html @@ -29,48 +29,67 @@ - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -84,44 +103,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + @@ -135,16 +124,37 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + +
合作方名称对应平台合同期限开票税点开户行银行账号是否签署合同备注
合作方名称对应平台公司性质内外团归属合同期限开票税点开户行银行账号是否签署合同备注会长账号结算周期产品类型游戏名称合作方分成比例
会长账号结算周期产品类型游戏名称合作方分成比例
aOh! 暂时还没有内容!
{$data.company_name}{$data.platform_name}{$data.contact_begin} - {$data.contact_end}{$data.fax_ratio}%{$data.bank_name} {$data.bank_card}{$data.is_sign_contact}{$data.content}
{$promote['account']} {$promote['settlement_type']}
aOh! 暂时还没有内容!
{$data.company_name}{$data.platform_name}{$data.company_type}{$data.company_belong}{$data.contact_begin} - {$data.contact_end}{$data.fax_ratio}%{$data.bank_name} {$data.bank_card}{$data.is_sign_contact}{$data.content}
 {$promote['account']} {$promote['settlement_type']}
{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
{$game['game_type_name']} {$game['relation_game_name']} {$ratio['ratio']}
{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
{$promote['account']} {$promote['settlement_type']}{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
 {$promote['account']} {$promote['settlement_type']}{$game['game_type_name']} {$game['relation_game_name']} {$ratio['ratio']}
{$game['game_type_name']}{$game['relation_game_name']}
{$ratio['name']}{$ratio['ratio']}
{$ratio['name']}{$ratio['ratio']}
汇总: + 累计推广公司数量:{$count}  会长数量:{$promotecount} +
+ class="form-horizontal form_info_ml" id="form">
奖惩编辑
  • - + +
  • - + +
  • @@ -93,22 +99,22 @@ $account):?>
  • @@ -153,72 +159,72 @@
- - - + + + \ No newline at end of file From e58bb1149fffc1d65e8ed9d618514d397d2be40b Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 18 Feb 2020 16:25:27 +0800 Subject: [PATCH 24/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=90=BD=E5=9C=B0?= =?UTF-8?q?=E9=A1=B5=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/PromoteService.class.php | 2 +- .../Home/Controller/ApplyController.class.php | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index dc8be7cc6..6595b95ab 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -1015,7 +1015,7 @@ class PromoteService { if (!$record) { return false; } - if ($record['status'] != 1) { + if (!in_array($record['status'], [1, 2])) { return false; } } diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index ed99d068b..c7cf38695 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -132,6 +132,15 @@ class ApplyController extends BaseController } } break; + case 0: + $applyService = new ApplyService(); + $gameIdList = $applyService->getSociatyGameIds($loginPromote); + if (count($gameIdList) > 0) { + $gameIds = implode(',', $gameIdList); + $map['tab_game.id'] = ['in', $gameIds]; + } else { + $map = '1 = 2'; + } } $page = intval(I('get.p', 0)); @@ -615,8 +624,13 @@ class ApplyController extends BaseController $promoteId = $_REQUEST['promote_id']; } + $applyService = new ApplyService(); + $gameIdList = $applyService->getSociatyGameIds($loginPromote); + $applyMap['promote_id'] = $promoteId; $applyMap['offline_status'] = 0; + $applyMap['game_id'] = ['in', $gameIdList]; + $gameIds = M('Apply', 'tab_')->where($applyMap)->getField('game_id', true); $gameIds = implode(',', $gameIds); @@ -1795,7 +1809,7 @@ class ApplyController extends BaseController $promoteId = $promote['id']; } $apply = M('apply', 'tab_')->where(['promote_id' => $promoteId, 'game_id' => $gameId])->find(); - $game = M('game', 'tab_')->field(['icon'])->where(['id' => $gameId])->find(); + $game = M('game', 'tab_')->field(['id', 'icon', 'apply_auth'])->where(['id' => $gameId])->find(); if ($apply == null) { $this->ajaxReturn([ 'status' => 0, @@ -1805,6 +1819,16 @@ class ApplyController extends BaseController ]); } + $applyService = new ApplyService(); + if (!$applyService->checkSociatyPerm($promote, $game)) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '该游戏未授权', + 'data' => [ + ] + ]); + } + $promoteService = new PromoteService(); if (!$promoteService->canPresidentApplyGame($promote)) { $this->ajaxReturn([ @@ -1817,7 +1841,6 @@ class ApplyController extends BaseController $icon = Request::getHost() . '/' . get_cover($game['icon'], 'path'); - $applyService = new ApplyService(); $result = $applyService->checkApplyStatus($apply); if (!$result['status']) { $this->ajaxReturn([ @@ -1847,7 +1870,8 @@ class ApplyController extends BaseController } $apply = M('apply', 'tab_')->where(['promote_id' => $promoteId, 'game_id' => $gameId])->find(); - $game = M('game', 'tab_')->field(['icon'])->where(['id' => $gameId])->find(); + $game = M('game', 'tab_')->field(['icon', 'apply_auth', 'id'])->where(['id' => $gameId])->find(); + if ($apply == null) { $this->ajaxReturn([ 'status' => 1, @@ -1857,6 +1881,16 @@ class ApplyController extends BaseController ]); } + $applyService = new ApplyService(); + if (!$applyService->checkSociatyPerm($promote, $game)) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '该游戏未授权', + 'data' => [ + ] + ]); + } + $promoteService = new PromoteService(); if (!$promoteService->canPresidentApplyGame($promote)) { $this->ajaxReturn([ @@ -1869,7 +1903,6 @@ class ApplyController extends BaseController $icon = Request::getHost() . '/' . get_cover($game['icon'], 'path'); - $applyService = new ApplyService(); $result = $applyService->checkApplyStatus($apply); if (!$result['status']) { $this->ajaxReturn([ From 6d91ec7c60ca526cb62bfe21a4db4ed7f6fb930d Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Tue, 18 Feb 2020 16:37:19 +0800 Subject: [PATCH 25/32] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98-=E3=80=8B?= =?UTF-8?q?=E5=A5=96=E7=BD=9A=E8=AE=B0=E5=BD=95=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E3=80=8B=E4=B8=8A=E4=B8=8B=E6=B8=B8=E5=85=AC=E5=8F=B8=E4=B8=8E?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E7=B1=BB=E5=9E=8B=E8=81=94=E5=8A=A8=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=9C=AA=E6=98=BE=E7=A4=BA=E4=B8=8B=E6=B8=B8?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AjaxController.class.php | 18 +++++++++++ .../StatementMangement/rewardManageList.html | 31 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 012a7a5ff..f63370a9f 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -522,4 +522,22 @@ class AjaxController extends ThinkController{ # code... } + /** + *获取上下游公司 + */ + public function getCompanyList() + { + $company_type = I('company_type');//公司类型 + if ($company_type ==1) {//上游公司 + $data = M('partner','tab_')->field('id, partner as name,1 as type')->where(['status' => 1])->select(); + } elseif ($company_type ==2) {//下游公司 + $data = M('promote_company','tab_')->field('id, company_name as name,2 as type')->where(['status' => 1])->select(); + } else { + $partner = M('partner','tab_')->field('id, partner as name,1 as type')->where(['status' => 1])->select(); + $promote_company = M('promote_company','tab_')->field('id, company_name as name, 2 as type')->where(['status' => 1])->select(); + $data = array_merge($partner, $promote_company); + } + $this->ajaxReturn($data); + } + } \ No newline at end of file diff --git a/Application/Admin/View/StatementMangement/rewardManageList.html b/Application/Admin/View/StatementMangement/rewardManageList.html index 064f94ca5..8ac38dd30 100644 --- a/Application/Admin/View/StatementMangement/rewardManageList.html +++ b/Application/Admin/View/StatementMangement/rewardManageList.html @@ -77,7 +77,7 @@
@@ -201,6 +201,31 @@ $(".select_gallery").select2(); highlight_subnav("{:U('StatementMangement/rewardManageList')}"); + function get_company_list() + { + var id = $('#partner_id').val(); + var company_type = $("#company_type option:selected").val(); + $.ajax({ + url:"{:U('Ajax/getCompanyList')}", + type:"post", + data:{ + company_type:company_type, + }, + dataType:'json', + success:function(data){ + var str = ""; + for (var i in data){ + str += "" + } + // console.log(str); + $("#partner_id").empty(); + $("#partner_id").append(str); + $("#partner_id").select2(); + + } + }) + } + function get_game_list() { var game_name = $('#game_name').val(); @@ -228,9 +253,13 @@ }) } $(function(){ + get_company_list(); $("#partner_id").change(function(){ get_game_list(); }); + $("#company_type").change(function(){ + get_company_list(); + }); //搜索功能 $("#search").click(function(){ var url = $(this).attr('url'); From c6a0f87dfeeb43e125562bf38795bbe038be7961 Mon Sep 17 00:00:00 2001 From: zhengchanglong Date: Tue, 18 Feb 2020 16:44:40 +0800 Subject: [PATCH 26/32] =?UTF-8?q?=E5=A5=96=E7=BD=9A=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5=E5=8F=AA=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/View/StatementMangement/rewardManageSave.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Application/Admin/View/StatementMangement/rewardManageSave.html b/Application/Admin/View/StatementMangement/rewardManageSave.html index 43b9f5f22..885bb6c85 100644 --- a/Application/Admin/View/StatementMangement/rewardManageSave.html +++ b/Application/Admin/View/StatementMangement/rewardManageSave.html @@ -68,20 +68,20 @@
  • - + - disabled>
  • - + - disabled> From be932b1ebd48a47bebd1aa44009eaaf2bfa0c09c Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 18 Feb 2020 17:27:06 +0800 Subject: [PATCH 27/32] =?UTF-8?q?=E5=A5=96=E7=BD=9A=E7=AE=A1=E7=90=86bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 37 +++++++++++++++++++ .../StatementMangementController.class.php | 10 ++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 52ae4ab44..bf22be7ba 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2135,5 +2135,42 @@ function getPromoteGameRatio($promoteID = 0, $relationGameId = 0, $amount=0, $ti } return $ratio; } +//验证账号 +function checkAccount($type,$account) { + +// $type = I('type'); +// $account = I('account'); + + $map = []; + $map['account'] = $account; + + if ($type == 1) { + + $result = M('promote','tab_')->field('account')->where($map)->find(); + + } else { + $result = M('user','tab_')->field('account')->where($map)->find(); + } + + if ($result) { + return 1; + } else { + return 0; + } + + } +//去重函数 +function a_array_unique($array){ + $out = array(); + + foreach ($array as $key=>$value) { + if (!in_array($value, $out)){ + $out[$key] = $value; + } + } + + $out = array_values($out); + return $out; + } ?> diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 4cc3d58f8..4714782a8 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -294,11 +294,19 @@ class StatementMangementController extends ThinkController if ($accounts) { foreach ($accounts as $index => $account) { - $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); + + if (checkAccount($user_types[$index],$account)==1) { + $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); + } else { + return $this->error('账号'.$account.'不存在,请重新输入'); + } +// $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); } } else { $data['accounts'] = []; } + $data['accounts']=a_array_unique($data['accounts']); +// dump($data['accounts']);die(); $data['accounts'] = json_encode($data['accounts']); if (!is_numeric(I('money'))) { return $this->error('请输入正确的金额'); From 5158b07d85f5de0c71ceaea7747408527244eb35 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 18 Feb 2020 17:39:58 +0800 Subject: [PATCH 28/32] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=AB=98=E4=BA=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/TestOrder/lists.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Application/Admin/View/TestOrder/lists.html b/Application/Admin/View/TestOrder/lists.html index 6b12f90f8..d54ff84ba 100644 --- a/Application/Admin/View/TestOrder/lists.html +++ b/Application/Admin/View/TestOrder/lists.html @@ -192,6 +192,16 @@ +