| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490 | 
							- <?php
 
- /**
 
-  * Created by PhpStorm.
 
-  * User: michaelwu
 
-  * Date: 2018/10/30
 
-  * Time: 11:22
 
-  */
 
- namespace App\Services\Company;
 
- use App\Exceptions\ResponseException;
 
- use App\Models\Company;
 
- use App\Models\Jobs;
 
- use App\Models\Payment;
 
- use App\Models\SubsiteJob;
 
- use App\Repositories\AuditReasonsRepository;
 
- use App\Repositories\CompanyRepository;
 
- use App\Repositories\CompanyStatisticsRepository;
 
- use App\Repositories\Jobfair\JobfairJobRepository;
 
- use App\Repositories\Jobfair\JobfairJobsContactRepository;
 
- use App\Repositories\JobsContactRepository;
 
- use App\Repositories\JobsRepository;
 
- use App\Repositories\MemberHandselRepository;
 
- use App\Repositories\MemberLogRepository;
 
- use App\Repositories\MemberPointRepository;
 
- use App\Repositories\MemberSetmealRepository;
 
- use App\Repositories\MembersSetmealLogRepository;
 
- use App\Repositories\OrderRepository;
 
- use App\Repositories\PersonalJobsApplyRepository;
 
- use App\Repositories\QueueAutoRefreshRepository;
 
- use App\Repositories\RefreshLogRepository;
 
- use App\Repositories\SetmealRepository;
 
- use App\Repositories\SubsiteJobRepository;
 
- use Exception;
 
- use Illuminate\Http\JsonResponse;
 
- use Illuminate\Support\Facades\DB;
 
- use Illuminate\Support\Facades\Cache;
 
- use App\Repositories\CategoryRepository;
 
- use App\Repositories\CategoryJobsRepository;
 
- use App\Repositories\CategoryDistrictRepository;
 
- use App\Repositories\ResumeRepository;
 
- use App\Repositories\ViewJobRepository;
 
- use App\Repositories\PersonFavoriteRepository;
 
- use App\Services\Common\PaymentService;
 
- use App\Services\Common\OrderService;
 
- use App\Services\Common\PayService;
 
- use App\Services\Company\ServiceService;
 
- use Aix\Pay\Data\PayOrder;
 
- use App\Repositories\ResumePrivacyRepository;
 
- use Illuminate\Support\MessageBag;
 
- class JobsService
 
- {
 
-     protected $jobsRepository;
 
-     protected $jobsContactRepository;
 
-     protected $companyRepository;
 
-     protected $membersSetmealRepository;
 
-     protected $personalJobsApplyRepository;
 
-     protected $auditReasonsRepository;
 
-     protected $refreshLogRepository;
 
-     protected $memberPointRepository;
 
-     protected $setmealRepository;
 
-     protected $jobsSearchRepository;
 
-     protected $memberHandselRepository;
 
-     protected $membersSetmealLogRepository;
 
-     protected $app_spell = true;
 
-     protected $categoryRepository;
 
-     protected $categoryJobsRepository;
 
-     protected $categoryDistrictRepository;
 
-     protected $resumeRepository;
 
-     protected $viewJobRepository;
 
-     protected $personFavoriteRepository;
 
-     protected $queueAutoRefreshRepository;
 
-     protected $orderRepository;
 
-     protected $companyStatisticsRepository;
 
-     protected $jobfairJobRepository;
 
-     protected $jobfairJobsContactRepository;
 
-     protected $subsiteJobRepository;
 
-     protected $paymentService;
 
-     protected $orderService;
 
-     protected $payService;
 
-     protected $serviceService;
 
-     protected $ResumePrivacyRepository;
 
-     protected $memberLogRepository;
 
-     /**
 
-      * JobsService constructor.
 
-      * @param $jobsRepository
 
-      * @param $jobsContactRepository
 
-      * @param $companyRepository
 
-      * @param $memberSetmealRepository
 
-      * @param $personalJobsApplyRepository
 
-      * @param $auditReasonsRepository
 
-      * @param $refreshLogRepository
 
-      * @param $memberPointRepository
 
-      * @param $setmealRepository
 
-      * @param $memberHandselRepository
 
-      * @param $membersSetmealLogRepository
 
-      * @param $queueAutoRefreshRepository
 
-      * @param $orderRepository
 
-      * @param $companyStatisticsRepository
 
-      * @param $subsiteJobRepository
 
-      * @param $jobfairJobRepository
 
-      * @param $jobfairJobsContactRepository
 
-      * @param $ResumePrivacyRepository
 
-      */
 
-     public function __construct(
 
-         JobsRepository $jobsRepository,
 
-         ServiceService $serviceService,
 
-         PayService $payService,
 
-         SubsiteJobRepository $subsiteJobRepository,
 
-         JobfairJobsContactRepository $jobfairJobsContactRepository,
 
-         JobfairJobRepository $jobfairJobRepository,
 
-         CompanyStatisticsRepository $companyStatisticsRepository,
 
-         OrderRepository $orderRepository,
 
-         QueueAutoRefreshRepository $queueAutoRefreshRepository,
 
-         SetmealRepository $setmealRepository,
 
-         MemberPointRepository $memberPointRepository,
 
-         JobsContactRepository $jobsContactRepository,
 
-         CompanyRepository $companyRepository,
 
-         MemberSetmealRepository $memberSetmealRepository,
 
-         PersonalJobsApplyRepository $personalJobsApplyRepository,
 
-         AuditReasonsRepository $auditReasonsRepository,
 
-         RefreshLogRepository $refreshLogRepository,
 
-         CategoryRepository $categoryRepository,
 
-         CategoryJobsRepository $categoryJobsRepository,
 
-         CategoryDistrictRepository $categoryDistrictRepository,
 
-         ResumeRepository $resumeRepository,
 
-         ViewJobRepository $viewJobRepository,
 
-         PersonFavoriteRepository $personFavoriteRepository,
 
-         MembersSetmealLogRepository $membersSetmealLogRepository,
 
-         MemberHandselRepository $memberHandselRepository,
 
-         PaymentService $paymentService,
 
-         OrderService $orderService,
 
-         ResumePrivacyRepository $ResumePrivacyRepository,
 
-         MemberLogRepository $memberLogRepository
 
-     ) {
 
-         $this->jobsRepository = $jobsRepository;
 
-         $this->jobsContactRepository = $jobsContactRepository;
 
-         $this->companyRepository = $companyRepository;
 
-         $this->membersSetmealRepository = $memberSetmealRepository;
 
-         $this->personalJobsApplyRepository = $personalJobsApplyRepository;
 
-         $this->auditReasonsRepository = $auditReasonsRepository;
 
-         $this->refreshLogRepository = $refreshLogRepository;
 
-         $this->memberPointRepository = $memberPointRepository;
 
-         $this->setmealRepository = $setmealRepository;
 
-         $this->memberHandselRepository = $memberHandselRepository;
 
-         $this->membersSetmealLogRepository = $membersSetmealLogRepository;
 
-         $this->categoryRepository = $categoryRepository;
 
-         $this->categoryJobsRepository = $categoryJobsRepository;
 
-         $this->categoryDistrictRepository = $categoryDistrictRepository;
 
-         $this->resumeRepository = $resumeRepository;
 
-         $this->viewJobRepository = $viewJobRepository;
 
-         $this->personFavoriteRepository = $personFavoriteRepository;
 
-         $this->queueAutoRefreshRepository = $queueAutoRefreshRepository;
 
-         $this->orderRepository = $orderRepository;
 
-         $this->companyStatisticsRepository = $companyStatisticsRepository;
 
-         $this->jobfairJobRepository = $jobfairJobRepository;
 
-         $this->jobfairJobsContactRepository = $jobfairJobsContactRepository;
 
-         $this->subsiteJobRepository = $subsiteJobRepository;
 
-         $this->paymentService = $paymentService;
 
-         $this->orderService = $orderService;
 
-         $this->payService = $payService;
 
-         $this->serviceService = $serviceService;
 
-         $this->ResumePrivacyRepository = $ResumePrivacyRepository;
 
-         $this->memberLogRepository=$memberLogRepository;
 
-     }
 
-     /**
 
-      * 职位管理
 
-      * @param $type
 
-      * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
 
-      */
 
-     public function list($type, $user)
 
-     {
 
-         $where = [];
 
-         $orwhere = [];
 
-         $where['company_id'] =$user->id;
 
-         if ($type == 1) {
 
-             $where['display'] = 1;
 
-             if (config('aix.companyset.comset.show_set.jobs_display') == 2) {
 
-                 $where[] = ['audit', '<>', 3];
 
-             } else {
 
-                 $where['audit'] = 1;
 
-             }
 
-             $where['valid'] = 1;
 
-         } elseif ($type == 2) {
 
-             $orwhere[] = 2;  //显示状态
 
-             $orwhere[] = 0;  //是否有效
 
-             $orwhere[] = 1;  //审核状态
 
-             if (config('aix.companyset.comset.show_set.jobs_display') == 2) {
 
-                 $orwhere[] = 2;
 
-             }
 
-         }
 
-         $page = 5;
 
-         $jobs_list = $this->jobsRepository->list($page, $where, $orwhere);
 
-         //获取职位分类信息
 
-         $job_cates = $this->categoryJobsRepository->getJobCategories();
 
-         foreach ($jobs_list as $key => $val) {
 
-             $jobs_list[$key]->jobcategory = '';
 
-             if ($job_cates) {
 
-                 if ($val->subclass) {
 
-                     if (array_has($job_cates, $val->category) && array_has($job_cates[$val->category], $val->subclass)) {
 
-                         $jobs_list[$key]->jobcategory = $job_cates[$val->category][$val->subclass]['spell'];
 
-                     } elseif (array_has($job_cates, $val->category)) {
 
-                         $jobs_list[$key]->jobcategory = $job_cates[$val->topclass][$val->category]['spell'];
 
-                     } else {
 
-                         $jobs_list[$key]->jobcategory = '';
 
-                     }
 
-                 } else {
 
-                     if ($val->category && array_has($job_cates, $val->category)) {
 
-                         $jobs_list[$key]->jobcategory = $job_cates[$val->topclass][$val->category]['spell'];
 
-                     } else {
 
-                         $jobs_list[$key]->jobcategory = '';
 
-                     }
 
-                 }
 
-             }
 
-             if (!empty($val->promotion)) {
 
-                 foreach ($val->promotion as $k => $v) {
 
-                     if ($v->ptype == 1) {
 
-                         $jobs_list[$key]->stickDays = 0;
 
-                         if($v->endtime > time()){
 
-                             $jobs_list[$key]->stickDays = ceil(($v->endtime-time())/86400);
 
-                         }
 
-                         $jobs_list[$key]->stickarr = $v;
 
-                     }
 
-                     if ($v->ptype == 2) {
 
-                         $jobs_list[$key]->emergencyDays = 0;
 
-                         if($v->endtime > time()){
 
-                             $jobs_list[$key]->emergencyDays = ceil(($v->endtime-time())/86400);
 
-                         }
 
-                         $jobs_list[$key]->emergencyarr = $v;
 
-                     }
 
-                 }
 
-             }
 
-             $val->auto_refresh = 0;
 
-             $auto_refresh = $this->queueAutoRefreshRepository->findData(['type'=>1, 'pid'=>$val->id]);
 
-             if ($auto_refresh) {
 
-                 $order_list = $this->orderRepository->findByField(['uid'=>$val->company_id,'order_type'=>12]);
 
-                 foreach ($order_list as $k => $v) {
 
-                     $order_params = unserialize($v->params);
 
-                     if ($order_params['jobs_id']==$val->id) {
 
-                         $val->auto_refresh = 1;
 
-                         $val->auto_refresh_starttime = date('Y-m-d', $order_params['starttime']);
 
-                         $val->auto_refresh_endtime = date('Y-m-d', $order_params['endtime']);
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-             if ($val->audit == 2) {
 
-                 $val->_audit = config('aix.companyset.comset.show_set.jobs_display') == 2 ? 1 : $val->audit;
 
-             } else {
 
-                 $val->_audit = $val->audit;
 
-             }
 
-             if ($val->_audit == 2) {
 
-                 $val->status_cn = '审核中';
 
-             } elseif ($val->_audit == 3) {
 
-                 $val->status_cn = '审核未通过';
 
-                 $val->reason = $this->auditReasonsRepository->getAuditReasons($val->id, 3);
 
-             } elseif ($val->_audit == 1 && $val->audit == 2) {
 
-                 $val->status_cn = '审核中';
 
-             }
 
-             if ($val->display == 2 || ($val->deadline > 0 && $val->deadline < time())) {
 
-                 $val->status_cn = '已关闭';
 
-             }
 
-             $val->resumeCount = $this->personalJobsApplyRepository->getApplyResume($val->id);
 
-         }
 
-         return $jobs_list;
 
-     }
 
-     /**发布职位总数
 
-      * @return mixed
 
-      */
 
-     public function jobsTotal($id)
 
-     {
 
-         $where['company_id'] = $id;
 
-         $where['display'] = 1;
 
-         $where['valid'] = 1;
 
-         $where[] = ['audit','<>',3];
 
-         return $this->jobsRepository->jobsTotal($where);
 
-     }
 
-     /**
 
-      * 根据jobsid获取职位信息
 
-      * @param $id
 
-      * @return mixed
 
-      */
 
-     public function jobsInfo($id)
 
-     {
 
-         return $this->jobsRepository->getJobsById($id);
 
-     }
 
-     /**
 
-      * 职位保存
 
-      * @param $request
 
-      * @return JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function jobsSave($data, $user)
 
-     {
 
-         $jid = 0;
 
-         $iscustomize = $data['iscustomize'];
 
-         unset($data['iscustomize']);
 
-         //分站关系
 
-         if (isset($data['subsite_id'])) {
 
-             $subsite_id = $data['subsite_id'];
 
-         } else {
 
-             $subsite_id = [];
 
-         }
 
-         $jobsExist=$this->jobsRepository->jobsTotal(['company_id'=>$user->id,'id'=>$data['id']]);
 
-         if (empty($jobsExist) && !empty($data['id'])){
 
-             return response()->json(['status'=>0, 'msg'=>"没有这个职位"]);
 
-         }
 
-         unset($data['subsite_id']);
 
-         if (isset($data['id']) && $data['id']) {
 
-             $jid = $data['id'];
 
-             $job_info = $this->jobsRepository->find($jid);
 
-             unset($data['id']);
 
-         } else {
 
-             //查询企业已发布多少职位数
 
-             $condition['company_id'] = $user->id;
 
-             $condition['display'] = 1;
 
-             $condition['valid'] = 1;
 
-             $condition[] = ['audit','<>',3];//加入把审核失败的去除
 
-             $jobsCount = $this->jobsRepository->jobsTotal($condition);
 
-             //查询企业套餐内可发布职位数
 
-             $mySetmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-             if (isExpire($mySetmeal)){
 
-                 return response()->json(['status'=>0, 'msg'=>"提醒:您的套餐已到期,请及时到我的套餐处升级套餐"]);
 
-             }
 
-             if ($mySetmeal->jobs_meanwhile <= $jobsCount) {
 
-                 return response()->json(['status'=>0, 'msg'=>"当前显示的职位已经达到最大限制,请升级服务套餐!"]);
 
-             }
 
-         }
 
-         $basis_contact = $data['basis_contact'];
 
-         unset($data['basis_contact']);
 
-         $jobData = [];
 
-         $contactData = [];
 
-         foreach ($data as $key => $val) {
 
-             if ($key == 'contact') {
 
-                 $contactData['contact'] = $val;
 
-             } elseif ($key == 'telephone') {
 
-                 $contactData['telephone'] = $val;
 
-             } elseif ($key == 'landline_tel') {
 
-                 if ($jid) {
 
-                     $contactData['landline_tel'] = $val;
 
-                 } else {
 
-                     $list1 = explode('-', $val);
 
-                     foreach ($list1 as $ke => $vo) {
 
-                         if ($vo) {
 
-                             $contactData['landline_tel'][$ke] = $vo;
 
-                         } else {
 
-                             $contactData['landline_tel'][$ke] = '';
 
-                         }
 
-                     }
 
-                 }
 
-             } elseif ($key == 'email') {
 
-                 $contactData['email'] = $val;
 
-             } elseif ($key == 'address') {
 
-                 $contactData['address'] = $val;
 
-             } elseif ($key == 'telephone_show') {
 
-                 $contactData['telephone_show'] = $val;
 
-             } elseif ($key == 'contact_show') {
 
-                 $contactData['contact_show'] = $val;
 
-             } elseif ($key == 'landline_tel_show') {
 
-                 $contactData['landline_tel_show'] = $val;
 
-             } elseif ($key == 'email_show') {
 
-                 $contactData['email_show'] = $val;
 
-             } elseif ($key == 'notify_mobile') {
 
-                 $contactData['notify_mobile'] = $val;
 
-             } elseif ($key == 'notify') {
 
-                 $contactData['notify'] = $val;
 
-             } else {
 
-                 if ($key == 'jobcategory') {
 
-                     $category = explode('.', $val);
 
-                     $jobData['topclass'] = $category[0];
 
-                     $jobData['category'] = $category[1];
 
-                     $jobData['subclass'] = $category[2];
 
-                 } elseif ($key == 'deadline') {
 
-                     if ($val) {
 
-                         $jobData[$key] = time() + ($val * 86400);
 
-                     } else {
 
-                         //职位有效期多少天
 
-                         $job_expire=config('aix.companyset.comset.com_set.job_expire');
 
-                         $jobData[$key] = time() +  $job_expire* 86400;
 
-                         if($job_expire==0){
 
-                             $jobData[$key]=0;
 
-                         }
 
-                     }
 
-                 } elseif ($key == 'tag') {
 
-                     $jobData[$key] = explode(',', $val);
 
-                 } elseif ($key == 'district') {
 
-                     $district = getCityInfo($val);
 
-                     $jobData[$key] = $district['district'];
 
-                 } else {
 
-                     $jobData[$key] = $val;
 
-                 }
 
-             }
 
-         }
 
-         $com_info = $this->companyRepository->getCompanyColumn($user->id, ['*']);
 
-         $setmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-         if (!$jid) {
 
-             $jobData['audit']= 2;
 
-         } else {
 
-             if ($com_info['audit']==1) {
 
-                 $jobData['audit'] = config('aix.companyset.audit.audit_type.audit_verifycom_editjob') == 1?$job_info->audit:2;
 
-             } else {
 
-                 $jobData['audit'] = config('aix.companyset.audit.audit_type.audit_unexaminedcom_editjob')==1?$job_info->audit:2;
 
-             }
 
-         }
 
-         $jobArr = ['map_zoom', 'scale', 'companyname', 'created_at', 'audit','trade','subsite_id'];
 
-         foreach ($jobArr as $key => $val) {
 
-             if ($val == 'companyname') {
 
-                 $jobData['company_name'] = $com_info['companyname'];
 
-             } elseif ($val == 'created_at') {
 
-                 $jobData['company_addtime'] = strtotime($com_info['created_at']);
 
-             } elseif ($val == 'audit') {
 
-                 $jobData['company_audit'] = $com_info['audit'];
 
-             } else {
 
-                 $jobData[$val] = $com_info[$val];
 
-             }
 
-         }
 
-         if ($data['wage']==-1) {
 
-             $jobData['wage'] = -1;
 
-             $jobData['wage_min']=0;
 
-             $jobData['wage_max']=0;
 
-         } else {
 
-             if (intval($data['wage'])==0) {
 
-                 $jobData['wage'] = 0;
 
-                 $jobData['wage_min']=$data['wage_min'];
 
-                 $jobData['wage_max']=$data['wage_max'];
 
-             } else {
 
-                 $wage = explode('~', format_wage(get_category($jobData['wage'])));
 
-                 $jobData['wage_max'] =0;
 
-                 if (isset($wage[1])) {
 
-                     $jobData['wage_max'] =intval($wage[1]);
 
-                 }
 
-                 $jobData['wage_min'] =intval($wage[0]);
 
-             }
 
-         }
 
- //        $jobData['syq']=$data['syq'];
 
- //        $jobData['syqxz_min']=$data['syqxz_min'];
 
-         $jobData['company_id'] = $user->id;
 
-         $jobData['robot'] = 0;
 
-         $jobData['valid'] = 1;
 
-         $jobData['refresh_time'] = time();
 
-         $jobData['setmeal_deadline'] = $setmeal->endtime ? strtotime($setmeal->endtime) : 0;
 
-         $jobData['setmeal_id'] = $setmeal->setmeal_id;
 
-         $jobData['setmeal_name'] = $setmeal->setmeal_name;
 
-         if ($basis_contact=='1') {
 
-             $contactArr = ['contact', 'telephone', 'landline_tel', 'email', 'address', 'contact_show', 'telephone_show', 'email_show', 'landline_tel_show'];
 
-             foreach ($contactArr as $key => $val) {
 
-                 if ($val == 'telephone') {
 
-                     $conData[$val] = $com_info['mobile'];
 
-                 } elseif ($val == 'landline_tel') {
 
-                     if ($com_info[$val]) {
 
-                         if ($jid) {
 
-                             $conData[$val] = $com_info[$val];
 
-                         } else {
 
-                             $list = explode('-', $com_info[$val]);
 
-                             foreach ($list as $ke => $vo) {
 
-                                 if ($vo) {
 
-                                     $conData[$val][$ke] = $vo;
 
-                                 } else {
 
-                                     $conData[$val][$ke] = '';
 
-                                 }
 
-                             }
 
-                         }
 
-                     } else {
 
-                         $conData[$val] = '';
 
-                     }
 
-                 } else {
 
-                     $conData[$val] = $com_info[$val];
 
-                 }
 
-             }
 
-             $jobContactData = $conData;
 
-         } else {
 
-             $jobContactData = $contactData;
 
-         }
 
-         $subsite_id[] = $com_info['subsite_id'];
 
-         DB::beginTransaction();
 
-         try {
 
-             if ($jid) {
 
-                 if (!$this->jobsRepository->update($jobData, $jid)) {
 
-                     throw new Exception('修改职位失败');
 
-                 }
 
-                 //修改分站关系
 
-                 if ($subsite_id) {
 
-                     if ($this->subsiteJobRepository->findSubsite($jid)->isNotEmpty()) {
 
-                         if (!$this->subsiteJobRepository->deleteWhere(['jobs_id'=>$jid])) {
 
-                             throw new Exception('修改分站关系失败');
 
-                         }
 
-                     }
 
-                     foreach ($subsite_id as $key => $val) {
 
-                         $sub_data[] = [
 
-                             'subsite_id'=>$val,
 
-                             'jobs_id'=>$jid,
 
-                             'created_at'=>date('Y-m-d H:i:s', time()),
 
-                             'updated_at'=>date('Y-m-d H:i:s', time()),
 
-                         ];
 
-                     }
 
-                     if (false == $this->subsiteJobRepository->createData($sub_data)) {
 
-                         throw new Exception('修改分站关系失败');
 
-                     }
 
-                 }
 
-                 if (false == $this->jobsContactRepository->update($jobContactData, $jid)) {
 
-                     throw new Exception('修改联系方式失败');
 
-                 }
 
-                 event_search_update(Jobs::class, (string)$jid, 'update');
 
-                 event_search_update(Company::class, (string)$user->id, 'update');
 
-             } else {
 
-                 if (!$job = $this->jobsRepository->store($jobData)) {
 
-                     throw new Exception('添加职位失败');
 
-                 }
 
-                 $jobContactData['job_id'] = $job->id;
 
-                 if (false == $this->jobsContactRepository->store($jobContactData)) {
 
-                     throw new Exception('添加联系方式失败');
 
-                 }
 
- //                if (!$this->companyRepository->modifyJobsNum($user->id, 1, 1)) {
 
- //                    throw new Exception('修改企业职位数失败!');
 
- //                }
 
- //                if (!$this->membersSetmealRepository->modifyJobsMeanwhile($setmeal->id, 1, 2)) {
 
- //                    throw new Exception('修改套餐可发布职位数失败!');
 
- //                }
 
-                 //添加分站关系
 
-                 if ($subsite_id) {
 
-                     foreach ($subsite_id as $key => $val) {
 
-                         $sub_data[] = [
 
-                             'subsite_id'=>$val,
 
-                             'jobs_id'=>$job->id,
 
-                             'created_at'=>date('Y-m-d H:i:s', time()),
 
-                             'updated_at'=>date('Y-m-d H:i:s', time()),
 
-                         ];
 
-                     }
 
-                     if (false == $this->subsiteJobRepository->createData($sub_data)) {
 
-                         throw new Exception('职位同步至其他分站失败!');
 
-                     }
 
-                 }
 
-                 event_search_update(Jobs::class, (string)$job->id, 'update');
 
-                 event_search_update(Company::class, (string)$user->id, 'update');
 
-             }
 
-             DB::commit();
 
-             if ($jid) {
 
-                 $msg = '修改';
 
-                 $log_type=1003;
 
-             } else {
 
-                 $msg = '添加';
 
-                 $log_type=1002;
 
-                 $jid=$job->id;
 
-                 $total=$setmeal->jobs_meanwhile-$this->jobsRepository->jobsTotal($condition);
 
-                 $this->membersSetmealLogRepository->createLog($user,"发布了职位{$jobData['jobs_name']}",$total);
 
-             }
 
-             //写日志
 
-             $this->memberLogRepository->createLog($user,$log_type,$jid);
 
-             return response()->json(['status' => 1, 'msg' => $msg . "职位成功"]);
 
-         } catch (Exception $e) {
 
-             DB::rollback();
 
-             return response()->json(['status' => 0, 'msg' => $e->getMessage()]);
 
-         }
 
-     }
 
-     /**
 
-      * 职位保存
 
-      * @param $data
 
-      * @param $user
 
-      * @return JsonResponse
 
-      */
 
-     public function jobsSaveMobile($data, $user)
 
-     {
 
-         $jid = '';
 
-         //分站关系
 
-         if (isset($data['subsite_id'])) {
 
-             $subsite_id = explode(',', $data['subsite_id']);
 
-         } else {
 
-             $subsite_id = [];
 
-         }
 
-         unset($data['subsite_id']);
 
-         if (isset($data['id']) && $data['id']) {
 
-             $jid = $data['id'];
 
-             $job_info = $this->jobsRepository->findWhere(['id'=>$jid,'company_id'=>$user->id])->first();
 
-             if (empty($job_info)){
 
-                 return response()->json(['status'=>0, 'msg'=>"无改职位!"]);
 
-             }
 
-             unset($data['id']);
 
-         } else {
 
-             //查询企业已发布多少职位数
 
-             $condition['display'] = 1;
 
-             $condition['valid'] = 1;
 
-             $condition['company_id'] = $user->id;
 
-             $jobsCount = $this->jobsRepository->jobsTotal($condition);
 
-             //查询企业套餐内可发布职位数
 
-             $mySetmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-             if (isExpire($mySetmeal)){
 
-                 return response()->json(['status'=>0, 'msg'=>"提醒:您的套餐已到期,请及时到我的套餐处升级套餐"]);
 
-             }
 
-             if ($mySetmeal->jobs_meanwhile<=$jobsCount) {
 
-                 return response()->json(['status'=>0, 'msg'=>"当前显示的职位已经达到最大限制,请升级服务套餐!"]);
 
-             }
 
-         }
 
-         $basis_contact = $data['basis_contact'];
 
-         unset($data['basis_contact']);
 
-         $jobData = [];
 
-         $contactData = [];
 
-         foreach ($data as $key => $val) {
 
-             if ($key == 'contact') {
 
-                 $contactData['contact'] = $val;
 
-             } elseif ($key == 'telephone') {
 
-                 $contactData['telephone'] = $val;
 
-             } elseif ($key == 'landline_tel') {
 
-                 if ($jid) {
 
-                     $contactData['landline_tel'] = $val;
 
-                 } else {
 
-                     $list1 = explode('-', $val);
 
-                     foreach ($list1 as $ke => $vo) {
 
-                         if ($vo) {
 
-                             $contactData['landline_tel'][$ke] = $vo;
 
-                         } else {
 
-                             $contactData['landline_tel'][$ke] = '';
 
-                         }
 
-                     }
 
-                 }
 
-             } elseif ($key == 'email') {
 
-                 $contactData['email'] = $val;
 
-             } elseif ($key == 'address') {
 
-                 $contactData['address'] = $val;
 
-             } elseif ($key == 'telephone_show') {
 
-                 $contactData['telephone_show'] = $val;
 
-             } elseif ($key == 'contact_show') {
 
-                 $contactData['contact_show'] = $val;
 
-             } elseif ($key == 'landline_tel_show') {
 
-                 $contactData['landline_tel_show'] = $val;
 
-             } elseif ($key == 'email_show') {
 
-                 $contactData['email_show'] = $val;
 
-             } elseif ($key == 'notify_mobile') {
 
-                 $contactData['notify_mobile'] = $val;
 
-             } elseif ($key == 'notify') {
 
-                 $contactData['notify'] = $val;
 
-             } else {
 
-                 if ($key == 'jobcategory') {
 
-                     $category = explode('.', $val);
 
-                     $jobData['topclass'] = $category[0];
 
-                     $jobData['category'] = $category[1];
 
-                     $jobData['subclass'] = $category[2];
 
-                 } elseif ($key == 'deadline') {
 
-                     if ($val) {
 
-                         $jobData[$key] = time() + ($val * 86400);
 
-                     } else {
 
-                         $jobData[$key] = time() + 30 * 86400;
 
-                     }
 
-                 } elseif ($key == 'tag') {
 
-                     $jobData[$key] = explode(',', $val);
 
-                 } elseif ($key == 'age') {
 
-                     $jobData[$key] = $val;
 
-                 } else {
 
-                     $jobData[$key] = $val;
 
-                 }
 
-             }
 
-         }
 
- //        if (isset($jobData['syqxz_min']) && $jobData['syqxz_min'] && $jobData['syqxz_min'] < $jobData['wage_min']*0.8 ) {
 
- //
 
- //        return response()->json(['status'=>0, 'msg'=>"试用期薪资不得低于正式工资的80%"]);
 
- //    }
 
-         $com_info = $this->companyRepository->getCompanyColumn($user->id, ['*']);
 
-         $setmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-         if (!$jid) {
 
-             $jobData['audit']= 2;
 
-         } else {
 
-             if ($com_info['audit']==1) {
 
-                 $jobData['audit'] = config('aix.companyset.audit.audit_type.audit_verifycom_editjob') == 1?$job_info->audit:2;
 
-             } else {
 
-                 $jobData['audit'] = config('aix.companyset.audit.audit_type.audit_unexaminedcom_editjob')==1?$job_info['audit']:2;
 
-             }
 
-         }
 
-         $jobArr = ['map_zoom', 'scale', 'companyname', 'created_at', 'audit','trade','subsite_id'];
 
-         foreach ($jobArr as $key => $val) {
 
-             if ($val == 'companyname') {
 
-                 $jobData['company_name'] = $com_info['companyname'];
 
-             } elseif ($val == 'created_at') {
 
-                 $jobData['company_addtime'] = strtotime($com_info['created_at']);
 
-             } elseif ($val == 'audit') {
 
-                 $jobData['company_audit'] = $com_info['audit'];
 
-             } else {
 
-                 $jobData[$val] = $com_info[$val];
 
-             }
 
-         }
 
-         if ($data['wage']==-1) {
 
-             $jobData['wage'] = -1;
 
-             $jobData['wage_min']=0;
 
-             $jobData['wage_max']=0;
 
-         } else {
 
-             if (intval($data['wage'])==0) {
 
-                 $jobData['wage'] = 0;
 
-                 $jobData['wage_min']=$data['wage_min'];
 
-                 $jobData['wage_max']=$data['wage_max'];
 
-             } else {
 
-                 $wage = explode('~', format_wage(get_category($jobData['wage'])));
 
-                 if (isset($wage[1])) {
 
-                     $jobData['wage_max'] =intval($wage[1]);
 
-                 }
 
-                 $jobData['wage_min'] =intval($wage[0]);
 
-             }
 
-         }
 
-         if(isset($data['syq'])){
 
-             $jobData['syq']=$data['syq'];
 
-         }
 
-         if(isset($data['syqxz_min'])){
 
-             $jobData['syqxz_min']=$data['syqxz_min'];
 
-         }
 
-        
 
-         $jobData['company_id'] = $user->id;
 
-         $jobData['robot'] = 0;
 
-         $jobData['valid'] = 1;
 
-         $jobData['refresh_time'] = time();
 
-         $jobData['setmeal_deadline'] = $setmeal->endtime ? strtotime($setmeal->endtime) : 0;
 
-         $jobData['setmeal_id'] = $setmeal->setmeal_id;
 
-         $jobData['setmeal_name'] = $setmeal->setmeal_name;
 
-         if ($basis_contact==1) {
 
-             $contactArr = ['contact', 'telephone', 'landline_tel', 'email', 'address', 'contact_show', 'telephone_show', 'email_show', 'landline_tel_show'];
 
-             foreach ($contactArr as $key => $val) {
 
-                 if ($val == 'telephone') {
 
-                     $conData[$val] = $com_info['mobile'];
 
-                 } elseif ($val == 'landline_tel') {
 
-                     if ($com_info[$val]) {
 
-                         if ($jid) {
 
-                             $conData[$val] = $com_info[$val];
 
-                         } else {
 
-                             $list = explode('-', $com_info[$val]);
 
-                             foreach ($list as $ke => $vo) {
 
-                                 if ($vo) {
 
-                                     $conData[$val][$ke] = $vo;
 
-                                 } else {
 
-                                     $conData[$val][$ke] = '';
 
-                                 }
 
-                             }
 
-                         }
 
-                     } else {
 
-                         $conData[$val] = '';
 
-                     }
 
-                 } else {
 
-                     $conData[$val] = $com_info[$val];
 
-                 }
 
-             }
 
-             $jobContactData = $conData;
 
-         } else {
 
-             $jobContactData = $contactData;
 
-         }
 
-         $subsite_id[] = $com_info['subsite_id'];
 
-         DB::beginTransaction();
 
-         try {
 
-             if ($jid) {
 
-                 if (!$this->jobsRepository->update($jobData, $jid)) {
 
-                     throw new Exception('修改职位失败');
 
-                 }
 
-                 //修改分站关系
 
-                 if ($subsite_id) {
 
-                     if ($this->subsiteJobRepository->findSubsite($jid)->isNotEmpty()) {
 
-                         if (!$this->subsiteJobRepository->deleteWhere(['jobs_id'=>$jid])) {
 
-                             throw new Exception('修改分站关系失败');
 
-                         }
 
-                     }
 
-                     foreach ($subsite_id as $key => $val) {
 
-                         $sub_data[] = [
 
-                             'subsite_id'=>$val,
 
-                             'jobs_id'=>$jid,
 
-                             'created_at'=>date('Y-m-d H:i:s', time()),
 
-                             'updated_at'=>date('Y-m-d H:i:s', time()),
 
-                         ];
 
-                     }
 
-                     if (false ===$this->subsiteJobRepository->createData($sub_data)) {
 
-                         throw new Exception('修改分站关系失败');
 
-                     }
 
-                 }
 
-                 if (false===$this->jobsContactRepository->update($jobContactData, $jid)) {
 
-                     throw new Exception('修改联系方式失败');
 
-                 }
 
-                 event_search_update(Jobs::class, (string)$jid, 'update');
 
-                 event_search_update(Company::class, (string)$com_info['id'], 'update');
 
-             } else {
 
-                 if (false == $jobs = $this->jobsRepository->store($jobData)) {
 
-                     throw new Exception('添加职位失败');
 
-                 }
 
-                 $jobContactData['job_id'] = $jobs->id;
 
-                 if (false === $this->jobsContactRepository->create($jobContactData)) {
 
-                     throw new Exception('添加联系方式失败');
 
-                 }
 
- //                if (!$this->companyRepository->modifyJobsNum($user->id, 1, 1)) {
 
- //                    throw new Exception('修改企业职位数失败!');
 
- //                }
 
- //                if (!$this->membersSetmealRepository->modifyJobsMeanwhile($setmeal->id, 1, 2)) {
 
- //                    throw new Exception('修改套餐可发布职位数失败!');
 
- //                }
 
-                 //添加分站关系
 
-                 if ($subsite_id) {
 
-                     foreach ($subsite_id as $key => $val) {
 
-                         $sub_data[] = [
 
-                             'subsite_id'=>$val,
 
-                             'jobs_id'=>$jobContactData['job_id'],
 
-                             'created_at'=>date('Y-m-d H:i:s', time()),
 
-                             'updated_at'=>date('Y-m-d H:i:s', time()),
 
-                         ];
 
-                     }
 
-                     if (!$this->subsiteJobRepository->createData($sub_data)) {
 
-                         throw new Exception('职位同步至其他分站失败!');
 
-                     }
 
-                 }
 
-                 event_search_update(Jobs::class, (string)$jobs->id, 'update');
 
-                 event_search_update(Company::class, (string)$user->id, 'update');
 
-             }
 
-             DB::commit();
 
-             if ($jid) {
 
-                 $msg = '修改';
 
-             } else {
 
-                 $msg = '添加';
 
-             }
 
-             return response()->json(['status' => 1, 'msg' => $msg . "职位成功"]);
 
-         } catch (Exception $e) {
 
-             DB::rollback();
 
-             return response()->json(['status' => 0, 'msg' => $e->getMessage()]);
 
-         }
 
-     }
 
-     /**职位关闭
 
-      * @param $request
 
-      * @return JsonResponse
 
-      */
 
-     public function jobsClose($id,$user)
 
-     {
 
-         if (!is_array($id)) {
 
-             $ids = explode(',', $id);
 
-         } else {
 
-             $ids = $id;
 
-         }
 
-         $jobsExist=$this->jobsRepository->jobsHas($user,$ids);
 
-         if (empty($jobsExist) && !empty($data['id'])){
 
-             return response()->json(['status'=>0, 'msg'=>"没有这个职位"]);
 
-         }
 
-         if (!$this->jobsRepository->closeJobs($ids)) {
 
-             return response()->json(['status' => 0, 'msg' => '职位关闭失败', 'data' => '']);
 
-         }
 
-         $condition = [['whereIn','id', $ids]];
 
-         event_search_update(Jobs::class, $condition, 'update');
 
-         $com_ids =$this->jobsRepository->findWhereIn('id', $ids, ['company_id'])->toArray();
 
-         $company_condition = [['whereIn','id', $com_ids]];
 
-         event_search_update(Company::class, $company_condition, 'update');
 
-         //写日志
 
-         if (!is_array($id)) {
 
-             foreach ($ids as $item) {
 
-                 if (!$this->memberLogRepository->createLog($user,1007,$item)) {
 
-                     throw new \Exception('添加刷新记录失败!');
 
-                 }
 
-             }
 
-         }else{
 
-             if (!$this->memberLogRepository->createLog($user,1007,$id)) {
 
-                 throw new \Exception('添加刷新记录失败!');
 
-             }
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => '职位关闭成功', 'data' => '']);
 
-     }
 
-     /**
 
-      * 职位恢复
 
-      * @param $request
 
-      * @return JsonResponse
 
-      */
 
-     public function jobsShow($id, $user)
 
-     {
 
-         $ids = explode(',', $id);
 
-         $data['display'] = 1;
 
-         $data['valid'] = 1;
 
-         $data['deadline'] = time()+config('aix.companyset.comset.com_set.job_expire')*86400;
 
-         $jobsExist=$this->jobsRepository->jobsHas($user,$ids);
 
-         if (empty($jobsExist)){
 
-             return response()->json(['status'=>0, 'msg'=>"没有这个职位"]);
 
-         }
 
-         //查询企业已发布多少职位数
 
-         $condition['company_id'] = $user->id;
 
-         $condition[] = ['audit','<>',3];
 
-         $condition['display'] = 1;
 
-         $condition['valid'] = 1;
 
-         $jobsCount = $this->jobsRepository->jobsTotal($condition);
 
-         //查询企业套餐内可发布职位数
 
-         $mySetmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-         if ($mySetmeal->jobs_meanwhile<=$jobsCount) {
 
-             return response()->json(['status'=>0, 'msg'=>"当前显示的职位已经达到最大限制,请升级服务套餐或关闭未招聘职位!"]);
 
-         }
 
-         if (!$this->jobsRepository->showJobs($ids, $data)) {
 
-             return response()->json(['status' => 0, 'msg' => '职位恢复失败', 'data' => '']);
 
-         }
 
-         $condition = [['whereIn','id', $ids]];
 
-         event_search_update(Jobs::class, $condition, 'update');
 
-         $com_ids =$this->jobsRepository->findWhereIn('id', $ids, ['company_id'])->toArray();
 
-         $company_condition = [['whereIn','id', $com_ids]];
 
-         event_search_update(Company::class, $company_condition, 'update');
 
-         //写日志
 
-         if (!is_array($id)) {
 
-             foreach ($ids as $item) {
 
-                 if (!$this->memberLogRepository->createLog($user,1008,$item)) {
 
-                     throw new \Exception('添加删除记录失败!');
 
-                 }
 
-             }
 
-         }else{
 
-             if (!$this->memberLogRepository->createLog($user,1008,$id)) {
 
-                 throw new \Exception('添加删除记录失败!');
 
-             }
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => '职位恢复成功', 'data' => '']);
 
-     }
 
-     /**
 
-      * 职位删除
 
-      * @param $request
 
-      * @return JsonResponse
 
-      */
 
-     public function jobsDel($id, $user)
 
-     {
 
-         if (!is_array($id)) {
 
-             $ids = explode(',', $id);
 
-         } else {
 
-             $ids = $id;
 
-         }
 
-         $count = count($ids);
 
-         $setmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-         DB::beginTransaction();
 
-         try {
 
-             if (!$this->jobsRepository->delJobs($ids)) {
 
-                 throw new Exception('职位删除失败');
 
-             }
 
- //            if (!$this->companyRepository->modifyJobsNum($user->id, 2, $count)) {
 
- //                throw new Exception('修改企业职位数失败!');
 
- //            }
 
-             if (!$this->jobsContactRepository->delJobsContact($ids)) {
 
-                 throw  new Exception('删除职位联系人失败!');
 
-             }
 
- //            if (!$this->membersSetmealRepository->modifyJobsMeanwhile($setmeal->id, $count, 1)) {
 
- //                throw new Exception('修改套餐可发布职位数失败!');
 
- //            }
 
-             $condition = [['whereIn', 'id', $ids]];
 
-             event_search_update(Jobs::class, $condition, 'delete');
 
-             $com_ids =$this->jobsRepository->findWhereIn('id', $ids, ['company_id'])->toArray();
 
-             $company_condition = [['whereIn','id', $com_ids]];
 
-             event_search_update(Company::class, $company_condition, 'update');
 
-             DB::commit();
 
-         } catch (Exception $e) {
 
-             DB::rollback();
 
-             return response()->json(['status' => 0, 'msg' =>$e->getMessage(), 'data' => '']);
 
-         }
 
-         //写日志
 
-         if (!is_array($id)) {
 
-             foreach ($ids as $item) {
 
-                 if (!$this->memberLogRepository->createLog($user,1009,$item)) {
 
-                     throw new \Exception('添加删除记录失败!');
 
-                 }
 
-             }
 
-         }else{
 
-             if (!$this->memberLogRepository->createLog($user,1009,$id)) {
 
-                 throw new \Exception('添加删除记录失败!');
 
-             }
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => '职位删除成功', 'data' => '']);
 
-     }
 
-     /**招聘效果统计==访客统计
 
-      * @param $request
 
-      * @return mixed
 
-      * @throws \Throwable
 
-      */
 
-     public function statisticsVisitor($request, $user)
 
-     {
 
-         return $this->allStatistics($request, 'visitor', $user);
 
-     }
 
-     /**招聘效果统计==职位浏览
 
-      * @param $request
 
-      * @return mixed
 
-      * @throws \Throwable
 
-      */
 
-     public function statisticsViewjobs($request, $user)
 
-     {
 
-         return $this->allStatistics($request, 'viewjobs', $user);
 
-     }
 
-     /**招聘效果统计==应聘
 
-      * @param $request
 
-      * @return mixed
 
-      * @throws \Throwable
 
-      */
 
-     public function statisticsApply($request, $user)
 
-     {
 
-         return $this->allStatistics($request, 'apply', $user);
 
-     }
 
-     /**招聘效果统计
 
-      * @param $request
 
-      * @param $type
 
-      * @return mixed
 
-      * @throws \Throwable
 
-      */
 
-     public function allStatistics($request, $type, $user)
 
-     {
 
-         $settr = $request->settr?$request->settr:7;
 
-         $source = $request->source?$request->source:1;
 
-         $jobid = $request->jobid?$request->jobid:0;
 
-         $where['company_id'] = $user->id;
 
-         $where[] = ['apply', '>=', 0];
 
-         $apply = 0;
 
-         if ($type == "apply") {
 
-             $where[] = ['apply', '>=',1];
 
-             $apply = 1;
 
-         }
 
-         $model = $this->companyStatisticsRepository;
 
-         $today = date('Y-m-d');
 
-         $settr_tmp = strtotime($today)-($settr+1)*3600*24;
 
-         if ($settr>0) {
 
-             $where[] = ['created_at','>=', date('Y-m-d', $settr_tmp)];
 
-             $where[] = ['created_at','<', $today];
 
-         }
 
-         if ($source>0) {
 
-             $where['source'] = $source;
 
-         }
 
-         if ($jobid>0) {
 
-             $where['job_id'] = $jobid;
 
-         }
 
-         $param_array = ['settr','source','jobid','page'];
 
-         $params= [];
 
-         if ($request->all()) {
 
-             foreach ($request->all() as $k => $v) {
 
-                 if (in_array($k, $param_array)) {
 
-                     $params[$k] = $v;
 
-                 }
 
-             }
 
-         }
 
-         $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 = [];
 
-         $count_num = ['total'=>0,'login'=>0];
 
-         if ($type) {
 
-             $remark = $type.'_';
 
-         } else {
 
-             $remark='';
 
-         }
 
-         $statistics_list = $model->orderBy('created_at', 'desc')->findWhere($where)->toArray();
 
-         $view_time = [];
 
-         foreach ($statistics_list as $key => $value) {
 
-             if ($value['uid']>0) {
 
-                 if ($value['job_id']>0 && $value['apply']==0 && !isset($view_time['time']['viewjobs'][$value['uid']])) {
 
-                     $view_time['time']['viewjobs'][$value['uid']] = strtotime($value['created_at']);
 
-                     $view_time['source']['viewjobs'][$value['uid']] = $value['source'];
 
-                 }
 
-                 if ($value['job_id']>0 && $value['apply']>0 && !isset($view_time['time']['apply'][$value['uid']])) {
 
-                     $view_time['time']['apply'][$value['uid']] = strtotime($value['created_at']);
 
-                     $view_time['source']['apply'][$value['uid']] = $value['source'];
 
-                     $view_time['source']['visitor'][$value['uid']] = $value['source'];
 
-                     $view_time['time']['visitor'][$value['uid']] = strtotime($value['created_at']);
 
-                 }
 
-                 if ($value['apply']==0 && !isset($view_time['time']['visitor'][$value['uid']])) {
 
-                     $view_time['time']['visitor'][$value['uid']] = strtotime($value['created_at']);
 
-                     $view_time['source']['visitor'][$value['uid']] = $value['source'];
 
-                 }
 
-                 $set_login[strtotime(date('Y-m-d', strtotime($value['created_at'])))]++;
 
-                 $uidArr[] = $value['uid'];
 
-             }
 
-             $set_total[strtotime(date('Y-m-d', strtotime($value['created_at'])))]++;
 
-             $count_num['total']++;
 
-         }
 
-         $res ['view_time'] = $view_time;
 
-         $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 ($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;
 
-         if (!empty($uidArr)) {
 
-             //这里如果需要缓存的话,需要做修改
 
- //            $resumelist = Cache::get($remark.$where['apply'].'_'.$user->id.'_'.$jobid.'_'.$source.'_'.$settr.'_resumelist');
 
- //            if (null === $resumelist) {
 
-             $resumelist = $this->resumeRepository->findResumeList($uidArr);
 
- //                Cache::put($remark.$where['apply'].'_'.$user->id.'_'.$jobid.'_'.$source.'_'.$settr.'_resumelist', $resumelist, 10);
 
- //            }
 
-         } else {
 
-             $resumelist = [];
 
-         }
 
-         $sex_total = [1=>0,2=>0];
 
-         $sex_total['total'] = 0;
 
-         $education_total = [];
 
-         $education_total['total'] = 0;
 
-         $experience_total = [];
 
-         $experience_total['total'] = 0;
 
-         $age_total = [];
 
-         $age_total['total'] = 0;
 
-         foreach ($resumelist as $key => $value) {
 
-             if ($value->display_name=="2") {
 
-                 $resumelist[$key]->fullname="N".str_pad($value->id, 7, "0", STR_PAD_LEFT);
 
-             } elseif ($value->display_name=="3") {
 
-                 if ($value->sex==1) {
 
-                     $resumelist[$key]->fullname=cut_str($value->fullname, 1, 0, "先生");
 
-                 } elseif ($value->sex == 2) {
 
-                     $resumelist[$key]->fullname=cut_str($value->fullname, 1, 0, "女士");
 
-                 } else {
 
-                     $resumelist[$key]->fullname=cut_str($value->fullname, 1, 0, "**");
 
-                 }
 
-             } else {
 
-                 $resumelist[$key]->fullname=$value->fullname;
 
-             }
 
-             $resumelist[$key]->intention_jobs=cut_str($value->intention_jobs, 10, 0, '..');
 
-             $resumelist[$key]->age=date('Y')-$value->birthdate;
 
-             if (!$request->ajax()) {
 
-                 $count_num['login']++;
 
-                 if ($value->sex>0) {
 
-                     if (isset($sex_total[$value->sex])) {
 
-                         $sex_total[$value->sex]++;
 
-                     } else {
 
-                         $sex_total[$value->sex] = 1;
 
-                     }
 
-                 }
 
-                 if ($value->experience>0) {
 
-                     if (isset($experience_total['total'])) {
 
-                         $experience_total['total'] += 1;
 
-                     } else {
 
-                         $experience_total['total'] = 0;
 
-                         $experience_total['total'] +=1 ;
 
-                     }
 
-                     if (isset($experience_total['data'][$value->experience])) {
 
-                         $experience_total['data'][$value->experience]['num']++;
 
-                     } else {
 
-                         $experience_total['data'][$value->experience]['label'] = $value->experience_cn;
 
-                         $experience_total['data'][$value->experience]['num'] = 1;
 
-                     }
 
-                 }
 
-                 if ($value->education>0) {
 
-                     if (isset($education_total['total'])) {
 
-                         $education_total['total'] += 1;
 
-                     } else {
 
-                         $education_total['total'] = 0;
 
-                         $education_total['total'] +=1 ;
 
-                     }
 
-                     if (isset($education_total['data'][$value->education])) {
 
-                         $education_total['data'][$value->education]['num']++;
 
-                     } else {
 
-                         $education_total['data'][$value->education]['label'] = $value->education_cn;
 
-                         $education_total['data'][$value->education]['num'] = 1;
 
-                     }
 
-                 }
 
-                 if ($value->birthdate>0) {
 
-                     if (isset($age_total['total'])) {
 
-                         $age_total['total'] += 1;
 
-                     } else {
 
-                         $age_total['total'] = 0;
 
-                         $age_total['total'] +=1 ;
 
-                     }
 
-                     $minus_age = date('Y') - $value->birthdate;
 
-                     if ($minus_age<26) {
 
-                         $age_total['data'][0]['label'] = '18-25岁';
 
-                         if (isset($age_total['data'][0]['num'])) {
 
-                             $age_total['data'][0]['num'] += 1;
 
-                         } else {
 
-                             $age_total['data'][0]['num'] = 0;
 
-                             $age_total['data'][0]['num'] +=1 ;
 
-                         }
 
-                     } elseif ($minus_age<31) {
 
-                         $age_total['data'][1]['label'] = '26-30岁';
 
-                         if (isset($age_total['data'][1]['num'])) {
 
-                             $age_total['data'][1]['num'] += 1;
 
-                         } else {
 
-                             $age_total['data'][1]['num'] = 0;
 
-                             $age_total['data'][1]['num'] +=1 ;
 
-                         }
 
-                     } elseif ($minus_age<41) {
 
-                         $age_total['data'][2]['label'] = '31-40岁';
 
-                         if (isset($age_total['data'][2]['num'])) {
 
-                             $age_total['data'][2]['num'] += 1;
 
-                         } else {
 
-                             $age_total['data'][2]['num'] = 0;
 
-                             $age_total['data'][2]['num'] +=1 ;
 
-                         }
 
-                     } elseif ($minus_age<51) {
 
-                         $age_total['data'][3]['label'] = '41-50岁';
 
-                         if (isset($age_total['data'][3]['num'])) {
 
-                             $age_total['data'][3]['num'] += 1;
 
-                         } else {
 
-                             $age_total['data'][3]['num'] = 0;
 
-                             $age_total['data'][3]['num'] +=1 ;
 
-                         }
 
-                     } else {
 
-                         $age_total['data'][4]['label'] = '50岁';
 
-                         if (isset($age_total['data'][4]['num'])) {
 
-                             $age_total['data'][4]['num'] += 1;
 
-                         } else {
 
-                             $age_total['data'][4]['num'] = 0;
 
-                             $age_total['data'][4]['num'] +=1 ;
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         $res['table_data'] = $resumelist;
 
-         if ($request->ajax()) {
 
-             $res['mark'] = $type;
 
-             $html = view('app.company.ajax.ajax_statistics_list', $res)->render();
 
-             return response()->json(['data'=>$html]);
 
-         }
 
-         $sex_xml = '<chart showborder="0" enablesmartlabels="0" showlabels="0" showpercentvalues="1" showlegend="1" defaultcenterlabel="性别 ('.($sex_total[1]+$sex_total[2]).'人)" centerlabel="$label: $value人" centerlabelbold="0" showtooltip="0" decimals="0" usedataplotcolorforlabels="1" theme="fint">';
 
-         if (!empty($sex_total['total'])) {
 
-             $sex_xml.= '<set label="男" value="'.$sex_total[1].'" />';
 
-             $sex_xml.= '<set label="女" value="'.$sex_total[2].'" />';
 
-         }
 
-         $sex_xml.= '</chart>';
 
-         $res['sex_xml'] = $sex_xml;
 
-         $experience_xml = '<chart showborder="0" enablesmartlabels="0" showlabels="0" showpercentvalues="1" showlegend="1" defaultcenterlabel="工作经验 ('.$experience_total['total'].'人)" centerlabel="$label: $value人" centerlabelbold="0" showtooltip="0" decimals="0" usedataplotcolorforlabels="1" theme="fint">';
 
-         if (!empty($experience_total['data'])) {
 
-             foreach ($experience_total['data'] as $key => $value) {
 
-                 $experience_xml.= '<set label="'.$value['label'].'" value="'.$value['num'].'" />';
 
-             }
 
-         }
 
-         $experience_xml.= '</chart>';
 
-         $res['experience_xml'] = $experience_xml;
 
- //        dd($experience_xml);
 
-         $education_xml = '<chart showborder="0" enablesmartlabels="0" showlabels="0" showpercentvalues="1" showlegend="1" defaultcenterlabel="学历 ('.$education_total['total'].'人)" centerlabel="$label: $value人" centerlabelbold="0" showtooltip="0" decimals="0" usedataplotcolorforlabels="1" theme="fint">';
 
-         if (!empty($education_total['data'])) {
 
-             foreach ($education_total['data'] as $key => $value) {
 
-                 $education_xml.= '<set label="'.$value['label'].'" value="'.$value['num'].'" />';
 
-             }
 
-         }
 
-         $education_xml.= '</chart>';
 
-         $res['education_xml'] = $education_xml;
 
-         $age_xml = '<chart showborder="0" enablesmartlabels="0" showlabels="0" showpercentvalues="1" showlegend="1" defaultcenterlabel="年龄 ('.$age_total['total'].'人)" centerlabel="$label: $value人" centerlabelbold="0" showtooltip="0" decimals="0" usedataplotcolorforlabels="1" theme="fint">';
 
-         if (!empty($age_total['data'])) {
 
-             foreach ($age_total['data'] as $key => $value) {
 
-                 $age_xml.= '<set label="'.$value['label'].'" value="'.$value['num'].'" />';
 
-             }
 
-         }
 
-         $age_xml.= '</chart>';
 
-         $res['age_xml'] = $age_xml;
 
-         $res['source'] = $source;
 
-         $res['settr'] = $settr;
 
-         $res['jobid'] = $jobid;
 
-         $mysetmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, 1);
 
-         $upper_limit = 0;
 
-         $jids = $this->jobsRepository->jobsTotal([['company_id', '=', $user->id]]);
 
-         if ($jids>=$mysetmeal->jobs_meanwhile) {
 
-             $upper_limit = 1;
 
-         }
 
-         $res['upper_limit'] = $upper_limit;
 
-         $res['source_arr'] = ['1'=>'PC端','2'=>'触屏端','3'=>'移动端'];
 
-         $res['count_num'] = $count_num;
 
-         $res['params'] = $params;
 
-         return $res;
 
-     }
 
-     public function callCashPay($user, $increment_info, $my_point, $order_pay_type, $payment_name = '', $amount = '0.0', $is_deductible, $deductible = 0, $description = '', $params = '', $points = 0, $stemeal = 0, $discount = '')
 
-     {
 
-         //获取支付方式
 
-         $paymenttpye = $this->paymentService->returnPayment($payment_name);
 
-         if (!$paymenttpye) {
 
-             return array( 'status'=>0, 'msg' => '支付方式错误!');
 
-         }
 
-         if ($my_point->points < $deductible) {
 
-             return array( 'status'=>0, 'msg' => '积分不足,请使用其他方式支付!');
 
-         }
 
-         if ($is_deductible==0) {
 
-             $deductible = 0;
 
-         }
 
-         if ($deductible>0) {
 
-             $m_amount = $amount- floatval($deductible/config('aix.companyset.points.points_set.payment_rate'));
 
-         } else {
 
-             $m_amount = $amount;
 
-         }
 
-         $m_amount=round($m_amount,2);
 
-         $paysetarr['ordtotal_fee']=$m_amount;
 
-         if ($description=='') {
 
-             $description = '购买服务:'.$increment_info['name'];
 
-         }
 
-         $description .= ';'.$paymenttpye->name.$paysetarr['ordtotal_fee'].'元';
 
-         if ($deductible>0) {
 
-             $description .= ';积分支付:'.$deductible.'积分';
 
-         }
 
-         $stime = time();
 
-         //生成订单
 
-         $order = $this->orderService->addOrder($user, $order_pay_type, $amount, $paysetarr['ordtotal_fee'], 0, $increment_info['name'], $payment_name, $paymenttpye->name, $description, 1, $deductible, $stemeal, 0, serialize($params), $discount);
 
-         $tradeNo = $this->payService->getTradeNo($order->id);
 
-         if (!$this->serviceService->updateOid($order->id, $tradeNo)) {
 
-             throw new ResponseException('生成订单号失败!');
 
-         }
 
-         if ($payment_name == 'wechat') {
 
-             $type = 'scan';
 
-         } else {
 
-             $type = 'web';
 
-         }
 
-         $payOrder = new PayOrder();
 
-         $payOrder->trade_no = $tradeNo;
 
-         $payOrder->subject = '购买' . $increment_info['name'];
 
-         $payOrder->detail = $description;
 
-         $payOrder->price = $m_amount;
 
-         //执行刷新操作或其他
 
-         $payOrder->callback = "App\Services\Common\OrderService.incrementSave";
 
-         $payOrder->return_url = route('jobs.list');
 
-         $result = $this->payService->pay($payment_name, $type, $payOrder);
 
-         if ($payment_name == 'wechat') {
 
-             return response()->json([
 
-                 'status' => 1,
 
-                 'tradeCode' => get_qrcode_html($result->code_url),
 
-                 'tradeNo' => $tradeNo,
 
-             ]);
 
-         } else {
 
-             return $result;
 
-         }
 
-     }
 
-     /**刷新职位 =======积分刷新职位或套餐内免费
 
-      * @param $jid
 
-      * @param $mySetmeal
 
-      * @return array
 
-      */
 
-     public function jobsRefreshSave($jid, $user, $mySetmeal)
 
-     {
 
-         $jobsCount = count($jid);
 
-         $where = [
 
-             'uid' => $user->id,
 
-             'utype' => 1,
 
-             'type' => 1006,
 
-             'mode' => 2
 
-         ];
 
-         $todayCount = $this->refreshLogRepository->getTodayRefreshTimes($where); //今天免费刷新次数
 
-         $headsel1 = 0;
 
-         $free_mode = 0;
 
-         if ($todayCount >= ($mySetmeal->refresh_jobs_free + config('aix.companyset.comsume.comsume_set.refresh_jobs_more'))) {
 
-             $myPoints = $this->memberPointRepository->getPointsOne($user->id, 1);
 
-             if ($myPoints['points'] < ($jobsCount * config('aix.companyset.comsume.comsume_set.refresh_jobs_price') * config('aix.companyset.points.points_set.payment_rate'))) {
 
-                 return ['status' => 0, 'msg' => "你的积分不足,不能刷新职位!"];
 
-             }
 
-             $headsel1=1;
 
-             $handsel['uid'] = $user->id;
 
-             $handsel['utype'] = 1;
 
-             $handsel['htype'] = 'refresh_jobs';
 
-             $handsel['htype_cn'] = '刷新职位';
 
-             $handsel['operate'] = 2;
 
-             $handsel['points'] = config('aix.companyset.comsume.comsume_set.refresh_jobs_price') * config('aix.companyset.points.points_set.payment_rate') * $jobsCount;
 
-             $log_paymode =  '积分兑换刷新';
 
-         } else {
 
-             $free_mode = 1;
 
-             $log_paymode = '套餐内免费刷新';
 
-         }
 
-         //查询职位名称
 
-         $jobs_name_arr = $this->jobsRepository->findJobsName($jid);
 
-         $josname = array_column($jobs_name_arr, 'jobs_name', 'id');
 
-         DB::beginTransaction();
 
-         try {
 
-             foreach ($jid as $key => $val) {
 
-                 if (!$this->jobsRepository->jobsRefresh($val)) {
 
-                     throw new \Exception('刷新失败');
 
-                 }
 
-                 if ($free_mode!=1) {
 
-                     if (!$this->memberPointRepository->reportDeal($user->id, 1, 2, ($jobsCount * config('aix.companyset.comsume.comsume_set.refresh_jobs_price')*config('aix.companyset.points.points_set.payment_rate')))) {
 
-                         throw new \Exception('积分设置失败!');
 
-                     }
 
-                 }
 
-                 if (!$this->companyRepository->companySave(['refresh_time'=>time()], $user->id)) {
 
-                     throw new \Exception('刷新失败!修改企业信息表失败');
 
-                 }
 
-                 // 写入会员积分操作日志
 
-                 if ($headsel1) {
 
-                     if (!$this->memberHandselRepository->addNew($handsel)) {
 
-                         throw new \Exception('刷新失败!会员积分增减记录添加失败');
 
-                     }
 
-                 }
 
-                 //添加刷新操作日志
 
-                 $logData = [
 
-                     'uid' => $user->id,
 
-                     'utype' => 1,
 
-                     'mode' => 2,
 
-                     'type' => 1006,
 
-                     'obj_id'=> $val,
 
-                 ];
 
-                 if (!$this->refreshLogRepository->addLog($logData)) {
 
-                     throw new \Exception('添加刷新记录失败!');
 
-                 }
 
-                 //写日志
 
-                 if (!$this->memberLogRepository->createLog($user,1006,[$val,$log_paymode])) {
 
-                     throw new \Exception('添加刷新记录失败!');
 
-                 }
 
-                 $members_log['log_uid']=$user->id;
 
-                 $members_log['log_utype']=1;
 
-                 $members_log['log_username']=$user->username;
 
-                 $log_leave=$mySetmeal->refresh_jobs_free-1;
 
-                 $members_log['log_leave'] = $log_leave<0?0:$log_leave;
 
-                 $members_log['log_value'] = '刷新职位(职位名称:'.$josname[$val].')';
 
-                 $members_log['log_source']='网页版';
 
-                 if (!$this->membersSetmealLogRepository->addNew($members_log)) {
 
-                     throw  new \Exception('刷新失败!');
 
-                 }
 
-                 event_search_update(Jobs::class, (string)$val, 'update');
 
-                 Cache::put('refresh_jobid_'.$val, $jid, config('aix.companyset.comset.other_set.refresh_jobs_space'));
 
-             }
 
-             DB::commit();
 
-             return ['status' => 1, 'msg' => "刷新成功!"];
 
-         } catch (Exception $e) {
 
-             DB::rollback();
 
-             return ['status' => 0, 'msg' => $e->getMessage()];
 
-         }
 
-     }
 
-     /**
 
-      * 付费刷新
 
-      */
 
-     public function jobRefreshPay($jobs_id, $user, $is_deductible,$deductible,$mySetmeal){
 
-         if (isExpire($mySetmeal)){
 
-             return ['status' => 0, 'msg' => "提醒:您的套餐已到期,请及时到我的套餐处升级套餐!"];
 
-         }
 
-         DB::beginTransaction();
 
-         try {
 
-             if (!$this->jobsRepository->jobsRefresh($jobs_id)) {
 
-                 throw new \Exception('刷新失败');
 
-             }
 
-             if ($is_deductible) {
 
-                 if (!$this->memberPointRepository->reportDeal($user->id, 1, 2,$deductible)) {
 
-                     throw new \Exception('积分设置失败!');
 
-                 }
 
-             }
 
-             if (!$this->companyRepository->companySave(['refresh_time'=>time()], $user->id)) {
 
-                 throw new \Exception('刷新失败!修改企业信息表失败');
 
-             }
 
-             // 写入会员积分操作日志
 
-             $headsel1=1;
 
-             $handsel['uid'] = $user->id;
 
-             $handsel['utype'] = 1;
 
-             $handsel['htype'] = 'refresh_jobs';
 
-             $handsel['htype_cn'] = '刷新职位';
 
-             $handsel['operate'] = 2;
 
-             $handsel['points'] =  $deductible;
 
-             if ($headsel1) {
 
-                 if (!$this->memberHandselRepository->addNew($handsel)) {
 
-                     throw new \Exception('刷新失败!会员积分增减记录添加失败');
 
-                 }
 
-             }
 
-             //添加刷新操作日志
 
-             $logData = [
 
-                 'uid' => $user->id,
 
-                 'utype' => 1,
 
-                 'mode' => 2,
 
-                 'type' => 1006,
 
-                 'obj_id'=> $jobs_id,
 
-             ];
 
-             if (!$this->refreshLogRepository->addLog($logData)) {
 
-                 throw new \Exception('添加刷新记录失败!');
 
-             }
 
-             //写会员操作日志
 
-             if (!$this->memberLogRepository->createLog($user,1006,[$jobs_id,"付费刷新"])) {
 
-                 throw new \Exception('添加刷新记录失败!');
 
-             }
 
-             $members_log['log_uid']=$user->id;
 
-             $members_log['log_utype']=1;
 
-             $members_log['log_username']=$user->username;
 
-             $log_leave=$mySetmeal->refresh_jobs_free-1;
 
-             $members_log['log_leave'] = $log_leave<0?0:$log_leave;
 
-             $josname = $this->jobsRepository->getName($jobs_id);
 
-             $members_log['log_value'] = '刷新职位(职位名称:'.$josname.')';
 
-             $members_log['log_source']='网页版';
 
-             if (!$this->membersSetmealLogRepository->addNew($members_log)) {
 
-                 throw  new \Exception('刷新失败!');
 
-             }
 
-             event_search_update(Jobs::class, (string)$jobs_id, 'update');
 
-             DB::commit();
 
-             Cache::put('refresh_jobid_'.$jobs_id, $jobs_id, config('aix.companyset.comset.other_set.refresh_jobs_space'));
 
-             return ['status' => 1, 'msg' => "刷新成功!"];
 
-         } catch (Exception $e) {
 
-             DB::rollback();
 
-             return ['status' => 0, 'msg' => $e->getMessage()];
 
-         }
 
-     }
 
-     /**
 
-      * 微信公众号刷新职位
 
-      */
 
-     public function jobsRefreshWechat($user)
 
-     {
 
-         //企业发布职位数
 
-         $map['company_id'] = $user->id;
 
-         if (config('aix.companyset.comset.show_set.jobs_display')== 1) {
 
-             $map['audit'] = 1;
 
-         }
 
-         $map['display'] = 1;
 
-         $map['valid'] = 1;
 
-         $user_jobs = $this->jobsRepository->getComJobs($map);
 
-         //我的套餐
 
-         $mySetmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-         if (isExpire($mySetmeal)){
 
-             return ['status' => 0, 'msg' => "提醒:您的套餐已到期,请及时到我的套餐处升级套餐!"];
 
-         }
 
-         //我的积分
 
-         $myPoints = $this->memberPointRepository->getPointsOne($user->id, 1);
 
-         $where = [
 
-             'uid' => $user->id,
 
-             'utype' => 1,
 
-             'type' => 1006,
 
-             'mode' => 2
 
-         ];
 
-         $todayCount = $this->refreshLogRepository->getTodayRefreshTimes($where); //今天免费刷新次数
 
-         //没有可刷新职位
 
-         if (count($user_jobs)==0) {
 
-             return ['status'=>2,'msg'=>'没有可刷新的职位'];
 
-         }
 
-         //刷新间隔时间
 
-         $where1 = [
 
-             'uid' => $user->id,
 
-             'utype' => 1,
 
-             'type' => 1006,
 
-             'mode' => 2
 
-         ];
 
-         $refrestime = $this->refreshLogRepository->getLastRefreshDate($where1);
 
-         $duringtime = time() - strtotime($refrestime?$refrestime->created_at:0);
 
-         $space = config('aix.companyset.comset.other_set.refresh_jobs_space') * 60;
 
-         if ($space > 0 && $duringtime <= $space) {
 
-             return ['status' => 3, 'msg' => $space . "秒内不能重复刷新职位",];
 
-         }
 
-         $headsel1 = 0;
 
-         $free_mode = 0;
 
-         if ($todayCount >= ($mySetmeal->refresh_jobs_free + config('aix.companyset.comsume.comsume_set.refresh_jobs_more'))) {
 
-             if ($myPoints['points'] < (count($user_jobs) * config('aix.companyset.comsume.comsume_set.refresh_jobs_price') * config('aix.companyset.points.points_set.payment_rate'))) {
 
-                 return ['status' => 4, 'msg' => "你的积分不足,不能刷新职位!", 'url'=>route('mobile.firm.service.points.add')];
 
-             }
 
-             $headsel1=1;
 
-             $handsel['uid'] = $user->id;
 
-             $handsel['utype'] = 1;
 
-             $handsel['htype'] = 'refresh_jobs';
 
-             $handsel['htype_cn'] = '刷新职位';
 
-             $handsel['operate'] = 2;
 
-             $handsel['points'] = config('aix.companyset.comsume.comsume_set.refresh_jobs_price') * config('aix.companyset.points.points_set.payment_rate') * count($user_jobs);
 
-             $log_paymode =  '积分兑换刷新';
 
-         } else {
 
-             $free_mode = 1;
 
-             $log_paymode = '套餐内免费刷新';
 
-         }
 
-         //查询职位名称
 
-         $jobs_name_arr = $this->jobsRepository->getComJobs($map, ['id','jobs_name']);
 
-         $josname = array_column($jobs_name_arr, 'jobs_name', 'id');
 
-         $jid = array_column($jobs_name_arr, 'id', 'jobs_name');
 
-         DB::beginTransaction();
 
-         try {
 
-             foreach ($jid as $key => $val) {
 
-                 if (!$this->jobsRepository->jobsRefresh($val)) {
 
-                     throw new \Exception('刷新失败');
 
-                 }
 
-                 if ($free_mode!=1) {
 
-                     if (!$this->memberPointRepository->reportDeal($user->id, 1, 2, (count($user_jobs) * config('aix.companyset.comsume.comsume_set.refresh_jobs_price')*config('aix.companyset.points.points_set.payment_rate')))) {
 
-                         throw new \Exception('积分设置失败!');
 
-                     }
 
-                 }
 
-                 if (!$this->companyRepository->companySave(['refresh_time'=>time()], $user->id)) {
 
-                     throw new \Exception('刷新失败!修改企业信息表失败');
 
-                 }
 
-                 // 写入会员积分操作日志
 
-                 if ($headsel1) {
 
-                     if (!$this->memberHandselRepository->addNew($handsel)) {
 
-                         throw new \Exception('刷新失败!会员积分增减记录添加失败');
 
-                     }
 
-                 }
 
-                 //添加刷新操作日志
 
-                 $logData = [
 
-                     'uid' => $user->id,
 
-                     'utype' => 1,
 
-                     'mode' => 2,
 
-                     'type' => 1006,
 
-                     'obj_id'=> $val,
 
-                 ];
 
-                 if (!$this->refreshLogRepository->addLog($logData)) {
 
-                     throw new \Exception('添加刷新记录失败!');
 
-                 }
 
-                 $members_log['log_uid']=$user->id;
 
-                 $members_log['log_utype']=1;
 
-                 $members_log['log_username']=$user->username;
 
-                 $log_leave=$mySetmeal->refresh_jobs_free-1;
 
-                 $members_log['log_leave'] = $log_leave<0?0:$log_leave;
 
-                 $members_log['log_value'] = '刷新职位(职位名称:'.$josname[$val].')'.$log_paymode;
 
-                 $members_log['log_source']='网页版';
 
-                 if (!$this->membersSetmealLogRepository->addNew($members_log)) {
 
-                     throw  new \Exception('刷新失败!');
 
-                 }
 
-                 Cache::put('refresh_jobid_'.$val, $jid, config('aix.companyset.comset.other_set.refresh_jobs_space'));
 
-             }
 
-             DB::commit();
 
-             return ['status' => 1, 'msg' => "刷新成功!"];
 
-         } catch (Exception $e) {
 
-             DB::rollback();
 
-             return ['status' => 0, 'msg' => $e->getMessage()];
 
-         }
 
-     }
 
-     /**
 
-      * 企业会员中心首页一键刷新职位
 
-      */
 
-     public function jobsRefreshAll($user)
 
-     {
 
-         $map['company_id'] = $user->id;
 
-         if (config('aix.companyset.comset.show_set.jobs_display')== 1) { //如果是先审核再展示
 
-             $map['audit'] = 1;
 
-         }else{
 
-             $map[]=  ['audit', '!=',"3"];//如果是先展示再审核,去掉审核未通过的
 
-         }
 
-         $map['valid'] = 1;
 
-         $user_jobs = $this->jobsRepository->jobsTotal($map);
 
-         if ($user_jobs==0) {
 
-             return response()->json(['status'=>0,'msg'=>'没有可刷新的职位']);
 
-         }
 
-         $where = [
 
-             'uid' => $user->id,
 
-             'utype' => 1,
 
-             'type' => 1006,
 
-             'mode' => 2
 
-         ];
 
-         $refresh_time = $this->refreshLogRepository->getTodayRefreshTimes($where);
 
-         $mySetmeal = $this->membersSetmealRepository->getSetmealByUid($user->id, $user->utype);
 
-         if (isExpire($mySetmeal)){
 
-             return response()->json(['status' => 0, 'msg' => "提醒:您的套餐已到期,请及时到我的套餐处升级套餐!"]);
 
-         }
 
-         if (!$mySetmeal) {
 
-             return response()->json(['status'=>0,'msg'=>'您还没有开通服务,请开通!']);
 
-         }
 
-         if ($mySetmeal->exprie == 1 && $mySetmeal->setmeal_id > 1) {
 
-             return response()->json(['status'=>0,'msg'=>'您的服务已经到期,请重新开通!']);
 
-         }
 
-         $route = route('jobs.list');
 
-         if(is_mobile_route()){
 
-             $route = route('mobile.firm.jobs.list');
 
-         }
 
-         if(isset(request()->vail)&&!empty(request()->vail)){
 
-             $condition['company_id'] = $user->id;
 
-             if (config('aix.companyset.comset.show_set.jobs_display')== 1) {
 
-                 $condition['audit'] = 1;
 
-             }else{
 
-                 $condition[]=  ['audit', '!=',"3"];//如果是先展示再审核,去掉审核未通过的
 
-             }
 
-             $condition['valid'] = 1;
 
-             $jobsid_arr = $this->jobsRepository->findWhere($condition, ['id'])->toArray();
 
-             $yid = array_column($jobsid_arr, 'id');
 
-             $r = $this->jobsRefreshSave($yid, $user, $mySetmeal);
 
-             return response()->json(['status'=>$r['status'],'msg'=>$r['msg']]);
 
-         }else{
 
-             if ($refresh_time >= $mySetmeal->refresh_jobs_free) {
 
-                 return response()->json(['status'=>2,'msg'=>'      您当前共有 <span class="font_yellow">'.$user_jobs.'</span> 条在招职位,今天免费刷新次数已用完。</br>请前往 <a target="_blank" href="'.$route.'" class="font_blue">职位列表</a> 单条刷新。','data'=>route('jobs.list', ['type'=>1])]);
 
-               /*
 
-                 $mobile_surplus = $mySetmeal->refresh_jobs_free + config('aix.companyset.comsume.comsume_set.refresh_jobs_more')-$refresh_time;
 
-                 if ($mobile_surplus >= 0) {
 
-                     return response()->json(['status'=>2,'msg'=>'      您当前共有 <span class="font_yellow">'.$user_jobs.'</span> 条在招职位,今天免费刷新次数已用完。</br>请前往 <a target="_blank" href="'.$route.'" class="font_blue">职位列表</a> 单条刷新。使用触屏版还可免费刷新 <span class="font_yellow">'.$mobile_surplus.'</span> 次!','data'=>route('jobs.list', ['type'=>1])]);
 
-                 } else {
 
-                     return response()->json(['status'=>2,'msg'=>'      您当前共有 <span class="font_yellow">'.$user_jobs.'</span> 条在招职位,今天免费刷新次数已用完。</br>请前往 <a target="_blank" href="'.$route.'" class="font_blue">职位列表</a> 单条刷新。','data'=>route('jobs.list', ['type'=>1])]);
 
-                 }*/
 
-             } elseif ($user_jobs+$refresh_time>$mySetmeal->refresh_jobs_free) {
 
-                 $surplus = $mySetmeal->refresh_jobs_free - $refresh_time;
 
-                 return response()->json(['status'=>2,'msg'=>'      您当前共有 <span class="font_yellow">'.$user_jobs.'</span> 条在招职位,今天免费刷新次数剩余 <span class="font_yellow">'.$surplus.'</span> 次。</br>请前往 <a target="_blank" href="'.$route.'" class="font_blue">职位列表</a> 单条刷新。','data'=>route('jobs.list', ['type'=>1])]);
 
-             } else {
 
-                 $surplus =  $mySetmeal->refresh_jobs_free - $refresh_time;
 
-                 return response()->json(['status'=>3,'msg'=>'      您当前共有 <span class="font_yellow">'.$user_jobs.'</span> 条在招职位,今天免费刷新次数剩余 <span class="font_yellow">'.$surplus.'</span> 次。</br>如不需要批量刷新职位,请前往 <a target="_blank" href="'.$route.'" class="font_blue">职位列表</a> 单条刷新。','data'=>route('jobs.list', ['type'=>1])]);
 
-             }
 
-         }
 
-     }
 
-     //找工作
 
-     public function getLists($whereData)
 
-     {
 
-         //默认地区
 
-         $citycategory = array_get($whereData, 'citycategory');
 
-         if (!$citycategory) {
 
-             $citycategory = config('aix.system.site_other.site_other.district');
 
-         }
 
-         return false;
 
-     }
 
-     public function getJobInfo($where, $user = null)
 
-     {
 
-         $val = $this->jobsRepository->getInfo($where);
 
-         if (!$val) {
 
-             return ['status'=>0,'error'=>'职位不存在'];
 
-         }
 
-         if (!($user && $user->utype == 1 && $user->id == $val->company_id)) {
 
-             if ($val->display != 1) {
 
-                 return ['status'=>0,'error'=>'职位已关闭'];
 
-             }
 
-             if ($val->valid != 1) {
 
-                 return ['status'=>0,'error'=>'职位已失效'];
 
-             }
 
-             if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-                 if ($val->audit !='1') {
 
-                     return ['status'=>0,'error'=>'职位审核中或审核失败'];
 
-                 }
 
-             } else {
 
-                 if ($val->audit =='3') {
 
-                     return ['status'=>0,'error'=>'职位审核失败'];
 
-                 }
 
-             }
 
-         }
 
-         $companyInfo = $this->companyRepository->find($val->company_id, ['utype']);
 
-         $tmp = 0;
 
-         if (($val->audit == 2 && config('aix.companyset.comset.show_set.jobs_display') == 1) || $val->audit == '3') {
 
-             $tmp = 1;
 
-         }
 
-         /*if ($tmp) {
 
-             throw new ResponseException('职位不存在', '', '404');
 
-         }*/
 
-         $val->tmp = $tmp;
 
-         /*$subsite_type = Cache::get('subsite_type');
 
-         //TODO 获取职位信息时添加分站判断,判断职位是否可以在当前分站显示
 
-         if ($subsite_type) {
 
-             //获取职位分站id
 
-             $subsite_id = get_jobs_subsite_id($val);
 
-             //判断分站是否可以访问
 
-             check_url(Cache::get('subsite_id'), $subsite_id);
 
-         }*/
 
-         if ($val->deadline < time()) {
 
-             $val->jobs_overtime = 1;
 
-         } elseif ($val->audit <> '1' || $val->display <> '1' || ($val->setmeal_deadline <> '0' && $val->setmeal_deadline < time())) {
 
-             $val->jobs_overtime = 2;
 
-         }
 
-         if ($val->setmeal_deadline < time() && $val->setmeal_deadline <> "0" && $val->add_mode == "2") {
 
-             $val->deadline = $val->setmeal_deadline;
 
-         }
 
-         if ($val->amount == 0) {
 
-             $val->amount = '若干';
 
-         }
 
-         $subsite_id = get_jobs_subsite_id($val);
 
-         $val->jobs_url = route(url_rewrite('AIX_jobsshow', null, $subsite_id), array('id'=>$val['id']));
 
-         $setmeal = $this->membersSetmealRepository->getSetmealByUid($val->company_id, $companyInfo->utype);
 
-         $val->show_contact_direct = $setmeal->show_contact_direct;
 
-         $profile = $this->companyRepository->getCompanyInfo(array('id'=>$val->company_id));
 
-         $profile->setmeal_id = $setmeal->setmeal_id;
 
-         $profile->setmeal_name = $setmeal->setmeal_name;
 
-         $val->company = $profile;
 
-         $val->contact =$this->jobsContactRepository->getContactInfo(array('job_id'=>$val->id));
 
-         $val->expire = sub_day($val->deadline, time());
 
-         $val->contents = htmlspecialchars_decode($val->contents, ENT_QUOTES);
 
-         $val->refresh_time_cn = daterange(time(), $val->refresh_time, 'Y-m-d', "#FF3300");
 
-         $val->company_url = route(url_rewrite('AIX_companyshow'), array('id'=>$val->company_id));
 
-         if ($val->company->logo) {
 
-             $val->company->logo=upload_asset($val->company->logo);
 
-         } else {
 
-             $val->company->logo = public_data_path('data/upload/no_logo.png');
 
-         }
 
-         if ($val->company->website) {
 
-             $val->company->website_ = $val->company->website;
 
-             if ((strstr($val->company->website, "http://") === false) && (strstr($val->company->website, "https://") === false)) {
 
-                 $val->company->website = "http://".$val->company->website;
 
-             } else {
 
-                 if (strstr($val->company->website, "http://") === false) {
 
-                     $val->company->website_ = str_replace("https://", "", $val->company->website_);
 
-                 } else {
 
-                     $val->company->website_ = str_replace("http://", "", $val->company->website_);
 
-                 }
 
-             }
 
-         }
 
-         //薪资待遇
 
-         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 . '/月';
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         $age = $val->age;
 
-         if (count($age)>1) {
 
-             if (!$age[0] && !$age[1]) {
 
-                 $val->age_cn = '不限';
 
-             } else {
 
-                 if ($age[0] && $age[1]) {
 
-                     $val->age_cn = $age[0].'-'.$age[1].'岁';
 
-                 } else {
 
-                     $age[0] && $val->age_cn = $age[0].'岁以上';
 
-                     $age[1] && $val->age_cn = $age[1].'岁以下';
 
-                 }
 
-             }
 
-         } else {
 
-             $val->age_cn = $val->age_cn = (int)$age[0].'岁以上';
 
-         }
 
-         $other_categories = $this->categoryRepository->getCategories();
 
-         //企业性质
 
-         if ($other_categories) {
 
-             $company_types = array_get($other_categories, 'AIX_company_type');
 
-             if ($company_types) {
 
-                 $type_cn = array_get($company_types, $val->company->nature);
 
-                 if ($type_cn) {
 
-                     $val->company->nature_cn = $type_cn['demand'];
 
-                 }
 
-             }
 
-             //企业行业
 
-             $company_trades = array_get($other_categories, 'AIX_trade');
 
-             if ($company_trades) {
 
-                 $trade_cn = array_get($company_trades, $val->company->trade);
 
-                 if ($trade_cn) {
 
-                     $val->company->trade_cn = $trade_cn['demand'];
 
-                 }
 
-             }
 
-             //企业规模
 
-             $company_scales = array_get($other_categories, 'AIX_scale');
 
-             if ($company_scales) {
 
-                 $scale_cn = array_get($company_scales, $val->company->scale);
 
-                 if ($scale_cn) {
 
-                     $val->company->scale_cn = $scale_cn['demand'];
 
-                 }
 
-             }
 
-         } else {
 
-             $val->company->nature_cn = '';
 
-             $val->company->trade_cn = '';
 
-             $val->company->scale_cn = '';
 
-         }
 
-         //标签
 
-         $job_tags = array();
 
-         if ($other_categories) {
 
-             $job_tags = array_get($other_categories, 'AIX_jobtag');
 
-         }
 
-         if (implode(',', $val->tag)) {
 
-             $tag_cn = array();
 
-             foreach ($val->tag as $k => $v) {
 
-                 $tag = array_get($job_tags, $v);
 
-                 $tag_cn[] = $tag['demand'];
 
-             }
 
-             $val->tag_cn = $tag_cn;
 
-         } else {
 
-             $val->tag_cn = array();
 
-         }
 
-         if ($other_categories) {
 
-             //工作性质
 
-             $job_nature = array_get($other_categories, 'AIX_jobs_nature');
 
-             if ($job_nature) {
 
-                 $nature_cn = array_get($job_nature, $val->nature);
 
-                 if ($nature_cn) {
 
-                     $val->nature_cn = $nature_cn['demand'];
 
-                 } else {
 
-                     $val->nature_cn = '不限';
 
-                 }
 
-             }
 
-             //工作经验
 
-             $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 = '不限';
 
-             }
 
-             //职位类别
 
-             $categories = array();
 
-             if (Cache::has('jobs_cate_list')) {
 
-                 $categories = Cache::get('jobs_cate_list');
 
-             } else {
 
-                 $categories = $this->categoryJobsRepository->jobsCateInfoCache();
 
-                 Cache::put('jobs_cate_list', $categories, '86400');
 
-             }
 
-             $category = array();
 
-             if ($val->subclass) {
 
-                 $category = array_get($categories['id'], $val->subclass);
 
-             } elseif ($val->category) {
 
-                 $category = array_get($categories['id'], $val->category);
 
-             } elseif ($val->topclass) {
 
-                 $category = array_get($categories['id'], $val->topclass);
 
-             }
 
-             if ($category) {
 
-                 $val->category_cn = $category['name'];
 
-             } else {
 
-                 $val->category_cn =  '';
 
-             }
 
-             //职位类别
 
-             if ($this->app_spell) {
 
-                 $spell = $val->category ? $val->category : $val->topclass;
 
-                 if ($spell) {
 
-                     $val->jobcategory = $categories['id'][$spell]['spell'];
 
-                 } else {
 
-                     $val->jobcategory = '';
 
-                 }
 
-                 $val->jobcategory_id = $spell;
 
-             } else {
 
-                 $val->jobcategory = intval($val->topclass).".".intval($val->category).".0";
 
-                 $val->jobcategory_id = $val->category ? $val->category : $val->topclass;
 
-             }
 
-             //用工形式
 
-             $company_ygxs = array_get($other_categories, 'AIX_ygxs');
 
-             if ($company_ygxs) {
 
-                 $ygxs_cn = array_get($company_ygxs, $val->ygxs);
 
-                 if ($ygxs_cn) {
 
-                     $val->ygxs_cn = $ygxs_cn['demand'];
 
-                 } else {
 
-                     $val->ygxs_cn = '不限';
 
-                 }
 
-             }
 
-             //技能等级
 
-             $techlevels = array_get($other_categories, 'AIX_techlevel');
 
-             if ($techlevels) {
 
-                 $techlevel_cn = array_get($techlevels, $val->techlevel);
 
-                 if ($techlevel_cn) {
 
-                     $val->techlevel_cn = $techlevel_cn['demand'];
 
-                 } else {
 
-                     $val->techlevel_cn = '不限';
 
-                 }
 
-             }
 
-             //试用期
 
-             $syqs = array_get($other_categories, 'zs_syq');
 
-             if ($syqs) {
 
-                 if (empty($val->syq)) {
 
-                     $val->syq = 367;
 
-                 }
 
-                 $syq_cn = array_get($syqs, $val->syq);
 
-                 if ($syq_cn) {
 
-                     $val->syq_cn = $syq_cn['demand'];
 
-                 } else {
 
-                     $val->syq_cn = '无';
 
-                 }
 
-             }
 
-             //试用期工资:
 
-             if ($val->wage == -1) {
 
-                 $val->syqxz_min_cn='面议';
 
-             } else {
 
-                 $val->syqxz_min_cn=$val->syqxz_min.'元/月';
 
-             }
 
-         }
 
-         //性别要求
 
-         if ($val->sex =='1') {
 
-             $val->sex_cn = '男';
 
-         } elseif ($val->sex =='2') {
 
-             $val->sex_cn = '女';
 
-         } else {
 
-             $val->sex_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);
 
-         }
 
-         //企业所在地区
 
-         if (!strpos($val->company->district, ".")) { //直接读取地区信息
 
-             $district_cn = array_get($city_cates['id'], $val->company->district);
 
-             if ($district_cn) {
 
-                 $val->company->district_cn = $district_cn['name'];
 
-             }
 
-         } else {//处理地区信息
 
-             $c_district = explode('.', $val->company->district);
 
-             $district_cn = [];
 
-             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);
 
-             $val->company->district_cn = $district_cn;
 
-         }
 
-         //处理联系方式是否显示
 
-         $hide = true;
 
-         if (isMobile()) {
 
-             $showjobcontact = config('aix.companyset.comset.contact_set.showjobcontact_wap');
 
-         } else {
 
-             $showjobcontact = config('aix.companyset.comset.contact_set.showjobcontact');
 
-         }
 
-         if ($showjobcontact == 0) {
 
-             $hide = false;
 
-         } elseif ($showjobcontact == 1) {
 
-             if ($user) {
 
-                 $hide = false;
 
-             }
 
-         }
 
-         //判断是否是企业用户自己创建的职位
 
-         if ($hide) {
 
-             if ($user && $user->utype ==1 && $val->company_id == $user->id) {
 
-                 $hide = false;
 
-             }
 
-         }
 
-         if ($hide) {
 
-             if ($val->contact->telephone) {
 
-                 $val->contact->telephone = contact_hide($val->contact->telephone);
 
-             } else {
 
-                 $val->contact->telephone = contact_hide(trim(implode('-', $val->contact->landline_tel), '-'), 1);
 
-             }
 
-         } else {
 
-             if ($user && $user->utype ==1 && $val->company_id == $user->id) {
 
-                 $val->contact->contact_show = 1;
 
-                 $val->contact->telephone_show = 1;
 
-                 if (!$val->contact->telephone) {
 
-                     $val->contact->telephone = trim(implode('-', $val->contact->landline_tel), '-');
 
-                 }
 
-             } else {
 
-                 if ($val->contact->telephone_show==0 && $val->contact->landline_tel_show==0) {
 
-                     $val->contact->telephone_show = 0;
 
-                 } elseif ($val->contact->telephone_show==1 && $val->contact->telephone) {
 
-                     $val->contact->telephone_show = $val->contact->telephone_show;
 
-                 } elseif ($val->contact->telephone && (!$val->contact->landline_tel || ($val->contact->landline_tel && !trim(implode('-', $val->contact->landline_tel), '-'))) && $val->contact->telephone_show==0) {
 
-                     $val->contact->telephone_show = $val->contact->telephone_show;
 
-                 } else {
 
-                     $val->contact->telephone = trim(implode('-', $val->contact->landline_tel), '-');
 
-                     $val->contact->telephone_show = $val->contact->landline_tel_show;
 
-                 }
 
-             }
 
-         }
 
-         $val->contact->telephone_ = $val->contact->telephone;
 
-         if (config('aix.companyset.comset.contact_type_set.contact_img_com') == 2) {
 
-             $pwdhash = config('aix.system.site_other.site_other.pwb_hash');
 
-             $val->contact->telephone = "<img src='".route('common.contact_img', array('text'=>encrypt($val->contact->telephone, $pwdhash),'type'=>'phone'))."' />";
 
-         } elseif (config('aix.companyset.comset.contact_type_set.contact_img_com') == 3 && C('LOG_SOURCE')!=2) {// 扫码获取
 
-             $val->contact->telephone = '';
 
-         }
 
-         $val->hide = $hide;
 
-         //简历处理效率
 
-         $app_where[] = array('jobs_id','=',$val->id);
 
-         $app_where[] = array('created_at','>',date('Y-m-d H:i:s', strtotime("-14day")));
 
-         $apply = $this->personalJobsApplyRepository->getJobsApply($app_where);
 
-         $val->deliver = 0;
 
-         $reply = 0;
 
-         $reply_time = 0;
 
-         foreach ($apply as $key => $v) {
 
-             if ($v->is_reply) {
 
-                 $reply++;
 
-                 if ($v->reply_time) {
 
-                     $reply_time += $v->reply_time - strtotime($v->created_at);
 
-                 }
 
-             }
 
-             if ($user && $user->utype==2 && $user->id == $v->personal_uid) {
 
-                 $val->deliver = 1;
 
-             }
 
-         }
 
-         if (count($apply)) {
 
-             $val->company->reply_ratio = !$apply ? '0%' : intval($reply / count($apply) * 100).'%';
 
-         } else {
 
-             $val->company->reply_ratio = '0%';
 
-         }
 
-         $val->company->reply_time = !$reply_time ? '0天' : sub_day(intval($reply_time / count($apply)), 0);
 
-         if (!$val->company->last_login_time) {
 
-             $val->company->last_login_time = '未登录';
 
-         }
 
-         if ($user && $user->utype == 2) {
 
-             $resume = $this->resumeRepository->getPersonInfo($user->id);
 
-             $val->resume = $resume;
 
-             if ($resume) {
 
-                 $val->resume->url = route(url_rewrite('AIX_resumeshow'), ['id'=>$val->resume->id]);
 
-             }
 
-             //判断是否在黑名单
 
-             $shield_where = [
 
-                 'uid' => $user->id,
 
-                 'company_id' => $val->company_id
 
-             ];
 
-             if(!$this->ResumePrivacyRepository->getShield($shield_where))
 
-             {
 
-                 //没有记录访问记录
 
-                 $log_where = array('uid'=>$user->id,'job_id'=>$val->id);
 
-                 $view_log = $this->viewJobRepository->getLog($log_where, 1);
 
-                 if ($view_log) {
 
-                     $log_data = array('updated_at' => date('Y-m-d H:i:s', time()));
 
-                     $this->viewJobRepository->update($log_data, $log_where);
 
-                 } else {
 
-                     $time = date('Y-m-d H:i:s', time());
 
-                     $log_data = array(
 
-                         'uid'        => $user->id,
 
-                         'job_id'     => $val->id,
 
-                         'company_id' => $val->company_id,
 
-                         'created_at' => $time,
 
-                         'updated_at' => $time
 
-                     );
 
-                     $this->viewJobRepository->addLog($log_data);
 
-                 }
 
-             }
 
-             //检测是否已收藏
 
-             $favor_log = $this->personFavoriteRepository->getInfo(array('job_id'=>$val->id,'uid'=>$user->id));
 
-             if ($favor_log) {
 
-                 $val->favor = 1;
 
-             } else {
 
-                 $val->favor = 0;
 
-             }
 
-         } else {
 
-             $val->favor = 0;
 
-         }
 
-         //来源分站名称
 
-         $subsites = Cache::get('subsites_list');
 
-         if (array_has($subsites, $val->subsite_id)) {
 
-             $val->subsite_cn = $subsites[$val->subsite_id]['sitename'];
 
-         } else {
 
-             $val->subsite_cn = '';
 
-         }
 
-         // if(!$this->memberLogRepository->createLog(auth('web-company')->user(),2034,$where['id'])){
 
-         //     throw new \Exception("日志记失败!");
 
-         // }
 
-         return ['status'=>1, 'job'=>$val];
 
-     }
 
-     public function incrementData($where, $num, $filed)
 
-     {
 
-         return $this->jobsRepository->incrementData($where, $num, $filed);
 
-     }
 
-     //获取紧急招聘职位
 
-     public function getEmergencyJobs($limit = '')
 
-     {
 
-         $emergency_jobs = array();
 
-         $emergency_where = array(
 
-             array('valid','=','1'),
 
-             array('emergency','=','1')
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-             $emergency_where[] = array('audit','=',1);
 
-         } else {
 
-             $emergency_where[] = array('audit','<>',3);
 
-         }
 
-         $emergency_where[] = array('display','=',1);
 
-         $emergency_where[] = array('valid','=',1);
 
-         $emergency_jobs = $this->getOtherJobs($emergency_where, $limit);
 
-         return $emergency_jobs;
 
-     }
 
-     //获取最新职位
 
-     public function getNewJobs($limit = '')
 
-     {
 
-         $new_jobs = array();
 
-         $where = array(
 
-             array('valid','=','1'),
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-             $where[] = array('audit','=',1);
 
-         } else {
 
-             $where[] = array('audit','<>',3);
 
-         }
 
-         $where[] = array('display','=',1);
 
-         $where[] = array('valid','=',1);
 
-         $where[] = array('deadline','>',time());
 
-         $jobs = $this->jobsRepository->getCompanyJobs($where, array(), array('refresh_time'=>'desc'), $limit);
 
-         if ($jobs->isNotEmpty()) {
 
-             $other_categories = $this->categoryRepository->getCategories();
 
-             if ($other_categories) {
 
-                 $wages = array_get($other_categories, 'AIX_wage');
 
-                 $educations = array_get($other_categories, 'AIX_education');
 
-                 $experiences = array_get($other_categories, 'AIX_experience');
 
-                 $natures     = array_get($other_categories, 'AIX_job_nature');
 
-             } else {
 
-                 $wages = array();
 
-                 $educations = array();
 
-                 $experiences = array();
 
-                 $natures = array();
 
-             }
 
-             $city_cates = Cache::get('city_cate_list');
 
-             if (null === $city_cates) {
 
-                 $city_cates = $this->categoryDistrictRepository->cityCateCache();
 
-                 Cache::put('city_cate_list', $city_cates, '86400');
 
-             }
 
-             foreach ($jobs as $k => $v) {
 
-                 //修改薪资信息
 
-                 $jobs[$k]->wage_cn = '薪资面议';
 
-                 if ($wages) {
 
-                     if ($wage= array_get($wages, $v->wage)) {
 
-                         $jobs[$k]->wage_cn = $wage['demand'];
 
-                         if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                             $jobs[$k]->wage_cn = array_has($wages, [$v->wage])?$wages[$v->wage]['k_demand']:'面议';
 
-                         } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
 
-                             $jobs[$k]->wage_cn = array_has($wages, [$v->wage])?$wages[$v->wage]['c_demand']:'面议';
 
-                         }
 
-                     }
 
-                 }
 
-                 //修改学历
 
-                 $jobs[$k]->education_cn = '学历不限';
 
-                 if ($educations) {
 
-                     if ($education = array_get($educations, $v->education)) {
 
-                         $jobs[$k]->education_cn = $education['demand'];
 
-                     }
 
-                 }
 
-                 //工作经验
 
-                 $jobs[$k]->experience_cn = '经验不限';
 
-                 if ($experiences) {
 
-                     if ($experience = array_get($experiences, $v->experience)) {
 
-                         $jobs[$k]->experience_cn = $experience['demand'];
 
-                     }
 
-                 }
 
-                 //职位性质
 
-                 $jobs[$k]->nature_cn = '不限';
 
-                 if ($natures) {
 
-                     if ($nature = array_get($natures, $v->nature)) {
 
-                         $jobs[$k]->nature_cn = $nature['demand'];
 
-                     }
 
-                 }
 
-                 //修改工作所在地
 
-                 $jobs[$k]->district_cn ='';
 
-                 if (!strpos($v->district, ".")) {
 
-                     $district_cn = array_get($city_cates['id'], $v->district);
 
-                     if ($district_cn) {
 
-                         $jobs[$k]->district_cn = $district_cn['name'];
 
-                     }
 
-                 } else {
 
-                     $c_district = explode('.', $v->district);
 
-                     $district_cn = array();
 
-                     foreach ($c_district as $j => $val) {
 
-                         if ($val) {
 
-                             $district_info = array_get($city_cates['id'], $val);
 
-                             if ($district_info) {
 
-                                 $district_cn[] = $district_info['name'];
 
-                             }
 
-                         }
 
-                     }
 
-                     $district_cn = implode('/', $district_cn);
 
-                     $jobs[$k]->district_cn = $district_cn;
 
-                 }
 
-                 //企业logo
 
-                 $company = $v->company;
 
-                 if ($company->logo) {
 
-                     $jobs[$k]->company_logo=upload_asset($company->logo);
 
-                 } else {
 
-                     $jobs[$k]->company_logo = public_data_path('data/upload/no_logo.png');
 
-                 }
 
-             }
 
-             $new_jobs = $jobs;
 
-         }
 
-         return $new_jobs;
 
-     }
 
-     public function getOtherJobs($where, $limit = '')
 
-     {
 
-         $lists = $this->jobsRepository->getOtherJobs($where, $limit);
 
-         if (!$lists->toArray()) {
 
-             return $lists;
 
-         } else {
 
-             $other_categories = $this->categoryRepository->getCategories();
 
-             if ($other_categories) {
 
-                 $wages = array_get($other_categories, 'AIX_wage');
 
-                 $educations = array_get($other_categories, 'AIX_education');
 
-                 $experiences = array_get($other_categories, 'AIX_experience');
 
-                 $natures     = array_get($other_categories, 'AIX_job_nature');
 
-             } else {
 
-                 $wages = array();
 
-                 $educations = array();
 
-                 $experiences = array();
 
-                 $natures = array();
 
-             }
 
-             $city_cates = Cache::get('city_cate_list');
 
-             if (null === $city_cates) {
 
-                 $city_cates = $this->categoryDistrictRepository->cityCateCache();
 
-                 Cache::put('city_cate_list', $city_cates, '86400');
 
-             }
 
-             foreach ($lists as $k => $v) {
 
-                 //修改薪资信息
 
-                 $lists[$k]->wage_cn = '面议';
 
-                 if ($v->wage >0) {
 
-                     if ($wages) {
 
-                         if ($wage= array_get($wages, $v->wage)) {
 
-                             $lists[$k]->wage_cn = $wage['demand'];
 
-                             if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                                 $lists[$k]->wage_cn = array_has($wages, [$v->wage])?$wages[$v->wage]['k_demand']:'面议';
 
-                             } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
 
-                                 $lists[$k]->wage_cn = array_has($wages, [$v->wage])?$wages[$v->wage]['c_demand']:'面议';
 
-                             }
 
-                         }
 
-                     }
 
-                 } elseif ($v->wage == 0) {
 
-                     $lists[$k]->wage_cn = $this->dealWage($v->wage, $v->wage_min, $v->wage_max);
 
-                 }
 
-                 //修改学历
 
-                 $lists[$k]->education_cn = '学历不限';
 
-                 if ($educations) {
 
-                     if ($education = array_get($educations, $v->education)) {
 
-                         $lists[$k]->education_cn = $education['demand'];
 
-                     }
 
-                 }
 
-                 //工作经验
 
-                 $lists[$k]->experience_cn = '经验不限';
 
-                 if ($experiences) {
 
-                     if ($experience = array_get($experiences, $v->experience)) {
 
-                         $lists[$k]->experience_cn = $experience['demand'];
 
-                     }
 
-                 }
 
-                 //职位性质
 
-                 $lists[$k]->nature_cn = '不限';
 
-                 if ($natures) {
 
-                     if ($nature = array_get($natures, $v->nature)) {
 
-                         $lists[$k]->nature_cn = $nature['demand'];
 
-                     }
 
-                 }
 
-                 //修改工作所在地
 
-                 $lists[$k]->district_cn ='';
 
-                 if (!strpos($v->district, ".")) {
 
-                     $district_cn = array_get($city_cates['id'], $v->district);
 
-                     if ($district_cn) {
 
-                         $lists[$k]->district_cn = $district_cn['name'];
 
-                     }
 
-                 } else {
 
-                     $c_district = explode('.', $v->district);
 
-                     $district_cn = array();
 
-                     foreach ($c_district as $j => $val) {
 
-                         if ($val) {
 
-                             $district_info = array_get($city_cates['id'], $val);
 
-                             if ($district_info) {
 
-                                 $district_cn[] = $district_info['name'];
 
-                             }
 
-                         }
 
-                     }
 
-                     $district_cn = implode('/', $district_cn);
 
-                     $lists[$k]->district_cn = $district_cn;
 
-                 }
 
-                 //年龄限制
 
-                 if (is_array($v->age)) {
 
-                     if (implode('', $v->age)=='') {
 
-                         $lists[$k]->age_cn = '不限';
 
-                     } else {
 
-                         $lists[$k]->age_cn = implode('-', $v->age).'岁';
 
-                     }
 
-                 } else {
 
-                     if ($v->age == '-' || $v->age == '0') {
 
-                         $lists[$k]->age_cn = '不限';
 
-                     } else {
 
-                         $lists[$k]->age_cn = $v->age.'岁';
 
-                     }
 
-                 }
 
-                 $lists[$k]->refresh_time_cn = date('Y-m-d', $v->refresh_time);
 
-             }
 
-         }
 
-         return $lists;
 
-     }
 
-     //收藏职位
 
-     public function jobFavor($job_id)
 
-     {
 
-         if (!$job_id) {
 
-             throw new ResponseException('请选择要收藏的职位!');
 
-         }
 
-         if (!is_array($job_id)) {
 
-             $jobs_id = explode(',', $job_id);
 
-         } else {
 
-             $jobs_id = $job_id;
 
-         }
 
-         if (count($jobs_id) == 1) { //单个收藏
 
-             $jobInfo = $this->jobsRepository->getJobsById($job_id);
 
-             if (!$jobInfo) {
 
-                 throw new ResponseException('请选择有效职位!');
 
-             }
 
-             //判断当前职位是否已收藏
 
-             $uid = auth('web-member')->user()->id;
 
-             $favor_log = $this->personFavoriteRepository->getInfo(array('job_id'=>$job_id,'uid'=>$uid));
 
-             if ($favor_log) {
 
-                 //throw new ResponseException('您已经收藏该职位,不能重复收藏!');
 
-                 //取消收藏
 
-                 $cancel_rst = $this->personFavoriteRepository->cancelFavor(array('job_id'=>$job_id,'uid'=>$uid));
 
-                 if (!$cancel_rst) {
 
-                     throw new ResponseException('取消收藏失败!');
 
-                 }
 
-                 //return true;
 
-                 return 1;
 
-             }
 
-             $time = date('Y-m-d H:i:s', time());
 
-             $favor_data = array(
 
-                 'uid' => $uid,
 
-                 'job_id' => $job_id,
 
-                 'job_name' => $jobInfo->jobs_name,
 
-                 'created_at' => $time,
 
-                 'updated_at'=>$time
 
-             );
 
-             $add_res = $this->personFavoriteRepository->addData($favor_data);
 
-             if ($add_res) {
 
-                 //return true;
 
-                 return 2;
 
-             } else {
 
-                 throw new ResponseException('收藏失败!');
 
-             }
 
-         } else {
 
-             //批量收藏
 
-             //获取所选有效职位信息
 
-             //获取当前用户收藏的所有职位信息
 
-             //所选职位是否已收藏,组成添加数据
 
-             $jobs = $this->jobsRepository->getJobs($jobs_id);
 
-             $fav_jobs = $this->getFavoriteJobs(array('uid'=>auth('web-member')->user()->id), 'job_id');
 
-             $fav_data = array();
 
-             $stime = date('Y-m-d H:i:s', time());
 
-             foreach ($jobs as $k => $v) {
 
-                 if (!$fav_jobs || ($fav_jobs && !array_has($fav_jobs, $v->id))) {
 
-                     $fav_data[] = array(
 
-                         'uid'        => auth('web-member')->user()->id,
 
-                         'job_id'     => $v->id,
 
-                         'job_name'   => $v->jobs_name,
 
-                         'created_at' => $stime,
 
-                         'updated_at' => $stime
 
-                     );
 
-                 }
 
-             }
 
-             if ($fav_data) {
 
-                 $rst = $this->personFavoriteRepository->insertData($fav_data);
 
-                 if ($rst) {
 
-                     return true;
 
-                 } else {
 
-                     throw new ResponseException('收藏失败!');
 
-                 }
 
-             } else {
 
-                 throw new ResponseException('您已经收藏所选职位,不能重复收藏!');
 
-             }
 
-         }
 
-     }
 
-     //获取企业会员审核通过的职位(有效、通过审核(后台职位显示设置要求)、在招的职位)
 
-     public function getAuditJobs($company_id)
 
-     {
 
-         $where = array(
 
-             array('company_id','=',$company_id),
 
-             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');
 
-         }
 
-         return $this->jobsRepository->getOtherJobsCount($where);
 
-     }
 
-     public function getAuditJobsNum($company_id)
 
-     {
 
-         $rst = $this->getAuditJobs($company_id);
 
-         return count($rst);
 
-     }
 
-     public function dealjobList($data, $limit)
 
-     {
 
-         $list = array();
 
-         if ($data) {
 
-             $wage_categories = $this->categoryRepository->getCategories();
 
-             foreach ($data as $key => $val) {
 
-                 if ($limit && ($key >= $limit)) {
 
-                     break;
 
-                 }
 
-                 $list[$key] = $val;
 
-                 //薪资字段
 
-                 if ($val->wage > 0) {
 
-                     if ($wage_categories) {
 
-                         if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                             $list[$key]->wage_cn = array_has($wage_categories['AIX_wage_k'], [$val->wage])?$wage_categories['AIX_wage_k'][$val->wage]:'面议';
 
-                         } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
 
-                             $list[$key]->wage_cn = array_has($wage_categories['AIX_wage_c'], [$val->wage])?$wage_categories['AIX_wage_c'][$val->wage]:'面议';
 
-                         }
 
-                     }
 
-                 } elseif ($val->wage==0) {
 
-                     $list[$key]->wage_cn = $this->dealWage($val->wage, $val->wage_min, $val->wage_max);
 
-                 } else {
 
-                     $list[$key]->wage_cn = '面议';
 
-                 }
 
-                 $list[$key]->experience_cn = '经验不限';
 
-                 $list[$key]->education_cn = '学历不限';
 
-                 $other_categories = $this->categoryRepository->getCategories();
 
-                 if ($other_categories) {
 
-                     if ($val->experience) {
 
-                         $job_experience = array_get($other_categories, 'AIX_experience');
 
-                         if ($job_experience) {
 
-                             $list[$key]->experience_cn = $job_experience[$val->experience]['demand'];
 
-                         }
 
-                     }
 
-                     if ($val->education) {
 
-                         $job_education = array_get($other_categories, 'AIX_education');
 
-                         if ($job_education) {
 
-                             $list[$key]->education_cn = $job_education[$val->education]['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($val->district, ".")) {
 
-                     if (array_get($city_cates['id'], $val->district)) {
 
-                         $list[$key]->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) {
 
-                                 $list[$key]->district_cn = $parent_district['name'].$list[$key]->district_cn;
 
-                                 if ($parent_district['parent_id'] > 0) {
 
-                                     $pp_district = array_get($city_cates['id'], $parent_district['parent_id']);
 
-                                     if ($pp_district) {
 
-                                         $list[$key]->district_cn = $pp_district['name'].$list[$key]->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'];
 
-                             }
 
-                         }
 
-                     }
 
-                     $list[$key]->district_cn = implode('/', $city_district_cn);
 
-                 }
 
-             }
 
-         }
 
-         return $list;
 
-     }
 
-     public function dealWage($wage, $minwage, $maxwage,$ygxs = 0)
 
-     {
 
-         // 小时工处理
 
-         $date_str = '月';
 
-         if($ygxs == 363){
 
-             $date_str = '小时';
 
-         }else{
 
-             if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                 $minwage = $minwage%1000==0?(($minwage/1000).'K'):(round($minwage/1000, 1).'K');
 
-                 if ($minwage == 0) {
 
-                     $maxwage = '以上';
 
-                 } else {
 
-                     $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) {
 
-                         $minwage = ($minwage/10000).'万';
 
-                     } else {
 
-                         $minwage = round($minwage/10000, 1);
 
-                         $minwage = strpos($minwage, '.') ? str_replace('.', '万', $minwage) : $minwage.'万';
 
-                     }
 
-                 } else {
 
-                     if ($minwage%1000 == 0) {
 
-                         $minwage = ($minwage/1000).'千';
 
-                     } else {
 
-                         $minwage = round($minwage/1000, 1);
 
-                         $minwage = strpos($minwage, '.') ? str_replace('.', '千', $minwage) : $minwage.'千';
 
-                     }
 
-                 }
 
-                 if ($maxwage > 0) {
 
-                     if ($maxwage >= 10000) {
 
-                         if ($maxwage%10000 == 0) {
 
-                             $maxwage = ($maxwage/10000).'万';
 
-                         } else {
 
-                             $maxwage = round($maxwage/10000, 1);
 
-                             $maxwage = strpos($maxwage, '.') ? str_replace('.', '万', $maxwage) : $maxwage.'万';
 
-                         }
 
-                     } elseif ($maxwage) {
 
-                         if ($maxwage%1000 == 0) {
 
-                             $maxwage = ($maxwage/1000).'千';
 
-                         } else {
 
-                             $maxwage = round($maxwage/1000, 1);
 
-                             $maxwage = strpos($maxwage, '.') ? str_replace('.', '千', $maxwage) : $maxwage.'千';
 
-                         }
 
-                     } else {
 
-                         $maxwage = '0';
 
-                     }
 
-                 } else {
 
-                     $maxwage = '0';
 
-                 }
 
-             }
 
-         }
 
-         if ($minwage == $maxwage) {
 
-             if($ygxs == 363){
 
-                 $wage_cn = $minwage.'元/'.$date_str;
 
-             }else{
 
-                 $wage_cn = $minwage.'/'.$date_str;
 
-             }
 
-         } else {
 
-             if ($minwage>0 && $maxwage==0) {
 
-                 $wage_cn = $minwage.'以上/'.$date_str;
 
-             } elseif ($wage==0 && $minwage==0 && $maxwage==0) {
 
-                 $wage_cn = $minwage.'以上/'.$date_str;
 
-             } else {
 
-                 $wage_cn = $minwage.'~'.$maxwage.'/'.$date_str;
 
-             }
 
-         }
 
-         return $wage_cn;
 
-     }
 
-     public function dealjobFilelds($list, $map_data = array(), $limit = '')
 
-     {
 
-         $favor_jobs = array();
 
-         $apply_jobs = array();
 
-         if (auth('web-member')->check()) {
 
-             //个人用户登录时获取个人收藏的简历信息和一段时间间隔内已申请的职位信息 config('aix.personal_set.per_set.per_set.apply_job_space')
 
-             $favor_where = array('uid'=> auth('web-member')->user()->id);
 
-             $favor_jobs = $this->getFavoriteJobs($favor_where);
 
-             $space_time = (integer)config('aix.personal_set.per_set.per_set.apply_job_space');
 
-             $stime = date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-".$space_time." day"))));
 
-             $apply_where = array(array('personal_uid','=',auth('web-member')->user()->id),array('created_at','>=',$stime));
 
-             $apply_jobs = $this->getApplyJobs($apply_where);
 
-         }
 
-         $other_categories = $this->categoryRepository->getCategories();
 
-         $wage_categories = $this->categoryRepository->getCategories();
 
-         $city_cates = Cache::get('city_cate_list');
 
-         if (null === $city_cates) {
 
-             $city_cates = $this->categoryDistrictRepository->cityCateCache();
 
-             Cache::put('city_cate_list', $city_cates, '86400');
 
-         }
 
-         $categories = array();
 
-         if (Cache::has('jobs_cate_list')) {
 
-             $categories = Cache::get('jobs_cate_list');
 
-         } else {
 
-             $categories = $this->categoryJobsRepository->jobsCateInfoCache();
 
-             Cache::put('jobs_cate_list', $categories, '86400');
 
-         }
 
-         $filter_lat = '';
 
-         $filter_lng = '';
 
-         if ($map_data) {
 
-             $filter_lng = $map_data['lng'];
 
-             $filter_lat = $map_data['lat'];
 
-         }
 
-         $return_list = array();
 
-         foreach ($list as $key => $val) {
 
-             if ($limit && ($key >= $limit)) {
 
-                 break;
 
-             }
 
-             $return_list[$key] = $val;
 
-             if (!$val->company) {
 
-                 $companyInfo = $this->companyRepository->getCompanyInfo(['id'=>$val->company_id]);
 
-                 $return_list[$key]->company = $companyInfo;
 
-                 $val->company = $companyInfo;
 
-                 $val->company->membersSetmeal = $this->membersSetmealRepository->getSetmealByUid($companyInfo->id, 1);
 
-             }
 
-             //套餐图片
 
-             if ($val->company->membersSetmeal) {
 
-                 $val->setmeal_img = $val->company->membersSetmeal->setmeal_img;
 
-             } else {
 
-                 $val->setmeal_img = null;
 
-             }
 
-             if ($favor_jobs && array_has($favor_jobs, $val->id)) {
 
-                 $return_list[$key]->has_favor = 1;
 
-             } else {
 
-                 $return_list[$key]->has_favor = 0;
 
-             }
 
-             if ($apply_jobs && array_has($apply_jobs, $val->id)) {
 
-                 $return_list[$key]->has_deliver = 1;
 
-             } else {
 
-                 $return_list[$key]->has_deliver = 0;
 
-             }
 
-             //薪资字段
 
-             if ($val->wage == -1) {
 
-                 $return_list[$key]->wage_cn = '面议';
 
-             } else {
 
-                 if ($val->wage > 0) {
 
-                     if ($wage_categories) {
 
-                         if (config('aix.system.site_other.site_other.site_salary') == 1) {
 
-                             $return_list[$key]->wage_cn = array_has($wage_categories['AIX_wage_k'], [$val->wage])?$wage_categories['AIX_wage_k'][$val->wage]:'面议';
 
-                         } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
 
-                             $return_list[$key]->wage_cn = array_has($wage_categories['AIX_wage_c'], [$val->wage])?$wage_categories['AIX_wage_c'][$val->wage]:'面议';
 
-                         }
 
-                     }
 
-                 } else {
 
-                     $return_list[$key]->wage_cn = $this->dealWage($val->wage, $val->wage_min, $val->wage_max,$val->ygxs);
 
-                 }
 
-             }
 
-             $return_list[$key]->experience_cn = '经验不限';
 
-             $return_list[$key]->nature_cn = '职位性质不限';
 
-             $return_list[$key]->education_cn = '学历不限';
 
-             $return_list[$key]->tag_cn = array();
 
-             $return_list[$key]->category_cn =  '';
 
-             $return_list[$key]->company->nature_cn = '';
 
-             $return_list[$key]->company->scale_cn = '';
 
-             if ($other_categories) {
 
-                 if ($val->experience) {
 
-                     $job_experience = array_get($other_categories, 'AIX_experience');
 
-                     if ($job_experience) {
 
-                         $return_list[$key]->experience_cn = $job_experience[$val->experience]['demand'];
 
-                     }
 
-                 }
 
-                 if ($val->nature) {
 
-                     $job_nature = array_get($other_categories, 'AIX_jobs_nature');
 
-                     if ($job_nature) {
 
-                         $return_list[$key]->nature_cn = $job_nature[$val->nature]['demand'];
 
-                     }
 
-                 }
 
-                 if ($val->education) {
 
-                     $job_education = array_get($other_categories, 'AIX_education');
 
-                     if ($job_education) {
 
-                         $return_list[$key]->education_cn = $job_education[$val->education]['demand'];
 
-                     }
 
-                 }
 
-                 $return_list[$key]->company_audit = $val->company->audit;
 
-                 $return_list[$key]->setmeal_id = $val->company->setmeal_id;
 
-                 $return_list[$key]->setmeal_name = $val->company->setmeal_name;
 
-                 $job_tags = array_get($other_categories, 'AIX_jobtag');
 
-                 if (implode(',', $val->tag)) {
 
-                     $tag_cn = array();
 
-                     foreach ($val->tag as $k => $v) {
 
-                         $tag = array_get($job_tags, $v);
 
-                         $tag_cn[] = $tag['demand'];
 
-                     }
 
-                     $return_list[$key]->tag_cn = $tag_cn;
 
-                 }
 
-                 //企业性质
 
-                 $company_types = array_get($other_categories, 'AIX_company_type');
 
-                 if ($company_types) {
 
-                     $type_cn = array_get($company_types, $val->company->nature);
 
-                     if ($type_cn) {
 
-                         $return_list[$key]->company->nature_cn= $type_cn['demand'];
 
-                     }
 
-                 }
 
-                 //企业规模
 
-                 $company_scales = array_get($other_categories, 'AIX_scale');
 
-                 if ($company_scales) {
 
-                     $scale_cn = array_get($company_scales, $val->company->scale);
 
-                     if ($scale_cn) {
 
-                         $return_list[$key]->company->scale_cn = $scale_cn['demand'];
 
-                     }
 
-                 }
 
-                 //企业行业
 
-                 $company_trades = array_get($other_categories, 'AIX_trade');
 
-                 if ($company_trades) {
 
-                     $trade_cn = array_get($company_trades, $val->company->trade);
 
-                     if ($trade_cn) {
 
-                         $return_list[$key]->company->trade_cn = $trade_cn['demand'];
 
-                     }
 
-                 }
 
-                 //企业logo
 
-                 if ($val->company->logo) {
 
-                     $return_list[$key]->company->logo = upload_asset($val->company->logo);
 
-                 } else {
 
-                     $return_list[$key]->company->logo = public_data_path('data/upload/no_logo.png');
 
-                 }
 
-             }
 
-             //职位类别
 
-             $category = array();
 
-             if ($val->subclass) {
 
-                 $category = array_get($categories['id'], $val->subclass);
 
-             } elseif ($val->category) {
 
-                 $category = array_get($categories['id'], $val->category);
 
-             } elseif ($val->topclass) {
 
-                 $category = array_get($categories['id'], $val->topclass);
 
-             }
 
-             if ($category) {
 
-                 $return_list[$key]->category_cn = $category['name'];
 
-             }
 
-             //工作地点
 
-             if (!strpos($val->district, ".")) {
 
-                 if (array_get($city_cates['id'], $val->district)) {
 
-                     $return_list[$key]->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) {
 
-                             $return_list[$key]->district_cn = $parent_district['name'].$return_list[$key]->district_cn;
 
-                             if ($parent_district['parent_id'] > 0) {
 
-                                 $pp_district = array_get($city_cates['id'], $parent_district['parent_id']);
 
-                                 if ($pp_district) {
 
-                                     $return_list[$key]->district_cn = $pp_district['name'].$return_list[$key]->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'];
 
-                         }
 
-                     }
 
-                 }
 
-                 $return_list[$key]->district_cn = implode('/', $city_district_cn);
 
-             }
 
-             //刷新时间
 
-             if (!$val->refresh_time) {
 
-                 $return_list[$key]->refresh_time = strtotime($val->updated_at);
 
-             }
 
-             //距离
 
-             if ($map_data) {
 
-                 $filter_lng = $map_data['lng'];
 
-                 $filter_lat = $map_data['lat'];
 
-                 $return_list[$key]->map_range = $this->getDistance($filter_lng, $filter_lat, $val->map_x, $val->map_y);
 
-             }
 
-             //招聘人数
 
-             if (!$val->amount) {
 
-                 $return_list[$key]->amount = '若干';
 
-             }
 
-             //年龄限制
 
-             if (is_array($val->age)) {
 
-                 /*
 
-                 if ((implode('', $val->age)=='') || ((int)implode('', $val->age)==0)) {
 
-                     $return_list[$key]->age_cn = '不限';
 
-                 } else {
 
-                     $return_list[$key]->age_cn = implode('-', $val->age).'岁';
 
-                 }*/
 
-                 if (count($val->age)>1) {
 
-                     $age = $val->age;
 
-                     if (!$age[0] && !$age[1]) {
 
-                         $return_list[$key]->age_cn = '不限';
 
-                     } else {
 
-                         if ($age[0] && $age[1]) {
 
-                             $return_list[$key]->age_cn = $age[0].'-'.$age[1].'岁';
 
-                         } else {
 
-                             $age[0] && $return_list[$key]->age_cn = $age[0].'岁以上';
 
-                             $age[1] && $return_list[$key]->age_cn = $age[1].'岁以下';
 
-                         }
 
-                     }
 
-                 } else {
 
-                     $age = $val->age;
 
-                     $return_list[$key]->age_cn = $val->age_cn = (int)$age[0].'岁以上';
 
-                 }
 
-             } else {
 
-                 if ($val->age == '-' || $val->age == '0') {
 
-                     $return_list[$key]->age_cn = '不限';
 
-                 } else {
 
-                     $return_list[$key]->age_cn = $val->age.'岁';
 
-                 }
 
-             }
 
-             //性别
 
-             if ($val->sex == 1) {
 
-                 $return_list[$key]->sex_cn = '男';
 
-             } elseif ($val->sex == 2) {
 
-                 $return_list[$key]->sex_cn = '女';
 
-             } else {
 
-                 $return_list[$key]->sex_cn = '不限';
 
-             }
 
-         }
 
-         return $return_list;
 
-     }
 
-     public function getApplyJobs($where, $field = 'jobs_id')
 
-     {
 
-         $rst = $this->personalJobsApplyRepository->getJobsApply($where);
 
-         $list = array();
 
-         if ($rst->toArray()) {
 
-             foreach ($rst as $key => $val) {
 
-                 $list[$val->$field] = $val;
 
-             }
 
-         }
 
-         return $list;
 
-     }
 
-     public function getFavoriteJobs($where, $field = 'job_id')
 
-     {
 
-         $rst = $this->personFavoriteRepository->getList($where);
 
-         $list = array();
 
-         if ($rst->toArray()) {
 
-             foreach ($rst as $key => $val) {
 
-                 $list[$val->$field] = $val;
 
-             }
 
-         }
 
-         return $list;
 
-     }
 
-     public function getDistance($lng1, $lat1, $lng2, $lat2)
 
-     {
 
-         $radLat1 = deg2rad($lat1);
 
-         $radLat2 = deg2rad($lat2);
 
-         $radLng1 = deg2rad($lng1);
 
-         $radLng2 = deg2rad($lng2);
 
-         $a = $radLat1 - $radLat2;
 
-         $b = $radLng1 - $radLng2;
 
-         $s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2))) * 6378.137;
 
-         return round($s, 2).'km';
 
-     }
 
-     public function dealJobCompanies($jobs)
 
-     {
 
-         $job_companys = array();
 
-         if ($jobs) {
 
-             foreach ($jobs as $k => $val) {
 
-                 if (!$job_companys || ($job_companys && !array_has($job_companys, $val->company_id))) {
 
-                     $job_companys[$val->company_id] = $val->company;
 
-                     $jobs_where = array(array('company_id','=',$val->company_id),array('valid','=',1),array('display','=',1));
 
-                     if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
 
-                         $jobs_where[] = array('audit','=','1');
 
-                     } else {
 
-                         $jobs_where[] = array('audit','<>','3');
 
-                     }
 
-                     $jobs = $this->getOtherJobs($jobs_where, 3);
 
-                     $job_companys[$val->company_id]->jobs = $jobs;
 
-                 }
 
-             }
 
-         }
 
-         return  array_values($job_companys);
 
-     }
 
-     //获取推荐职位
 
-     public function getRecommendOrder($user = array())
 
-     {
 
-         $order = array();
 
-         /*if (auth('web-member')->check()) {
 
-             $order = array('refresh_time'=>'desc');
 
-         } else {
 
-             $order = array('click'=>'desc','stime'=>'desc','refresh_time'=> 'desc');
 
-         }*/
 
-         $order = array('click'=>'desc','stime'=>'desc','refresh_time'=> 'desc');
 
-         return $order;
 
-     }
 
-     //TODO 修改用户读取方式
 
-     public function getRecommendWhere($user = array())
 
-     {
 
-         $where = array();
 
-         //个人会员
 
-         if ($user && $user->utype==2) {
 
-             $filter_resume = array(
 
-                 array('uid','=',$user->id)
 
-             );
 
-             if (config('aix.personal_set.per_set.show_set.resume_display')==2) {
 
-                 $filter_resume[] = array('audit','<>',0);
 
-             } else {
 
-                 $filter_resume[] = array('audit','=',2);
 
-             }
 
-             $resumes = $this->resumeRepository->getResumes($filter_resume);
 
-             if ($resumes->isNotEmpty()) {
 
-                 $or_where = array();
 
-                 foreach ($resumes as $k => $v) {
 
-                     $or_where[] = $this->setRecommendJobWhere($v);
 
-                 }
 
-                 $and_where = array();
 
-                 $and_where[] = array('valid','=',1);
 
-                 $and_where[] = array('display','=',1);
 
-                 if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-                     $and_where[] = array('audit','=',1);
 
-                 } else {
 
-                     $and_where[] = array('audit','<>',3);
 
-                 }
 
-                 $where['or'] = $or_where;
 
-                 $where['and'] = $and_where;
 
-             }
 
-             return $where;
 
-         } else {
 
-             //游客、企业会员 - 点击次数、置顶职位、刷新靠前的职位
 
-             /*$where[] = array('valid','=',1);
 
-             $where[] = array('display','=',1);
 
-             if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-                 $where[] = array('audit','=',1);
 
-             } else {
 
-                 $where[] = array('audit','<>',3);
 
-             }
 
-             $where[] = array('subsite_ids','=',get_subsite_id());*/
 
-             $where['and'][] = array('valid','=',1);
 
-             $where['and'][] = array('display','=',1);
 
-             if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-                 $where['and'][] = array('audit','=',1);
 
-             } else {
 
-                 $where['and'][] = array('audit','<>',3);
 
-             }
 
-             $where['and'][] = array('subsite_ids','=',get_subsite_id());
 
-         }
 
-         return $where;
 
-     }
 
-     //匹配个人推荐职位的查询条件
 
-     public function setRecommendJobWhere($resume)
 
-     {
 
-         $where = array();
 
-         /*$where[] = array('valid','=',1);
 
-         $where[] = array('display','=',1);
 
-         if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-             $where[] = array('audit','=',1);
 
-         } else {
 
-             $where[] = array('audit','<>',3);
 
-         }*/
 
-         //匹配性别
 
-         if ($resume->sex == 1) {
 
-             $where[] = array('sex','<>',2);
 
-         } else {
 
-             $where[] = array('sex','<>',1);
 
-         }
 
-         //匹配年龄age_min、age_max
 
-         $age = date("Y") - $resume->birthdate;
 
-         $where[] = array('age_min','<=',$age);
 
-         $where[] = array('age_max','>=',$age);
 
-         $where[] = array('education','<=',$resume->education);      //匹配学历
 
-         $where[] = array('experience','<=',$resume->experience);    //匹配工作经验
 
-         $where[] = array('nature','=',$resume->nature);              //匹配工作性质 - 精准匹配
 
-         //匹配期望行业trade - 如果没有值则不添加匹配条件
 
-         if ($resume->trade) {
 
-             $trades = explode(',', $resume->trade);
 
-             $where[] = array('trade','in',$trades);
 
-         }
 
-         //匹配期望职位 - 二级职位
 
-         $intention_jobs_cates = explode(',', $resume->intention_jobs_id);
 
-         $intention_cates = array();
 
-         foreach ($intention_jobs_cates as $k => $v) {
 
-             $i_ids = explode('.', $v);
 
-             if (array_has($i_ids, 1)) {
 
-                 $intention_cates[] = (int)$i_ids[1];
 
-             }
 
-         }
 
-         if ($intention_cates) {
 
-             $where[] = array('intention_jobs_id','in',$intention_cates);
 
-         }
 
-         //匹配工作地区(职位的工作地区)(三级地区存在时匹配三级地区,不存在时匹配二级地区)
 
-         $district = explode(',', $resume->district);
 
-         $district_ids = array();
 
-         if ($district) {
 
-             foreach ($district as $k => $v) {
 
-                 if (!strpos($v, ".")) {
 
-                     $district_ids[] = $v;
 
-                 } else {
 
-                     $district_arr = explode('.', $v);
 
-                     if (array_has($district_arr, 2) && array_get($district_arr, 2)>0) {
 
-                         $district_ids[] = (int)$district_arr[2];
 
-                     } else {
 
-                         $district_ids[] = (int)$district_arr[1];
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         if ($district_ids) {
 
-             $where[] = array('district','in',$district_ids);
 
-         }
 
-         //匹配期望薪资 - (第二版逻辑:职位薪资最大值和最小值包含期望薪资、面议)
 
-         $where[] = array('wage_min','<=',$resume->wage_min);
 
-         $where[] = array('wage_max','>=',$resume->wage_max);
 
-         $where[] = array('subsite_ids','=',get_subsite_id());
 
-         return $where;
 
-     }
 
-     public function autoRefreshJobs(array $pid_arr)
 
-     {
 
-         if ($this->jobsRepository->autoRefreshJobs($pid_arr)) {
 
-             return true;
 
-         }
 
-         return false;
 
-     }
 
-     /**将职位管理内的职位转入招聘会职位库
 
-      * @param $request
 
-      * @return JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function jobsAddToJobfair($request,$user)
 
-     {
 
-         $jid = $request->id;
 
-         if (!$jid || !$jobsInfo = $this->jobsRepository->find($jid)) {
 
-             return response()->json(['status'=>0,'msg'=>"参数错误或无此职位"]);
 
-         }
 
-         $this->isOwn($jid,$user);
 
-         $type1 = $this->jobfairJobRepository->findWhere(['jobs_name'=>$jobsInfo->jobs_name,'company_id'=>$jobsInfo->company_id,'type'=>1])->isNotEmpty();
 
-         $type2 = $this->jobfairJobRepository->findWhere(['jobs_name'=>$jobsInfo->jobs_name,'company_id'=>$jobsInfo->company_id,'type'=>2])->isNotEmpty();
 
-         if($type1 && $type2 ){
 
-             return response()->json(['status'=>0,'msg'=>"该职位已存在招聘会职位库中,请添加其他职位"]);
 
-         }
 
-         $insertArr = [];
 
-         if ($jobCatact = $this->jobsContactRepository->getContactInfo(['job_id'=>$jid])) {
 
-             $contactData = $this->jobsContactRepository->find($jobCatact->id);
 
-             $contactArr = ['contact','qq','mobile','notify','landline_tel','email','address','notify_mobile','contact_show','telephone_show','email_show','landline_tel_show'];
 
-             foreach ($contactArr as $key => $val) {
 
-                 if ($val == 'mobile') {
 
-                     $insertArr[$val] = $jobCatact->telephone;
 
-                 } elseif ($val=='landline_tel') {
 
-                     if (isset($jobCatact->landline_tel)) {
 
-                         $insertArr[$val] = implode('-', $jobCatact->landline_tel);
 
-                     } else {
 
-                         $insertArr[$val]='--';
 
-                     }
 
-                 } else {
 
-                     $insertArr[$val] = $jobCatact->$val;
 
-                 }
 
-             }
 
-         }
 
-         $jobfairArr = [
 
-             'jobs_name',
 
-             'company_id',
 
-             'company_name',
 
-             'company_addtime',
 
-             'company_audit',
 
-             'stick',
 
-             'amount',
 
-             'negotiable',
 
-             'jobs_content',
 
-             'audit',
 
-             'click',
 
-             'display',
 
-             'robot',
 
-             'map_x',
 
-             'map_y',
 
-             'map_zoom',
 
-             'add_mode',
 
-             'department',
 
-             'nature',
 
-             'sex',
 
-             'age',
 
-             'topclass',
 
-             'category',
 
-             'subclass',
 
-             'trade',
 
-             'scale',
 
-             'district',
 
-             'education',
 
-             'experience',
 
-             'wage',
 
-             'wage_max',
 
-             'wage_min',
 
-             'ygxs',
 
-             'syq',
 
-             'syqxz_min',
 
-             'techlevel'
 
-         ];
 
-         foreach ($jobfairArr as $key => $val) {
 
-             $insertData[$val] = $jobsInfo->$val;
 
-         }
 
-         if ($jobsInfo['topclass'] && $jobsInfo['category'] && $jobsInfo['subclass']) {
 
-             $insertData['category_cn'] = get_job_category_cn($jobsInfo['topclass'].".".$jobsInfo['category'].'.'.$jobsInfo['subclass']);
 
-         } else {
 
-             $insertData['category_cn'] = '';
 
-         }
 
-         if(!empty($insertData['age'])){
 
-             $insertData['age'] = implode('-',$insertData['age'] );
 
-         }
 
-         $insertData['nature_cn'] = $jobsInfo['nature']?get_category($jobsInfo['nature']):'';
 
-         $insertData['trade_cn'] = $jobsInfo['trade']?get_category($jobsInfo['trade']):'';
 
-         $insertData['scale_cn'] = $jobsInfo['scale']?get_category($jobsInfo['scale']):'';
 
-         $insertData['education_cn'] = $jobsInfo['education']?get_category($jobsInfo['education']):'';
 
-         $insertData['experience_cn'] = $jobsInfo['experience']?get_category($jobsInfo['experience']):"";
 
-         if (intval($insertData['wage']) == 0) {
 
-             if ($insertData['wage_max']) {
 
-                 $insertData['wage_cn'] = $insertData['wage_min'].'~'.$insertData['wage_max'].'/月';
 
-             } else {
 
-                 $insertData['wage_cn'] = $insertData['wage_min'].'/月以上';
 
-             }
 
-         }elseif(intval($insertData['wage']) == -1){
 
-             $insertData['wage_cn'] = '面议';
 
-         }else{
 
-             $insertData['wage_cn'] = $jobsInfo['wage']?get_category($jobsInfo['wage']):'';
 
-         }
 
-         $insertData['ygxs'] = $jobsInfo['ygxs']?$jobsInfo['ygxs']:'';
 
-         $insertData['syq'] = $jobsInfo['syq']?$jobsInfo['syq']:'';
 
-         $insertData['syqxz_min'] = $jobsInfo['syqxz_min']?$jobsInfo['syqxz_min']:'';
 
-         $insertData['techlevel'] = $jobsInfo['techlevel']?$jobsInfo['techlevel']:'';
 
-         $insertData['district_cn'] = get_district_cn($jobsInfo['district']);
 
-         if ($jobsInfo['tag'][0]) {
 
-             $insertData['tag_cn'] = get_tag_cn(implode(',', $jobsInfo['tag']));
 
-         } else {
 
-             $insertData['tag_cn']='';
 
-         }
 
-         switch ($jobsInfo['sex']) {
 
-             case 1:
 
-                 $insertData['sex_cn'] = '男';
 
-                 break;
 
-             case 2:
 
-                 $insertData['sex_cn'] = '女';
 
-                 break;
 
-             case 0:
 
-                 $insertData['sex_cn'] = '不限';
 
-                 break;
 
-         }
 
-         try{
 
-             if(!$type1){
 
-                 $insertData['type'] = 1;
 
-                 if (!$jobfair_jobid = $this->jobfairJobRepository->create($insertData)) {
 
-                     throw new \Exception('转入招聘会职位库失败!');
 
-                 }
 
-                 if ($insertArr) {
 
-                     $insertArr['pid'] = $jobfair_jobid->id;
 
-                     $this->jobfairJobsContactRepository->create($insertArr);
 
-                 }
 
-             }
 
-             if(!$type2){
 
-                 $insertData['type'] = 2;
 
-                 if (!$jobfairout_jobid = $this->jobfairJobRepository->create($insertData)) {
 
-                     throw new \Exception('转入招聘会职位库失败!');
 
-                 }
 
-                 if ($insertArr) {
 
-                     $insertArr['pid'] = $jobfairout_jobid->id;
 
-                     $this->jobfairJobsContactRepository->create($insertArr);
 
-                 }
 
-             }
 
-             DB::commit();
 
-             return response()->json(['status'=>1,'msg'=>"成功转入招聘会职位库!",'data' => '']);
 
-         }catch (Exception $e) {
 
-             DB::rollback();
 
-             return response()->json(['status'=>1,'msg'=>$e->getMessage(),'data' => '']);
 
-         }
 
-     }
 
-     public function isOwn($ids,$user)
 
-     {
 
-         $ids = is_array($ids)?$ids:explode(',',$ids);
 
-         $putJobs = $this->jobsRepository->getPluck(['company_id'=>$user->id],'id')->toArray();
 
-         if(array_diff($ids,$putJobs))
 
-         {
 
-             throw new ResponseException('抱歉,您只能操作自己的招聘会职位!');
 
-         }
 
-     }
 
- }
 
 
  |