diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 239e890ab..c64bf0209 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -541,4 +541,19 @@ function getPartnerList($id = 0) function getPartnerName($id = 0) { return M('Partner', 'tab_')->where(array('id' => intval($id)))->getField('partner'); +} + +function getTopPromote($promote_id) +{ + $promoter = M('promote', 'tab_')->where(['id' => $promote_id])->find(); + if (!$promoter) { + return []; + } + $chain = trim($promoter['chain'], '/'); + if ($chain == '') { + return $promoter; + } else { + $topPromoteId = explode('/', $chain)[0]; + return M('promote', 'tab_')->where(['id' => $topPromoteId])->find(); + } } \ No newline at end of file diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 6b2384035..df3846a4c 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -2,6 +2,7 @@ namespace Admin\Controller; use User\Api\UserApi as UserApi; +use Base\Service\PromoteService as PromoteService; /** * 后台首页控制器 @@ -57,6 +58,8 @@ class MendController extends ThinkController { public function edit($id = null) { + // $promoteService = new PromoteService(); + if (IS_POST) { if ($_POST['prmoote_id_to'] == -1){ $_POST['prmoote_id_to'] = 0; @@ -68,12 +71,14 @@ class MendController extends ThinkController { $this->error('没有变更数据'); } $create = $_REQUEST; + dump($create); $map['id'] = $create['user_id']; $map_['user_id'] = $create['user_id']; $data['promote_id'] = $create['prmoote_id_to']; $data['promote_account'] = get_promote_name($create['prmoote_id_to']); // 加入补链时间 $data['rebind_time'] = $create['rebind_time']; + dump($data); $user_data = $data; $promote = M('promote', 'tab_')->where(array("id"=>I('prmoote_id_to')))->find(); if ($promote['parent_id'] != "0") { @@ -85,24 +90,24 @@ class MendController extends ThinkController { $user_data['parent_name']=get_promote_name($user_data['parent_id']); - $user = M('user', 'tab_')->where($map)->save($user_data); - $user_ = M('UserPlay', 'tab_')->where($map_)->save($data); - $puser_ = M('UserPlayInfo', 'tab_')->where($map_)->save($data); - $spend = M('Spend', 'tab_')->where($map_)->where(array('is_check'=>array('in','1,2')))->save($data);// spend只改未对账的数据 - $depost = M('Deposit', 'tab_')->where($map_)->save($data); - $Bind_spend = M('Bind_spend', 'tab_')->where($map_)->save($data); - $create['user_account'] = get_user_account($create['user_id']); - $create['promote_account'] = get_promote_name($create['promote_id']); - $create['promote_id_to'] = $create['prmoote_id_to']; - $create['promote_account_to'] = get_promote_name($create['prmoote_id_to']); - $create['create_time'] = time(); - $create['op_id'] = UID; - $create['op_account'] = session('user_auth.username'); - $create['bind_type'] = $create['bind_type']; - $mend = M('mend', 'tab_')->add($create); - if ($mend) { - $this->success('补链成功', U('lists'), 2); - } + // $user = M('user', 'tab_')->where($map)->save($user_data); + // $user_ = M('UserPlay', 'tab_')->where($map_)->save($data); + // $puser_ = M('UserPlayInfo', 'tab_')->where($map_)->save($data); + // $spend = M('Spend', 'tab_')->where($map_)->where(array('is_check'=>array('in','1,2')))->save($data);// spend只改未对账的数据 + // $depost = M('Deposit', 'tab_')->where($map_)->save($data); + // $Bind_spend = M('Bind_spend', 'tab_')->where($map_)->save($data); + // $create['user_account'] = get_user_account($create['user_id']); + // $create['promote_account'] = get_promote_name($create['promote_id']); + // $create['promote_id_to'] = $create['prmoote_id_to']; + // $create['promote_account_to'] = get_promote_name($create['prmoote_id_to']); + // $create['create_time'] = time(); + // $create['op_id'] = UID; + // $create['op_account'] = session('user_auth.username'); + // $create['bind_type'] = $create['bind_type']; + // $mend = M('mend', 'tab_')->add($create); + // if ($mend) { + // $this->success('补链成功', U('lists'), 2); + // } } else { $user = A('User', 'Event'); $user_data = $user->user_entity($id); diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 654a0b42d..7d63f35f0 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -31,36 +31,14 @@ class PromoteController extends ThinkController { $promoteid = $_REQUEST['promote_id']; unset($_REQUEST['promote_id']); if(isset($_REQUEST['parent_id'])) { - $parent_id = $_REQUEST['parent_id']; unset($_REQUEST['parent_id']); if($promoteid == $parent_id) { $map['id'] = $promoteid; - } else { - $maps['parent_id'] = $parent_id; - $maps['grand_id'] = $parent_id; - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select(); - - if (!empty($pro_ids)){ - $map['id'] = array('eq',-1); - } - } } else { $map['id'] = $promoteid; - /* $maps['parent_id'] = $promoteid; - $maps['grand_id'] = $promoteid; - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id,account')->where($maps)->select(); - $pro_ids = array_column($pro,'id'); - $pro_ids[] = $promoteid; - if (!empty($pro_ids)){ - $map['id'] = ['in',$pro_ids]; - }else{ - $map['id'] = array('eq',-1); - } */ } } else { @@ -315,32 +293,9 @@ unset($_REQUEST['parent_id']); } else { $parent_id = get_promote_id($_REQUEST['parent_id']); - $maps['parent_id'] = $parent_id; - $maps['grand_id'] = $parent_id; - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select(); - - if (!empty($pro_ids)){ - $map['tab_user.promote_id'] = array('eq',-1); - } - } } else { - - /*$maps['parent_id'] = $promoteid; - $maps['grand_id'] = $promoteid; - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id,account')->where($maps)->select(); - $pro_ids = array_column($pro,'id'); - $pro_ids[] = $promoteid; - if (!empty($pro_ids)){ - $map['tab_user.promote_id'] = ['in',$pro_ids]; - }else{ - $map['tab_user.promote_id'] = array('eq',-1); - }*/ - $map['tab_user.promote_id'] = $promoteid; - } } @@ -348,10 +303,7 @@ unset($_REQUEST['parent_id']); if(isset($_REQUEST['parent_id'])){ $parent_id = get_promote_id($_REQUEST['parent_id']); - $maps['parent_id'] = $parent_id; - $maps['grand_id'] = $parent_id; - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id,account')->where($maps)->select(); + $pro = M('promote','tab_')->field('id,account')->where("chain like '%/{$parent_id}/%'")->select(); $pro_ids = array_column($pro,'id'); $pro_ids[] = get_promote_id($_REQUEST['parent_id']); if (!empty($pro_ids)){ @@ -510,10 +462,7 @@ unset($_REQUEST['parent_id']); } else { - $maps['parent_id'] = I('parent_id'); - $maps['grand_id'] =I('parent_id'); - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id')->where([array('id'=>$map['promote_id']),$maps])->select(); + $pro = M('promote','tab_')->field('id')->where("chain like '%/{$_REQUEST['parent_id']}/%' or id={$_REQUEST['parent_id']}")->select(); if(!$pro) { $map['promote_id'] = array('eq',999999999); @@ -522,20 +471,6 @@ unset($_REQUEST['parent_id']); } } else { - /*$maps['parent_id'] = $map['promote_id']; - $maps['grand_id'] =$map['promote_id']; - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id')->where($maps)->select(); - $pro_ids = array_column($pro,'id'); - $pro_ids[] = $map['promote_id']; - if (!empty($pro_ids)){ - $map['promote_id'] = ['in',$pro_ids]; - }else{ - $map['promote_id'] = array('eq',999999999); - } - - */ - } } @@ -543,10 +478,7 @@ unset($_REQUEST['parent_id']); }else{ if(!empty(I('parent_id'))){ - $maps['parent_id'] = I('parent_id'); - $maps['grand_id'] =I('parent_id'); - $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id')->where($maps)->select(); + $pro = M('promote','tab_')->field('id')->where("chain like '%/{$_REQUEST['parent_id']}/%'")->select(); $pro_ids = array_column($pro,'id'); $pro_ids[] = I('parent_id'); if (!empty($pro_ids)){ @@ -832,11 +764,7 @@ unset($_REQUEST['parent_id']); public function del_promote(){ if(IS_AJAX){ M()->startTrans(); - $map['id'] = $_POST['id']; - $map['parent_id'] = $_POST['id']; - $map['grand_id'] = $_POST['id']; - $map['_logic'] = 'or'; - $result = M('promote','tab_')->where($map)->delete(); + $result = M('promote','tab_')->where("chain like '%/{$_POST['id']}/%' or id={$_POST['id']} ")->delete(); if($result){ M()->commit(); $this->ajaxReturn(array('status'=>1,'msg'=>'删除成功')); diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index 62bfa1f13..5473d271c 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -84,7 +84,7 @@
'; @@ -1998,9 +1858,15 @@ class PromoteController extends BaseController //验证安全密码 $metaTitle = '设置'; $modelList = ['游戏管理', $metaTitle]; - $this->verifyPasswordView($modelList, $metaTitle); + $res = $this->verifyPasswordView($modelList, ($_POST ? false : true)); if ($_POST) { + if ($res === false) { + $data['status'] = 0; + $data['msg'] = '权限异常'; + $this->ajaxReturn($data); + } + $save['child_game_permission'] = I('post.child_game_permission'); $saveRes = D('Promote')->where(array('id' => PID))->save($save); if ($saveRes === false) { @@ -2018,6 +1884,7 @@ class PromoteController extends BaseController $this->assign('data', $promoteData); $this->meta_title = $metaTitle; + $this->assign('modelList', $modelList); $this->display(); } } diff --git a/Application/Home/Model/PromoteModel.class.php b/Application/Home/Model/PromoteModel.class.php index 702dc56a2..0bc8172f0 100644 --- a/Application/Home/Model/PromoteModel.class.php +++ b/Application/Home/Model/PromoteModel.class.php @@ -108,7 +108,7 @@ class PromoteModel extends Model{ } - public function get_child_promote($pid,$field=true) { + public function get_child_promote($pid, $field=true) { $map['parent_id'] = $pid; $map['grand_id'] = $pid; $map['_logic'] = 'or'; diff --git a/Application/Home/View/default/Finance/index.html b/Application/Home/View/default/Finance/index.html new file mode 100644 index 000000000..c527c2559 --- /dev/null +++ b/Application/Home/View/default/Finance/index.html @@ -0,0 +1,184 @@ + + + + + + +
+
    +
  • 历史收益

    ¥{$income.history_income}
  • +
  • 本月收益

    ¥{$income.this_month_income}
  • +
  • 昨日收益

    ¥{$income.yesterday_income}
  • +
  • 账户余额

    ¥{$income.balance}
  • +
+
+
+ +
+
+
{$meta_title}
+
+ +
+ + + + + + + + + + + + + + + + + +
时间收益操作

暂无数据

{$data.day}{$data.income}明细
+
+
+ {$_page} +
+
+
+ + + + + + + +
\ No newline at end of file diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html index f66bf47b3..08d2c16fa 100644 --- a/Application/Home/View/default/Finance/settlementDtl.html +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -66,7 +66,15 @@
diff --git a/Data/update.sql b/Data/update.sql index ebabebfe9..ffb537dea 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -336,3 +336,6 @@ CREATE TABLE `tab_spend_user_count` ( KEY `count_date` (`count_date`) USING BTREE ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表'; +-- 2019-11-6 cxj +ALTER TABLE `tab_spend` ADD COLUMN `withdraw_id` int(11) NOT NULL DEFAULT 0 COMMENT '提现ID' AFTER `pay_url`; +ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`; \ No newline at end of file