|  | @@ -116,48 +116,75 @@ class Integral extends EnterpriseController {
 | 
	
		
			
				|  |  |              $amounts = $params["amount"];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              $detailCounts = count($item_ids);
 | 
	
		
			
				|  |  | -            $ft_ids = [];
 | 
	
		
			
				|  |  |              for ($i = 0; $i < $detailCounts; $i++) {
 | 
	
		
			
				|  |  |                  if (!in_array($item_ids[$i], $tmp_item_ids)) {
 | 
	
		
			
				|  |  |                      $tmp_item_ids[] = $item_ids[$i];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (!is_numeric($amounts[$i]) || $amounts[$i] < 0) {
 | 
	
		
			
				|  |  | -                    throw new ValidateException(sprintf("第%d个积分标准项的数额填写错误,应填入大于0的数字", $i + 1));
 | 
	
		
			
				|  |  | +                    $res = ["msg" => sprintf("第%d个积分标准项的数额填写错误,应填入大于0的数字", $i + 1)];
 | 
	
		
			
				|  |  | +                    echo sprintf("<script>parent.IntegralInfoDlg.submitCallback(%s);</script>", json_encode($res));
 | 
	
		
			
				|  |  | +                    exit;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  $integralItemInfo = \app\common\api\IntegralItemApi::getOne($item_ids[$i]);
 | 
	
		
			
				|  |  |                  if (!$integralItemInfo) {
 | 
	
		
			
				|  |  | -                    throw new ValidateException(sprintf("第%d个积分标准项不存在", $i + 1));
 | 
	
		
			
				|  |  | +                    $res = ["msg" => sprintf("第%d个积分标准项不存在", $i + 1)];
 | 
	
		
			
				|  |  | +                    echo sprintf("<script>parent.IntegralInfoDlg.submitCallback(%s);</script>", json_encode($res));
 | 
	
		
			
				|  |  | +                    exit;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                $ft_ids = array_filter(explode(",", $integralItemInfo["fileTypeId"]));
 | 
	
		
			
				|  |  | +                if ($ft_ids) {
 | 
	
		
			
				|  |  | +                    $whereFt[] = ["id", "in", $ft_ids];
 | 
	
		
			
				|  |  | +                    $whereFt[] = ["must", "=", 1];
 | 
	
		
			
				|  |  | +                    $fts = Db::table("new_common_filetype")->where($whereFt)->select()->toArray();
 | 
	
		
			
				|  |  | +                    $count = count($fts);
 | 
	
		
			
				|  |  | +                    if ($count > 0) {
 | 
	
		
			
				|  |  | +                        $_ft_ids = array_column($fts, "id");
 | 
	
		
			
				|  |  | +                        $whr = [];
 | 
	
		
			
				|  |  | +                        $whr[] = ["type", "=", ProjectState::INTEGRAL];
 | 
	
		
			
				|  |  | +                        $whr[] = ["relationId", "=", $item_ids[$i]];
 | 
	
		
			
				|  |  | +                        $whr[] = ["typeId", "in", $_ft_ids];
 | 
	
		
			
				|  |  | +                        if ($id) {
 | 
	
		
			
				|  |  | +                            $whr[] = ["mainId", "=", $id];
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            $whr[] = ["id", "in", $params["uploadFiles"]];
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
 | 
	
		
			
				|  |  | +                        if ($count != count($distinct_filetypes)) {
 | 
	
		
			
				|  |  | +                            $res = ["msg" => '积分项目"' . $integralItemInfo["name"] . '"缺少必传附件'];
 | 
	
		
			
				|  |  | +                            echo sprintf("<script>parent.IntegralInfoDlg.submitCallback(%s);</script>", json_encode($res));
 | 
	
		
			
				|  |  | +                            exit;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                $ft_ids = array_filter(array_merge($ft_ids, (array) explode(",", $integralItemInfo["fileTypeId"])));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            $ft_ids = array_unique($ft_ids);
 | 
	
		
			
				|  |  |              if (count($tmp_item_ids) != $detailCounts) {
 | 
	
		
			
				|  |  | -                throw new ValidateException("同一个申报中,同一个积分标准不能申报多次");
 | 
	
		
			
				|  |  | +                $res = ["msg" => "同一个申报中,同一个积分标准不能申报多次"];
 | 
	
		
			
				|  |  | +                echo sprintf("<script>parent.IntegralInfoDlg.submitCallback(%s);</script>", json_encode($res));
 | 
	
		
			
				|  |  | +                exit;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              $whrCommonFt = [];
 | 
	
		
			
				|  |  |              $whrCommonFt[] = ["project", "=", ProjectState::INTEGRAL];
 | 
	
		
			
				|  |  |              $whrCommonFt[] = ["active", "=", 1];
 | 
	
		
			
				|  |  | +            $whrCommonFt[] = ["must", "=", 1];
 | 
	
		
			
				|  |  |              $whrCommonFt[] = ["delete", "=", 0];
 | 
	
		
			
				|  |  |              $whrCommonFt[] = ["type", "=", $this->user["type"]];
 | 
	
		
			
				|  |  |              $whrCommonFt[] = ["isConditionFile", "=", 1];
 | 
	
		
			
				|  |  |              $common_fts = Db::table("new_common_filetype")->where($whrCommonFt)->select()->toArray();
 | 
	
		
			
				|  |  |              $common_ft_ids = array_column($common_fts, "id");
 | 
	
		
			
				|  |  | -            $ft_ids = array_filter(array_merge($ft_ids, (array) $common_ft_ids));
 | 
	
		
			
				|  |  | -            if ($ft_ids) {
 | 
	
		
			
				|  |  | +            if ($common_ft_ids) {
 | 
	
		
			
				|  |  |                  $whr = [];
 | 
	
		
			
				|  |  | +                $whr[] = ["type", "=", ProjectState::INTEGRAL];
 | 
	
		
			
				|  |  | +                $whr[] = ["typeId", "in", $common_ft_ids];
 | 
	
		
			
				|  |  |                  if ($id) {
 | 
	
		
			
				|  |  |                      $whr[] = ["mainId", "=", $id];
 | 
	
		
			
				|  |  | -                    $whr[] = ["type", "=", ProjectState::INTEGRAL];
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  | -                    if ($params["uploadFiles"])
 | 
	
		
			
				|  |  | -                        $whr[] = ["id", "in", $params["uploadFiles"]];
 | 
	
		
			
				|  |  | +                    $whr[] = ["id", "in", $params["uploadFiles"]];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                $whr[] = ["typeId", "in", $ft_ids];
 | 
	
		
			
				|  |  |                  $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
 | 
	
		
			
				|  |  |                  $upload_type_counts = count($distinct_filetypes);
 | 
	
		
			
				|  |  | -                if ($upload_type_counts != count($ft_ids)) {
 | 
	
		
			
				|  |  | -                    $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
 | 
	
		
			
				|  |  | +                if ($upload_type_counts != count($common_ft_ids)) {
 | 
	
		
			
				|  |  | +                    $res = ["msg" => "公共附件缺少必传附件"];
 | 
	
		
			
				|  |  |                      echo sprintf("<script>parent.IntegralInfoDlg.submitCallback(%s);</script>", json_encode($res));
 | 
	
		
			
				|  |  |                      exit;
 | 
	
		
			
				|  |  |                  }
 |