|
@@ -195,11 +195,26 @@ class Project extends Base
|
|
|
}
|
|
|
$nu = Db::name("project_feedback")->insertAll($data);
|
|
|
if($nu>0){
|
|
|
+ $projectinfo['status']=2;
|
|
|
+ $projectinfo['updatetime']=date("Y-m-d H:i:s");
|
|
|
+ $up = Db::name("project_info")->save($projectinfo);
|
|
|
+ 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){
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"添加成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Db::commit();
|
|
|
return app_show(0,"添加成功");
|
|
|
}else{
|
|
|
Db::rollback();
|
|
|
- return app_show(0,"添加成功");
|
|
|
+ return error_show(1004,"添加失败");
|
|
|
}
|
|
|
|
|
|
}catch (\Exception $e){
|
|
@@ -391,6 +406,9 @@ class Project extends Base
|
|
|
if($info==false){
|
|
|
return error_show(1004,"未找到项目信息");
|
|
|
}
|
|
|
+ if($info['status']!=3 || $info['status']!=4){
|
|
|
+ return error_show(1004,"项目状态有误");
|
|
|
+ }
|
|
|
$feedback =isset($this->post['feedback'])&&!empty($this->post['feedback'])?$this->post['feedback']:"";
|
|
|
if($feedback==""){
|
|
|
return error_show(1004,"参数feedback不能为空");
|
|
@@ -441,8 +459,13 @@ class Project extends Base
|
|
|
];
|
|
|
$up =Db::name("project_plan")->insert($data);
|
|
|
if($up){
|
|
|
- Db::commit();
|
|
|
- return app_show(0,"方案制作成功",["planNo"=>$planNo]);
|
|
|
+ $info['status']=4;
|
|
|
+ $info['updatetime']=date("Y-m-d H:i:s");
|
|
|
+ $cr =Db::name("project")->save($info);
|
|
|
+ if($cr){
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"方案制作成功",["planNo"=>$planNo]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
Db::rollback();
|
|
@@ -525,12 +548,42 @@ class Project extends Base
|
|
|
if(empty($selec)){
|
|
|
return error_show(1004,"反馈数据信息未找到");
|
|
|
}
|
|
|
- $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
- if($up){
|
|
|
- return app_show(0,"反馈数据选择成功");
|
|
|
- }else{
|
|
|
- return error_show(1004,"反馈数据选择失败");
|
|
|
+ Db::startTrans();
|
|
|
+ try{
|
|
|
+ $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+ if($up){
|
|
|
+ foreach ($selec as $value){
|
|
|
+ $projectinfo=[];
|
|
|
+ $projectinfo['status']=3;
|
|
|
+ $projectinfo['updatetime']=date("Y-m-d H:i:s");
|
|
|
+ $up = Db::name("project_info")->where(['pgNo'=>$value['pgNo']])->save($projectinfo);
|
|
|
+ if($up){
|
|
|
+ $count = Db::name("project_info")->where(["projectNo"=>$value['projectNo'],"status"=>2])
|
|
|
+ ->count();
|
|
|
+ if($count==0){
|
|
|
+ $proc =Db::name("project")->where(["projectNo"=>$value['projectNo'],"status"=>2])->save
|
|
|
+ (["status"=>3,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+ if(!$proc){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"反馈数据选择失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"反馈数据选择失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"反馈数据选择成功");
|
|
|
+ }else{
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"反馈数据选择失败");
|
|
|
+ }
|
|
|
+ }catch (\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,$e->getMessage());
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
public function planCheck(){
|
|
|
$planNos = isset($this->post['planNos'])&&!empty($this->post['planNos'])? $this->post['planNos'] :"";
|
|
@@ -545,12 +598,28 @@ class Project extends Base
|
|
|
if(empty($selec)){
|
|
|
return error_show(1004,"项目方案数据信息未找到");
|
|
|
}
|
|
|
- $up = Db::name("project_plan")->where(["planNo"=>$planNos,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
- if($up){
|
|
|
- return app_show(0,"方案数据修改成功");
|
|
|
- }else{
|
|
|
- return error_show(1004,"方案数据修改失败");
|
|
|
+ Db::startTrans();
|
|
|
+ try{
|
|
|
+ $up = Db::name("project_plan")->where(["planNo"=>$planNos,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+ if($up) {
|
|
|
+ $project = array_column($selec, "projectNo");
|
|
|
+ if (empty($project)) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004, "方案选择失败");
|
|
|
+ }
|
|
|
+ $pro = Db::name("project")->where(["projectNo" => $project, "status" => 4])->save(["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
|
|
|
+ if ($pro) {
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0, "方案数据修改成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"方案选择失败");
|
|
|
+ }catch (\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,$e->getMessage());
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function changeRate(){
|