后台任务领取统计 bug 修改
This commit is contained in:
@@ -492,17 +492,23 @@ class Statistical extends adminApi
|
|||||||
$begin_time = input('begin_time', '');
|
$begin_time = input('begin_time', '');
|
||||||
$end_time = input('end_time', '');
|
$end_time = input('end_time', '');
|
||||||
$where =[];
|
$where =[];
|
||||||
|
$search_user_id = 0;
|
||||||
|
$search_gift_bag_id = 0;
|
||||||
if($search_id){
|
if($search_id){
|
||||||
|
$search_user_id= db::name('user')->where('user_code', $search_id)->value('id');
|
||||||
$where['b.user_code'] = $search_id;
|
$where['b.user_code'] = $search_id;
|
||||||
}
|
}
|
||||||
if($search_name){
|
if($search_name){
|
||||||
$where['b.nickname'] = ['like', '%'.$search_name.'%'];
|
$where['b.nickname'] = ['like', '%'.$search_name.'%'];
|
||||||
|
$search_user_id= db::name('user')->where('nickname', $search_name)->value('id');
|
||||||
}
|
}
|
||||||
if($search_task_id){
|
if($search_task_id){
|
||||||
$where['a.task_id'] = $search_task_id;
|
$where['a.task_id'] = $search_task_id;
|
||||||
|
$search_gift_bag_id = db::name('vs_tasks')->where('id', $search_task_id)->value('tasks_bag_id');
|
||||||
}
|
}
|
||||||
if($search_task_name){
|
if($search_task_name){
|
||||||
$where['c.task_name'] = ['like', '%'.$search_task_name.'%'];
|
$where['c.task_name'] = ['like', '%'.$search_task_name.'%'];
|
||||||
|
$search_gift_bag_id = db::name('vs_tasks')->where('task_name', $search_task_name)->value('tasks_bag_id');
|
||||||
}
|
}
|
||||||
if($begin_time !== ''){
|
if($begin_time !== ''){
|
||||||
$where['a.collection_time'] = ['>=', strtotime($begin_time)];
|
$where['a.collection_time'] = ['>=', strtotime($begin_time)];
|
||||||
@@ -629,25 +635,34 @@ class Statistical extends adminApi
|
|||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'total_reward_price' => $this->get_claimed_reward_price($begin_time, $end_time),
|
'total_reward_price' => $this->get_claimed_reward_price($begin_time, $end_time,$search_user_id,$search_gift_bag_id),
|
||||||
'lists' => $data_list,
|
'lists' => $data_list,
|
||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
}
|
}
|
||||||
//获取已领取任务奖励的总价值
|
//获取已领取任务奖励的总价值
|
||||||
public function get_claimed_reward_price($stime="",$etime=""){
|
public function get_claimed_reward_price($stime="",$etime="",$search_user_id=0,$search_gift_bag_id=0){
|
||||||
//获取所有已领取的任务奖励礼包
|
//获取所有已领取的任务奖励礼包
|
||||||
$where = [];
|
$where = [];
|
||||||
if(!empty($stime)){
|
if(!empty($stime)){
|
||||||
$where['createtime'] = ['>=', strtotime($stime)];
|
$where['a.createtime'] = ['>=', strtotime($stime)];
|
||||||
}
|
}
|
||||||
if(!empty($etime)){
|
if(!empty($etime)){
|
||||||
$where['createtime'] = ['<=', strtotime($etime)];
|
$where['a.createtime'] = ['<=', strtotime($etime)];
|
||||||
}
|
}
|
||||||
$tasks_bag_details = db::name('vs_gift_bag_detail')
|
if($search_user_id > 0){
|
||||||
->where(['type'=>['in', [1,2]]])
|
$where['a.user_id'] = $search_user_id;
|
||||||
->where('gift_bag_id','>=',18)
|
}
|
||||||
->where('gift_bag_id','<=',51)
|
if($search_gift_bag_id > 0){
|
||||||
|
$where['a.gift_bag_id'] = $search_gift_bag_id;
|
||||||
|
}
|
||||||
|
$tasks_bag_details = db::name('vs_gift_bag_receive_log')
|
||||||
|
->alias('a')
|
||||||
|
->join('vs_gift_bag_detail b', 'a.parent_id=b.id')
|
||||||
|
->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold')
|
||||||
|
->where(['b.type'=>['in', [1,2]]])
|
||||||
|
->where('a.gift_bag_id','>=',18)
|
||||||
|
->where('a.gift_bag_id','<=',51)
|
||||||
->where($where)
|
->where($where)
|
||||||
->select();
|
->select();
|
||||||
$total_reward_price = 0;
|
$total_reward_price = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user