From d1c60ed1532901c7e0b69fcca6cb8d2adecd0e5a Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Tue, 7 Jan 2020 10:33:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A8sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/update.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Data/update.sql b/Data/update.sql index 8f0ce3a30..5acdbc763 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -928,3 +928,20 @@ ALTER TABLE tab_partner ADD `payee_name` varchar(24) DEFAULT NULL COMMENT '收 ALTER TABLE tab_partner ADD `bank_account` varchar(32) DEFAULT NULL COMMENT '银行账号' AFTER `payee_name`; ALTER TABLE tab_partner ADD `opening_bank` varchar(128) DEFAULT NULL COMMENT '开户行' AFTER `bank_account`; +-- 推广公会归属管理 2020-1-1 刘伟文 +CREATE TABLE `tab_promote_belong` ( + `id` int(11) NOT NULL, + `promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广员id', + `verify_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '审核状态:0-待审核;1-审核通过;2-审核拒绝', + `company_belong` tinyint(1) NOT NULL DEFAULT '0' COMMENT '工会归属:0-内团;1-外团', + `company_relation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '工会关系:0-自主开发及维护;1-只维护', + `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `applicant_id` int(11) NOT NULL DEFAULT '0' COMMENT '申请人(后台管理员)id', + `approver_id` int(11) NOT NULL DEFAULT '0' COMMENT '确认人(后台管理员)id', + `applicant_time` int(11) DEFAULT '0' COMMENT '申请时间', + `verify_time` int(11) DEFAULT '0' COMMENT '审批时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='推广公会归属管理'; + + + From 89883d2005324ac1dc78bd8213880dc0dbbe5bfc Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 7 Jan 2020 11:34:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 15 ++++ .../Controller/QueryController.class.php | 83 +++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index a6bf48085..1f3f36e48 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1793,4 +1793,19 @@ function all_pay_way_other($type=false) $pay_way[15]=array('key'=>15,'value'=>'双乾支付-快捷'); return $pay_way; } + +function getMonthOther() { + $start = date("Y-m", strtotime("now")); + //开始月份 + $range = []; + $i = 0; + do { + $month = date('Y-m', strtotime($start . ' - ' . $i . ' month')); + $range[] = $month; + $i++; + } while ($i<36); + + return $range; +} + ?> diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index 99a3a3e77..7e5b41c82 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1000,4 +1000,87 @@ class QueryController extends ThinkController } } + + + public function marketList($p=1) { + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $arraypage = $page; + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $map = []; + + if ($_REQUEST['promote_id']) { + $map['root_id'] = $_REQUEST['promote_id']; + } + + if ($_REQUEST['game_name']) { + $map['game_names'] = $_REQUEST['game_name']; + } + + if ($_REQUEST['count_date']) { + $map['my_time'] = $_REQUEST['count_date']; + } + + if ($_REQUEST['device']) { + $map['game_name'] = ['like','%'.$_REQUEST['device'].'%']; + } + + //获取spend表中的数据,同时根据会长id进行group分类 + $data = M('Spend','tab_') + ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,game_name,SUBSTRING_INDEX(`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id ") + ->join("left join tab_promote on promote_id = tab_promote.id") + ->where(['pay_status'=>1]) + ->group("my_time,game_names,root_id") + ->order("my_time Desc") + ->select(false); + + $count = M()->table('('.$data.') as a') + ->field("my_time,pay_amount,game_id,game_names,promote_id,promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account") + ->join("left join tab_promote on root_id = tab_promote.id") + ->group("my_time,game_names,root_id") + ->where($map) + ->order("my_time Desc") + ->select(false); + + //关联表获取会长账号名 + $data = M()->table('('.$data.') as a') + ->field("my_time,pay_amount,game_id,game_name,game_names,promote_id,promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account") + ->join("left join tab_promote on root_id = tab_promote.id") + ->page($page,$row) + ->where($map) + ->group("my_time,game_names,root_id") + ->order("my_time Desc") + ->select(); + + $pagecount = M()->table('('.$count.') as a')->count(); + + foreach($data as $key => $value) { + + $data[$key]['upstream'] = $value['pay_amount'] * 0.2; + $data[$key]['downstream'] = $value['pay_amount'] * 0.7; + + $data[$key]['highquality'] = ($value['pay_amount']-$data[$key]['upstream']-$data[$key]['downstream']) * (1-0.0672); + + $data[$key]['company_belong'] = $data[$key]['company_belong']?'外团':'内团'; + $data[$key]['company_relation'] = $data[$key]['company_relation']?'只维护':'自主开发及维护'; + + } + + $page = set_pagination($pagecount, $row); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('data',$data); + + $this->display(); + } + } From 216321f46b897672ee97d10fe54b9c168a7906e2 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 7 Jan 2020 11:34:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8D=A2=E7=BB=91?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=9C=A8=E5=AE=A1=E6=A0=B8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/MendController.class.php | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 034ad96ed..25dd2846d 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -9,7 +9,7 @@ use Base\Service\PromoteService as PromoteService; * @author 麦当苗儿 */ class MendController extends ThinkController { - + public $tempid = 0; public function lists($p=1){ $this->m_title = '推广补链'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find()); @@ -124,7 +124,7 @@ class MendController extends ThinkController { // $this->error('在订单日期内含有已经结算的订单,无法补链'); // } if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){ - $this->error('在订单日期内含有已经结算的订单,无法补链'); + $this->error("在订单日期内含有已经结算的订单,无法补链。如订单:{$this->tempid}"); } if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){ $this->error('在订单日期内含有多个推广员,无法补链'); @@ -169,14 +169,45 @@ class MendController extends ThinkController { * 2020.1.3 之后判断订单是否已经结算 */ private function checkSpend($order_time,$account){ + //获取所有涉及订单 $map = array( "pay_status"=>1, "user_account"=>$account, - "pay_time"=>array("EGT",$order_time), - "selle_status"=>1 + "pay_time"=>array("EGT",$order_time) ); - $flag = M("Spend","tab_")->where($map)->count(); - if($flag > 0) return true; + $spendlist = M("Spend","tab_")->field("id,selle_status,pay_order_number")->where($map)->select(); + if(count($spendlist) < 1){ + return false; + } + //获取所有未审核 + $withmap = array( + "status"=>0, + "settlement_begin_time"=>array("EGT",$order_time), + "settlement_end_time"=>array("ELT",$order_time) + ); + $withspendlist = M("withdraw","tab_")->field("spend_ids")->select(); + + $dsh_list = false; + if(!empty($withspendlist)){ + //获取所有涉及订单 + foreach ($withspendlist as $value) { + $dsh_list .= (','.$value['spend_ids']); + } + } + if($dsh_list){ + $dsh_list = array_flip(explode(",",$dsh_list)); + } + foreach($spendlist as $k=>$v){ + + if($v['selle_status'] == 1){ + $this->tempid = $v['pay_order_number']; + return true; //有已结算 + } + if($dsh_list && $dsh_list[$v['id']]){ + $this->tempid = $v['pay_order_number']; + return true; //有待审核的 + } + } return false; }