|
|
|
@ -259,28 +259,21 @@ class PromoteController extends BaseController
|
|
|
|
|
|
|
|
|
|
$whereUser['promote_id'] = ['IN', $promoteId];
|
|
|
|
|
|
|
|
|
|
if ($type == 1) {
|
|
|
|
|
$pay_time = total(1);
|
|
|
|
|
$start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
|
|
|
|
|
$end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
|
|
|
|
|
$whereUser['register_time'] = ['between', array($start, $end - 1)];
|
|
|
|
|
$userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
|
|
|
|
|
|
|
|
|
|
} else if ($type == 2) {
|
|
|
|
|
$pay_time = total(3);
|
|
|
|
|
$start = mktime(0, 0, 0, date('m'), 1, date('Y'));
|
|
|
|
|
$end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1;
|
|
|
|
|
if (in_array($type, [1, 2])) {
|
|
|
|
|
if ($type == 1) {
|
|
|
|
|
$pay_time = total(1);
|
|
|
|
|
$start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
|
|
|
|
|
$end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
|
|
|
|
|
} else {
|
|
|
|
|
$pay_time = total(3);
|
|
|
|
|
$start = mktime(0, 0, 0, date('m'), 1, date('Y'));
|
|
|
|
|
$end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1;
|
|
|
|
|
}
|
|
|
|
|
$whereUser['register_time'] = ['between', array($start, $end - 1)];
|
|
|
|
|
$userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
|
|
|
|
|
$userId = M('user', 'tab_')->where($whereUser)->getField('id', true);
|
|
|
|
|
}
|
|
|
|
|
// if ($userId) {
|
|
|
|
|
// var_dump($userId);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if ($userId) {
|
|
|
|
|
|
|
|
|
|
$userId = implode(',', array_column($userId, 'id'));
|
|
|
|
|
// var_dump($userId);
|
|
|
|
|
$map1['user_id'] = $map['user_id'] = ['IN', $userId];
|
|
|
|
|
} else if (!$userId && $type != 0) {
|
|
|
|
|
return array('sum_mounth' => 0, 'sum_today' => 0);
|
|
|
|
@ -333,9 +326,6 @@ class PromoteController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
$data[] = $dbdata;
|
|
|
|
|
}
|
|
|
|
|
// if ($userId) {
|
|
|
|
|
// echo $spend->_sql();die();
|
|
|
|
|
// }
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
$value['count'] ?: 0;
|
|
|
|
|
$value['today'] ?: 0;
|
|
|
|
@ -353,8 +343,6 @@ class PromoteController extends BaseController
|
|
|
|
|
$total = $this->data_total($data);
|
|
|
|
|
|
|
|
|
|
return $total;
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function data_total($data)
|
|
|
|
|