|
@@ -23,15 +23,29 @@ class EnterpriseApi {
|
|
$companyId = session('user')['companyId'];
|
|
$companyId = session('user')['companyId'];
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$where = [];
|
|
$where = [];
|
|
|
|
+ $whereRaw = "";
|
|
if ($company_info['code'] != 'super') {
|
|
if ($company_info['code'] != 'super') {
|
|
$where[] = ['type', '=', session('user')['type']];
|
|
$where[] = ['type', '=', session('user')['type']];
|
|
if (session('user')['type'] == 1) {
|
|
if (session('user')['type'] == 1) {
|
|
- $list = \app\common\model\EnterpriseVerifyMgr::where('companyId', '=', $companyId)->select()->toArray();
|
|
|
|
|
|
+ $whr[] = ["companyId", "=", $companyId];
|
|
|
|
+ $whr[] = ["delete", "=", 0];
|
|
|
|
+ $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
|
|
$talentType = [];
|
|
$talentType = [];
|
|
|
|
+ $uniCodes = [];
|
|
foreach ($list as $k => $v) {
|
|
foreach ($list as $k => $v) {
|
|
array_push($talentType, $v['enterpriseTag']);
|
|
array_push($talentType, $v['enterpriseTag']);
|
|
|
|
+ $codes = explode(",", $v["uniCode"]);
|
|
|
|
+ $uniCodes = array_merge($uniCodes, (array) $codes);
|
|
|
|
+ }
|
|
|
|
+ if ($talentType && $uniCodes) {
|
|
|
|
+ $whereRaw = sprintf('enterpriseTag in (%s) or idCard in (%s)', explode(",", $talentType), explode(",", $uniCodes));
|
|
|
|
+ }
|
|
|
|
+ if ($talentType && !$uniCodes) {
|
|
|
|
+ $where[] = ["enterpriseTag", "in", $talentType];
|
|
|
|
+ }
|
|
|
|
+ if (!$talentType && $uniCodes) {
|
|
|
|
+ $where[] = ["idCard", "in", $uniCodes];
|
|
}
|
|
}
|
|
- $where[] = ['enterpriseTag', 'in', $talentType];
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -83,14 +97,21 @@ class EnterpriseApi {
|
|
if ($industryFieldNew) {
|
|
if ($industryFieldNew) {
|
|
$where[] = ["industryFieldNew", "=", "{$industryFieldNew}"];
|
|
$where[] = ["industryFieldNew", "=", "{$industryFieldNew}"];
|
|
}
|
|
}
|
|
-
|
|
|
|
- $count = Enterprise::where($where)->count();
|
|
|
|
|
|
+ if ($whereRaw) {
|
|
|
|
+ $count = Enterprise::where($where)->whereRaw($whereRaw)->count();
|
|
|
|
+ } else {
|
|
|
|
+ $count = Enterprise::where($where)->count();
|
|
|
|
+ }
|
|
if ($count > 0) {
|
|
if ($count > 0) {
|
|
$talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
$talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
$industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
$industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
//dd($talentTypeList);
|
|
//dd($talentTypeList);
|
|
- $list = Enterprise::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
|
|
+ if ($whereRaw) {
|
|
|
|
+ $list = Enterprise::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
+ } else {
|
|
|
|
+ $list = Enterprise::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
+ }
|
|
foreach ($list as $k => &$v) {
|
|
foreach ($list as $k => &$v) {
|
|
unset($v['password']);
|
|
unset($v['password']);
|
|
$v['enterpriseTagName'] = $talentTypeList[$v['enterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
|
|
$v['enterpriseTagName'] = $talentTypeList[$v['enterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
|
|
@@ -107,15 +128,29 @@ class EnterpriseApi {
|
|
$companyId = session('user')['companyId'];
|
|
$companyId = session('user')['companyId'];
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$where = [];
|
|
$where = [];
|
|
|
|
+ $whereRaw = "";
|
|
if ($company_info['code'] != 'super') {
|
|
if ($company_info['code'] != 'super') {
|
|
$where[] = ['type', '=', session('user')['type']];
|
|
$where[] = ['type', '=', session('user')['type']];
|
|
if (session('user')['type'] == 1) {
|
|
if (session('user')['type'] == 1) {
|
|
- $list = \app\common\model\EnterpriseVerifyMgr::where('companyId', '=', $companyId)->select()->toArray();
|
|
|
|
|
|
+ $whr[] = ["companyId", "=", $companyId];
|
|
|
|
+ $whr[] = ["delete", "=", 0];
|
|
|
|
+ $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
|
|
$talentType = [];
|
|
$talentType = [];
|
|
|
|
+ $uniCodes = [];
|
|
foreach ($list as $k => $v) {
|
|
foreach ($list as $k => $v) {
|
|
array_push($talentType, $v['enterpriseTag']);
|
|
array_push($talentType, $v['enterpriseTag']);
|
|
|
|
+ $codes = explode(",", $v["uniCode"]);
|
|
|
|
+ $uniCodes = array_merge($uniCodes, (array) $codes);
|
|
|
|
+ }
|
|
|
|
+ if ($talentType && $uniCodes) {
|
|
|
|
+ $whereRaw = sprintf('newEnterpriseTag in (%s) or newIdCard in (%s)', explode(",", $talentType), explode(",", $uniCodes));
|
|
|
|
+ }
|
|
|
|
+ if ($talentType && !$uniCodes) {
|
|
|
|
+ $where[] = ["newEnterpriseTag", "in", $talentType];
|
|
|
|
+ }
|
|
|
|
+ if (!$talentType && $uniCodes) {
|
|
|
|
+ $where[] = ["newIdCard", "in", $uniCodes];
|
|
}
|
|
}
|
|
- $where[] = ['newEnterpriseTag', 'in', $talentType];
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -177,13 +212,20 @@ class EnterpriseApi {
|
|
if ($newIndustryFieldNew) {
|
|
if ($newIndustryFieldNew) {
|
|
$where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
$where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
}
|
|
}
|
|
-
|
|
|
|
- $count = EnterpriseRecord::where($where)->count();
|
|
|
|
|
|
+ if ($whereRaw) {
|
|
|
|
+ $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
|
|
|
|
+ } else {
|
|
|
|
+ $count = EnterpriseRecord::where($where)->count();
|
|
|
|
+ }
|
|
if ($count > 0) {
|
|
if ($count > 0) {
|
|
$talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
$talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
$industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
$industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
- $list = EnterpriseRecord::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
|
|
+ if ($whereRaw) {
|
|
|
|
+ $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
+ } else {
|
|
|
|
+ $list = EnterpriseRecord::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
+ }
|
|
foreach ($list as $k => &$v) {
|
|
foreach ($list as $k => &$v) {
|
|
$v['oldStreetName'] = $streetList[$v['oldStreet']];
|
|
$v['oldStreetName'] = $streetList[$v['oldStreet']];
|
|
$v['newStreetName'] = $streetList[$v['newStreet']];
|
|
$v['newStreetName'] = $streetList[$v['newStreet']];
|