| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302 | 
							- <?php
 
- /**
 
-  * Created by PhpStorm.
 
-  * User: michaelwu
 
-  * Date: 2018/10/31
 
-  * Time: 10:03
 
-  */
 
- namespace App\Services\Company;
 
- use App\Exceptions\ResponseException;
 
- use App\Models\Category;
 
- use App\Models\Company;
 
- use App\Models\CompanyContact;
 
- use App\Models\Jobs;
 
- use App\Models\JobsContact;
 
- use App\Models\MemberInfo;
 
- use App\Models\Resume;
 
- use App\Repositories\CompanyInterviewRepository;
 
- use App\Repositories\CompanyRepository;
 
- use App\Repositories\JobsRepository;
 
- use App\Repositories\MemberLogRepository;
 
- use App\Repositories\MemberMsgtipRepository;
 
- use App\Repositories\MemberPointRepository;
 
- use App\Repositories\MsgRepository;
 
- use App\Repositories\OauthRepository;
 
- use App\Repositories\PersonalJobsApplyRepository;
 
- use App\Repositories\PersonFocusComRepository;
 
- use App\Repositories\CompanyImgRepository;
 
- use App\Repositories\CategoryRepository;
 
- use App\Repositories\MemberSetmealRepository;
 
- use App\Repositories\CategoryDistrictRepository;
 
- use App\Repositories\CompanyStatisticsRepository;
 
- use App\Repositories\PmsRepository;
 
- use App\Repositories\SubsiteRepository;
 
- use App\Repositories\TaskLogRepository;
 
- use App\Repositories\ThirdloginRepository;
 
- use App\Services\Common\TaskService;
 
- use http\Env\Response;
 
- use Illuminate\Support\Facades\DB;
 
- use Illuminate\Support\Facades\Hash;
 
- use Illuminate\Support\Facades\Cache;
 
- use App\Repositories\CompanyContactRepository;
 
- use Illuminate\Support\Facades\Log;
 
- class CompanyService
 
- {
 
-     protected $companyRepository;
 
-     protected $jobsRepository;
 
-     protected $oauthRepository;
 
-     protected $taskService;
 
-     protected $personalJobsApplyRepository;
 
-     protected $personFocusComRepository;
 
-     protected $companyImgRepository;
 
-     protected $categoryRepository;
 
-     protected $memberSetmealRepository;
 
-     protected $categoryDistrictRepository;
 
-     protected $companyStatisticsRepository;
 
-     protected $taskLogRepository;
 
-     protected $memberPointRepository;
 
-     protected $companyInterviewRepository;
 
-     protected $memberLogRepository;
 
-     protected $pmsRepository;
 
-     protected $memberMsgtipRepository;
 
-     protected $msgRepository;
 
-     protected $subsiteRepository;
 
-     protected $thirdloginRepository;
 
-     protected $companyContactRepository;
 
-     /**
 
-      * CompanyService constructor.
 
-      * @param CompanyRepository $companyRepository
 
-      * @param MemberMsgtipRepository $memberMsgtipRepository
 
-      * @param PmsRepository $pmsRepository
 
-      * @param MemberLogRepository $memberLogRepository
 
-      * @param CompanyInterviewRepository $companyInterviewRepository
 
-      * @param MemberPointRepository $memberPointRepository
 
-      * @param JobsRepository $jobsRepository
 
-      * @param OauthRepository $oauthRepository
 
-      * @param TaskService $taskService
 
-      * @param TaskLogRepository $taskLogRepository
 
-      * @param PersonalJobsApplyRepository $personalJobsApplyRepository
 
-      * @param PersonFocusComRepository $personFocusComRepository
 
-      * @param CompanyImgRepository $companyImgRepository
 
-      * @param CategoryRepository $categoryRepository
 
-      * @param MemberSetmealRepository $memberSetmealRepository
 
-      * @param CategoryDistrictRepository $categoryDistrictRepository
 
-      * @param CompanyStatisticsRepository $companyStatisticsRepository
 
-      * @param MsgRepository $msgRepository
 
-      * @param SubsiteRepository $subsiteRepository
 
-      * @param ThirdloginRepository $thirdloginRepository
 
-      * @param CompanyContactRepository $companyContactRepository
 
-      */
 
-     public function __construct(CompanyRepository $companyRepository, ThirdloginRepository $thirdloginRepository, MemberMsgtipRepository $memberMsgtipRepository, SubsiteRepository $subsiteRepository, PmsRepository $pmsRepository, MemberLogRepository $memberLogRepository, CompanyInterviewRepository $companyInterviewRepository, MemberPointRepository $memberPointRepository, JobsRepository $jobsRepository, OauthRepository $oauthRepository, TaskService $taskService, TaskLogRepository $taskLogRepository, PersonalJobsApplyRepository $personalJobsApplyRepository, PersonFocusComRepository $personFocusComRepository, CompanyImgRepository $companyImgRepository, CategoryRepository $categoryRepository, MemberSetmealRepository $memberSetmealRepository, CategoryDistrictRepository $categoryDistrictRepository, CompanyStatisticsRepository $companyStatisticsRepository, MsgRepository $msgRepository, CompanyContactRepository $companyContactRepository)
 
-     {
 
-         $this->companyRepository = $companyRepository;
 
-         $this->jobsRepository = $jobsRepository;
 
-         $this->oauthRepository = $oauthRepository;
 
-         $this->taskService = $taskService;
 
-         $this->personalJobsApplyRepository = $personalJobsApplyRepository;
 
-         $this->personFocusComRepository = $personFocusComRepository;
 
-         $this->companyRepository = $companyRepository;
 
-         $this->companyImgRepository = $companyImgRepository;
 
-         $this->categoryRepository = $categoryRepository;
 
-         $this->memberSetmealRepository = $memberSetmealRepository;
 
-         $this->categoryDistrictRepository = $categoryDistrictRepository;
 
-         $this->companyStatisticsRepository = $companyStatisticsRepository;
 
-         $this->taskLogRepository = $taskLogRepository;
 
-         $this->memberPointRepository = $memberPointRepository;
 
-         $this->companyInterviewRepository = $companyInterviewRepository;
 
-         $this->memberLogRepository = $memberLogRepository;
 
-         $this->pmsRepository = $pmsRepository;
 
-         $this->memberMsgtipRepository = $memberMsgtipRepository;
 
-         $this->msgRepository = $msgRepository;
 
-         $this->subsiteRepository = $subsiteRepository;
 
-         $this->thirdloginRepository = $thirdloginRepository;
 
-         $this->companyContactRepository = $companyContactRepository;
 
-     }
 
-     /**
 
-      * 企业会员中心页
 
-      * @return array
 
-      */
 
-     public function index($user)
 
-     {
 
-         $myPoints = $this->memberPointRepository->getPointsOne($user->id, $user->utype); //我的积分
 
-         $mySetmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, 1);
 
-         //套餐临近到期提醒
 
-         $setmealMsg = '';
 
-         session(["setmeal_message" => ""]);
 
-         if ($mySetmeal->endtime != 0) {
 
-             $days = (strtotime($mySetmeal->endtime) - time()) / 86400;
 
-             $meal_min_remind = config('aix.companyset.setmeal_com.setmeal_com_set.meal_min_remind');
 
-             if ($meal_min_remind > 0 && $days <= $meal_min_remind) {
 
-                 $setmealMsg = "提醒:您的套餐快到期,为避免造成不必要的麻烦,请升级套餐";
 
-             }
 
-             if (strtotime($mySetmeal->endtime) < time() && $mySetmeal->endtime != 0) {
 
-                 $setmealMsg = "提醒:您的套餐已到期,请及时到我的套餐处升级套餐";
 
-             }
 
-             session(["setmeal_message" => $setmealMsg]);
 
-         }
 
-         //招聘中的职位数
 
-         $condition = [
 
-             'company_id' => $user->id,
 
-             'valid' => 1,
 
-             'display' => 1,
 
-         ];
 
-         if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-             $condition[] = ['audit', '=', 1];
 
-         } else {
 
-             $condition[] = ['audit', '<>', 3];
 
-         }
 
-         $jobsing = $this->jobsRepository->getJobCount($condition);
 
-         //待处理简历
 
-         $condition1 = [
 
-             'is_reply' => 0,
 
-             'company_id' => $user->id,
 
-         ];
 
-         $resumes = $this->personalJobsApplyRepository->resumesCount($condition1);
 
-         //面试邀请
 
-         $condition2 = [
 
-             'company_id' => $user->id,
 
-             'result' => 0,
 
-         ];
 
-         $interview = $this->companyInterviewRepository->interviewCount($condition2);
 
-         //谁关注我
 
-         $condition3 = [
 
-             'company_id' => $user->id,
 
-         ];
 
-         $concern = $this->personFocusComRepository->getFansCount($condition3);
 
-         //我的消息
 
-         /*  $condition4 = [
 
-               'msgtouid' => $user->id,
 
-               'utype' => $user->utype,
 
-               'new' => 1,
 
-           ];
 
-           $pms = $this->pmsRepository->getPmsCount($condition4);*/
 
-         //是否已签到
 
-         $isSign = $this->taskLogRepository->getTaskLogCount($user->id, 18, $user->utype);
 
-         $res = [
 
-             'week' => array('日', '一', '二', '三', '四', '五', '六'),
 
-             'mypoints' => $myPoints,
 
-             'user' => $user,
 
-             'jobsing' => $jobsing,
 
-             'resumesCount' => $resumes,
 
-             'interview' => $interview,
 
-             'isSign' => $isSign,
 
-             'concern' => $concern,
 
-             /* 'pms'=>$pms,*/
 
-             'mySetmeal' => $mySetmeal,
 
-             'setmealMsg' => $setmealMsg,
 
-         ];
 
-         return $res;
 
-     }
 
-     public function ajaxSms($user)
 
-     {
 
-         //获取当天
 
-         //当天开始时间
 
-         $start_time = strtotime(date("Y-m-d", time()));
 
-         //当天结束之间
 
-         $end_time = $start_time + 60 * 60 * 24;
 
-         $condit[] = ['new', 1];
 
-         $condit[] = ['msgtouid', $user->id];
 
-         $condit[] = ['utype', $user->utype];
 
-         $condit[] = ['msgtype', 2];
 
-         $condit[] = ['msgfromuid', 0];
 
-         $condit[] = ['msgfrom', 'admin'];
 
-         /*$condit[] = ['started_at', '<=', time()];
 
-         $condit[] = ['ended_at', '>=',  time()];*/
 
-         $condit[] = ['started_at', '<=', $start_time];
 
-         $condit[] = ['ended_at', '>=', $start_time];
 
-         $message = $this->pmsRepository->findFirstPms($condit);;
 
-         $info = '';
 
-         $id = '';
 
-         if ($message) {
 
-             $order = array("\r\n", "\n", "\r");
 
-             $replace = '<br/>';
 
-             $info = $message->message;
 
-             $id = $message->id;
 
-         }
 
-         return ['message' => $info, 'id' => $id];
 
-     }
 
-     public function setMatchJob($data, $company)
 
-     {
 
-         $job_id = array_get($data, 'job_id');
 
-         $type = array_get($data, 'type');
 
-         $jids = session('match_jobs_' . $company->id, array());
 
-         if ($jids) {
 
-             $jids[] = $job_id;
 
-         } else {
 
-             $jids = array($job_id);
 
-         }
 
-         if ($job_id) {
 
-             session(['match_jobs_' . $company->id => $jids]);
 
-         }
 
-         //判断当前企业是否有其它职位,如果没有则清空过滤的session
 
-         $job = $this->getMatchJob($company);
 
-         if (!$job) {
 
-             session(['match_jobs_' . $company->id => null]);
 
-         }
 
-     }
 
-     //获取推荐简历需要匹配的职位
 
-     public function getMatchJob($company)
 
-     {
 
-         $job_where = array(
 
-             array('company_id', '=', $company->id),
 
-             array('valid', '=', 1),
 
-             array('deadline', '>=', time())
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-             $job_where[] = array('audit', '=', 1);
 
-         } else {
 
-             $job_where[] = array('audit', '<>', 3);
 
-         }
 
-         //排除已推荐过的职位
 
-         $has_jids = session('match_jobs_' . $company->id, array());
 
-         $where_notIn = array();
 
-         if ($has_jids) {
 
-             $where_notIn = ['id' => $has_jids];
 
-         }
 
-         $orderby = array('stime' => 'DESC', 'refresh_time' => 'DESC', 'click' => 'DESC');
 
-         $jobinfo = $this->jobsRepository->getMatchJob($job_where, $where_notIn, $orderby);
 
-         if ($jobinfo) {
 
-             return $jobinfo;
 
-         } else {
 
-             return array();
 
-         }
 
-     }
 
-     //获取推荐简历排序
 
-     public function getRecommendOrder($user = array())
 
-     {
 
-         $order = array();
 
-         $order = array('click' => 'desc', 'stime' => 'desc', 'updated_at' => 'desc');
 
-         return $order;
 
-     }
 
-     public function getRecommendWhere($user)
 
-     {
 
-         $where = array();
 
-         if ($user && $user->utype == 1) {
 
-             //获取发布中的职位
 
-             $job_where = array(
 
-                 array('company_id', '=', $user->id),
 
-                 array('valid', '=', 1),
 
-                 array('deadline', '>=', time())
 
-             );
 
-             if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-                 $job_where[] = array('audit', '=', 1);
 
-             } else {
 
-                 $job_where[] = array('audit', '<>', 3);
 
-             }
 
-             $orderby = array('stime' => 'DESC', 'refresh_time' => 'DESC', 'click' => 'DESC');
 
-             $jobs = $this->jobsRepository->fliterJobs($job_where, array(), $orderby);
 
-             if ($jobs->isNotEmpty()) {
 
-                 $or_where = array();
 
-                 foreach ($jobs as $k => $v) {
 
-                     $or_where[] = $this->getRecommendResumeWhere($v);
 
-                 }
 
-                 $and_where[] = array('display', '=', 1);
 
-                 if (config('aix.personal_set.per_set.show_set.resume_display') == 1) {
 
-                     $and_where[] = array('audit', '=', 2);
 
-                 } else {
 
-                     $and_where[] = array('audit', '<>', 0);
 
-                 }
 
-                 $where['or'] = $or_where;
 
-             }
 
-             return $where;
 
-         } else {
 
-             $where[] = array('display', '=', 1);
 
-             if (config('aix.personal_set.per_set.show_set.resume_display') == 1) {
 
-                 $where[] = array('audit', '=', 2);
 
-             } else {
 
-                 $where[] = array('audit', '<>', 0);
 
-             }
 
-             return $where;
 
-         }
 
-     }
 
-     //获取推荐简历
 
-     public function getRecommendResumeWhere($job)
 
-     {
 
-         $where = array();
 
-         //简历公开、简历审核状态、默认简历通过审核
 
-         $where[] = array('display', '=', 1);
 
-         //$where[] = array('def','=',1);
 
-         if (config('aix.personal_set.per_set.show_set.resume_display') == 1) {
 
-             $where[] = array('audit', '=', 2);
 
-         } else {
 
-             $where[] = array('audit', '<>', 0);
 
-         }
 
-         if (auth('web-company')->check()) {
 
-             //获取企业信息
 
-             $company = auth('web-company')->user();
 
-             if ($job) {
 
-                 //匹配年龄、工作性质、期望行业、期望职位、工作地区、期望薪资
 
-                 //匹配学历
 
-                 $education = $job->education;
 
-                 if ($education) {
 
-                     $where[] = array('education', '>=', $education);
 
-                 }
 
-                 //匹配工作经验
 
-                 $experience = $job->experience;
 
-                 if ($experience) {
 
-                     $where[] = array('experience', '>=', $experience);
 
-                 }
 
-                 //匹配性别
 
-                 $sex = $job->sex;
 
-                 if ($sex) {
 
-                     $where[] = array('sex', '=', $sex);
 
-                 }
 
-                 //匹配年龄
 
-                 $age = $job->age;
 
-                 if (array_get($age, 0) || array_get($age, 1)) {
 
-                     if (is_numeric(array_get($age, 0))) {
 
-                         $birthday_min = date("Y") - $age[0];
 
-                         $where[] = array('member_infos.birthday', '<=', $birthday_min);
 
-                     }
 
-                     if (is_numeric(array_get($age, 1))) {
 
-                         $birthday_max = date("Y") - $age[1];
 
-                         $where[] = array('member_infos.birthday', '>=', $birthday_max);
 
-                     }
 
-                 }
 
-                 //匹配工作性质
 
-                 $nature = $job->nature;
 
-                 $where[] = array('nature', '=', $nature);
 
-                 //匹配期望行业
 
-                 /*$trade = $company->trade;
 
-                 $where[] = array('trade','=',$trade);*/
 
-                 //匹配工作地区 - 判断三级地区是否存在,如果不存在则判断二级地区
 
-                 $district = $job->district;
 
-                 if ($district) {
 
-                     if (!strpos($district, ".")) {
 
-                         $where[] = array('district', '=', $district);
 
-                     } else {
 
-                         $district_arr = explode('.', $district);
 
-                         if (array_has($district_arr, 2) && array_get($district_arr, 2) > 0) {
 
-                             $where[] = array('district', '=', $district_arr[2]);
 
-                         } else {
 
-                             $where[] = array('district', '=', $district_arr[1]);
 
-                         }
 
-                     }
 
-                 }
 
-                 //匹配期望薪资
 
-                 if ($job->wage >= -1) {
 
-                     $where[] = array('wage_min', '>=', $job->wage_min);
 
-                     $where[] = array('wage_max', '<=', $job->wage_max);
 
-                 }
 
-                 //期望职位 - intention_jobs_id
 
-                 $category = $job->category;
 
-                 if ($category) {
 
-                     $where[] = array('intention_jobs_id', '=', $category);
 
-                 }
 
-             }
 
-         }
 
-         $where[] = array('subsite_ids', '=', get_subsite_id());
 
-         return $where;
 
-     }
 
-     public function ajaxGetStatistics($request, $user)
 
-     {
 
-         $where['company_id'] = $user->id;
 
-         $type = $request['type'] ? $request['type'] : 'visitor';
 
-         switch ($type) {
 
-             case 'visitor':
 
-                 $where['apply'] = 0;
 
-                 break;
 
-             case 'apply':
 
-                 $where['apply'] = 1;
 
-                 break;
 
-             case 'viewjobs':
 
-                 $where['apply'] = 0;
 
-                 $where[] = ['job_id', '>', 0];
 
-                 break;
 
-         }
 
-         $settr = $request['settr'] ? $request['settr'] : 7;
 
-         $today = date('Y-m-d');
 
-         $where[] = ['created_at', '<', $today];
 
-         if ($settr > 0) {
 
-             $settr_tmp = strtotime($today) - $settr * 3600 * 24;
 
-             $where[] = ['created_at', '>=', date('Y-m-d H:i:s', $settr_tmp)];
 
-             $where[] = ['created_at', '<', $today];
 
-         }
 
-         $category = [];
 
-         $set_total = $set_login = [];
 
-         for ($i = $settr_tmp; $i < strtotime($today); $i = $i + 3600 * 24) {
 
-             $category[] = date('Y-m-d', $i);
 
-             $set_total[$i] = 0;
 
-             $set_login[$i] = 0;
 
-         }
 
-         $uidArr = [];
 
-         $statistics_list = $this->companyStatisticsRepository->findWhere($where);
 
-         foreach ($statistics_list as $key => $value) {
 
-             if ($value['uid'] > 0) {
 
-                 $set_login[strtotime(date('Y-m-d', strtotime($value['created_at'])))]++;
 
-             }
 
-             $set_total[strtotime(date('Y-m-d', strtotime($value['created_at'])))]++;
 
-         }
 
-         $line_xml = '<chart palettecolors="#0075c2,#1aaf5d" bgcolor="#ffffff" showborder="0" showshadow="0" showcanvasborder="0" useplotgradientcolor="0" legendborderalpha="0" legendshadow="0" showaxislines="0" showalternatehgridcolor="0" divlinethickness="1" divlinedashed="1" divlinedashlen="1" showvalues="0">';
 
-         $line_xml .= '<categories>';
 
-         foreach ($category as $key => $value) {
 
-             $line_xml .= '<category label="' . $value . '" />';
 
-         }
 
-         $line_xml .= '</categories>';
 
-         if ($where['apply'] == 1) {
 
-             $line_xml .= '<dataset seriesname="用户应聘次数">';
 
-             foreach ($set_login as $key => $value) {
 
-                 $line_xml .= '<set value="' . $value . '" />';
 
-             }
 
-             $line_xml .= '</dataset>';
 
-         } else {
 
-             $line_xml .= '<dataset seriesname="总浏览次数">';
 
-             foreach ($set_total as $key => $value) {
 
-                 $line_xml .= '<set value="' . $value . '" />';
 
-             }
 
-             $line_xml .= '</dataset>';
 
-             $line_xml .= '<dataset seriesname="登录用户浏览次数">';
 
-             foreach ($set_login as $key => $value) {
 
-                 $line_xml .= '<set value="' . $value . '" />';
 
-             }
 
-             $line_xml .= '</dataset>';
 
-         }
 
-         $line_xml .= '</chart>';
 
-         $res = [
 
-             'line_xml' => $line_xml,
 
-         ];
 
-         return response()->json(['data' => view('app.company.ajax.ajax_statistics', $res)->render()]);
 
-     }
 
-     public function mobileCompanySave($data, $user)
 
-     {
 
-         $id = $data['id'];
 
-         $updateData['short_name'] = $data['short_name'];
 
-         $updateData['nature'] = $data['nature'];
 
-         $updateData['scale'] = $data['scale'];
 
-         $updateData['trade'] = $data['trade'];
 
-         $updateData['district'] = $data['district'];
 
-         $updateData['district_cn'] = get_district_cn($data['district']);
 
-         $updateData['contents'] = $data['contents'];
 
-         $updateData['address'] = $data['address'];
 
-         $updateData['contact'] = $data['contact'];
 
-         $updateData['mobile'] = $data['mobile'];
 
-         $updateData['email'] = $data['email'];
 
-         $updateData['map_x'] = $data['map_x'] ? $data['map_x'] : 0;
 
-         $updateData['map_y'] = $data['map_y'] ? $data['map_y'] : 0;
 
-         $updateData['map_zoom'] = $data['map_zoom'] ? $data['map_zoom'] : 0;
 
-         $updateData['tag'] = explode(',', $data['tag']);
 
-         $updateData['landline_tel'] = $data['landline_tel_first'] . '-' . $data['landline_tel_next'] . '-' . $data['landline_tel_last'];
 
-         !empty($data['landline_tel_first']) ? $updateData['landline_tel'] = $data['landline_tel_first'] : $updateData['landline_tel'] = "";
 
-         !empty($data['landline_tel_next']) ? $updateData['landline_tel'] = $updateData['landline_tel'] . "-" . $data['landline_tel_next'] : "";
 
-         !empty($data['landline_tel_last']) ? $updateData['landline_tel'] = $updateData['landline_tel'] . "-" . $data['landline_tel_last'] : "";
 
-         $updateData['organization_code'] = $data['organization_code'];
 
-         $updateData['unit_character'] = $data['unit_character'];
 
-         $updateData['unit_character_cn'] = get_category($data['unit_character']);
 
-         $updateData['industry'] = $data['industry'];
 
-         $updateData['industry_cn'] = get_category($data['industry']);
 
-         $updateData['economy'] = $data['economy'];
 
-         $updateData['economy_cn'] = get_category($data['economy']);
 
-         $company_audit = $this->companyRepository->find($id, ['audit']);
 
-         if ($company_audit->audit != 0) {
 
-             if (config('aix.companyset.audit.audit_type.audit_edit_com') != 1) {
 
-                 $updateData['audit'] = 2;
 
-             }
 
-         }
 
-         DB::beginTransaction();
 
-         try {
 
-             if (!$this->companyRepository->companySave($updateData, $user->id)) {
 
-                 throw new \Exception('企业信息修改失败');
 
-             }
 
-             event_search_update(Company::class, (string)$id, 'update');
 
-             DB::commit();
 
-             $taskid = 27;
 
-             $dotask = $this->taskService->doTask($taskid, $id, 1);
 
-             if ($updateData['map_x'] && $updateData['map_y']) {
 
-                 $this->taskService->doTask(29, $id, 1);
 
-             }
 
-             if ($dotask['code']) {
 
-                 $html = view('app.company.ajax.ajax_com_info_saved', ['points' => $dotask['data']['points']])->render();
 
-                 return ['status' => 1, 'msg' => '企业信息修改成功', 'html' => $html, 'data' => $dotask['data']['points']];
 
-             } else {
 
-                 $html = view('app.company.ajax.ajax_com_info_saved')->render();
 
-                 return ['status' => 1, 'msg' => '企业信息修改成功', 'html' => $html, 'data' => ''];
 
-             }
 
-         } catch (\Exception $e) {
 
-             DB::rollback();
 
-             return ['status' => 0, 'msg' => $e->getMessage()];
 
-         }
 
-     }
 
-     /**
 
-      * @param $data
 
-      * @return array
 
-      * @throws \Throwable
 
-      */
 
-     public function companySave($data, $user)
 
-     {
 
-         if ($data['legal_idcard'] && !isCreditNo($data['legal_idcard'])) {
 
-             return ['status' => 0, 'msg' => '法人代表身份证格式不正确'];
 
-         }
 
-         if (empty($data['address'])) {
 
-             return ['status' => 0, 'msg' => '联系地址不能为空'];
 
-         }
 
-         $apiAddress = apiAddress($data['address']);
 
-         if (!$apiAddress) {
 
-             return ['status' => 0, 'msg' => '联系地址定位不准确'];
 
-         }
 
-         $id = $user->id;
 
-         $updateData['nature'] = $data['nature'];
 
-         $updateData['scale'] = $data['scale'];
 
-         $updateData['trade'] = $data['trade'];
 
-         $updateData['registered'] = $data['registered'];
 
-         $city = getCityInfo($data['district']);
 
-         $updateData['district'] = $city['district'];
 
-         $updateData['district_cn'] = $city['district_cn_all'];
 
-         $updateData['website'] = $data['website'];
 
-         $updateData['currency'] = $data['currency'];
 
-         $updateData['contents'] = $data['contents'];
 
-         $updateData['address'] = $data['address'];
 
-         $updateData['contact'] = $data['contact'];
 
-         $updateData['mobile'] = $data['mobile'];
 
-         $updateData['email'] = $data['email'];
 
-         $updateData['legal'] = $data['legal'];
 
-         $updateData['legal_idcard'] = $data['legal_idcard'];
 
-         $updateData['qq'] = $data['qq'] ? $data['qq'] : '';
 
-         $updateData['map_x'] = $apiAddress['lng'];
 
-         $updateData['map_y'] = $apiAddress['lat'];
 
-         $updateData['map_zoom'] = $data['map_zoom'] ? $data['map_zoom'] : 0;
 
-         $updateData['contact_show'] = $data['contact_show'];
 
-         $updateData['telephone_show'] = $data['telephone_show'];
 
-         $updateData['email_show'] = $data['email_show'];
 
-         $updateData['landline_tel_show'] = $data['landline_tel_show'];
 
-         $updateData['tag'] = explode(',', $data['tag']);
 
-         !empty($data['landline_tel_first']) ? $updateData['landline_tel'] = $data['landline_tel_first'] : $updateData['landline_tel'] = "";
 
-         !empty($data['landline_tel_next']) ? $updateData['landline_tel'] = $updateData['landline_tel'] . "-" . $data['landline_tel_next'] : "";
 
-         !empty($data['landline_tel_last']) ? $updateData['landline_tel'] = $updateData['landline_tel'] . "-" . $data['landline_tel_last'] : "";
 
-         $updateData['logo'] = $data['logo'];
 
-         $updateData['short_name'] = $data['short_name'];
 
-         $updateData['organization_code'] = $data['organization_code'];
 
-         $company_audit = $this->companyRepository->find($id, ['audit']);
 
-         if ($company_audit->audit != 0) {
 
-             if (config('aix.companyset.audit.audit_type.audit_edit_com') != 1) {
 
-                 $updateData['audit'] = 2;
 
-             }
 
-         }
 
-         $jobsData['map_x'] = $data['map_x'];
 
-         $jobsData['map_y'] = $data['map_y'];
 
-         $jobsData['map_zoom'] = $data['map_zoom'] ? $data['map_zoom'] : '';
 
-         DB::beginTransaction();
 
-         try {
 
-             if ($data['sync'] == 1) {
 
-                 $jobs_id = Jobs::where(['company_id' => $user->id])->pluck('id')->toArray();
 
-                 $contact = [];
 
-                 if ($jobs_id) {
 
-                     $contact['telephone'] = $data['mobile'];
 
-                     $contact['email'] = $data['email'];
 
-                     $contact['contact'] = $data['contact'];
 
-                     $contact['qq'] = $data['qq'];
 
-                     $contact['landline_tel'] = $updateData['landline_tel'];
 
-                     $contact['address'] = $data['address'];
 
-                     $contact['contact_show'] = $data['contact_show'];
 
-                     $contact['telephone_show'] = $data['telephone_show'];
 
-                     $contact['email_show'] = $data['email_show'];
 
-                     $contact['landline_tel_show'] = $data['landline_tel_show'];
 
-                     JobsContact::whereIn('job_id', $jobs_id)->update($contact);
 
-                 }
 
-             }
 
-             if (!$this->companyRepository->companySave($updateData, $id)) {
 
-                 throw new \Exception('企业信息修改失败');
 
-             }
 
-             if (!$this->jobsRepository->getJobsByUid($id)->isEmpty()) {
 
-                 if (!$this->jobsRepository->updateMap($id, $jobsData)) {
 
-                     throw new \Exception('修改联系方式同步到职位失败!');
 
-                 }
 
-             }
 
-             event_search_update(Company::class, (string)$id, 'update');
 
-             DB::commit();
 
-             if ($jobsData['map_x'] && $jobsData['map_y']) {
 
-                 $this->taskService->doTask(29, $id, 1);
 
-             }
 
-             $taskid = 27;
 
-             $dotask = $this->taskService->doTask($taskid, $id, 1);
 
-             $user = auth('web-company')->user();
 
-             $this->memberLogRepository->createLog($user, 1004, "");
 
-             if ($dotask['code']) {
 
-                 $html = view('app.company.ajax.ajax_com_info_saved', ['points' => $dotask['data']['points']])->render();
 
-                 return ['status' => 1, 'msg' => '企业信息修改成功', 'html' => $html, 'data' => $dotask['data']['points']];
 
-             } else {
 
-                 $html = view('app.company.ajax.ajax_com_info_saved')->render();
 
-                 return ['status' => 1, 'msg' => '企业信息修改成功', 'html' => $html, 'data' => ''];
 
-             }
 
-         } catch (\Exception $e) {
 
-             DB::rollback();
 
-             return ['status' => 0, 'msg' => $e->getMessage()];
 
-         }
 
-     }
 
-     /**保存logo
 
-      * @param $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function saveLogo($request, $user)
 
-     {
 
-         $logo = $request['logo'];
 
-         $companyInfo = $this->companyRepository->getCompanyInfoByID($user->id);
 
-         //就是重新认证
 
-         if (config('aix.companyset.audit.audit_type.audit_edit_com') == 2) {
 
-             if (!empty($companyInfo->certificate_img)) {//只要企业的营业执照不为空,那企业就是未认证
 
-                 $data['audit'] = 2;
 
-             } else {
 
-                 $data['audit'] = 0;
 
-             }
 
-         }
 
-         $data['logo'] = $logo;
 
-         if (!$this->companyRepository->companySave($data, $user->id)) {
 
-             return response()->json(['status' => 0, 'msg' => "LOGO保存失败!"]);
 
-         }
 
-         $dotask = $this->taskService->doTask(19, $user->id, 1);
 
-         if ($dotask['code']) {
 
-             return response()->json(['status' => 1, 'msg' => "LOGO保存成功!", 'data' => ['path' => upload_asset($logo), 'points' => $dotask['data']['points']]]);
 
-         } else {
 
-             return response()->json(['status' => 1, 'msg' => "LOGO保存成功!", 'data' => ['path' => upload_asset($logo)]]);
 
-         }
 
-     }
 
-     /**删除logo
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function logoDel($user)
 
-     {
 
-         $data['logo'] = '';
 
-         if (!$this->companyRepository->companySave($data, $user->id)) {
 
-             return response()->json(['status' => 0, 'msg' => "LOGO删除失败!"]);
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => "LOGO删除成功!"]);
 
-     }
 
-     /**
 
-      * 企业资料页面
 
-      * @return array
 
-      * @throws ResponseException
 
-      */
 
-     public function companyInfo($user)
 
-     {
 
-         $companyInfo = $this->companyRepository->getCompanyInfoByID($user->id);
 
-         if ($companyInfo->subsite_id) {
 
-             $subsiteInfo = $this->subsiteRepository->find($companyInfo->subsite_id);
 
-         } else {
 
-             $subsiteInfo = '';
 
-         }
 
-         $companyInfo->subsite_name = $subsiteInfo ? $subsiteInfo->sitename : '总站';
 
-         //企业性质
 
-         $companyType = Category::categoryType('AIX_company_type');
 
-         //企业规模
 
-         $scale = Category::categoryType('AIX_scale');
 
-         //企业行业
 
-         $trade = Category::categoryType('AIX_trade');
 
-         //单位性质
 
-         $unit_character = Category::categoryType('AIX_dwxz');
 
-         $industry = Category::categoryType('AIX_cylb');
 
-         $economy = Category::categoryType('AIX_jjlx');
 
-         if ($jump_certificate = config('aix.companyset.audit.checkset.login_com_audit_certificate') == 1 && $companyInfo->audit == 0) {
 
-             $jump_certificate = 1;
 
-         } else {
 
-             $jump_certificate = 0;
 
-         }
 
-         $res = [
 
-             'companyInfo' => $companyInfo,
 
-             'companyType' => $companyType,
 
-             'scale' => $scale,
 
-             'trade' => $trade,
 
-             'unit_character' => $unit_character,
 
-             'industry' => $industry,
 
-             'economy' => $economy,
 
-             'jump_certificate' => $jump_certificate,
 
-         ];
 
-         return $res;
 
-     }
 
-     /**
 
-      * 获取企业基本信息
 
-      * @return mixed
 
-      * @throws ResponseException
 
-      */
 
-     public function getInfoById($user)
 
-     {
 
-         return $this->companyRepository->getCompanyInfoByID($user->id);
 
-     }
 
-     /**
 
-      * 获取企业基本信息
 
-      * @return mixed
 
-      * @throws ResponseException
 
-      */
 
-     public function getCompInfo($id)
 
-     {
 
-         $where = ['id' => $id];
 
-         return $this->companyRepository->getCompanyInfo($where);
 
-     }
 
-     /**
 
-      * 账号安全
 
-      * @return array
 
-      * @throws ResponseException
 
-      */
 
-     public function companySecurity($user)
 
-     {
 
-         $companyInfo = $this->companyRepository->getCompanyInfoByID($user->id);
 
-         $thirdBindQq = $this->thirdloginRepository->checkBind($user, ['1']);   //qq
 
-         $thirdBindWechat = $this->thirdloginRepository->checkBind($user, ['2', '3', '4']);  //微信
 
-         $isBind_qq = 0;
 
-         $isBind_weixin = 0;
 
-         if ($thirdBindQq) {
 
-             $isBind_qq = 1;
 
-         }
 
-         if ($thirdBindWechat) {
 
-             $isBind_weixin = 1;
 
-         }
 
-         $res = [
 
-             'companyInfo' => $companyInfo,
 
-             'qq' => $isBind_qq,
 
-             'weixin' => $isBind_weixin,
 
-         ];
 
-         return $res;
 
-     }
 
-     public function unBindThird($alias, $user)
 
-     {
 
-         $type = [];
 
-         switch ($alias) {
 
-             case 'qq':
 
-                 $type = ['1'];
 
-                 break;
 
-             case 'weixin':
 
-                 $type = ['2', '3', '4'];
 
-                 break;
 
-         }
 
-         if (!$type) {
 
-             return response()->json(['status' => 0, 'msg' => "参数错误"]);
 
-         }
 
-         if (!$this->thirdloginRepository->checkBind($user, $type)) {
 
-             return response()->json(['status' => 0, 'msg' => "参数错误"]);
 
-         }
 
-         if ($this->thirdloginRepository->unBind($type, $user)) {
 
-             return response()->json(['status' => 1, 'msg' => "解绑成功!"]);
 
-         }
 
-         return response()->json(['status' => 0, 'msg' => "解绑失败!"]);
 
-     }
 
-     /**
 
-      * 修改用户名
 
-      * @param $request
 
-      * @return bool
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function saveUsername($username, $user)
 
-     {
 
-         if (!$this->companyRepository->save(['username' => $username], $user->id)) {
 
-             return false;
 
-         }
 
-         return true;
 
-     }
 
-     public function modifyUserName($user)
 
-     {
 
-         return $this->companyRepository->getCompanyColumn($user->id, ['username']);
 
-     }
 
-     /**
 
-      * 修改密码
 
-      * @param $oldpassword
 
-      * @param $pwd
 
-      * @param $pwd1
 
-      * @return bool
 
-      * @throws ResponseException
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function savePwd($user, $oldpassword, $pwd, $pwd1)
 
-     {
 
-         $com_info = $this->companyRepository->getCompanyColumn($user->id, ['password']);
 
-         if (!Hash::check($oldpassword, $com_info['password'])) {
 
-             throw  new ResponseException('原密码不正确!');
 
-         }
 
-         if ($oldpassword == $pwd) {
 
-             throw  new ResponseException('新密码与原密码一致!');
 
-         }
 
-         if ($pwd != $pwd1) {
 
-             throw new ResponseException('新密码与确认密码不一致');
 
-         }
 
-         if (!$this->companyRepository->save(['password' => bcrypt($pwd)], $user->id)) {
 
-             return false;
 
-         }
 
-         return true;
 
-     }
 
-     /**
 
-      * 验证手机
 
-      * @return mixed
 
-      */
 
-     public function authMobile($user)
 
-     {
 
-         return $this->companyRepository->getCompanyColumn($user->id, ['mobile', 'mobile_audit']);
 
-     }
 
-     public function checkMobileAudit($id, $mobile)
 
-     {
 
-         return $this->companyRepository->findByField(['id' => $id, 'mobile' => $mobile, 'mobile_audit' => 1]);
 
-     }
 
-     /**
 
-      * 认证手机
 
-      * @param $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      */
 
-     public function verifyCode($mobile, $user)
 
-     {
 
-         $data['mobile'] = $mobile;
 
-         $data['mobile_audit'] = 1;
 
-         if (!$this->companyRepository->verifyCode($data, $user->id)) {
 
-             return ['status' => 0, 'msg' => '手机认证失败'];
 
-         }
 
-         $taskRes = $this->taskService->doTask(22, $user->id, 1);
 
-         if (!$taskRes['code']) {
 
-             return ['status' => 1, 'msg' => '你的手机已经通过验证!'];
 
-         }
 
-         return ['status' => 1, 'msg' => '你的手机已经通过验证', 'data' => $taskRes['data']];
 
-     }
 
-     /**
 
-      * 验证email
 
-      * @return mixed
 
-      */
 
-     public function authEmail($user)
 
-     {
 
-         return $this->companyRepository->getCompanyColumn($user->id, ['email', 'email_audit']);
 
-     }
 
-     public function checkEmailAudit($id, $email)
 
-     {
 
-         return $this->companyRepository->findByField(['id' => $id, 'email' => $email, 'email_audit' => 1]);
 
-     }
 
-     /**
 
-      * 企业登录日志
 
-      * @return mixed
 
-      */
 
-     public function companyLoginLog($user)
 
-     {
 
-         return $this->memberLogRepository->getMemberLog($user->id, 1, 1001);
 
-     }
 
-     /**
 
-      * @param $request
 
-      * @return mixed
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function certificate($certificate_img_up, $user)
 
-     {
 
-         $data['audit'] = 2;
 
-         $data['certificate_img'] = $certificate_img_up;
 
-         if (!$this->companyRepository->save($data, $user->id)) {
 
-             return response()->json(['status' => 0, 'msg' => '营业执照保存失败']);
 
-         }
 
-         //写入日志
 
-         $this->memberLogRepository->createLog($user, 1005, "");
 
-         return response()->json(['status' => 1, 'msg' => '营业执照保存成功']);
 
-     }
 
-     //获取企业详细信息页面内容
 
-     public function getCompanyInfo($where)
 
-     {
 
-         $where[] = array('user_status', '=', 1);
 
-         //获取企业信息
 
-         $company = $this->companyRepository->getCompanyInfo($where);
 
-         if (!$company) {
 
-             throw new ResponseException('企业不存在', [], 404);
 
-         }
 
-         //处理企业地址和介绍、logo
 
-         $company->company_url = route(url_rewrite('AIX_companyshow'), array('id' => $company->id));
 
-         $company->company_profile = htmlspecialchars_decode($company->contents, ENT_QUOTES);
 
-         if ($company->logo) {
 
-             $company->logo = upload_asset($company->logo);
 
-         } else {
 
-             $company->logo = public_data_path('data/upload/no_logo.png');
 
-         }
 
-         //简历处理率、统计近两周企业简历处理率、如果收到的简历是0份,则简历处理率为0%
 
-         $app_where[] = array('company_id', '=', $company->id);
 
-         $app_where[] = array('created_at', '>', date('Y-m-d H:i:s', strtotime("-14day")));
 
-         $apply = $this->personalJobsApplyRepository->getJobsApply($app_where);
 
-         $reply = 0;
 
-         $reply_time = 0;
 
-         foreach ($apply as $key => $val) {
 
-             if ($val->is_reply) {
 
-                 $reply++;
 
-                 $val['reply_time'] && $reply_time += $val->reply_time - strtotime($val->created_at);
 
-             }
 
-         }
 
-         if ($apply->toArray()) {
 
-             $company->reply_ratio = intval($reply / count($apply) * 100);
 
-             if ($reply_time) {
 
-                 $company->reply_time = sub_day(intval($reply_time / count($apply)), 0);
 
-             } else {
 
-                 $company->reply_time = '0天';
 
-             }
 
-         } else {
 
-             $company->reply_ratio = 0;
 
-             $company->reply_time = '0天';
 
-         }
 
-         //登录时间
 
-         if (!$company->last_login_time) {
 
-             $company->last_login_time = '未登录';
 
-         } else {
 
-             $company->last_login_time = date('Y-m-d H:i', $company->last_login_time);
 
-         }
 
-         //获取在招职位信息(职位显示规则)
 
-         $jobs_display = config('aix.companyset.comset.show_set.jobs_display');
 
-         $job_count_map = array(array('company_id', '=', $company->id), array('valid', '=', 1), array('display', '=', 1));
 
-         if ($jobs_display == 1) {
 
-             $job_count_map[] = array('audit', '=', '1');
 
-         } else {
 
-             $job_count_map[] = array('audit', '<>', '3');
 
-         }
 
-         $jobs_count = $this->jobsRepository->getJobsCount($job_count_map);
 
-         $company->jobs_count = $jobs_count;
 
-         //企业网址
 
-         if ($company->website) {
 
-             $company->website_ = $company->website;
 
-             if ((strstr($company->website, "http://") === false) && (strstr($company->website, "https://") === false)) {
 
-                 $company->website = "http://" . $company->website;
 
-             } else {
 
-                 if (strstr($company->website, "http://") === false) {
 
-                     $company->website_ = str_replace("https://", "", $company->website_);
 
-                 } else {
 
-                     $company->website_ = str_replace("http://", "", $company->website_);
 
-                 }
 
-             }
 
-         }
 
-         //获取粉丝数量
 
-         $fan_where = array('company_id' => $company->id);
 
-         $fans = $this->personFocusComRepository->getFansCount($fan_where);
 
-         $company->fans = $fans;
 
-         $company->preview = 0;
 
-         if (auth('web-company')->check()) {
 
-             if (auth('web-company')->user()->id == $company->id) {
 
-                 $company->preview = 1;
 
-             }
 
-         }
 
-         $company->focus = 0;
 
-         //个人用户登录时判断是否关注过当前企业
 
-         if (auth('web-member')->check()) {
 
-             $focus_where = array(
 
-                 'uid' => auth('web-member')->user()->id,
 
-                 'company_id' => $company->id
 
-             );
 
-             $focus_rst = $this->personFocusComRepository->getFocus($focus_where);
 
-             if ($focus_rst) {
 
-                 $company->focus = 1;
 
-             }
 
-         }
 
-         //企业风采
 
-         $img_where = array(
 
-             array('company_id', '=', $company->id)
 
-         );
 
-         $companyimg_display = config('aix.companyset.comset.show_set.companyimg_display');
 
-         if ($companyimg_display == 1) {
 
-             $img_where[] = array('audit', '=', 1);
 
-         } else {
 
-             $img_where[] = array('audit', '<>', 3);
 
-         }
 
-         $company_images = $this->companyImgRepository->getImages($img_where);
 
-         if ($company_images->toArray()) {
 
-             foreach ($company_images as $key => $value) {
 
-                 $company_images[$key]->img = upload_asset($value->image);
 
-             }
 
-         } else {
 
-             $company_images = null;
 
-         }
 
-         $company->img = $company_images;
 
-         //亮点tag
 
-         $tag_arr = array();
 
-         $other_categories = $this->categoryRepository->getCategories();
 
-         if (implode(',', $company->tag)) {
 
-             $tag_ids = $company->tag;
 
-             if ($other_categories) {
 
-                 $tag_category = array_get($other_categories, 'AIX_jobtag');
 
-                 if ($tag_category) {
 
-                     foreach ($tag_ids as $k => $v) {
 
-                         if (array_get($tag_category, $v)) {
 
-                             $tag_arr[] = array_get($tag_category, $v);
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         $company->tag_arr = $tag_arr;
 
-         //企业性质/行业/规模/地区/注册资金
 
-         $company->nature_cn = '';
 
-         $company->trade_cn = '';
 
-         $company->scale_cn = '';
 
-         $company->district_cn = '';
 
-         if ($other_categories) {
 
-             $company_types = array_get($other_categories, 'AIX_company_type');
 
-             $company_trades = array_get($other_categories, 'AIX_trade');
 
-             $company_scales = array_get($other_categories, 'AIX_scale');
 
-             if ($company_types) {
 
-                 $type_cn = array_get($company_types, $company->nature);
 
-                 if ($type_cn) {
 
-                     $company->nature_cn = $type_cn['demand'];
 
-                 }
 
-             }
 
-             $company_trades = array_get($other_categories, 'AIX_trade');
 
-             if ($company_trades) {
 
-                 $trade_cn = array_get($company_trades, $company->trade);
 
-                 if ($trade_cn) {
 
-                     $company->trade_cn = $trade_cn['demand'];
 
-                 }
 
-             }
 
-             $company_scales = array_get($other_categories, 'AIX_scale');
 
-             if ($company_scales) {
 
-                 $scale_cn = array_get($company_scales, $company->scale);
 
-                 if ($scale_cn) {
 
-                     $company->scale_cn = $scale_cn['demand'];
 
-                 }
 
-             }
 
-         }
 
-         $city_cates = Cache::get('city_cate_list');
 
-         if (null === $city_cates) {
 
-             $city_cates = $this->categoryDistrictRepository->cityCateCache();
 
-             Cache::put('city_cate_list', $city_cates, '86400');
 
-         }
 
-         if (!strpos($company->district, ".")) { //直接读取地区信息
 
-             $district_cn = array_get($city_cates['id'], $company->district);
 
-             if ($district_cn) {
 
-                 $company->district_cn = $district_cn['name'];
 
-             }
 
-         } else {//处理地区信息
 
-             $c_district = explode('.', $company->district);
 
-             $district_cn = array();
 
-             foreach ($c_district as $k => $v) {
 
-                 if ($v) {
 
-                     $district_info = array_get($city_cates['id'], $v);
 
-                     if ($district_info) {
 
-                         $district_cn[] = $district_info['name'];
 
-                     }
 
-                 }
 
-             }
 
-             $district_cn = implode('/', $district_cn);
 
-             $company->district_cn = $district_cn;
 
-         }
 
-         ///会员套餐
 
-         $setmeal = $this->memberSetmealRepository->getSetmealByUid($company->id, $company->utype);
 
-         $company->setmeal = $setmeal;
 
-         $company->setmeal_id = $setmeal->id;
 
-         $company->setmeal_name = $setmeal->setmeal_name;
 
-         $company->setmeal_img = $setmeal->setmeal_img;
 
-         ///联系方式
 
-         /*判断查看联系方式设置
 
-           如果设置成游客
 
-                 判断企业中心的联系方式设置 公开   完全显示,
 
-                                          不公开 显示‘企业设置不公开’
 
-           设置成登陆会员
 
-                 游客:
 
-                     企业中心的联系方式设置 公开  *******
 
-                                           不公开 显示‘企业设置不公开’
 
-                 已登录用户:
 
-                     企业中心的联系方式设置 公开  完全显示
 
-                                                 不公开 显示‘企业设置不公开’
 
-         如果设置成下载后可见
 
-                 判断企业中心的联系方式设置 公开   *******,
 
-                                          不公开 显示‘企业设置不公开’
 
-          *
 
-          */
 
-         /// 处理固定电话
 
-         if (strstr($company->landline_tel, '-')) {
 
-             $landline_tel_arr = explode('-', $company->landline_tel);
 
-             foreach ($landline_tel_arr as $k => $v) {
 
-                 if (!(int)$v) {
 
-                     unset($landline_tel_arr[$k]);
 
-                 }
 
-             }
 
-         } elseif (strstr($company->landline_tel, ' ')) {
 
-             $landline_tel_arr = explode(' ', $company->landline_tel);
 
-             foreach ($landline_tel_arr as $k => $v) {
 
-                 if (!(int)$v) {
 
-                     unset($landline_tel_arr[$k]);
 
-                 }
 
-             }
 
-         } else {
 
-             $landline_tel_arr = (array)$company->landline_tel;
 
-         }
 
-         if ($landline_tel_arr) {
 
-             $landline_tel = implode('-', $landline_tel_arr);
 
-         } else {
 
-             $landline_tel = '';
 
-         }
 
-         $company->landline_tel = $landline_tel;
 
-         $hide = true;
 
-         if (config('aix.companyset.comset.contact_set.showjobcontact') == 0) {  //游客
 
-             $hide = false;
 
-         } elseif (config('aix.companyset.comset.contact_set.showjobcontact') == 1) {  //已登录会员
 
-             if (auth('web-member')->check() || auth('web-company')->check()) {
 
-                 $hide = false;
 
-             }
 
-         }
 
-         if ($hide) {
 
-             if ($company->mobile) {
 
-                 $company->mobile = contact_hide($company->mobile, 2);
 
-             }
 
-             if ($company->landline_tel) {
 
-                 $company->landline_tel = contact_hide($landline_tel, 1);
 
-             }
 
-             if ($company->email) {
 
-                 $company->email = contact_hide($company->email, 3);
 
-             }
 
-         }
 
-         if (!$company->contact_show) {
 
-             $company->contact = '企业设置不公开';
 
-         }
 
-         //联系方式展现方式
 
-         $pwdhash = config('aix.system.site_other.site_other.pwb_hash');
 
-         if (config('aix.companyset.comset.contact_type_set.contact_img_com') == 2) {
 
-             if (!$company->telephone_show) {
 
-                 $company->mobile = '企业设置不公开';
 
-             } else {
 
-                 if ($company->mobile) {
 
-                     $company->mobile = "<img src='" . route('common.contact_img', array('text' => encrypt($company->mobile, $pwdhash), 'type' => 'phone')) . "' />";
 
-                 }
 
-             }
 
-             if (!$company->landline_tel_show) {
 
-                 $company->landline_tel = '企业设置不公开';
 
-             } else {
 
-                 if ($company->landline_tel) {
 
-                     $company->landline_tel = "<img src='" . route('common.contact_img', array('text' => encrypt($company->landline_tel, $pwdhash), 'type' => 'phone')) . "' />";
 
-                 }
 
-             }
 
-             if (!$company->email_show) {
 
-                 $company->email = '企业设置不公开';
 
-             } else {
 
-                 if ($company->email) {
 
-                     $company->email = "<img src='" . route('common.contact_img', array('text' => encrypt($company->email, $pwdhash), 'type' => 'email')) . "' />";
 
-                 }
 
-             }
 
-         } else {
 
-             //判断企业中心设置
 
-             if (!$company->telephone_show) {
 
-                 $company->mobile = '企业设置不公开';
 
-             }
 
-             if (!$company->landline_tel_show) {
 
-                 $company->landline_tel = '企业设置不公开';
 
-             }
 
-             if (!$company->email_show) {
 
-                 $company->email = '企业设置不公开';
 
-             }
 
-         }
 
-         $company->hide = $hide;
 
-         $company->setmeal_id = $setmeal->setmeal_id;
 
-         $company->setmeal_name = $setmeal->setmeal_name;
 
-         //来源分站名称
 
-         $subsites = Cache::get('subsites_list');
 
-         if (array_has($subsites, $company->subsite_id)) {
 
-             $company->subsite_cn = $subsites[$company->subsite_id]['sitename'];
 
-         } else {
 
-             $company->subsite_cn = '';
 
-         }
 
-         return $company;
 
-     }
 
-     //关注/取消关注
 
-     public function focusCompany($company_id, $person_id)
 
-     {
 
-         $focus_where = array(
 
-             'uid' => $person_id,
 
-             'company_id' => $company_id
 
-         );
 
-         $has = $this->personFocusComRepository->getFocus($focus_where);
 
-         if ($has) {
 
-             //取消关注
 
-             $rst = $this->personFocusComRepository->deleteFocus($focus_where);
 
-             if ($rst) {
 
-                 return array('status' => 1, 'msg' => '已取消关注!', 'data' => array('html' => '关注', 'op' => 2));
 
-             } else {
 
-                 return array('status' => 0, 'msg' => '取消关注失败!');
 
-             }
 
-         } else {
 
-             //关注
 
-             $stime = date('Y-m-d H:i:s', time());
 
-             $focus_data = array(
 
-                 'uid' => $person_id,
 
-                 'company_id' => $company_id,
 
-                 'created_at' => $stime,
 
-                 'updated_at' => $stime
 
-             );
 
-             $rst = $this->personFocusComRepository->addFocus($focus_data);
 
-             if ($rst) {
 
-                 return array('status' => 1, 'msg' => '已关注!', 'data' => array('html' => '取消关注', 'op' => 1));
 
-             } else {
 
-                 return array('status' => 0, 'msg' => '关注失败!');
 
-             }
 
-         }
 
-     }
 
-     //添加企业访客统计
 
-     public function addStatistics($company_id, $job_id = 0, $user = array(), $apply = 0, $source = 1)
 
-     {
 
-         $uid = 0;
 
-         $utype = 0;
 
-         $source = $source;
 
-         if ($user) {
 
-             $utype = $user->utype;
 
-             $uid = $user->id;
 
-         }
 
-         if ($job_id) {
 
-             $apply = 1;
 
-         }
 
-         $time = date('Y-m-d H:i:s', time());
 
-         $add_data = array(
 
-             'company_id' => (int)$company_id,
 
-             'uid' => $uid,
 
-             'utype' => $utype,
 
-             'job_id' => $job_id,
 
-             'source' => $source,
 
-             'apply' => $apply,
 
-             'created_at' => $time,
 
-             'updated_at' => $time
 
-         );
 
-         return $this->companyStatisticsRepository->addRecord($add_data);
 
-     }
 
-     //获取其它公司
 
-     public function getSetmailCompanies($where, $limit = 20)
 
-     {
 
-         $except_id = array_get($where, 'except_id');
 
-         if (array_has($where, 'except_id')) {
 
-             unset($where['except_id']);
 
-         }
 
-         if ($limit > 20) {
 
-             $limit = 20;
 
-         }
 
-         $order = 'real_refreshtime desc,id desc';
 
-         $field = '*,if(refresh_time>UNIX_TIMESTAMP(NOW()),(refresh_time-100000000),refresh_time) as real_refreshtime';
 
-         //处理trade
 
-         $map = array();
 
-         $trade = array_get($where, 'trade');
 
-         $trade_in = array();
 
-         if ($trade) {
 
-             if (strpos($trade, ',')) {
 
-                 $arr = explode(',', $trade);
 
-                 $sqlin = implode(',', array_slice($arr, 0, $limit));
 
-                 if (preg_match('/^(\d{1,10},)*(\d{1,10})$/', $sqlin) === 1) {
 
-                     $trade_in = explode(',', $sqlin);
 
-                 }
 
-             } else {
 
-                 $map[] = array('trade', '=', intval($trade));
 
-             }
 
-         }
 
-         if ($except_id) {
 
-             $map[] = array('id', '<>', intval($except_id));
 
-         }
 
-         $map[] = array('subsite_id', '=', get_subsite_id());
 
-         $result = $this->companyRepository->getTradeCompanies($map, $trade_in, $field, $order, $limit);
 
-         $job_where = array(
 
-             array('valid', '=', 1),
 
-             array('display', '=', 1),
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-             $job_where[] = array('audit', '=', 1);
 
-         } else {
 
-             $job_where[] = array('audit', '<>', 3);
 
-         }
 
-         $order_by = array('refresh_time' => 'desc');
 
-         $com_arr = ['com_id'=>[]];
 
-         if ($result->toArray()) {
 
-             foreach ($result as $key => $value) {
 
-                 $row = $value;
 
-                 $row->companyname_ = $row->companyname;
 
-                 $row->refreshtime_cn = $row->refresh_time > time() ? daterange(time(), $row->real_refreshtime) : daterange(time(), $row->refresh_time);
 
-                 $row->url = route(url_rewrite('AIX_companyshow'), array('id' => $row->id));
 
-                 $row->comjobs_url = route('jobs.company.jobs', array('id' => $row->id));
 
-                 $row->briefly = strip_tags($row->contents);
 
-                 if ($row->logo) {
 
-                     $row->logo = upload_asset($row->logo);
 
-                 } else {
 
-                     $row->logo = public_data_path('data/upload/no_logo.png');
 
-                 }
 
-                 $com_arr['com_id'][] = $row->id;
 
-                 $com_arr[$row->id]['logo'] = $row->logo;
 
-                 $com_arr[$row->id]['companyname_'] = $row->companyname_;
 
-                 $com_arr[$row->id]['comjobs_url'] = $row->comjobs_url;
 
-                 $com_arr[$row->id]['url'] = $row->url;
 
-                 //$list[] = $row;
 
-             }
 
-         }
 
-         $job_where_in = array('company_id' => $com_arr['com_id']);
 
-         $jobs_list = $this->jobsRepository->getCompanyJobs($job_where, $job_where_in, $order_by, 16);
 
-         if ($jobs_list->isNotEmpty()) {
 
-             foreach ($jobs_list as $k => $val) {
 
-                 $subsite_id = get_jobs_subsite_id($val);
 
-                 $val->logo = isset($com_arr[$val->company_id]['logo']) ? $com_arr[$val->company_id]['logo'] : '';
 
-                 $val->companyname_ = isset($com_arr[$val->company_id]['companyname_']) ? $com_arr[$val->company_id]['companyname_'] : '';
 
-                 $val->comjobs_url = isset($com_arr[$val->company_id]['comjobs_url']) ? $com_arr[$val->company_id]['comjobs_url'] : '';
 
-                 $val->url = isset($com_arr[$val->company_id]['url']) ? $com_arr[$val->company_id]['url'] : '';
 
-                 $val->jobs_url = route(url_rewrite('AIX_jobsshow', null, $subsite_id), array('id'=>$val['id']));
 
-                 //薪资待遇
 
-                 if ($val->wage > 0) {
 
-                     $wage_category = $this->categoryRepository->getOriginCategory(array('alias'=>'AIX_wage','id'=>$val->wage));
 
-                     if ($wage_category && preg_match_all('(\d+)', $wage_category->demand, $reg)) {
 
-                         $reg = $reg[0];
 
-                         if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                             $val->minwage = $reg[0]%1000==0?(($reg[0]/1000).'K'):(round($reg[0]/1000, 1).'K');
 
-                             $val->maxwage = array_has($reg, 1)?($reg[1]%1000==0?(($reg[1]/1000).'K'):(round($reg[1]/1000, 1).'K')):0;
 
-                         } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
 
-                             if ($reg[0] >= 10000) {
 
-                                 if ($reg[0]%10000 == 0) {
 
-                                     $val->minwage = ($reg[0]/10000).'万';
 
-                                 } else {
 
-                                     $minwage = round($reg[0]/10000, 1);
 
-                                     $val->minwage = strpos($minwage, '.') ? str_replace('.', '万', $minwage) : $minwage.'万';
 
-                                 }
 
-                             } else {
 
-                                 if ($reg[0]%1000 == 0) {
 
-                                     $val->minwage = ($reg[0]/1000).'千';
 
-                                 } else {
 
-                                     $minwage = round($reg[0]/1000, 1);
 
-                                     $val->minwage = strpos($minwage, '.') ? str_replace('.', '千', $minwage) : $minwage.'千';
 
-                                 }
 
-                             }
 
-                             if (array_has($reg, 1)) {
 
-                                 if ($reg[1] >= 10000) {
 
-                                     if ($reg[1]%10000 == 0) {
 
-                                         $val->maxwage = ($reg[1]/10000).'万';
 
-                                     } else {
 
-                                         $maxwage = round($reg[1]/10000, 1);
 
-                                         $val->maxwage = strpos($maxwage, '.') ? str_replace('.', '万', $maxwage) : $maxwage.'万';
 
-                                     }
 
-                                 } elseif ($reg[1]) {
 
-                                     if ($reg[1]%1000 == 0) {
 
-                                         $val->maxwage = ($reg[1]/1000).'千';
 
-                                     } else {
 
-                                         $maxwage = round($reg[1]/1000, 1);
 
-                                         $val->maxwage = strpos($maxwage, '.') ? str_replace('.', '千', $maxwage) : $maxwage.'千';
 
-                                     }
 
-                                 } else {
 
-                                     $val->maxwage = 0;
 
-                                 }
 
-                             } else {
 
-                                 $val->maxwage = 0;
 
-                             }
 
-                         }
 
-                     } else {
 
-                         $val->maxwage = 0;
 
-                     }
 
-                     if ($val->minwage == $val->maxwage) {
 
-                         $val->wage_cn = $val->minwage.'/月';
 
-                     } else {
 
-                         if ($val->minwage>0 && $val->maxwage==0) {
 
-                             $val->wage_cn = $val->minwage.'以上/月';
 
-                         } else {
 
-                             $val->wage_cn = $val->minwage.'~'.$val->maxwage.'/月';
 
-                         }
 
-                     }
 
-                 } elseif ($val->wage == -1) {
 
-                     $val->wage_cn = '面议';
 
-                 } else {
 
-                     //自定义薪资
 
-                     $maxwage = $val->wage_max;
 
-                     $minwage = $val->wage_min;
 
-                     if ($val->ygxs == '363') {
 
-                         $val->wage_cn = $val->wage_min . '元/小时';
 
-                     } else {
 
-                         if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                             $val->minwage = $minwage % 1000 == 0 ? (($minwage / 1000) . 'K') : (round($minwage / 1000, 1) . 'K');
 
-                             if ($minwage == 0) {
 
-                                 $val->maxwage = '以上';
 
-                             } else {
 
-                                 $val->maxwage = $maxwage % 1000 == 0 ? (($maxwage / 1000) . 'K') : (round($maxwage / 1000, 1) . 'K');
 
-                             }
 
-                         } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
 
-                             if ($minwage >= 10000) {
 
-                                 if ($minwage % 10000 == 0) {
 
-                                     $val->minwage = ($minwage / 10000) . '万';
 
-                                 } else {
 
-                                     $minwage = round($minwage / 10000, 1);
 
-                                     $val->minwage = strpos($minwage, '.') ? str_replace('.', '万', $minwage) : $minwage . '万';
 
-                                 }
 
-                             } else {
 
-                                 if ($minwage % 1000 == 0) {
 
-                                     $val->minwage = ($minwage / 1000) . '千';
 
-                                 } else {
 
-                                     $minwage = round($minwage / 1000, 1);
 
-                                     $val->minwage = strpos($minwage, '.') ? str_replace('.', '千', $minwage) : $minwage . '千';
 
-                                 }
 
-                             }
 
-                             if ($maxwage > 0) {
 
-                                 if ($maxwage >= 10000) {
 
-                                     if ($maxwage % 10000 == 0) {
 
-                                         $val->maxwage = ($maxwage / 10000) . '万';
 
-                                     } else {
 
-                                         $maxwage = round($maxwage / 10000, 1);
 
-                                         $val->maxwage = strpos($maxwage, '.') ? str_replace('.', '万', $maxwage) : $maxwage . '万';
 
-                                     }
 
-                                 } elseif ($maxwage) {
 
-                                     if ($maxwage % 1000 == 0) {
 
-                                         $val->maxwage = ($maxwage / 1000) . '千';
 
-                                     } else {
 
-                                         $maxwage = round($maxwage / 1000, 1);
 
-                                         $val->maxwage = strpos($maxwage, '.') ? str_replace('.', '千', $maxwage) : $maxwage . '千';
 
-                                     }
 
-                                 } else {
 
-                                     $val->maxwage = '0';
 
-                                 }
 
-                             } else {
 
-                                 $val->maxwage = '0';
 
-                             }
 
-                         }
 
-                         if ($val->minwage == $val->maxwage) {
 
-                             $val->wage_cn = $val->minwage . '/月';
 
-                         } else {
 
-                             if ($val->minwage > 0 && $val->maxwage == 0) {
 
-                                 $val->wage_cn = $val->minwage . '以上/月';
 
-                             } else {
 
-                                 $val->wage_cn = $val->minwage . '~' . $val->maxwage . '/月';
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-                 //工作经验
 
-                 $other_categories = $this->categoryRepository->getCategories();
 
-                 $job_experience = array_get($other_categories, 'AIX_experience');
 
-                 if ($job_experience) {
 
-                     $experience_cn = array_get($job_experience, $val->experience);
 
-                 }
 
-                 if ($experience_cn) {
 
-                     $val->experience_cn = $experience_cn['demand'];
 
-                 } else {
 
-                     $val->experience_cn = '不限';
 
-                 }
 
-                 //学历要求
 
-                 $job_education = array_get($other_categories, 'AIX_education');
 
-                 if ($job_education) {
 
-                     $education_cn = array_get($job_education, $val->education);
 
-                 }
 
-                 if ($education_cn) {
 
-                     $val->education_cn = $education_cn['demand'];
 
-                 } else {
 
-                     $val->education_cn = '不限';
 
-                 }
 
-                 //工作地点
 
-                 $city_cates = Cache::get('city_cate_list');
 
-                 if (null === $city_cates) {
 
-                     $city_cates = $this->categoryDistrictRepository->cityCateCache();
 
-                     Cache::put('city_cate_list', $city_cates, '86400');
 
-                 }
 
-                 if (!strpos($val->district, ".")) {
 
-                     if (array_get($city_cates['id'], $val->district)) {
 
-                         $val->district_cn = $city_cates['id'][$val->district]['name'];
 
-                         if ($city_cates['id'][$val->district]['parent_id'] > 0) {
 
-                             $parent_district = array_get($city_cates['id'], $city_cates['id'][$val->district]['parent_id']);
 
-                             if ($parent_district) {
 
-                                 $val->district_cn = $parent_district['name'].$val->district_cn;
 
-                                 if ($parent_district['parent_id'] > 0) {
 
-                                     $pp_district = array_get($city_cates['id'], $parent_district['parent_id']);
 
-                                     if ($pp_district) {
 
-                                         $val->district_cn = $pp_district['name'].$val->district_cn;
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                 } else {
 
-                     $city_district = explode('.', $val->district);
 
-                     $city_district_cn = array();
 
-                     foreach ($city_district as $k => $v) {
 
-                         if ($v) {
 
-                             $district_info = array_get($city_cates['id'], $v);
 
-                             if ($district_info) {
 
-                                 $city_district_cn[] = $district_info['name'];
 
-                             }
 
-                         }
 
-                     }
 
-                     $val->district_cn = implode('/', $city_district_cn);
 
-                 }
 
-             }
 
-         }
 
-         return $jobs_list;
 
-     }
 
-     //获取其它公司
 
-     public function getOtherCompanies($where, $limit = 10)
 
-     {
 
-         $except_id = array_get($where, 'except_id');
 
-         if (array_has($where, 'except_id')) {
 
-             unset($where['except_id']);
 
-         }
 
-         if ($limit > 20) {
 
-             $limit = 20;
 
-         }
 
-         $order = 'real_refreshtime desc,id desc';
 
-         $field = '*,if(refresh_time>UNIX_TIMESTAMP(NOW()),(refresh_time-100000000),refresh_time) as real_refreshtime';
 
-         //处理trade
 
-         $map = array();
 
-         $trade = array_get($where, 'trade');
 
-         $trade_in = array();
 
-         if ($trade) {
 
-             if (strpos($trade, ',')) {
 
-                 $arr = explode(',', $trade);
 
-                 $sqlin = implode(',', array_slice($arr, 0, $limit));
 
-                 if (preg_match('/^(\d{1,10},)*(\d{1,10})$/', $sqlin) === 1) {
 
-                     $trade_in = explode(',', $sqlin);
 
-                 }
 
-             } else {
 
-                 $map[] = array('trade', '=', intval($trade));
 
-             }
 
-         }
 
-         if ($except_id) {
 
-             $map[] = array('id', '<>', intval($except_id));
 
-         }
 
-         $map[] = array('subsite_id', '=', get_subsite_id());
 
-         $result = $this->companyRepository->getTradeCompanies($map, $trade_in, $field, $order, $limit);
 
-         $list = array();
 
-         if ($result->toArray()) {
 
-             foreach ($result as $key => $value) {
 
-                 $row = $value;
 
-                 $row->companyname_ = $row->companyname;
 
-                 $row->refreshtime_cn = $row->refresh_time > time() ? daterange(time(), $row->real_refreshtime) : daterange(time(), $row->refresh_time);
 
-                 $row->url = route(url_rewrite('AIX_companyshow'), array('id' => $row->id));
 
-                 //$row['comjobs_url'] = url_rewrite('QS_companyjobs',array('id'=>$row['id']));
 
-                 $row->comjobs_url = route('jobs.company.jobs', array('id' => $row->id));
 
-                 $row->contents = str_replace(' ', '', $row->contents);
 
-                 $row->briefly = strip_tags($row->contents);
 
-                 if ($row->logo) {
 
-                     $row->logo = upload_asset($row->logo);
 
-                 } else {
 
-                     $row->logo = public_data_path('data/upload/no_logo.png');
 
-                 }
 
-                 $row->jobs_count = $this->getCompanyValidJobs($row->id);
 
-                 $list[] = $row;
 
-             }
 
-         }
 
-         return $list;
 
-     }
 
-     /**
 
-      * 根据查询条件获取企业
 
-      * @param $where
 
-      * @param int $limit
 
-      */
 
-     public function getCompaniesByConditions($where,$limit = 10){
 
-         if ($limit > 20) {
 
-             $limit = 20;
 
-         }
 
-         $order = 'real_refreshtime desc,id desc';
 
-         $field = '*,if(refresh_time>UNIX_TIMESTAMP(NOW()),(refresh_time-100000000),refresh_time) as real_refreshtime';
 
-         //处理trade
 
-         $map = array();
 
-         $map[] = array('subsite_id', '=', $where['subsite_id']);
 
-         $result = $this->companyRepository->getTradeCompanies($map, [], $field, $order, $limit);
 
-         $job_where = array(
 
-             array('valid', '=', 1),
 
-             array('display', '=', 1),
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-             $job_where[] = array('audit', '=', 1);
 
-         } else {
 
-             $job_where[] = array('audit', '<>', 3);
 
-         }
 
-         $order_by = array('refresh_time' => 'desc');
 
-         if ($result->toArray()) {
 
-             $result = $result->toArray();
 
-             foreach ($result as $key => $value) {
 
-                 $result[$key]['companyname'] = $value['companyname'];
 
-                 $result[$key]['refreshtime_cn'] = $value['refresh_time'] > time() ? daterange(time(), $value['real_refreshtime']) : daterange(time(), $value['refresh_time']);
 
-                 $result[$key]['url'] = route(url_rewrite('AIX_companyshow'), array('id' => $value['id']));
 
-                 $result[$key]['comjobs_url'] = route('jobs.company.jobs', array('id' => $value['id']));
 
-                 $result[$key]['briefly'] = strip_tags($value['contents']);
 
-                 if ($value['logo']) {
 
-                     $result[$key]['logo'] = upload_asset($value['logo']);
 
-                 } else {
 
-                     $result[$key]['logo'] = public_data_path('data/upload/no_logo.png');
 
-                 }
 
-                 $job_where_in = array('company_id'=>array($value['id']));
 
-                 $jobs_list = $this->jobsRepository->getCompanyJobs($job_where, $job_where_in, $order_by,16);
 
-                 $result[$key]['jobs'] = $jobs_list->toArray();
 
-                 //$list[] = $row;
 
-             }
 
-         }
 
-         return $result;
 
-     }
 
-     //获取企业在招职位
 
-     public function getCompanyValidJobs($company_id)
 
-     {
 
-         $jobs_display = config('aix.companyset.comset.show_set.jobs_display');
 
-         $job_count_map = array(
 
-             array('company_id', '=', $company_id),
 
-             array('valid', '=', 1)
 
-         );
 
-         if ($jobs_display == 1) {
 
-             $job_count_map[] = array('audit', '=', '1');
 
-         } else {
 
-             $job_count_map[] = array('audit', '<>', '3');
 
-         }
 
-         return $this->jobsRepository->getJobsCount($job_count_map);
 
-     }
 
-     //获取企业会员积分
 
-     public function getPoint($uid, $utype)
 
-     {
 
-         return $this->memberPointRepository->getPointsById($uid, $utype);
 
-     }
 
-     /**签到
 
-      * @return array
 
-      */
 
-     public function signIn($user)
 
-     {
 
-         $signCount = $this->taskLogRepository->getTaskLogCount($user->id, 18, $user->utype);
 
-         if ($signCount) {
 
-             return ['code' => 0, 'msg' => '您今天已经签到过了!', 'info' => ''];
 
-         } else {
 
-             $res = $this->taskService->doTask(18, $user->id, 1);
 
-             if ($res['code'] == 1) {
 
-                 $this->memberLogRepository->createLog($user, 8003, "");
 
-                 return ['code' => 1, 'msg' => '签到成功', 'info' => $res['data']['points']];
 
-             } else {
 
-                 return ['code' => 1, 'msg' => $res['info'], 'info' => ''];
 
-             }
 
-         }
 
-     }
 
-     /**企业中心======我的消息(系统消息)
 
-      * @param $request
 
-      * @return array
 
-      */
 
-     public function comPms($data, $user)
 
-     {
 
-         $where = [];
 
-         $new = isset($data['new']) ? $data['new'] : '';
 
-         $settr = isset($data['settr']) ? $data['settr'] : '';
 
-         if ($new) {
 
-             $where['new'] = $new;
 
-         }
 
-         if ($settr) {
 
-             $where[] = ['created_at', '<=', date('Y-m-d H:i:s', strtotime("{$settr} day"))];
 
-         }
 
-         $param_array = array('new', 'settr');
 
-         $params = array();
 
-         if ($data) {
 
-             foreach ($data as $k => $v) {
 
-                 if (in_array($k, $param_array)) {
 
-                     $params[$k] = $v;
 
-                 }
 
-             }
 
-         }
 
-         $where['msgtouid'] = $user->id;
 
-         $where['utype'] = $user->utype;
 
-         $pms = $this->pmsRepository->comPms($where);
 
-         $res = [
 
-             'companyInfo' => $user,
 
-             'pms' => $pms,
 
-             'params' => $params,
 
-         ];
 
-         return $res;
 
-     }
 
-     public function pmsRead($id)
 
-     {
 
-         if (!$id) {
 
-             return response()->json(['status' => 0, 'msg' => '参数错误']);
 
-         }
 
-         return $this->pmsRepository->update(['new' => 2], $id);
 
-     }
 
-     public function msgSend($user, $input)
 
-     {
 
-         $data = [];
 
-         if (empty($input['parent_id'])) {
 
-             throw new ResponseException('数据异常!');
 
-         }
 
-         if (empty($input['to_uid'])) {
 
-             throw new ResponseException('个人信息不存在!');
 
-         }
 
-         if (empty($input['message'])) {
 
-             throw new ResponseException('回复信息不能为空!');
 
-         }
 
-         if (mb_strlen($input['message'], 'utf-8') > 200) {
 
-             throw new ResponseException('回复信息不能超过200个字。');
 
-         }
 
-         $data['parent_id'] = $input['parent_id'];
 
-         $data['utype'] = $user->utype;
 
-         $data['from_uid'] = $user->id;
 
-         $data['to_uid'] = $input['to_uid'];
 
-         $data['message'] = $input['message'];
 
-         $res = $this->msgRepository->msgSend($data);
 
-         $this->memberLogRepository->createLog($user, 1026, [$input['parent_id'], $input['to_uid'], $input['message']]);
 
-         if ($res) {
 
-             $member = MemberInfo::where(['uid' => $data['to_uid']])->select('realname')->first();
 
-             if ($member) {
 
-                 $res->personName = $member->realname;
 
-             } else {
 
-                 $res->personName = '';
 
-             }
 
-         }
 
-         return $res;
 
-     }
 
-     public function msgDelete($input)
 
-     {
 
-         if (empty($input['parent_id'])) {
 
-             throw new ResponseException('请选择要删除的咨询消息!');
 
-         }
 
-         return $this->msgRepository->msgDelete($input['parent_id']);
 
-     }
 
-     /**消息设为查看
 
-      * @param $request
 
-      * @return bool|\Illuminate\Http\JsonResponse
 
-      * @throws \Throwable
 
-      */
 
-     public function companyPmsCheck($request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         if ($request->method() == 'POST') {
 
-             return true;
 
-         }
 
-         $id = $request->id;
 
-         if (!$id) {
 
-             return response()->json(['status' => 0, 'msg' => '请选择查看的消息!']);
 
-         }
 
-         $ids = is_array($id) ? $id : explode(',', $id);
 
-         //设置消息为已读
 
-         $res = $this->msgCheck($ids, $user);
 
-         if ($res['state']) {
 
-             $html = view('app.company.ajax.ajax_show_msg', ['msg' => $res['data']])->render();
 
-             return response()->json(['status' => 1, 'msg' => '获取消息成功!', 'data' => $html]);
 
-         }
 
-         return response()->json(['status' => 0, 'msg' => $res['error']]);
 
-     }
 
-     public function companyPmsConsult($user)
 
-     {
 
-         $res = $this->msgRepository->msg($user->utype, $user->id);
 
-         if ($res->total()) {
 
-             foreach ($res as $key => $val) {
 
-                 $utype = explode(',', $val->result);
 
-                 foreach ($utype as $key1 => $val1) {
 
-                     $utype1 = explode(':', $val1);
 
-                     if ($utype1[0] == 1) {
 
-                         $company = Company::where(['id' => $utype1[1]])->select('companyname')->first();
 
- //                        $member = MemberInfo::where(['uid'=>$utype1[2]])->select('images')->first();
 
-                         $member = MemberInfo::with(['resumes' => function ($query) {
 
-                             $query->where('def', 1);
 
-                         }])->where(['uid' => $utype1[2]])->select('images', 'uid')->first();
 
-                         $res[$key]->result = str_replace($utype1[2], isset($member->resumes[0]->id) ? $member->resumes[0]->id : 0, $res[$key]->result);
 
-                         if ($company) {
 
-                             $res[$key]->companyName = $company->companyname;
 
-                         } else {
 
-                             $res[$key]->companyName = '';
 
-                         }
 
-                         if ($member) {
 
-                             $res[$key]->images = $member->images;
 
-                             $res[$key]->personName = isset($member->resumes[0]->fullname) ? $member->resumes[0]->fullname : 0;
 
-                         } else {
 
-                             $res[$key]->images = '';
 
-                         }
 
-                         break;
 
-                     } else {
 
-                         $company = Company::where(['id' => $utype1[2]])->select('companyname')->first();
 
- //                        $member = MemberInfo::where(['uid'=>$utype1[1]])->select('images')->first();
 
-                         $member = MemberInfo::with(['resumes' => function ($query) {
 
-                             $query->where('def', 1);
 
-                         }])->where(['uid' => $utype1[1]])->select('images', 'uid')->first();
 
-                         $res[$key]->result = str_replace($utype1[1], isset($member->resumes[0]->id) ? $member->resumes[0]->id : 0, $res[$key]->result);
 
-                         if ($company) {
 
-                             $res[$key]->companyName = $company->companyname;
 
-                         } else {
 
-                             $res[$key]->companyName = '';
 
-                         }
 
-                         if ($member) {
 
-                             $res[$key]->images = $member->images;
 
-                             $res[$key]->personName = isset($member->resumes[0]->fullname) ? $member->resumes[0]->fullname : 0;
 
-                         } else {
 
-                             $res[$key]->images = '';
 
-                         }
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         return $res;
 
-     }
 
-     public function companyPmsDel($request, $user)
 
-     {
 
-         if (!$id = $request->id) {
 
-             return response()->json(['status' => 0, 'msg' => "请选择删除的消息!"]);
 
-         }
 
-         $ids = is_array($id) ? $id : explode(',', $id);
 
-         if (!$this->pmsRepository->deleteAll($ids, $user->id)) {
 
-             return response()->json(['status' => 0, 'msg' => "删除消息失败!"]);
 
-         }
 
-         if (!$this->memberLogRepository->createLog($user, 1025, $ids)) {
 
-             throw new \Exception("日志记录失败!");
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => "删除消息成功!"]);
 
-     }
 
-     public function getContactInfo($id, $user)
 
-     {
 
-         if (!$id) {
 
-             return ['status' => 0, 'msg' => "请选择查看的联系信息!"];
 
-         }
 
-         $companyContact = CompanyContact::find($id);
 
-         if (!$companyContact) {
 
-             return ['status' => 0, 'msg' => "联系信息不存在"];
 
-         }
 
-         if ($companyContact->company_id != $user->id) {
 
-             return ['status' => 0, 'msg' => "联系信息不存在"];
 
-         }
 
-         $contact_info = $this->companyContactRepository->getContact(['id' => $id]);
 
-         if ($contact_info) {
 
-             $landline_tel_cn = explode('-', $contact_info->landline_tel);
 
-             $contact_info->landline_tel_one = array_get($landline_tel_cn, 0);
 
-             $contact_info->landline_tel_two = array_get($landline_tel_cn, 1);
 
-             $contact_info->landline_tel_three = array_get($landline_tel_cn, 2);
 
-             return ['status' => 1, 'contact' => $contact_info];
 
-         } else {
 
-             return ['status' => 0, 'msg' => "联系信息不存在"];
 
-         }
 
-     }
 
-     public function companyContactDel($ids, $user)
 
-     {
 
-         if (!$ids) {
 
-             return response()->json(['status' => 0, 'msg' => "请选择删除的联系信息!"]);
 
-         }
 
-         $companyContact = CompanyContact::whereIn('id', $ids)->get();
 
-         if (!$companyContact->toArray()) {
 
-             return ['status' => 0, 'msg' => "联系信息不存在"];
 
-         }
 
-         $id_M = array_column($companyContact->toArray(), 'company_id');
 
-         foreach ($id_M as $key => $val) {
 
-             if ($val != $user->id) {
 
-                 return ['status' => 0, 'msg' => "联系信息不存在"];
 
-             }
 
-         }
 
-         if (!$this->companyContactRepository->deleteContact([], ['id' => $ids])) {
 
-             return response()->json(['status' => 0, 'msg' => "删除失败!"]);
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => "删除成功!"]);
 
-     }
 
-     public function updateContact($data, $user)
 
-     {
 
-         $id = $data['id'];
 
-         $landline_tel = '';
 
-         $tel_first = array_get($data, 'tel_first', '-');
 
-         $tel_next = array_get($data, 'tel_next', '-');
 
-         $tel_last = array_get($data, 'tel_last', '-');
 
-         $landline_tel = implode('-', [$tel_first ? $tel_first : '', $tel_next ? $tel_next : '', $tel_last ? $tel_last : '']);
 
-         $update_data = array(
 
-             'contact' => array_has($data, 'contact') ? $data['contact'] : '',
 
-             'telephone' => array_has($data, 'telephone') ? $data['telephone'] : '',
 
-             'landline_tel' => $landline_tel,
 
-             'email' => array_has($data, 'email') ? $data['email'] : '',
 
-             'qq' => array_has($data, 'qq') ? $data['qq'] : '',
 
-             'address' => array_has($data, 'contact') ? $data['address'] : ''
 
-         );
 
-         return $this->companyContactRepository->ContactUpdate(['company_id' => $user->id, 'id' => $id], $update_data);
 
-     }
 
-     protected function msgCheck($ids, $user)
 
-     {
 
-         $msg = $this->pmsRepository->findMsg($ids);
 
-         $where['msgtouid'] = $user->id;
 
-         $where['utype'] = $user->utype;
 
-         $where['new'] = 1;
 
-         $data['new'] = 2;
 
-         if (false === $count = $this->pmsRepository->updateNew($ids, $where, $data)) {
 
-             return ['state' => 0, 'error' => '消息已删除或不存在'];
 
-         }
 
-         //写日志
 
-         return array('state' => 1, 'data' => $msg);
 
-     }
 
-     /**
 
-      * 检查字段惟一性
 
-      * @param $key
 
-      * @param $value
 
-      * @param $id
 
-      * @return mixed
 
-      */
 
-     public function checkUnique($key, $value, $id)
 
-     {
 
-         return $this->checkUnique($key, $value, $id);
 
-     }
 
-     /**
 
-      * 认证邮件发送成功回调
 
-      * @param $newEmail
 
-      * @param $company
 
-      */
 
-     public function sendAuthEmailHook($newEmail, $company)
 
-     {
 
-         Cache::put($newEmail, $company, 24 * 60);
 
-     }
 
-     /**
 
-      * 邮箱验证
 
-      * @param $newEmail
 
-      * @return bool
 
-      */
 
-     public function verifyEmail($newEmail)
 
-     {
 
-         $company = Cache::pull($newEmail, null);
 
-         if ($company) {
 
-             $this->companyRepository->changeEmail($company->id, $newEmail);
 
-             return true;
 
-         }
 
-         return false;
 
-     }
 
-     //更新短信数量
 
-     public function incSms($uid, $type, $num)
 
-     {
 
-         return $this->companyRepository->updataSmsNum($uid, $type, $num);
 
-     }
 
-     //最新招聘
 
-     public function getNewestCompanies($params)
 
-     {
 
-         $lists = Cache::get('newest_jobs_company_list_s' . get_subsite_id());
 
-         if ($lists === null) {
 
-             $lists = $this->getSeatmealCompanies($params);
 
-             Cache::put('newest_jobs_company_list_' . get_subsite_id(), $lists, '1800');
 
-         }
 
-         return $lists;
 
-     }
 
-     //知名企业(非免费会员、有发布中的职位的企业信息  处理企业logo、企业名称长度、企业数量限制   页面显示的职位数量限制、处理职位名称和路由)
 
-     public function getSeatmealCompanies($params)
 
-     {
 
-         $list = array();
 
-         //获取有正在发布职位的企业
 
-         $where = array();
 
-         $where = array(
 
-             array('valid', '=', 1),
 
-             array('display', '=', 1),
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-             $where[] = array('audit', '=', 1);
 
-         } else {
 
-             $where[] = array('audit', '<>', 3);
 
-         }
 
-         if (array_has($params, 'seatmeal')) {
 
-             $where[] = array('setmeal_id', '>', $params['seatmeal']);
 
-         }
 
-         $where[] = array('deadline', '>', time());
 
-         $order_by = array('refresh_time' => 'desc');
 
-         $limit = '';
 
-         if (array_has($params, 'size')) {
 
-             $limit = $params['size'];
 
-         }
 
-         $rst = $this->jobsRepository->getJobCompanies($where, $order_by, $limit);
 
-         if ($rst) {
 
-             $com_rst = $rst->pluck('jobs_num', 'company_id');
 
-             $cid = $rst->pluck('company_id')->toArray();
 
-             //获取企业信息
 
-             $com_whereIn['id'] = $cid;
 
-             $companyInfo = $this->companyRepository->getCompanyies(array(), $com_whereIn, $order_by);
 
-             $cids = array();
 
-             $company = array();
 
-             if ($companyInfo->isNotEmpty()) {
 
-                 foreach ($companyInfo as $key => $val) {
 
-                     $company[$val->id] = $companyInfo[$key];
 
-                     if ($val->logo) {
 
-                         $company[$val->id]->logo = upload_asset($val->logo);
 
-                     } else {
 
-                         $company[$val->id]->logo = public_data_path('data/upload/no_logo.png');
 
-                     }
 
-                     $company[$val->id]->jobs_num = $com_rst[$val->id];
 
-                     $company[$val->id]->company_url = route(url_rewrite('AIX_companyshow'), array('id' => $val->id));
 
-                     $company[$val->id]->company_jobs_url = route(url_rewrite('AIX_companyjobs'), array('id' => $val->id));
 
-                     $company[$val->id]->refreshtime_cn = daterange(time(), $val->refresh_time, 'm-d', "#FF3300");
 
-                     $company[$val->id]->jobs_list = array();
 
-                     if (array_has($params, 'companynamelen')) {
 
-                         $dot = '...';
 
-                         if (array_has($params, 'dot')) {
 
-                             $dot = $params['dot'];
 
-                         }
 
-                         $company[$val->id]->companyname = cut_str($val->companyname, $params['companynamelen'], 0, $dot);
 
-                     }
 
-                     $cids[] = $val['id'];
 
-                 }
 
-                 if ($cids) {
 
-                     //获取当前所选企业的所有职位信息
 
-                     $job_where = array(
 
-                         array('valid', '=', 1),
 
-                         array('display', '=', 1),
 
-                         array('deadline', '>', time())
 
-                     );
 
-                     if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-                         $job_where[] = array('audit', '=', 1);
 
-                     } else {
 
-                         $job_where[] = array('audit', '<>', 3);
 
-                     }
 
-                     $job_where_in = array('company_id' => $cids);
 
-                     $jobs = $this->jobsRepository->getCompanyJobs($job_where, $job_where_in, $order_by);
 
-                     if ($jobs) {
 
-                         foreach ($jobs as $k => $v) {
 
-                             if (array_has($params, 'jobs_num')) {
 
-                                 if (count($company[$v->company_id]->jobs_list) >= $params['jobs_num']) {
 
-                                     continue;
 
-                                 }
 
-                             }
 
-                             //添加职位信息
 
-                             $jobs_list = $company[$v->company_id]->jobs_list;
 
-                             $jobs_list[] = $v;
 
-                             $company[$v->company_id]->jobs_list = $jobs_list;
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             $list = $company;
 
-         }
 
-         return $list;
 
-     }
 
-     public function dealCompanyFields($list)
 
-     {
 
-         if ($list) {
 
-             $other_categories = $this->categoryRepository->getCategories();
 
-             $company_types = array();
 
-             $company_trades = array();
 
-             $company_scale = array();
 
-             if ($other_categories) {
 
-                 $company_types = array_has($other_categories, 'AIX_company_type') ? $other_categories['AIX_company_type'] : array();
 
-                 $company_trades = array_has($other_categories, 'AIX_trade') ? $other_categories['AIX_trade'] : array();
 
-                 $company_scale = array_has($other_categories, 'AIX_scale') ? $other_categories['AIX_scale'] : array();
 
-             }
 
-             $jobs_display = config('aix.companyset.comset.show_set.jobs_display');
 
-             foreach ($list as $key => $val) {
 
-                 $list[$key]->company_url = route(url_rewrite('AIX_companyshow'), array('id' => $val->id));
 
-                 $list[$key]->contents = htmlspecialchars_decode($val->contents, ENT_QUOTES);
 
-                 if ($val->logo) {
 
-                     $list[$key]->logo = upload_asset($val->logo);
 
-                 } else {
 
-                     $list[$key]->logo = public_data_path('data/upload/no_logo.png');
 
-                 }
 
-                 $content = str_replace(' ', '', $val->contents);
 
-                 $content = cut_str(strip_tags($content), 130, 0, '...');
 
-                 $list[$key]->contents = $content;
 
-                 $list[$key]->comjobs_url = route('jobs.company.jobs', array('id' => $val->id));
 
-                 $list[$key]->nature_cn = '';
 
-                 $list[$key]->trade_cn = '';
 
-                 $list[$key]->scale_cn = '';
 
-                 if ($company_types && array_has($company_types, $val->nature)) {
 
-                     $list[$key]->nature_cn = $company_types[$val->nature]['demand'];
 
-                 }
 
-                 if ($company_trades && array_has($company_trades, $val->trade)) {
 
-                     $list[$key]->trade_cn = $company_trades[$val->trade]['demand'];
 
-                 }
 
-                 if ($company_scale && array_has($company_scale, $val->scale)) {
 
-                     $list[$key]->scale_cn = $company_scale[$val->scale]['demand'];
 
-                 }
 
-                 //在招职位数量
 
-                 $job_count_map = array(array('company_id', '=', $val->id), array('valid', '=', 1));
 
-                 if ($jobs_display == 1) {
 
-                     $job_count_map[] = array('audit', '=', '1');
 
-                 } else {
 
-                     $job_count_map[] = array('audit', '<>', '3');
 
-                 }
 
-                 $jobs_count = $this->jobsRepository->getJobsCount($job_count_map);
 
-                 $list[$key]->jobs_count = $jobs_count;
 
-             }
 
-         }
 
-         return $list;
 
-     }
 
-     //处理名企信息
 
-     public function dealSetmealCompany($companyInfo, $params)
 
-     {
 
-         $list = array();
 
-         $order_by = array('refresh_time' => 'desc');
 
-         $company = array();
 
-         $cids = [];
 
-         if (array_has($params, 'size')) {
 
-             $limit = $params['size'];
 
-         }
 
-         foreach ($companyInfo as $key => $val) {
 
-             if ($limit && count($company) >= $limit) {
 
-                 break;
 
-             }
 
-             $company[$val->id] = $companyInfo[$key];
 
-             if ($val->logo) {
 
-                 $company[$val->id]->logo = upload_asset($val->logo);
 
-             } else {
 
-                 $company[$val->id]->logo = public_data_path('data/upload/no_logo.png');
 
-             }
 
-             if ($val->job->count() == 0) {
 
-                 unset($company[$val->id]);
 
-                 continue;
 
-             }
 
-             $company[$val->id]->jobs_num = $val->job->count();
 
-             $company[$val->id]->company_url = route(url_rewrite('AIX_companyshow'), array('id' => $val->id));
 
-             $company[$val->id]->company_jobs_url = route(url_rewrite('AIX_companyjobs'), array('id' => $val->id));
 
-             $company[$val->id]->refreshtime_cn = daterange(time(), $val->refresh_time, 'm-d', "#FF3300");
 
-             $company[$val->id]->jobs_list = array();
 
-             if (array_has($params, 'companynamelen')) {
 
-                 $dot = '...';
 
-                 if (array_has($params, 'dot')) {
 
-                     $dot = $params['dot'];
 
-                 }
 
-                 $company[$val->id]->companyname = cut_str($val->companyname, $params['companynamelen'], 0, $dot);
 
-             }
 
-             $cids[] = $val['id'];
 
-             //$jobs = $val->job;
 
-             $job_count_map = array(array('valid', '=', 1), array('display', '=', 1));
 
-             if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-                 $job_count_map[] = array('audit', '=', '1');
 
-             } else {
 
-                 $job_count_map[] = array('audit', '<>', '3');
 
-             }
 
-             $jobs = $val->job()->where($job_count_map)->orderBy('refresh_time', 'desc')->get();
 
-             if ($jobs) {
 
-                 $jobs_arr = $jobs->toArray();
 
-                 $company[$val->id]->newst_job_refresh = $jobs_arr[0]['refresh_time'];
 
-                 foreach ($jobs as $k => $v) {
 
-                     if (array_has($params, 'jobs_num')) {
 
-                         if (count($company[$v->company_id]->jobs_list) >= $params['jobs_num']) {
 
-                             continue;
 
-                         }
 
-                     }
 
-                     //添加职位信息
 
-                     $jobs_list = $company[$v->company_id]->jobs_list;
 
-                     $jobs_list[] = $v;
 
-                     $company[$v->company_id]->jobs_list = $jobs_list;
 
-                 }
 
-             }
 
-         }
 
-         if ($company) {
 
-             $list = $company;
 
-         }
 
-         return $list;
 
-     }
 
-     //获取企业基本信息
 
-     public function getCompany($where)
 
-     {
 
-         return $this->companyRepository->getCompanyInfo($where);
 
-     }
 
-     //获取企业联系人信息
 
-     public function companyContact($company, $page_num = '')
 
-     {
 
-         $where = array('company_id' => $company->id);
 
-         $rsts = $this->companyContactRepository->getList($where, $page_num);
 
-         return $rsts;
 
-     }
 
-     public function addContact($data)
 
-     {
 
-         return $this->companyContactRepository->create($data);
 
-     }
 
-     //发送短信回调事件
 
-     public function sendSMSCallBack($user_id)
 
-     {
 
-         //减少短信条数
 
-         $this->companyRepository->SetSmsReduce($user_id);
 
-     }
 
- }
 
 
  |