Commit d2c02e44 authored by yinxiaoling's avatar yinxiaoling

任务数据列表

parent d2a754bd
......@@ -35,7 +35,7 @@ class StrategySetController extends Controller
$v['frequency_type_name'] = $v['frequency_type'] == 1 ? '一天一次' : '一天两次';
$listInfo[] = $v;
}
return $this->successWithInfo(['data'=>$listInfo]);
return $this->successWithInfo($listInfo);
}
public function store(Request $request,StrategyService $StrategyService){
......@@ -92,7 +92,7 @@ class StrategySetController extends Controller
}
//返回成功数、失败数、失败导出文件
$returnArr = compact('total','successTotal','failTotal','failDataFile');
return $this->successWithInfo(['data'=>$returnArr]);
return $this->successWithInfo($returnArr);
}
//删除策略
public function destroy($strategySn){
......@@ -107,12 +107,12 @@ class StrategySetController extends Controller
//项目列表
public function getProjectsList(){
$projectInfo = $this->getAllowProjects(0);
return $this->successWithInfo(['data'=>$projectInfo]);
return $this->successWithInfo($projectInfo);
}
//主叫号码列表
public function getCallNumberList(){
$callNumbnerInfo = $this->getAllowCallNumber();
return $this->successWithInfo(['data'=>$callNumbnerInfo]);
return $this->successWithInfo($callNumbnerInfo);
}
//下载模板及下载导入失败excel数据
......@@ -189,7 +189,7 @@ class StrategySetController extends Controller
//返回成功数、失败数、失败导出文件
$returnArr = compact('total','successTotal','failTotal','failDataFile');
return $this->successWithInfo(['data'=>$returnArr]);
return $this->successWithInfo($returnArr);
}else{
return $this->errorWithInfo('请选择导入文件', 401);
}
......
......@@ -15,20 +15,45 @@ class StrategyTaskController extends Controller
public function index(){
//搜索分页?
$pageSize=request()->pageSize;
$projectArr = $this->getAllowProjects(1);
$strategyInfo = StrategyTask::all()->toArray();
$listInfo = [];
foreach ($strategyInfo as $k=>$v){
$projectSnTemp = explode("#", $v['project_sn']);
$v['project_name'] = isset($projectArr[$projectSnTemp[0]]) ? $projectArr[$projectSnTemp[0]] : '';
if (isset($projectSnTemp[1]) && isset($projectArr[$projectSnTemp[1]])){
$v['project_name'] .= $projectArr[$projectSnTemp[1]];
//$strategyInfo = StrategyTask::all()->toArray();
$searchArr = [];
$searchArr['phone'] = request()->phone;
$searchArr['is_created'] = request()->is_created;
$searchArr['callTimeStart'] = request()->started_at;
$searchArr['callTimeStop'] = request()->stoped_at;
$strategyInfo = StrategyTask::where(function($query) use ($searchArr){
if (isset($searchArr['phone']) && !empty($searchArr['phone'])){
$query->where('phone','like',"%{$searchArr['phone']}%");
}
if (isset($searchArr['is_created']) && !empty($searchArr['is_created'])){
$query->where('is_created','like',"%{$searchArr['is_created']}%");
}
if (isset($searchArr['callTimeStart']) && !empty($searchArr['callTimeStart'])){
$query->whereRaw(" call_date || ' ' || call_time >= '{$searchArr['callTimeStart']}'");
}
$v['is_created_name'] = $v['is_created'] == 0 ? '未建' : '已建';
$listInfo[] = $v;
if (isset($searchArr['callTimeStop']) && !empty($searchArr['callTimeStop'])){
$query->whereRaw(" call_date || ' ' || call_time <= '{$searchArr['callTimeStart']}'");
}
});
if(empty($pageSize)){
$strategyInfo = $strategyInfo->get()->toArray();
}else{
$strategyInfo = $strategyInfo->paginate($pageSize)->toArray();
}
$listInfo = [];
foreach ($strategyInfo['data'] as $k=>$v){
$strategyInfo['data'][$k]['project_name'] = isset($projectArr[$v['project_sn']]) ? $projectArr[$v['project_sn']] : '';
$strategyInfo['data'][$k]['is_created_name'] = $v['is_created'] == 0 ? '未建' : '已建';
}
return $this->successWithInfo(['data'=>$listInfo]);
return $this->successWithInfo($strategyInfo);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment