Browse Source

编辑项目咨询单的接口优化consultfeededit

wufeng 2 years ago
parent
commit
8d81d7bcbb
1 changed files with 10 additions and 6 deletions
  1. 10 6
      app/admin/controller/Consult.php

+ 10 - 6
app/admin/controller/Consult.php

@@ -994,7 +994,7 @@ class Consult extends Base
                 $feed['sale_price']=$saleprice;
                 $feed['origin_price']=$total_fee;
                 $feed['updatetime']=date("Y-m-d H:i:s");
-                
+
                 $temp['updatetime']=date("Y-m-d H:i:s");
                 $nu = Db::name("project_feedback")->save($feed);
                 if($nu==false){
@@ -1007,11 +1007,15 @@ class Consult extends Base
                     if($up){
                         $count = Db::name("project_info")->where(["projectNo"=>$projectinfo['projectNo'],"status"=>1])->count();
 
-                        if($count==0){
-                            $proc =Db::name("project")->where(["projectNo"=>$projectinfo['projectNo'],"status"=>1])->save(["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
-                            if($proc==false){
-                                Db::rollback();
-                                return error_show(1006,"项目反馈失败");
+                        if ($count == 0) {
+                            //先查询是否存在status==1的项目,有的话再更新,否则跳过
+                            $project_id = Db::name("project")->where(["projectNo" => $projectinfo['projectNo'], "status" => 1])->value('id', 0);
+                            if ($project_id) {
+                                $proc = Db::name("project")->where(["id" => $project_id])->save(["status" => 2, "updatetime" => date("Y-m-d H:i:s")]);
+                                if ($proc == false) {
+                                    Db::rollback();
+                                    return error_show(1006, "项目反馈失败");
+                                }
                             }
                         }
                     }