|
...
|
...
|
@@ -84,10 +84,11 @@ class GeoQuestionLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function saveGeoQuestion(){
|
|
|
|
//处理数据
|
|
|
|
$this->param['question'] = json_encode($this->param['question'] ?? [],true);
|
|
|
|
$count = count($this->param['question']);
|
|
|
|
$question = $this->param['question'];
|
|
|
|
$this->param['url'] = json_encode($this->param['url'] ?? [],true);
|
|
|
|
$this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true);
|
|
|
|
//执行时间设置为今天
|
|
|
|
if($count <= 20){
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$id = $this->param['id'];
|
|
|
|
$this->model->edit($this->param,['id'=>$id]);
|
|
...
|
...
|
@@ -96,6 +97,27 @@ class GeoQuestionLogic extends BaseLogic |
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
}
|
|
|
|
return $this->success(['id'=>$id]);
|
|
|
|
}else{
|
|
|
|
$chunks = array_chunk($question, 20);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
foreach ($chunks as $index => $chunk) {
|
|
|
|
$this->param['question'] = json_encode($chunk ?? [],true);
|
|
|
|
if($index == 0){
|
|
|
|
$id = $this->param['id'];
|
|
|
|
$this->model->edit($this->param,['id'=>$id]);
|
|
|
|
}else{
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$this->param['next_time'] = date('Y-m-d');
|
|
|
|
foreach ($chunks as $chunk) {
|
|
|
|
$this->param['question'] = json_encode($chunk ?? [],true);
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success(['id'=>$id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|