|
@@ -784,10 +784,26 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$where = [];
|
|
|
$where[] = ["type", "=", $old["type"]];
|
|
|
$where[] = ["project", "=", ProjectState::JBT];
|
|
|
- $where[] = ["isConditionFile", "in", [0, $old["allowanceType"]]];
|
|
|
+ $where[] = ["isConditionFile", "=", $old["allowanceType"]];
|
|
|
$where[] = ["active", "=", 1];
|
|
|
$where[] = ["delete", "=", 0];
|
|
|
$filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["enterpriseId", "=", $old["enterpriseId"]];
|
|
|
+ $where[] = ["batch", "=", $old["year"]];
|
|
|
+ $commonFiles = Db::table("un_talent_allowance_common_file")->alias("f")->leftJoin("new_common_filetype ft", "ft.id=f.fileTypeId")->field("f.*,ft.relationIds")->where($where)->select()->toArray();
|
|
|
+ $relationIds = [];
|
|
|
+ foreach ($commonFiles as $key => $row) {
|
|
|
+ $_relationIds = array_filter(explode(",", $row["relationIds"]));
|
|
|
+ $relationIds = array_merge($relationIds, $_relationIds);
|
|
|
+ }
|
|
|
+ foreach ($filetypes as $key => $filetype) {
|
|
|
+ if (in_array($filetype["id"], $relationIds)) {
|
|
|
+ $filetypes[$key]["must"] = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$sb = [];
|
|
|
$sb[] = "以下为必传附件:";
|
|
|
foreach ($filetypes as $filetype) {
|
|
@@ -913,13 +929,42 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$batchId = $param["batch"];
|
|
|
$where = [["batchId", "=", $batchId], ["enterpriseId", "=", $this->user["uid"]]];
|
|
|
$list = Db::table("un_talent_allowance_common_file")->where($where)->select()->toArray();
|
|
|
+
|
|
|
+ $whr[] = ["type", "=", $this->user["type"]];
|
|
|
+ $whr[] = ["project", "=", ProjectState::JBT];
|
|
|
+ $whr[] = ["isConditionFile", "=", 0];
|
|
|
+ $whr[] = ["delete", "=", 0];
|
|
|
+ $commonFileTypes = Db::table("new_common_filetype")->where($whr)->whereRaw("find_in_set(:enterpriseId,enterpriseIds)", ["enterpriseId" => $this->user["uid"]])->select()->toArray();
|
|
|
+
|
|
|
foreach ($list as $key => $item) {
|
|
|
$list[$key]["ext"] = pathinfo($item["url"])["extension"];
|
|
|
$list[$key]["url"] = getStoragePath($item["url"]);
|
|
|
+ $list[$key]["fileTypes"] = $commonFileTypes;
|
|
|
}
|
|
|
return json(["rows" => $list]);
|
|
|
}
|
|
|
|
|
|
+ public function bindCommonFileWithFileType() {
|
|
|
+ $params = $this->request->param();
|
|
|
+ $fileId = $params["fileId"];
|
|
|
+ $fileTypeId = $params["fileTypeId"];
|
|
|
+ $upd["id"] = $fileId;
|
|
|
+ $upd["fileTypeId"] = $fileTypeId ?: 0;
|
|
|
+ $upd["updateTime"] = date("Y-m-d H:i:s");
|
|
|
+ $upd["updateUser"] = $this->user["uid"];
|
|
|
+ try {
|
|
|
+ Db::table("un_talent_allowance_common_file")->update($upd);
|
|
|
+ if ($fileTypeId > 0) {
|
|
|
+ $msg = "关联成功";
|
|
|
+ } else {
|
|
|
+ $msg = "取消关联成功";
|
|
|
+ }
|
|
|
+ return json(new Response(Response::SUCCESS, $msg));
|
|
|
+ } catch (\think\db\exception\DbException $e) {
|
|
|
+ return json(new Response(Response::ERROR, $e->getMessage()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function deleteCommonFile() {
|
|
|
$id = $this->request["id"];
|
|
|
$where = [];
|