作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !3342
@@ -152,8 +152,12 @@ class ProjectController extends BaseController @@ -152,8 +152,12 @@ class ProjectController extends BaseController
152 if (isset($this->map['seo_plan']) && $this->map['seo_plan'] == 1) { 152 if (isset($this->map['seo_plan']) && $this->map['seo_plan'] == 1) {
153 $query = $query->orderBy('gl_project.cooperate_date', 'desc')->orderBy('gl_project.id', 'desc'); 153 $query = $query->orderBy('gl_project.cooperate_date', 'desc')->orderBy('gl_project.id', 'desc');
154 } else { 154 } else {
  155 + if($this->map['type'] == 1){
  156 + $query = $query->orderBy('gl_project.id', 'desc');
  157 + }else{
155 $query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc'); 158 $query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc');
156 } 159 }
  160 + }
157 return $query; 161 return $query;
158 } 162 }
159 163
@@ -412,7 +412,7 @@ class AsideTicketController extends BaseController @@ -412,7 +412,7 @@ class AsideTicketController extends BaseController
412 $this->request->validate([ 412 $this->request->validate([
413 'project_cate'=>'required' 413 'project_cate'=>'required'
414 ],[ 414 ],[
415 - 'project_cate.required' => 'ID不能为空' 415 + 'project_cate.required' => 'project_cate不能为空'
416 ]); 416 ]);
417 $ticket = new Tickets(); 417 $ticket = new Tickets();
418 $data = $ticket->getOrderTypeOptions($this->param['project_cate']); 418 $data = $ticket->getOrderTypeOptions($this->param['project_cate']);
@@ -84,25 +84,21 @@ class GeoQuestionLogic extends BaseLogic @@ -84,25 +84,21 @@ class GeoQuestionLogic extends BaseLogic
84 */ 84 */
85 public function saveGeoQuestion(){ 85 public function saveGeoQuestion(){
86 //处理数据 86 //处理数据
  87 + $max_num = 200;//最大数量
87 $count = count($this->param['question']); 88 $count = count($this->param['question']);
  89 + if(isset($this->param['id']) && !empty($this->param['id'])){
  90 + //编辑
  91 + $sum = $this->model->where('project_id',$this->param['project_id'])->where('id','!=',$this->param['id'])->sum('question_num') ?? 0;
  92 + }else{
  93 + //新增
88 $sum = $this->model->where('project_id',$this->param['project_id'])->sum('question_num') ?? 0; 94 $sum = $this->model->where('project_id',$this->param['project_id'])->sum('question_num') ?? 0;
89 - if($sum >= 200 || $count >= 200){ 95 + }
  96 + if(($count + $sum) > $max_num){
90 $this->fail('当前问题数量大于最大数量200个问题,不允许保存'); 97 $this->fail('当前问题数量大于最大数量200个问题,不允许保存');
91 } 98 }
92 $question = $this->param['question']; 99 $question = $this->param['question'];
93 $this->param['url'] = json_encode($this->param['url'] ?? [],true); 100 $this->param['url'] = json_encode($this->param['url'] ?? [],true);
94 $this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true); 101 $this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true);
95 - if($count <= 20){  
96 - $this->param['question_num'] = $count;  
97 - if(isset($this->param['id']) && !empty($this->param['id'])){  
98 - $id = $this->param['id'];  
99 - $this->model->edit($this->param,['id'=>$id]);  
100 - }else{  
101 - $this->param['next_time'] = date('Y-m-d');  
102 - $id = $this->model->addReturnId($this->param);  
103 - }  
104 - return $this->success(['id'=>$id]);  
105 - }else{  
106 $chunks = array_chunk($question, 20); 102 $chunks = array_chunk($question, 20);
107 if(isset($this->param['id']) && !empty($this->param['id'])){ 103 if(isset($this->param['id']) && !empty($this->param['id'])){
108 foreach ($chunks as $index => $chunk) { 104 foreach ($chunks as $index => $chunk) {
@@ -125,7 +121,7 @@ class GeoQuestionLogic extends BaseLogic @@ -125,7 +121,7 @@ class GeoQuestionLogic extends BaseLogic
125 } 121 }
126 } 122 }
127 return $this->success(['id'=>$id]); 123 return $this->success(['id'=>$id]);
128 - } 124 +
129 } 125 }
130 126
131 /** 127 /**