|
@@ -85,10 +85,15 @@ class GeoQuestionLogic extends BaseLogic |
|
@@ -85,10 +85,15 @@ class GeoQuestionLogic extends BaseLogic |
|
85
|
public function saveGeoQuestion(){
|
85
|
public function saveGeoQuestion(){
|
|
86
|
//处理数据
|
86
|
//处理数据
|
|
87
|
$count = count($this->param['question']);
|
87
|
$count = count($this->param['question']);
|
|
|
|
88
|
+ $sum = $this->model->where('proejct_id',$this->param['project_id'])->sum('question_num') ?? 0;
|
|
|
|
89
|
+ if($sum >= 200 || $count >= 200){
|
|
|
|
90
|
+ $this->fail('当前问题数量大于最大数量200个问题,不允许保存');
|
|
|
|
91
|
+ }
|
|
88
|
$question = $this->param['question'];
|
92
|
$question = $this->param['question'];
|
|
89
|
$this->param['url'] = json_encode($this->param['url'] ?? [],true);
|
93
|
$this->param['url'] = json_encode($this->param['url'] ?? [],true);
|
|
90
|
$this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true);
|
94
|
$this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true);
|
|
91
|
if($count <= 20){
|
95
|
if($count <= 20){
|
|
|
|
96
|
+ $this->param['question_num'] = $count;
|
|
92
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
97
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
93
|
$id = $this->param['id'];
|
98
|
$id = $this->param['id'];
|
|
94
|
$this->model->edit($this->param,['id'=>$id]);
|
99
|
$this->model->edit($this->param,['id'=>$id]);
|
|
@@ -101,6 +106,7 @@ class GeoQuestionLogic extends BaseLogic |
|
@@ -101,6 +106,7 @@ class GeoQuestionLogic extends BaseLogic |
|
101
|
$chunks = array_chunk($question, 20);
|
106
|
$chunks = array_chunk($question, 20);
|
|
102
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
107
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
103
|
foreach ($chunks as $index => $chunk) {
|
108
|
foreach ($chunks as $index => $chunk) {
|
|
|
|
109
|
+ $this->param['question_num'] = count($chunk);
|
|
104
|
$this->param['question'] = json_encode($chunk ?? [],true);
|
110
|
$this->param['question'] = json_encode($chunk ?? [],true);
|
|
105
|
if($index == 0){
|
111
|
if($index == 0){
|
|
106
|
$id = $this->param['id'];
|
112
|
$id = $this->param['id'];
|