推广后台bug修正

master
zhengyongxing 5 years ago
parent a7f6d8b7a4
commit 77da9cf429

@ -244,17 +244,21 @@ class PromoteController extends BaseController
$today = total(1); $today = total(1);
$week = total(2); $week = total(2);
$mounth = total(3); $mounth = total(3);
$yesterday = total(5);
$map1['promote_id'] = $map['promote_id'] = array('gt', 0); $map1['promote_id'] = $map['promote_id'] = array('gt', 0);
$map1['pay_status'] = $map['pay_status'] = 1; $map1['pay_status'] = $map['pay_status'] = 1;
$map1['pay_way'] = $map['pay_way'] = array('gt', 0); $map1['pay_way'] = $map['pay_way'] = array('gt', 0);
$userId = []; $userId = [];
$promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid() . " or grand_id=" . get_pid())->select(); $grandPromote = get_pid();
$promoteId = M("promote", "tab_")->field('id')->where("chain like '%/{$grandPromote}/%' or id = {$grandPromote}")->select();
$promoteId = array_column($promoteId, 'id'); $promoteId = array_column($promoteId, 'id');
$promoteId = implode(',', $promoteId) . "," . get_pid(); $promoteId = implode(',', $promoteId);
$whereUser['promote_id'] = ['IN', $promoteId]; $whereUser['promote_id'] = ['IN', $promoteId];
if ($type == 1) { if ($type == 1) {
$start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
@ -313,21 +317,26 @@ class PromoteController extends BaseController
->group('promote_id') ->group('promote_id')
->select(false); ->select(false);
// $promote_map = "tp1.`chain` = '/'"; // $promote_map = "tp1.`chain` = '/'";
$promote_id = get_pid(); $promote_id = get_pid();
$promote_map = "tp1.`id` = {$promote_id}"; $promote_map = "tp1.`id` = {$promote_id}";
$spendData = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth') $data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id") ->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id")
->where($condition)->table('(' . $spendData . ') as a')->group('t.pid')->order('count desc,a.ordertime')->find(); ->where($condition)->table('(' . $spendData . ') as a')->group('t.pid')->order('count desc,a.ordertime')->find();
// var_dump($spendData);die();
$spendData['rand'] = 1; $spendData1 = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')
$spendData['count'] = $spendData['count'] / 100; ->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') ) AS t ON promote_id = t.id")
$spendData['today'] = $spendData['today'] / 100; ->where($condition)->table('(' . $spendData . ') as a')->group('t.pid')->order('count desc,a.ordertime')->find();
$spendData['week'] = $spendData['week'] / 100;
$spendData['mounth'] = $spendData['mounth'] / 100; $data['rand'] = 1;
$data['count'] = $data['count'] / 100;
return $spendData; $data['today'] = $spendData1['today'] / 100;
$data['week'] = $spendData1['week'] / 100;
$data['mounth'] = $spendData1['mounth'] / 100;
return $data;
} }
private function pay_total($type = 0, $newadd = 1, $promoteId = "") private function pay_total($type = 0, $newadd = 1, $promoteId = "")

@ -106,11 +106,11 @@
<div class="form-group normal_space fl"> <div class="form-group normal_space fl">
<label class="form-title select-title" style="position: relative;">申请时间:</label> <label class="form-title select-title" style="position: relative;">申请时间:</label>
<div class="select-time"> <div class="select-time">
<input type="text" id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}"> <input type="text" id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}" autocomplete="off">
</div> </div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label> <label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time"> <div class="select-time">
<input type="text" id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}"> <input type="text" id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}" autocomplete="off">
</div> </div>
</div> </div>

@ -154,14 +154,14 @@
<div class="form-group normal_space fr"> <div class="form-group normal_space fr">
<label class="form-title select-title" style="margin-right: 9px;"></label> <label class="form-title select-title" style="margin-right: 9px;"></label>
<div class="select-time"> <div class="select-time">
<input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}"> <input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}" autocomplete="off">
</div> </div>
</div> </div>
<div class="form-group normal_space fr"> <div class="form-group normal_space fr">
<label class="form-title select-title">申请时间:</label> <label class="form-title select-title">申请时间:</label>
<div class="select-time"> <div class="select-time">
<input type="text" id="sdate" class="txt" name="start" placeholder="开始时间" <input type="text" id="sdate" class="txt" name="start" placeholder="开始时间"
value="{:I('start')}"> value="{:I('start')}" autocomplete="off">
</div> </div>
</div> </div>
<div class="form-group normal_space fr"> <div class="form-group normal_space fr">

@ -46,13 +46,13 @@
<div class="form-group normal_space fr" style="margin-left: 9px;"> <div class="form-group normal_space fr" style="margin-left: 9px;">
<label class="form-title select-title" style="margin-right: 9px;"></label> <label class="form-title select-title" style="margin-right: 9px;"></label>
<div class="select-time"> <div class="select-time">
<input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}"> <input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}" autocomplete="off">
</div> </div>
</div> </div>
<div class="form-group normal_space fr"> <div class="form-group normal_space fr">
<label class="form-title select-title">申请时间:</label> <label class="form-title select-title">申请时间:</label>
<div class="select-time"> <div class="select-time">
<input type="text" id="sdate" class="txt" name="start" placeholder="开始时间" value="{:I('start')}" > <input type="text" id="sdate" class="txt" name="start" placeholder="开始时间" value="{:I('start')}" autocomplete="off">
</div> </div>
</div> </div>

@ -68,13 +68,13 @@
<div class="form-group normal_space fl"> <div class="form-group normal_space fl">
<label class="form-title select-title">申请时间:</label> <label class="form-title select-title">申请时间:</label>
<div class="select-time"> <div class="select-time">
<input type="text" id="sdate" class="txt" name="start" placeholder="开始时间" value="{:I('start')}" > <input type="text" id="sdate" class="txt" name="start" placeholder="开始时间" value="{:I('start')}" autocomplete="off">
</div> </div>
</div> </div>
<div class="form-group normal_space fl" style="margin-left: 9px;"> <div class="form-group normal_space fl" style="margin-left: 9px;">
<label class="form-title select-title" style="margin-right: 9px;"></label> <label class="form-title select-title" style="margin-right: 9px;"></label>
<div class="select-time"> <div class="select-time">
<input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}"> <input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}" autocomplete="off">
</div> </div>
</div> </div>

Loading…
Cancel
Save