1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759 |
- <?php
- namespace App\Services\Person;
- use Aix\Pay\Data\PayOrder;
- use App\Exceptions\ResponseException;
- use App\Models\Category;
- use App\Models\CompanyDownResume;
- use App\Models\Jobs;
- use App\Models\Member;
- use App\Models\MemberInfo;
- use App\Models\MembersHandsel;
- use App\Models\MembersPoint;
- use App\Models\Order;
- use App\Models\PersonalCategory;
- use App\Models\PersonalJobsApply;
- use App\Models\PersonalServiceStick;
- use App\Models\PersonalServiceStickLog;
- use App\Models\PersonalServiceTag;
- use App\Models\PersonalServiceTagLog;
- use App\Models\PersonalTalents;
- use App\Models\PersonalTalentsLog;
- use App\Models\QueueAutoRefresh;
- use App\Models\Report;
- use App\Models\Resume;
- use App\Models\ResumeAuthInfo;
- use App\Models\ResumeEntrust;
- use App\Models\ResumeImg;
- use App\Models\SubsiteResume;
- use App\Models\Task;
- use App\Models\ViewResume;
- use App\Repositories\CategoryDistrictRepository;
- use App\Repositories\CategoryJobsRepository;
- use App\Repositories\CategoryMajorRepository;
- use App\Repositories\CategoryRepository;
- use App\Repositories\CompanyDownResumeRepository;
- use App\Repositories\companyFavoriteRepository;
- use App\Repositories\CompanyInterviewRepository;
- use App\Repositories\JobsRepository;
- use App\Repositories\MemberPointRepository;
- use App\Repositories\PersonalJobsApplyRepository;
- use App\Repositories\PersonFocusComRepository;
- use App\Repositories\PersonTplRepository;
- use App\Repositories\PmsRepository;
- use App\Repositories\QueueAutoRefreshRepository;
- use App\Repositories\ResumeCredentRepository;
- use App\Repositories\ResumeEducationRepository;
- use App\Repositories\ResumeLanguageRepository;
- use App\Repositories\ResumeRepository;
- use App\Repositories\ResumeTrainRepository;
- use App\Repositories\ResumeWorkRepository;
- use App\Repositories\TaskLogRepository;
- use App\Repositories\TplRepository;
- use App\Repositories\ViewJobRepository;
- use App\Repositories\ViewResumeRepository;
- use App\Services\Common\CategoryService;
- use App\Services\Common\EmailService;
- use App\Services\Common\PaymentService;
- use App\Services\Common\PayService;
- use App\Services\Common\TaskService;
- use App\Services\Company\CompanyDownResumeService;
- use App\Services\Company\CompanyService;
- use Illuminate\Support\Facades\DB;
- use App\Repositories\ResumeEntrustRepository;
- use App\Repositories\TaskRepository;
- use App\Repositories\MemberHandselRepository;
- use Illuminate\Support\Facades\Cache;
- use Illuminate\Support\Facades\Route;
- use App\Services\Content\FeedbackService;
- use App\Repositories\MemberInfoRepository;
- use App\Repositories\MemberRepository;
- use App\Repositories\MemberSetmealRepository;
- use App\Repositories\MemberLogRepository;
- use App\Services\Auth\RegisterService;
- use App\Services\Common\SmsService;
- use Aix\Sms\Contracts\Smser;
- use Illuminate\Support\Facades\Storage;
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
- class ResumeService
- {
- /**
- * @var $ResumeRepository
- */
- protected $ResumeRepository;
- protected $PersonalJobsApplyRepository;
- protected $ViewResumeRepository;
- protected $CompanyInterviewRepository;
- protected $CategoryRepository;
- protected $CategoryMajorRepository;
- protected $CategoryDistrictRepository;
- protected $CategoryJobsRepository;
- protected $TaskLogRepository;
- protected $TaskService;
- protected $ResumeEducationRepository;
- protected $ResumeWorkRepository;
- protected $ResumeTrainRepository;
- protected $ResumeLanguageRepository;
- protected $ResumeCredentRepository;
- protected $ResumeEntrustRepository;
- protected $CompanyDownResumeService;
- protected $CompanyService;
- protected $companyFavoriteRepository;
- protected $CategoryService;
- protected $jobsRepository;
- protected $companyDownResumeRepository;
- protected $viewJobRepository;
- protected $feedbackService;
- protected $memberInfoRepository;
- protected $memberRepository;
- protected $memberSetmealRepository;
- protected $memberLogRepository;
- protected $pmsRepository;
- protected $registerService;
- protected $personTplRepository;
- protected $tplRepository;
- protected $memberPointRepository;
- protected $paymentService;
- protected $payService;
- protected $taskRepository;
- protected $memberHandselRepository;
- protected $smsService;
- protected $queueAutoRefreshRepository;
- protected $emailService;
- /**
- * PersonalJobsApplyService constructor.
- * @param ResumeRepository $ResumeRepository
- * @param PersonalJobsApplyRepository $PersonalJobsApplyRepository
- * @param ViewResumeRepository $ViewResumeRepository
- * @param CompanyInterviewRepository $CompanyInterviewRepository
- * @param CategoryRepository $CategoryRepository
- * @param CategoryMajorRepository $CategoryMajorRepository
- * @param CategoryDistrictRepository $CategoryDistrictRepository
- * @param CategoryJobsRepository $CategoryJobsRepository
- * @param TaskLogRepository $TaskLogRepository
- * @param TaskService $TaskService
- * @param ResumeEducationRepository $ResumeEducationRepository
- * @param ResumeWorkRepository $ResumeWorkRepository
- * @param ResumeTrainRepository $ResumeTrainRepository
- * @param ResumeLanguageRepository $ResumeLanguageRepository
- * @param ResumeCredentRepository $ResumeCredentRepository
- * @param ResumeEntrustRepository $ResumeEntrustRepository
- * @param CompanyDownResumeService $CompanyDownResumeService
- * @param CompanyService $CompanyService
- * @param companyFavoriteRepository $companyFavoriteRepository
- * @param CategoryService $CategoryService
- * @param JobsRepository $jobsRepository
- * @param CompanyDownResumeRepository $companyDownResumeRepository
- * @param ViewJobRepository $viewJobRepository
- * @param ViewJobRepository $feedbackService
- * @param ViewJobRepository $memberInfoRepository
- * @param ViewJobRepository $memberRepository
- * @param MemberSetmealRepository $memberSetmealRepository
- * @param MemberLogRepository $memberLogRepository
- * @param PersonFocusComRepository $personFocusComRepository
- * @param pmsRepository $pmsRepository
- * @param registerService $registerService
- */
- public function __construct(
- ResumeRepository $ResumeRepository,
- PersonFocusComRepository $personFocusComRepository,
- ViewJobRepository $viewJobRepository,
- CompanyDownResumeRepository $companyDownResumeRepository,
- JobsRepository $jobsRepository,
- PersonalJobsApplyRepository $PersonalJobsApplyRepository,
- ViewResumeRepository $ViewResumeRepository,
- CompanyInterviewRepository $CompanyInterviewRepository,
- CategoryRepository $CategoryRepository,
- CategoryMajorRepository $CategoryMajorRepository,
- CategoryDistrictRepository $CategoryDistrictRepository,
- CategoryJobsRepository $CategoryJobsRepository,
- TaskLogRepository $TaskLogRepository,
- TaskService $TaskService,
- ResumeEducationRepository $ResumeEducationRepository,
- ResumeWorkRepository $ResumeWorkRepository,
- ResumeTrainRepository $ResumeTrainRepository,
- ResumeLanguageRepository $ResumeLanguageRepository,
- ResumeCredentRepository $ResumeCredentRepository,
- ResumeEntrustRepository $ResumeEntrustRepository,
- CompanyDownResumeService $CompanyDownResumeService,
- CompanyService $CompanyService,
- companyFavoriteRepository $companyFavoriteRepository,
- CategoryService $CategoryService,
- FeedbackService $feedbackService,
- MemberInfoRepository $memberInfoRepository,
- MemberRepository $memberRepository,
- MemberSetmealRepository $memberSetmealRepository,
- MemberLogRepository $memberLogRepository,
- PmsRepository $pmsRepository,
- RegisterService $registerService,
- PersonTplRepository $personTplRepository,
- TplRepository $tplRepository,
- MemberPointRepository $memberPointRepository,
- PaymentService $paymentService,
- PayService $payService,
- TaskRepository $taskRepository,
- MemberHandselRepository $memberHandselRepository,
- SmsService $smsService,
- QueueAutoRefreshRepository $queueAutoRefreshRepository,
- EmailService $emailService
- )
- {
- $this->ResumeRepository = $ResumeRepository;
- $this->PersonalJobsApplyRepository = $PersonalJobsApplyRepository;
- $this->ViewResumeRepository = $ViewResumeRepository;
- $this->CompanyInterviewRepository = $CompanyInterviewRepository;
- $this->CategoryRepository = $CategoryRepository;
- $this->CategoryMajorRepository = $CategoryMajorRepository;
- $this->CategoryDistrictRepository = $CategoryDistrictRepository;
- $this->CategoryJobsRepository = $CategoryJobsRepository;
- $this->TaskLogRepository = $TaskLogRepository;
- $this->TaskService = $TaskService;
- $this->ResumeEducationRepository = $ResumeEducationRepository;
- $this->ResumeWorkRepository = $ResumeWorkRepository;
- $this->ResumeTrainRepository = $ResumeTrainRepository;
- $this->ResumeLanguageRepository = $ResumeLanguageRepository;
- $this->ResumeCredentRepository = $ResumeCredentRepository;
- $this->ResumeEntrustRepository = $ResumeEntrustRepository;
- $this->CompanyDownResumeService = $CompanyDownResumeService;
- $this->CompanyService = $CompanyService;
- $this->companyFavoriteRepository = $companyFavoriteRepository;
- $this->CategoryService = $CategoryService;
- $this->jobsRepository = $jobsRepository;
- $this->companyDownResumeRepository = $companyDownResumeRepository;
- $this->viewJobRepository = $viewJobRepository;
- $this->feedbackService = $feedbackService;
- $this->memberInfoRepository = $memberInfoRepository;
- $this->memberRepository = $memberRepository;
- $this->memberSetmealRepository = $memberSetmealRepository;
- $this->memberLogRepository = $memberLogRepository;
- $this->personFocusComRepository = $personFocusComRepository;
- $this->pmsRepository = $pmsRepository;
- $this->registerService = $registerService;
- $this->personTplRepository = $personTplRepository;
- $this->tplRepository = $tplRepository;
- $this->memberPointRepository = $memberPointRepository;
- $this->paymentService = $paymentService;
- $this->payService = $payService;
- $this->taskRepository = $taskRepository;
- $this->memberHandselRepository = $memberHandselRepository;
- $this->smsService = $smsService;
- $this->queueAutoRefreshRepository = $queueAutoRefreshRepository;
- $this->emailService = $emailService;
- }
- public function loginValidate($user)
- {
- $member = $this->memberInfoRepository->getMemberInfo($user->id);
- $resume = $this->ResumeRepository->getPersonInfo($user->id);
- $resumeTitle = '简历' . date('Ymd');
- if ($resume) {
- $stick = PersonalServiceStickLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
- $intention_jobs_id = explode(',', $resume->intention_jobs_id);
- $intenionArrTwo = [];
- $intenionArrThree = [];
- foreach ($intention_jobs_id as $key => $val) {
- if (explode('.', $val)[2]) {
- $intenionArrThree[] = explode('.', $val)[2];
- } else {
- $intenionArrTwo[] = explode('.', $val)[1];
- }
- }
- //$recommend_jobs = $this->jobsRepository->recommendJobs($intenionArrTwo, $intenionArrThree, 1, getJobsStatus());
- } else {
- $stick = [];
- $recommend_jobs = [];
- }
- return [
- 'resume' => $resume,
- 'stick' => $stick,
- //'recommend_jobs'=>$recommend_jobs,
- 'resumeTitle' => $resumeTitle,
- 'member' => $member
- ];
- }
- public function popPms($user)
- {
- //获取当天
- //当天开始时间
- $start_time = strtotime(date("Y-m-d", time()));
- //当天结束之间
- $end_time = $start_time + 60 * 60 * 24;
- $data[] = ['new', 1];
- $data[] = ['msgtouid', $user->id];
- $data[] = ['utype', $user->utype];
- $data[] = ['msgtype', 2];
- $data[] = ['msgfromuid', 0];
- $data[] = ['msgfrom', 'admin'];
- /*$data[] = ['started_at', '>=', $start_time];
- $data[] = ['ended_at', '<', $end_time];*/
- $data[] = ['started_at', '<=', $start_time];
- $data[] = ['ended_at', '>=', $start_time];
- return $this->pmsRepository->findFirstPms($data);
- }
- public function popPmsRead($id)
- {
- return $this->pmsRepository->updateNewById($id, ['new' => 2]);
- }
- /* public function ajax_get_interest_jobs($date)
- {
- $type = $date['type'];
- $p = isset($date['p']) ? $date['p'] : 1;
- $user = auth('web-member')->user();
- if ($type=='recommend_jobs') {
- $resume =$this->ResumeRepository->getPersonInfo($user->id);
- if ($resume) {
- $intention_jobs_id = explode(',', $resume->intention_jobs_id);
- $intenionArrTwo = [];
- $intenionArrThree = [];
- foreach ($intention_jobs_id as $key => $val) {
- if (explode('.', $val)[2]) {
- $intenionArrThree[] = explode('.', $val)[2];
- } else {
- $intenionArrTwo[] = explode('.', $val)[1];
- }
- }
- $recommend_jobs = $this->jobsRepository->recommendJobs($intenionArrTwo, $intenionArrThree, $p, getJobsStatus());
- } else {
- $recommend_jobs = (object)[];
- }
- return $recommend_jobs;
- } elseif ($type=='nearby_jobs') {
- $baidu_api_result = _get_baidumap_api();
- $baidu_api_jsoninfo = json_decode($baidu_api_result, true);
- if ($baidu_api_jsoninfo['status']==0) {
- $lng = $baidu_api_jsoninfo['content']['point']['x'];
- $lat = $baidu_api_jsoninfo['content']['point']['y'];
- $squares = square_point($lng, $lat);
- $lngArr = [];
- $lngArr[] = $squares['lt']['lng'];
- $lngArr[] = $squares['rb']['lng'];
- $latArr = [];
- $latArr[] = $squares['rb']['lat'];
- $latArr[] = $squares['lt']['lat'];
- $nearby_jobs = $this->jobsRepository->nearbyJobs($lngArr, $latArr, $p, getJobsStatus());
- } else {
- $nearby_jobs = (object)[];
- }
- return $nearby_jobs;
- } else {
- $newJobsArr = strtotime('-1 days');
- $nearby_jobs = $this->jobsRepository->new_jobs($newJobsArr, $p, getJobsStatus());
- return $nearby_jobs;
- }
- }*/
- /**
- * 我的简历
- */
- public function myResume($user)
- {
- $uid = $user->id;
- $resuem = $this->ResumeRepository->getAllResume($uid);
- $resume_id = null;
- foreach ($resuem as $key => $val) {
- if ($val->def == 1) {
- $resume_id = $val->id;
- break;
- }
- }
- if (!$resume_id) {
- throw new ResponseException('抱歉,搜索不到简历!', '', 404);
- }
- $resumeArr = [];
- $countResume = 0;
- foreach ($resuem as $key => $val) {
- $countResume++;
- if ($val->level == 1) {
- $level = '(<span class="t2">优</span>)';
- } elseif ($val->level == 2) {
- $level = '(<span class="t3">良</span>)';
- } else {
- $level = '(<span class="t1">差</span>)';
- }
- if (config('aix.personal_set.per_set.show_set.resume_display') == 2) {
- if ($val->audit == 2) {
- $audit = '<span class="font_green">审核通过</span>';
- $state = 'state';
- $resumeStauts = true;
- } elseif ($val->audit == 0) {
- $state = 'state0';
- $audit = '<span class="font_red">审核未通过</span>';
- $resumeStauts = false;
- } else {
- $audit = '<span class="font_green">审核通过</span>';
- $state = 'state';
- $resumeStauts = true;
- }
- } else {
- if ($val->audit == 2) {
- $audit = '<span class="font_green">审核通过</span>';
- $state = 'state';
- $resumeStauts = true;
- } elseif ($val->audit == 0) {
- $state = 'state0';
- $audit = '<span class="font_red">审核未通过</span>';
- $resumeStauts = false;
- } else {
- $state = 'state1';
- $audit = '<span class="font_yellow">审核中</span>';
- $resumeStauts = false;
- }
- }
- $updated_at = date_format_new(strtotime($val->updated_at));
- $updated_time = $updated_at ? $updated_at : '';
- $expires = true;
- if ($val->expires && $val->expires < time()) {
- $expires = false;
- }
- if ($val->def == 1) {
- $resumeArr['default']['id'] = $val->id;
- $resumeArr['default']['lock'] = $val->display ? '' : 'close';
- $resumeArr['default']['complete_percent'] = $val->complete_percent . "%";
- $resumeArr['default']['level'] = $level;
- $resumeArr['default']['expires'] = $expires;
- $resumeArr['default']['audit'] = $audit;
- $resumeArr['default']['updated_at'] = $updated_time;
- $resumeArr['default']['title'] = $val->title;
- $resumeArr['default']['state'] = $state;
- $resumeArr['default']['resumeStauts'] = $resumeStauts;
- $resumeArr['default']['display'] = $val->display;
- $resumeArr['default']['tag'] = DB::table('personal_service_tag_logs')->where('resume_id', $val->id)->first();
- $resumeArr['default']['stick'] = DB::table('personal_service_stick_logs')->where('resume_id', $val->id)->first();
- $resumeArr['default']['viewResume'] = $this->ViewResumeRepository->getViewResume(explode(',', $val->id));
- $resumeArr['default']['viewResumeDown'] = CompanyDownResume::whereHas('resumes')->where('resume_id', $val->id)->count();
- if ($val->entrust) {
- $resumeArr['default']['entrust'] = $val->entrust - time();
- } else {
- $resumeArr['default']['entrust'] = 0;
- }
- } else {
- $resumeArr['noDefault'][$key]['id'] = $val->id;
- $resumeArr['noDefault'][$key]['lock'] = $val->display ? '' : 'close';
- $resumeArr['noDefault'][$key]['complete_percent'] = $val->complete_percent . "%";
- $resumeArr['noDefault'][$key]['level'] = $level;
- $resumeArr['noDefault'][$key]['expires'] = $expires;
- $resumeArr['noDefault'][$key]['audit'] = $audit;
- $resumeArr['noDefault'][$key]['updated_at'] = $updated_time;
- $resumeArr['noDefault'][$key]['title'] = $val->title;
- $resumeArr['noDefault'][$key]['state'] = $state;
- $resumeArr['noDefault'][$key]['resumeStauts'] = $resumeStauts;
- $resumeArr['noDefault'][$key]['display'] = $val->display;
- $resumeArr['noDefault'][$key]['tag'] = DB::table('personal_service_tag_logs')->where('resume_id', $val->id)->first();
- $resumeArr['noDefault'][$key]['stick'] = DB::table('personal_service_stick_logs')->where('resume_id', $val->id)->first();
- $resumeArr['noDefault'][$key]['viewResume'] = $this->ViewResumeRepository->getViewResume(explode(',', $val->id));
- $resumeArr['noDefault'][$key]['viewResumeDown'] = CompanyDownResume::whereHas('companys')->whereHas('resumes')->where('resume_id', $val->id)->count();
- if ($val->entrust) {
- $resumeArr['noDefault'][$key]['entrust'] = $val->entrust - time();
- } else {
- $resumeArr['noDefault'][$key]['entrust'] = 0;
- }
- }
- }
- $applyJobs = $this->PersonalJobsApplyRepository->getApplyJobsDef($resume_id, getJobsStatus());
- $interview = $this->CompanyInterviewRepository->getInterviewDef($resume_id, getJobsStatus());
- $viewResume = $this->ViewResumeRepository->getViewResume([$resume_id]);
- return ['resume' => $resumeArr, 'countResume' => $countResume, 'applyJobs' => $applyJobs, 'interview' => $interview, 'viewResume' => $viewResume];
- }
- public function signIn($user)
- {
- $signCount = $this->TaskLogRepository->getTaskLogCount($user->id, 3, $user->utype);
- if ($signCount) {
- return ['code' => 0, 'info' => '您今天已经签到过了!'];
- } else {
- $res = $this->TaskService->doTask(3, $user->id, $user->utype);
- if ($res['code'] == 1) {
- $this->memberLogRepository->createLog($user, 8003, "");
- return ['code' => 1, 'info' => $res['data']['points']];
- } else {
- return ['code' => 0, 'info' => $res['info']];
- }
- }
- }
- public function myAllResume($uid)
- {
- return $this->ResumeRepository->getAllResume($uid);
- }
- public function myResumeAjax($user)
- {
- $uid = $user->id;
- return $this->ResumeRepository->getSuccessResume($uid, getResumeStatus());
- }
- public function getSuccessResumeCount($user)
- {
- $resumeCount = $this->ResumeRepository->getSuccessResumeCount($user->id, getResumeStatus());
- $resumeList = $this->ResumeRepository->getSuccessResume($user->id, getResumeStatus());
- if ($resumeCount == 0) {
- return ['code' => 0, 'info' => '您没有审核通过的简历'];
- } else {
- return ['code' => 1, 'info' => $resumeList];
- }
- }
- public function resumeCreate($date, $user)
- {
- if (empty($date['education'])) {
- throw new ResponseException('最高学历不能为空!');
- }
- if (empty($date['experience'])) {
- throw new ResponseException('工作经验不能为空!');
- }
- if (!vali_person_reg($date['card_t_cn'], $date['id_card'])) {
- throw new ResponseException('证件号格式错误!');
- }
- if (isset($date['qq']) && !empty($date['qq'])) {
- if (!preg_match('/^\d*$/', $date['qq'])) {
- throw new ResponseException('qq号只能是数字!');
- }
- }
- if (isset($date['weixin']) && !empty($date['weixin'])) {
- if (preg_match('/[\x7f-\xff]/', $date['weixin'])) {
- throw new ResponseException('微信号不能含有中文!');
- }
- }
- if ($date['email']) {
- if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $date['email'])) {
- throw new ResponseException('邮箱格式不正确!');
- }
- $member_vali = Member::where(['email' => $date['email']])->whereNotIn('id', [$user->id])->get()->toArray();
- if (!empty($member_vali)) {
- throw new ResponseException('邮箱格已被使用!');
- }
- }
- $count = $this->ResumeRepository->getResumeCount($user->id);
- if ($count >= config('aix.personal_set.per_set.per_set.resume_max')) {
- throw new ResponseException('您最大可以创建' . config('aix.personal_set.per_set.per_set.resume_max') . '份简历', '', 400);
- }
- $member_info['uid'] = $user->id;
- if (isset($date['display_name'])) {
- $member_info['display_name'] = $date['display_name'];
- }
- $member_info['realname'] = $date['fullname'];
- if ($date['sex'] == 1) {
- $sex_cn = '男';
- } else {
- $sex_cn = '女';
- }
- $member_info['sex'] = $date['sex'];
- $member_info['sex_cn'] = $sex_cn;
- $member_info['birthday'] = $date['birthdate'];
- $member_info['card_t_cn'] = 306;
- $member_info['id_card'] = $date['id_card'];
- $member_info['residence'] = $date['residence'];
- $residenseArr = explode(',', $date['residence']);
- $residenseArrId = [];
- foreach ($residenseArr as $key => $val) {
- $residenseArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
- }
- $residenseRes = $this->CategoryDistrictRepository->getManydistrict($residenseArrId);
- $member_info['residence_cn'] = '';
- foreach ($residenseRes as $key => $val) {
- $nm = $this->CategoryDistrictRepository->getCategoryDistrict($val->parent_id);
- $member_info['residence_cn'] .= $nm->name . '-' . $val->name . '+';
- }
- $member_info['residence_cn'] = rtrim($member_info['residence_cn'], '+');
- $member_info['education'] = $date['education'];
- $educationArr = $this->CategoryRepository->getCategory($date['education']);
- $education_cn = $educationArr['demand'];
- $member_info['education_cn'] = $education_cn;
- if (isset($date['major']) && !empty($date['major'])) {
- $majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
- $major_cn = $majorArr['name'];
- $member_info['major'] = $date['major'];
- $member_info['major_cn'] = $major_cn;
- }
- $member_info['experience'] = $date['experience'];
- $experienceArr = $this->CategoryRepository->getCategory($date['experience']);
- $experience_cn = $experienceArr['demand'];
- $member_info['experience_cn'] = $experience_cn;
- $member_info['phone'] = $date['telephone'];
- $member_info['email'] = $date['email'] ? $date['email'] : '';
- if (isset($date['height'])) {
- $member_info['height'] = $date['height'];
- }
- if (isset($date['householdaddress'])) {
- $member_info['householdaddress'] = $date['householdaddress'];
- $member_info['householdaddress_cn'] = '';
- if (!empty($date['householdaddress'])) {
- $houseArr = explode(',', $date['householdaddress']);
- $houseArrId = [];
- foreach ($houseArr as $key => $val) {
- $houseArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
- }
- $houseRes = $this->CategoryDistrictRepository->getManydistrict($houseArrId);
- foreach ($houseRes as $key => $val) {
- $nm = $this->CategoryDistrictRepository->getCategoryDistrict($val->parent_id);
- $member_info['householdaddress_cn'] .= $nm->name . '-' . $val->name . '+';
- }
- $member_info['householdaddress_cn'] = rtrim($member_info['householdaddress_cn'], '+');
- $resume_arr['householdaddress'] = $member_info['householdaddress_cn'];
- $resumeArr['householdaddress'] = $member_info['householdaddress_cn'];
- }
- }
- if (isset($date['techlevel']) && $date['techlevel']) {
- $member_info['techlevel'] = $date['techlevel'];
- $member_info['techlevel_cn'] = get_category($date['techlevel']);
- }
- if (isset($date['qq'])) {
- $member_info['qq'] = $date['qq'];
- $resumeArr['qq'] = $date['qq'];
- $resume_arr['qq'] = $date['qq'];
- }
- if (isset($date['weixin'])) {
- $member_info['weixin'] = $date['weixin'];
- $resumeArr['weixin'] = $date['weixin'];
- $resume_arr['weixin'] = $date['weixin'];
- }
- if (isset($date['marriage'])) {
- if ($date['marriage'] == 1) {
- $member_info['marriage'] = $date['marriage'];
- $member_info['marriage_cn'] = '未婚';
- } elseif ($date['marriage'] == 2) {
- $member_info['marriage'] = $date['marriage'];
- $member_info['marriage_cn'] = '已婚';
- } else {
- $member_info['marriage'] = $date['marriage'];
- $member_info['marriage_cn'] = '保密';
- }
- }
- if ($date['card_t_cn'] == 306) {
- $card = strlen($date['id_card']) == 15 ? ('19' . substr($date['id_card'], 6, 2)) : substr($date['id_card'], 6, 4);
- if ($member_info['birthday'] != $card) {
- throw new ResponseException('出生年月和身份证不符合!');
- }
- }
- $resume_arr['uid'] = $user->id;
- if (isset($date['display_name'])) {
- $resume_arr['display_name'] = $date['display_name'];
- }
- $resume_arr['title'] = isset($date['title']) ? $date['title'] : '简历' . date('Ymd');
- $resume_arr['fullname'] = $date['fullname'];
- $resume_arr['sex'] = $date['sex'];
- $resume_arr['sex_cn'] = $sex_cn;
- $resume_arr['nature'] = $date['nature'];
- $natureArr = $this->CategoryRepository->getCategory($date['nature']);
- $resume_arr['nature_cn'] = $natureArr['demand'];
- $resume_arr['trade'] = $date['trade'];
- // $resume_arr['techlevel'] = $date['techlevel'];
- // $resume_arr['techlevel_cn'] = get_category($date['techlevel']);
- $trade_cn = '';
- if (!empty($date['trade'])) {
- $tradeArr = $this->CategoryRepository->getManyCategory(explode(',', $date['trade']));
- foreach ($tradeArr as $key => $val) {
- $trade_cn .= $val->demand . '+';
- }
- $resume_arr['trade_cn'] = rtrim($trade_cn, '+');
- }
- $resume_arr['birthdate'] = $date['birthdate'];
- $resume_arr['residence'] = $member_info['residence_cn'];
- if (isset($date['height'])) {
- $resume_arr['height'] = $date['height'];
- }
- if (isset($date['marriage'])) {
- if ($date['marriage'] == 1) {
- $resume_arr['marriage'] = $date['marriage'];
- $resume_arr['marriage_cn'] = '未婚';
- } elseif ($date['marriage'] == 2) {
- $resume_arr['marriage'] = $date['marriage'];
- $resume_arr['marriage_cn'] = '已婚';
- } else {
- $resume_arr['marriage'] = $date['marriage'];
- $resume_arr['marriage_cn'] = '保密';
- }
- }
- $resume_arr['experience'] = $date['experience'];
- $resume_arr['experience_cn'] = $experience_cn;
- $resume_arr['subsite_id'] = $user->subsite_id;
- $resume_arr['district'] = $date['district'];
- $resume_arr['expires'] = 0;
- $expires = config('aix.personal_set.per_set.per_set.resume_expires');
- if ($expires) {
- $resume_arr['expires'] = strtotime("+{$expires} days");
- }
- $districtArr = explode(',', $date['district']);
- $resumrArrId = [];
- foreach ($districtArr as $key => $val) {
- $resumrArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
- }
- $resumeRes = $this->CategoryDistrictRepository->getManydistrict($resumrArrId);
- $resume_arr['district_cn'] = '';
- foreach ($resumeRes as $key => $val) {
- $resume_arr['district_cn'] .= $val->name . '+';
- }
- $resume_arr['district_cn'] = rtrim($resume_arr['district_cn'], '+');
- if (intval($date['wage'])) {
- $resume_arr['wage'] = $date['wage'];
- $wageArr = $this->CategoryRepository->getCategory($date['wage']);
- $resume_arr['wage_cn'] = $wageArr['demand'];
- if ($date['wage'] == 61) {
- $resume_arr['wage_min'] = 10000;
- $resume_arr['wage_max'] = 0;
- } else {
- $resume_arr['wage_min'] = explode('~', format_wage($wageArr['demand']))[0];
- $resume_arr['wage_max'] = explode('~', format_wage($wageArr['demand']))[1];
- }
- } else {
- $resume_arr['wage'] = 0;
- $resume_arr['wage_min'] = intval($date['wage_min']);
- $resume_arr['wage_max'] = intval($date['wage_max']);
- $resume_arr['wage_cn'] = intval($date['wage_min']) . '~' . intval($date['wage_max']) . '/月';
- }
- $resume_arr['education'] = $date['education'];
- $resume_arr['education_cn'] = $education_cn;
- if (isset($date['major']) && !empty($date['major'])) {
- $majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
- $major_cn = $majorArr['name'];
- $resume_arr['major'] = $date['major'];
- $resume_arr['major_cn'] = $major_cn;
- }
- $resume_arr['telephone'] = $date['telephone'];
- $resume_arr['email'] = $date['email'] ? $date['email'] : '';
- $resume_arr['intention_jobs_id'] = $date['intention_jobs_id'];
- $jobsArr = explode(',', $date['intention_jobs_id']);
- $jobArrId = [];
- foreach ($jobsArr as $key => $val) {
- $jobArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
- }
- $jobsRes = $this->CategoryJobsRepository->getManyJobs($jobArrId);
- $resume_arr['intention_jobs'] = '';
- foreach ($jobsRes as $key => $val) {
- $resume_arr['intention_jobs'] .= $val->name . '+';
- }
- $resume_arr['intention_jobs'] = rtrim($resume_arr['intention_jobs'], '+');
- $resume_arr['current'] = $date['current'];
- $currentArr = $this->CategoryRepository->getCategory($date['current']);
- $resume_arr['current_cn'] = $currentArr['demand'];
- $memberInfo = $this->memberInfoRepository->findMemberInfo(['uid' => $user->id]);
- if (!isset($date['resume_id']) || empty($date['resume_id'])) { //一体机。
- $resume_arr['complete_percent'] = 35;
- $resume_arr['level'] = 0;
- $personInfo = $this->ResumeRepository->getPersonInfo($user->id);
- $personInfo ? $resume_arr['def'] = 0 : $resume_arr['def'] = 1;
- if ($memberInfo) {
- if ($memberInfo->images) {
- $resume_arr['complete_percent'] = 40;
- }
- }
- }
- $memData = [];
- $member = $this->memberRepository->getMemberById($user->id);
- if (!$member->mobile_audit) {
- $memData['mobile'] = $date['telephone'];
- }
- if (!$member->email_audit) {
- $memData['email'] = $date['email'] ? $date['email'] : '';
- }
- $getResume = $this->ResumeRepository->getResumes(['uid' => $user->id]);
- $this->TaskService->doTask(1);
- $this->TaskService->doTask(2);
- DB::beginTransaction();//检查数据库事务
- try {
- if ($memData) {
- $this->memberRepository->updateInfo($user->id, $memData);
- }
- $memberInfo ? $this->memberInfoRepository->updateInfo($member_info, $user->id) : $this->memberInfoRepository->createInfo($member_info);
- if (!$getResume->isEmpty()) {
- $resume_id = array_column($getResume->toArray(), 'id');
- if (isset($date['display_name'])) {
- $resumeArr['display_name'] = $date['display_name'];
- }
- $resumeArr['fullname'] = $date['fullname'];
- $resumeArr['sex'] = $date['sex'];
- $resumeArr['sex_cn'] = $sex_cn;
- $resumeArr['birthdate'] = $date['birthdate'];
- $resumeArr['residence'] = $member_info['residence_cn'];
- if (isset($date['height'])) {
- $resumeArr['height'] = $date['height'];
- }
- if (isset($date['marriage'])) {
- if ($date['marriage'] == 1) {
- $resumeArr['marriage'] = $date['marriage'];
- $resumeArr['marriage_cn'] = '未婚';
- } elseif ($date['marriage'] == 2) {
- $resumeArr['marriage'] = $date['marriage'];
- $resumeArr['marriage_cn'] = '已婚';
- } else {
- $resumeArr['marriage'] = $date['marriage'];
- $resumeArr['marriage_cn'] = '保密';
- }
- }
- $resumeArr['experience'] = $date['experience'];
- $resumeArr['experience_cn'] = $member_info['experience_cn'];
- $resumeArr['education'] = $date['education'];
- $resumeArr['education_cn'] = $education_cn;
- if (isset($date['major']) && !empty($date['major'])) {
- $majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
- $major_cn = $majorArr['name'];
- $resumeArr['major'] = $date['major'];
- $resumeArr['major_cn'] = $major_cn;
- }
- $resumeArr['telephone'] = $date['telephone'];
- $resumeArr['email'] = $date['email'] ? $date['email'] : '';
- $resumeArr['idcard'] = $date['id_card'];
- $this->ResumeRepository->updateAllResume($resume_id, $resumeArr);
- }
- if (isset($date['resume_id']) && !empty($date['resume_id'])) {
- $this->ResumeRepository->updateById($resume_arr, $date['resume_id']);
- $result = (object)[];
- $result->id = $date['resume_id'];
- } else {
- $result = $this->ResumeRepository->resumeAdd($resume_arr);
- //通过学历判断人才类别前置操作
- $this->edu_mate($resume_arr['education'], $user->id);
- }
- $subsiteDefault = [
- [
- 'subsite_id' => $user->subsite_id,
- 'resume_id' => $result->id,
- 'created_at' => date('Y-m-d H:i:s'),
- 'updated_at' => date('Y-m-d H:i:s'),
- ]
- ];
- $subsiteArr = [];
- if (isset($date['subsite']) && $date['subsite'] !== null) {
- $subsite = explode(',', $date['subsite']);
- foreach ($subsite as $key => $val) {
- $subsiteArr[$key]['subsite_id'] = $val;
- $subsiteArr[$key]['resume_id'] = $result->id;
- $subsiteArr[$key]['created_at'] = date('Y-m-d H:i:s');
- $subsiteArr[$key]['updated_at'] = date('Y-m-d H:i:s');
- }
- if (in_array($user->subsite_id, $subsite)) {
- $subsiteDefault = $subsiteArr;
- } else {
- $subsiteDefault = array_merge($subsiteDefault, $subsiteArr);
- }
- }
- SubsiteResume::insert($subsiteDefault);
- event_search_update(Resume::class, (string)$result->id, 'update');
- DB::commit();
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2010, $result->id)) {
- throw new \Exception("日志记失败!");
- }
- return ['code' => 1, 'info' => $result->id];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- /**
- * 通过学历进行人才匹配前置方法
- */
- public function edu_mate($edu, $uid)
- {
- $edu_cn = Category::where('id', $edu)->value('demand');
- if ($edu_cn) {
- $where['name'] = $edu_cn;
- $p = PersonalCategory::where($where)->first();
- //学历信息
- $this->antic_personnel($uid, $p);
- }
- }
- /**
- * 最大人才类型预判断
- * 人才分类id,指当前被提交组里面的五类人才集合
- * 此功能是要指出最大的人才
- */
- public function antic_personnel($uid, $p = null)
- {
- //结合ResumeAuthInfo表与PersonalCategory表多表联查,找出当前简历的大分类
- $where['resume_auth_info.uid'] = $uid;
- //只取最高级别的人才等级排序id
- $p_id = ResumeAuthInfo::where($where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')->orderBy('personal_category.rc_order','desc')->first();
- #获取福建最高级别的人才等级id
- $fj_where = array('resume_auth_info.uid' => $uid, 'categorys.alias' => "RC_category_fj");
- $fj_info = ResumeAuthInfo::where($fj_where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')
- //->join(C('DB_PREFIX').'personal_category c on c.c_id = pc.rc_category_fj_id and c.c_alias = "RC_category_fj"','left')
- ->leftJoin('categorys', 'categorys.id', '=', 'personal_category.rc_category_fj_id')
- ->select('personal_category.rc_category_fj_id','personal_category.rc_category_fj','personal_category.rc_order')
- ->orderBy('categorys.order','desc')
- ->first();
- //获取泉州最高级别的人才等级id
- $qz_where = array('resume_auth_info.uid' => $uid, 'categorys.alias' => "RC_category_qz");
- $qz_info = ResumeAuthInfo::where($fj_where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')
- ->leftJoin('categorys', 'categorys.id', '=', 'personal_category.rc_category_qz_id')
- ->select('personal_category.rc_category_qz_id','personal_category.rc_category_qz','personal_category.rc_order')
- ->where($qz_where)
- ->orderBy('categorys.order','desc')
- ->first();
- //一共提交多少数据
- $count = ResumeAuthInfo::where(array('uid' => $uid))->count();
- //获取当前人才类别
- if ($p == null || $p == '' || empty($p)) {
- //找简历表的学历中文
- $infor = Resume::where(array("uid" => $uid, 'def' => 1))->first();
- if (!empty($infor->education_cn)) {
- $wheres['name'] = $infor->education_cn;
- $p = PersonalCategory::where($wheres)->first();
- }
- }
- if ($p_id && $p) {
- //如果荣誉..和学历都提交满足等级
- if ($p_id->rc_order >= $p->rc_order) {
- //新提交过来的等级判定信息
- $level_info = $p_id;
- } else {
- $level_info = $p;
- }
- $count += 1;
- } elseif ($p_id && !$p) {
- //如果只有荣誉..满足人才等级,学历不满足等级
- $level_info = $p_id;
- } elseif (!$p_id && $p) {
- //如果荣誉..不满足人才等级,学历满足等级
- $level_info = $p;
- $count += 1;
- } else {
- //如果荣誉..和学历都不满足人才等级
- $level_info = [];
- }
- //判断福建人才类别信息
- if ($fj_info && $p) {
- //如果荣誉..和学历都提交满足等级
- if ($fj_info['rc_order'] >= $p->rc_order) {
- $level_info['rc_fj_level'] = $fj_info->rc_category_fj;
- $level_info['rc_fj_level_id'] = $fj_info->rc_category_fj_id;
- } else {
- $level_info['rc_fj_level'] = $p->rc_category_fj;
- $level_info['rc_fj_level_id'] = $p->rc_category_fj_id;
- }
- } else if ($fj_info && !$p) {
- //如果只有荣誉..满足人才等级,学历不满足等级
- $level_info['rc_fj_level'] = $fj_info->rc_category_fj;
- $level_info['rc_fj_level_id'] = $fj_info->rc_category_fj_id;
- } else if (!$fj_info && $p) {
- //如果荣誉..不满足人才等级,学历满足等级
- $level_info['rc_fj_level'] = $p->rc_category_fj;
- $level_info['rc_fj_level_id'] = $p->rc_category_fj_id;
- }
- //判断泉州人才类别信息
- if ($qz_info && $p) {
- //如果荣誉..和学历都提交满足等级
- if ($qz_info['rc_order'] >= $p->rc_order) {
- $level_info['rc_qz_level'] = $qz_info->rc_category_qz;
- $level_info['rc_qz_level_id'] = $qz_info->rc_category_qz_id;
- } else {
- $level_info['rc_qz_level'] = $p->rc_category_qz;
- $level_info['rc_qz_level_id'] = $p->rc_category_qz_id;
- }
- } else if ($qz_info && !$p) {
- //如果只有荣誉..满足人才等级,学历不满足等级
- $level_info['rc_qz_level'] = $qz_info->rc_category_qz;
- $level_info['rc_qz_level_id'] = $qz_info->rc_category_qz_id;
- } else if (!$qz_info && $p) {
- //如果荣誉..不满足人才等级,学历满足等级
- $level_info['rc_qz_level'] = $p->rc_category_qz;
- $level_info['rc_qz_level_id'] = $p->rc_category_qz_id;
- }
- //会员名
- $username = Resume::where(array("uid" => $uid, 'def' => 1))->value('fullname');
- //身份证号
- $idcode = MemberInfo::where(array("uid" => $uid))->value("id_card");
- //判断人才等级表有没有这个人员记录
- $result = PersonalTalents::where(array("uid" => $uid))->first();
- if (!empty($level_info)) {
- $data['uid'] = $uid;
- $data['rc_username'] = $username;
- $data['rc_idcode'] = $idcode;
- $data['rc_level'] = $level_info['rc_category'];
- $data['rc_level_id'] = $level_info['rc_category_id'];
- $data['rc_fj_level'] = $level_info['rc_fj_level'];
- $data['rc_fj_level_id'] = $level_info['rc_fj_level_id'];
- $data['rc_qz_level'] = $level_info['rc_qz_level'];
- $data['rc_qz_level_id'] = $level_info['rc_qz_level_id'];
- $data['rc_sort'] = $level_info['rc_order'];
- $data['rc_audit'] = 2;
- $data['rc_where'] = 1;
- $data['rc_num'] = $count;
- $data['ifconform'] = 1;
- $data['personal_category_id'] = $level_info['id'];
- if ($result) {
- PersonalTalents::where(array("uid" => $uid))->update($data);
- if ($data['rc_sort'] != $result->rc_sort) {
- $info['talents_id'] = $result->id;
- $info['log_class'] = 1;//日志类型会员个人更新
- $info['content'] = $username . "更新人才资料,预判人才等级由‘" . $result->rc_level . "’转为‘" . $data['rc_level'] . "’,待重新审核";
- $info['log_time'] = time();
- $info['auth_man'] = $username;
- PersonalTalentsLog::create($info);
- }
- } else {
- $data['addtime'] = time();
- $res = PersonalTalents::create($data);
- $info['talents_id'] = $res->id;
- $info['log_class'] = 1;//日志类型会员个人更新
- $info['content'] = $username . "提交人才资料,预判人才等级为‘" . $data['rc_level'] . "’,待审核";
- $info['log_time'] = time();
- $info['auth_man'] = $username;
- PersonalTalentsLog::create($info);
- }
- return true;
- } else {
- $data['uid'] = $uid;
- $data['rc_username'] = $username;
- $data['rc_idcode'] = $idcode;
- $data['rc_level'] = '不符合人才标准';
- $data['rc_level_id'] = 0;
- $data['rc_sort'] = 0;
- $data['rc_audit'] = 2;
- $data['rc_where'] = 1;
- $data['rc_num'] = 0;
- $data['ifconform'] = 2;
- $data['personal_category_id'] = 0;
- if ($result) {
- PersonalTalents::where(array("uid" => $uid))->update($data);
- $info['talents_id'] = $result->id;
- $info['log_class'] = 1;//日志类型会员个人更新
- $info['content'] = $username . "更新人才资料,预判人才等级由‘" . $result->rc_level . "’转为‘不符合人才等级’,待重新审核";
- $info['log_time'] = time();
- $info['auth_man'] = $username;
- PersonalTalentsLog::create($info);
- }
- return true;
- }
- }
- public function getResumeById($id, $user)
- {
- $resume = $this->ResumeRepository->getResume($id);
- $memberInfo = DB::table('member_infos')->where('uid', $user->id)->first();
- $imgs = ResumeImg::where(['uid' => $user->id, 'resume_id' => $id])->get();
- $resume->district_keep = isset($resume->district) ? $resume->district : '';
- return ['resume' => $resume, 'imgs' => $imgs, 'member' => $memberInfo];
- }
- public function updateTitle($title, $id, $user)
- {
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在!');
- }
- $data['title'] = $title;
- $data['audit'] = 1;
- $expires = config('aix.personal_set.per_set.per_set.resume_expires');
- if ($expires) {
- $data['expires'] = strtotime("+{$expires} days");
- }
- event_search_update(Resume::class, (string)$id, 'update');
- return $this->ResumeRepository->updateById($data, $id);
- }
- public function updateHunting($date, $user)
- {
- $currentArr = $this->CategoryRepository->getCategory($date['current']);
- $date['current_cn'] = $currentArr['demand'];
- $natureArr = $this->CategoryRepository->getCategory($date['nature']);
- $date['nature_cn'] = $natureArr['demand'];
- if (intval($date['wage'])) {
- $wageArr = $this->CategoryRepository->getCategory($date['wage']);
- $date['wage_cn'] = $wageArr['demand'];
- if ($date['wage'] == 61) {
- $date['wage_min'] = 10000;
- $date['wage_max'] = 0;
- } else {
- $date['wage_min'] = explode('~', format_wage($wageArr['demand']))[0];
- $date['wage_max'] = explode('~', format_wage($wageArr['demand']))[1];
- }
- } else {
- $date['wage'] = 0;
- $date['wage_min'] = intval($date['wage_min']);
- $date['wage_max'] = intval($date['wage_max']);
- $date['wage_cn'] = intval($date['wage_min']) . '~' . intval($date['wage_max']) . '/月';
- }
- if (!empty($date['trade'])) {
- $tradeArr = $this->CategoryRepository->getManyCategory(explode(',', $date['trade']));
- $date['trade_cn'] = '';
- foreach ($tradeArr as $key => $val) {
- $date['trade_cn'] .= $val->demand . '+';
- }
- $date['trade_cn'] = rtrim($date['trade_cn'], '+');
- }
- if (!empty($date['techlevel'])) {
- $date['techlevel_cn'] = get_category($date['techlevel']);
- }
- $jobsArr = explode(',', $date['intention_jobs_id']);
- $jobArrId = [];
- foreach ($jobsArr as $key => $val) {
- $jobArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
- }
- $jobsRes = $this->CategoryJobsRepository->getManyJobs($jobArrId);
- $date['intention_jobs'] = '';
- foreach ($jobsRes as $key => $val) {
- $date['intention_jobs'] .= $val->name . '+';
- }
- $date['intention_jobs'] = rtrim($date['intention_jobs'], '+');
- $districtArr = explode(',', $date['district']);
- $resumrArrId = [];
- foreach ($districtArr as $key => $val) {
- $resumrArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
- }
- $resumeRes = $this->CategoryDistrictRepository->getManydistrict($resumrArrId);
- $date['district_cn'] = '';
- foreach ($resumeRes as $key => $val) {
- $date['district_cn'] .= $val->name . '+';
- }
- $date['district_cn'] = rtrim($date['district_cn'], '+');
- $date['audit'] = 1;
- $expires = config('aix.personal_set.per_set.per_set.resume_expires');
- if ($expires) {
- $date['expires'] = strtotime("+{$expires} days");
- }
- if (array_has($date, 'subsite_id')) {
- $subsite_id = $date['subsite_id'];
- unset($date['subsite_id']);
- $subsiteArr = SubsiteResume::where('resume_id', $date['id'])->get();
- if (!$subsiteArr->isEmpty()) {
- SubsiteResume::where('resume_id', $date['id'])->delete();
- }
- $subsiteDefault = [
- [
- 'subsite_id' => $user->subsite_id,
- 'resume_id' => $date['id'],
- 'created_at' => date('Y-m-d H:i:s'),
- 'updated_at' => date('Y-m-d H:i:s'),
- ]
- ];
- $subsiteArr = [];
- if ($subsite_id !== null) {
- $subsite = explode(',', $subsite_id);
- foreach ($subsite as $key => $val) {
- $subsiteArr[$key]['subsite_id'] = $val;
- $subsiteArr[$key]['resume_id'] = $date['id'];
- $subsiteArr[$key]['created_at'] = date('Y-m-d H:i:s');
- $subsiteArr[$key]['updated_at'] = date('Y-m-d H:i:s');
- }
- if (in_array($user->subsite_id, $subsite)) {
- $subsiteDefault = $subsiteArr;
- } else {
- $subsiteDefault = array_merge($subsiteDefault, $subsiteArr);
- }
- }
- SubsiteResume::insert($subsiteDefault);
- }
- event_search_update(Resume::class, (string)$date['id'], 'update');
- return $this->ResumeRepository->updateById($date, $date['id']);
- }
- public function updateSpecialty($data, $user)
- {
- if (!$data['specialty']) {
- throw new ResponseException('请填写自我描述!');
- }
- $resume_id = array_get($data, 'id');
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在!');
- }
- $res = $this->ResumeRepository->getResumeById($data['id']);
- DB::beginTransaction();//检查数据库事务
- try {
- if (!$res->specialty) {
- if ($res->complete_percent + 5 <= 100) {
- if ($res->complete_percent + 5 >= 70 && $res->complete_percent + 5 < 90) {
- $this->TaskService->doTask(12);
- $data['complete_percent'] = $res->complete_percent + 5;
- $data['level'] = 2;
- } elseif ($res->complete_percent + 5 >= 90 && $res->complete_percent + 5 <= 100) {
- $this->TaskService->doTask(11);
- $data['complete_percent'] = $res->complete_percent + 5;
- $data['level'] = 1;
- } else {
- $data['complete_percent'] = $res->complete_percent + 5;
- $data['level'] = 0;
- }
- }
- }
- $data['audit'] = 1;
- $expires = config('aix.personal_set.per_set.per_set.resume_expires');
- if ($expires) {
- $data['expires'] = strtotime("+{$expires} days");
- }
- event_search_update(Resume::class, (string)$data['id'], 'update');
- $result = $this->ResumeRepository->updateById($data, $data['id']);
- DB::commit();
- return ['code' => 1, 'info' => $result];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function tagSave($data)
- {
- $resume_id = $data['resume_id'];
- $tag = implode(',', $data['tag']);
- $tag_cn = implode(',', $data['tag_cn']);
- $resume = $this->ResumeRepository->getResumeById($resume_id);
- DB::beginTransaction();//检查数据库事务
- try {
- $das['audit'] = 1;
- $expires = config('aix.personal_set.per_set.per_set.resume_expires');
- if ($expires) {
- $das['expires'] = strtotime("+{$expires} days");
- }
- $this->ResumeRepository->updateById($das, $resume_id);
- if (empty($resume->tag_cn)) {
- if ($resume->complete_percent + 5 <= 100) {
- if ($resume->complete_percent + 5 >= 70 && $resume->complete_percent + 5 < 90) {
- $this->TaskService->doTask(12);
- $result = $this->ResumeRepository->updateById([
- 'complete_percent' => $resume->complete_percent + 5,
- 'level' => 2,
- 'tag' => $tag,
- 'tag_cn' => $tag_cn,
- ], $resume_id);
- } elseif ($resume->complete_percent + 5 >= 90 && $resume->complete_percent + 5 <= 100) {
- $this->TaskService->doTask(11);
- $result = $this->ResumeRepository->updateById([
- 'complete_percent' => $resume->complete_percent + 5,
- 'level' => 1,
- 'tag' => $tag,
- 'tag_cn' => $tag_cn,
- ], $resume_id);
- } else {
- $result = $this->ResumeRepository->updateById([
- 'complete_percent' => $resume->complete_percent + 5,
- 'level' => 0,
- 'tag' => $tag,
- 'tag_cn' => $tag_cn,
- ], $resume_id);
- }
- }
- } else {
- $result = $this->ResumeRepository->updateById(['tag' => $tag, 'tag_cn' => $tag_cn], $resume_id);
- }
- event_search_update(Resume::class, (string)$resume_id, 'update');
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2028, $resume_id)) {
- throw new \Exception("日志记失败!");
- }
- DB::commit();
- return ['code' => 1, 'info' => $result];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function tagDelete($resume_id, $tag_cn, $user)
- {
- if (!$resume_id || !$tag_cn) {
- throw new ResponseException('简历标签或简历不存在!');
- }
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在!');
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $resume = $this->ResumeRepository->find($resume_id);
- $resume_tag = isset($resume->tag) ? explode(',', $resume->tag) : [];
- $resume_tag_cn = isset($resume->tag_cn) ? explode(',', $resume->tag_cn) : [];
- foreach ($resume_tag_cn as $key => $val) {
- if ($tag_cn == $val) {
- unset($resume_tag_cn[$key]);
- unset($resume_tag[$key]);
- }
- }
- $res = $this->ResumeRepository->updateById(
- ['tag' => implode(',', $resume_tag), 'tag_cn' => implode(',', $resume_tag_cn)], $resume_id);
- DB::commit();
- return ['code' => 1, 'info' => $res];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function resumeCopy($id, $user)
- {
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- $resume_arr = []; //简历。
- $res = $this->ResumeRepository->getArrayById($id);
- $resume_arr['uid'] = $res['uid'];
- $resume_arr['display_name'] = $res['display_name'];
- $resume_arr['title'] = $res['title'];
- $resume_arr['fullname'] = $res['fullname'];
- $resume_arr['sex'] = $res['sex'];
- $resume_arr['sex_cn'] = $res['sex_cn'];
- $resume_arr['nature'] = $res['nature'];
- $resume_arr['nature_cn'] = $res['nature_cn'];
- $resume_arr['trade'] = $res['trade'];
- $resume_arr['trade_cn'] = $res['trade_cn'];
- $resume_arr['birthdate'] = $res['birthdate'];
- $resume_arr['residence'] = $res['residence'];
- $resume_arr['height'] = $res['height'];
- $resume_arr['marriage'] = $res['marriage'];
- $resume_arr['marriage_cn'] = $res['marriage_cn'];
- $resume_arr['experience'] = $res['experience'];
- $resume_arr['experience_cn'] = $res['experience_cn'];
- $resume_arr['district'] = $res['district'];
- $resume_arr['district_cn'] = $res['district_cn'];
- $resume_arr['wage'] = $res['wage'];
- $resume_arr['wage_cn'] = $res['wage_cn'];
- $resume_arr['wage_min'] = $res['wage_min'];
- $resume_arr['wage_max'] = $res['wage_max'];
- $resume_arr['householdaddress'] = $res['householdaddress'];
- $resume_arr['education'] = $res['education'];
- $resume_arr['education_cn'] = $res['education_cn'];
- $resume_arr['major'] = $res['major'];
- $resume_arr['major_cn'] = $res['major_cn'];
- $resume_arr['tag'] = $res['tag'];
- $resume_arr['tag_cn'] = $res['tag_cn'];
- $resume_arr['telephone'] = $res['telephone'];
- $resume_arr['email'] = $res['email'];
- $resume_arr['intention_jobs_id'] = $res['intention_jobs_id'];
- $resume_arr['intention_jobs'] = $res['intention_jobs'];
- $resume_arr['specialty'] = $res['specialty'];
- $resume_arr['photo'] = $res['photo'];
- $resume_arr['photo_audit'] = $res['photo_audit'];
- $resume_arr['qq'] = $res['qq'];
- $resume_arr['weixin'] = $res['weixin'];
- $resume_arr['subsite_id'] = $res['subsite_id'];
- $resume_arr['level'] = $res['level'];
- $resume_arr['complete_percent'] = $res['complete_percent'];
- $resume_arr['current'] = $res['current'];
- $resume_arr['current_cn'] = $res['current_cn'];
- $resume_arr['word_resume'] = $res['word_resume'];
- $resume_arr['word_resume_title'] = $res['word_resume_title'];
- $resume_arr['word_resume_addtime'] = $res['word_resume_addtime'];
- $resume_arr['tpl'] = $res['tpl'];
- $resume_arr['def'] = 0;
- $resume_arr['is_quick'] = 1;
- $Education = $this->ResumeEducationRepository->getEduByResumeU($id, $user->id);
- $Education_arr = []; //教育。
- $Work = $this->ResumeWorkRepository->getWorkByU($id, $user->id);
- $Work_arr = []; //工作
- $Train = $this->ResumeTrainRepository->getTrainByU($id, $user->id);
- $Train_arr = []; //培训。
- $Credent = $this->ResumeCredentRepository->getCredentByU($id, $user->id);
- $Credent_arr = []; //证书。
- $Language = $this->ResumeLanguageRepository->getCredentByU($id, $user->id);
- $Language_arr = []; //语言。
- $Imgs = DB::table('resume_imgs')->where(['resume_id' => $id, 'uid' => $user->id])->get();
- $Imgs_arr = []; //照片。
- $sub_resume_arr = []; //简历分站。
- $subsiteResume = SubsiteResume::where('resume_id', $id)->get();
- DB::beginTransaction();//检查数据库事务
- try {
- $resume_add = $this->ResumeRepository->resumeAdd($resume_arr);
- $resume_id = $resume_add->id;
- if (!$Education->isEmpty()) {
- foreach ($Education as $key => $val) {
- $Education_arr[$key]['uid'] = $val->uid;
- $Education_arr[$key]['resume_id'] = $resume_id;
- $Education_arr[$key]['startyear'] = $val->startyear;
- $Education_arr[$key]['startmonth'] = $val->startmonth;
- $Education_arr[$key]['endyear'] = $val->endyear;
- $Education_arr[$key]['endmonth'] = $val->endmonth;
- $Education_arr[$key]['school'] = $val->school;
- $Education_arr[$key]['speciality'] = $val->speciality;
- $Education_arr[$key]['education'] = $val->education;
- $Education_arr[$key]['education_cn'] = $val->education_cn;
- $Education_arr[$key]['todate'] = $val->todate;
- $Education_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $Education_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($Education_arr)) {
- $this->ResumeEducationRepository->addInsert($Education_arr);
- }
- if (!$Work->isEmpty()) {
- foreach ($Work as $key => $val) {
- $Work_arr[$key]['uid'] = $val->uid;
- $Work_arr[$key]['resume_id'] = $resume_id;
- $Work_arr[$key]['startyear'] = $val->startyear;
- $Work_arr[$key]['startmonth'] = $val->startmonth;
- $Work_arr[$key]['endyear'] = $val->endyear;
- $Work_arr[$key]['endmonth'] = $val->endmonth;
- $Work_arr[$key]['companyname'] = $val->companyname;
- $Work_arr[$key]['jobs'] = $val->jobs;
- $Work_arr[$key]['achievements'] = $val->achievements;
- $Work_arr[$key]['todate'] = $val->todate;
- $Work_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $Work_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($Work_arr)) {
- $this->ResumeWorkRepository->addInsert($Work_arr);
- }
- if (!$Train->isEmpty()) {
- foreach ($Train as $key => $val) {
- $Train_arr[$key]['uid'] = $val->uid;
- $Train_arr[$key]['resume_id'] = $resume_id;
- $Train_arr[$key]['startyear'] = $val->startyear;
- $Train_arr[$key]['startmonth'] = $val->startmonth;
- $Train_arr[$key]['endyear'] = $val->endyear;
- $Train_arr[$key]['endmonth'] = $val->endmonth;
- $Train_arr[$key]['agency'] = $val->agency;
- $Train_arr[$key]['course'] = $val->course;
- $Train_arr[$key]['description'] = $val->description;
- $Train_arr[$key]['todate'] = $val->todate;
- $Train_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $Train_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($Train_arr)) {
- $this->ResumeTrainRepository->addInsert($Train_arr);
- }
- if (!$Credent->isEmpty()) {
- foreach ($Credent as $key => $val) {
- $Credent_arr[$key]['uid'] = $val->uid;
- $Credent_arr[$key]['resume_id'] = $resume_id;
- $Credent_arr[$key]['name'] = $val->name;
- $Credent_arr[$key]['year'] = $val->year;
- $Credent_arr[$key]['month'] = $val->month;
- $Credent_arr[$key]['images'] = $val->images;
- $Credent_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $Credent_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($Credent_arr)) {
- $this->ResumeCredentRepository->addInsert($Credent_arr);
- }
- if (!$Language->isEmpty()) {
- foreach ($Language as $key => $val) {
- $Language_arr[$key]['uid'] = $val->uid;
- $Language_arr[$key]['resume_id'] = $resume_id;
- $Language_arr[$key]['language'] = $val->language;
- $Language_arr[$key]['language_cn'] = $val->language_cn;
- $Language_arr[$key]['level'] = $val->level;
- $Language_arr[$key]['level_cn'] = $val->level_cn;
- $Language_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $Language_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($Language_arr)) {
- $this->ResumeLanguageRepository->resumeLanAdd($Language_arr);
- }
- if (!$Imgs->isEmpty()) {
- foreach ($Imgs as $key => $val) {
- $Imgs_arr[$key]['uid'] = $val->uid;
- $Imgs_arr[$key]['resume_id'] = $resume_id;
- $Imgs_arr[$key]['img'] = $val->img;
- $Imgs_arr[$key]['title'] = $val->title;
- $Imgs_arr[$key]['audit'] = $val->audit;
- $Imgs_arr[$key]['subsite_id'] = $val->subsite_id;
- $Imgs_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $Imgs_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($Imgs_arr)) {
- DB::table('resume_imgs')->insert($Imgs_arr);
- }
- if ($subsiteResume->isNotEmpty()) {
- foreach ($subsiteResume as $key => $val) {
- $sub_resume_arr[$key]['subsite_id'] = $val->subsite_id;
- $sub_resume_arr[$key]['resume_id'] = $resume_id;
- $sub_resume_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
- $sub_resume_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
- }
- }
- if (!empty($sub_resume_arr)) {
- SubsiteResume::insert($sub_resume_arr);
- }
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2011, [$id, $resume_id])) {
- throw new \Exception("日志记失败!");
- }
- DB::commit();
- return ['code' => 1, 'info' => $resume_id];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function saveBasicInfo($data, $user)
- {
- $resume_id = array_get($data, 'resume_id');
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- $arr = $data;
- unset($arr['resume_id']);
- if (isset($data['marriage'])) {
- if ($data['marriage'] == 1) {
- $arr['marriage_cn'] = '未婚';
- } elseif ($data['marriage'] == 2) {
- $arr['marriage_cn'] = '已婚';
- } else {
- $arr['marriage_cn'] = '保密';
- }
- }
- if (isset($data['sex'])) {
- if ($data['sex'] == 1) {
- $arr['sex_cn'] = '男';
- } else {
- $arr['sex_cn'] = '女';
- }
- }
- if (isset($data['major'])) {
- $currentArr = $this->CategoryMajorRepository->getCategoryMajor($data['major']);
- $arr['major_cn'] = $currentArr['name'];
- }
- if (isset($data['education'])) {
- $educationArr = $this->CategoryRepository->getCategory($data['education']);
- $arr['education_cn'] = $educationArr['demand'];
- }
- if (isset($data['experience'])) {
- $experienceArr = $this->CategoryRepository->getCategory($data['experience']);
- $arr['experience_cn'] = $experienceArr['demand'];
- }
- $arr['audit'] = 1;
- return $this->ResumeRepository->updateById($arr, $data['resume_id']);
- }
- public function refreshResume($id, $user)
- {
- $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res_k, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- $res = $this->ResumeRepository->getArrayById($id);
- $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
- if ($resume_display != 2) {
- if ($res['audit'] != 2) {
- return ['code' => 0, 'info' => '审核中或审核未通过的简历无法刷新!'];
- }
- } else {
- if ($res['audit'] == 0) {
- return ['code' => 0, 'info' => '审核未通过的简历无法刷新!'];
- }
- }
- if ($res['display'] != 1) {
- return ['code' => 0, 'info' => '简历已关闭,无法刷新!'];
- }
- $timeSpace = config('aix.personal_set.per_set.per_set.refresh_resume_space') * 60;
- $duringtime = time() - strtotime($res['updated_at']);
- if ($duringtime <= $timeSpace && $timeSpace != 0) {
- return ['code' => 0, 'info' => config('aix.personal_set.per_set.per_set.refresh_resume_space') . '分钟内不允许重复刷新简历!'];
- }
- $resNum = config('aix.personal_set.per_set.per_set.refresh_resume_num');
- $startTime = time();
- $endTime = strtotime(date('Y-m-d 23:59:59', time()));
- if (Cache::has($user->id . $user->utype)) {
- $value = Cache::get($user->id . $user->utype);
- } else {
- $value = 0;
- }
- if ($resNum != 0 && $value >= $resNum) {
- return ['code' => 0, 'info' => '每天最多可刷新 ' . $resNum . " 次,您今天已达到最大刷新次数!"];
- }
- $result = $this->ResumeRepository->updateById(['updated_at' => date('Y-m-d H:i:s', time())], $id);
- event_search_update(Resume::class, (string)$id, 'update');
- if ($result) {
- $taskPoints = $this->TaskService->doTask(6, $user->id, $user->utype);
- Cache::put($user->id . $user->utype, $value + 1, intval(($endTime - $startTime) / 60));
- if ($taskPoints['code'] == 1) {
- //写入刷新日志
- $this->memberLogRepository->createLog($user, 1006, [$id, "手动刷新"]);
- return ['code' => 1, 'info' => $taskPoints['data']['points']];
- } else {
- return ['code' => 0, 'info' => $taskPoints['info']];
- }
- } else {
- return ['code' => 0, 'info' => '刷新失败'];
- }
- }
- public function getDuration($list)
- {
- if ($list) {
- foreach ($list as $key => $value) {
- $start = $value['startyear'] . '-' . $value['startmonth'];
- $end = $value['endyear'] . '-' . $value['endmonth'];
- if ($value['todate'] == 1) {
- $end = date('Y-m');
- }
- $list[$key]['duration'] = ddate($start, $end);
- }
- }
- return $list;
- }
- public function totalWorkDuration($list)
- {
- $total_year = 0;
- $total_month = 0;
- $return = '';
- if ($list) {
- foreach ($list as $key => $value) {
- $current_duration = strpos($value['duration'], '年');
- if ($current_duration === false) {
- $total_month += intval($value['duration']);
- } else {
- $arr = explode("年", $value['duration']);
- $total_year += intval($arr[0]);
- $total_month += intval($arr[1]);
- }
- }
- }
- $add_year = intval($total_month / 12);
- $total_year += $add_year;
- $total_month = intval($total_month % 12);
- if ($total_year > 0) {
- $return .= $total_year . '年';
- }
- if ($total_month > 0) {
- $return .= $total_month . '个月';
- }
- return $return;
- }
- public function resumeShow($id, $jobs_id = '', $user = null, $type = '', $guid = 0)
- {
- $request_all = \Illuminate\Support\Facades\Request::all();
- $utype = 0;
- $uid = 0;
- if ($user) {
- $utype = $user->utype;
- $uid = $user->id;
- }
- $resume = $this->ResumeRepository->getResume($id);
- if (!$resume) {
- return array('status' => 0, 'msg' => '简历不存在!');
- }
- if ($type != 1) {
- if (!isset(request()->token)) {
- if (!($user && $utype == 2 && $user->id == $resume->uid)) {
- if (!($user && $user->utype == '1' && $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id))) {
- if ($resume->display == 0) {
- return array('status' => 0, 'msg' => '简历不公开!');
- } else {
- if ($type != 'qr') {
- if (config('aix.personal_set.per_set.show_set.resume_display') == 1 && $resume->audit != '2') {
- return array('status' => 0, 'msg' => '简历未审核通过!');
- } elseif (config('aix.personal_set.per_set.show_set.resume_display') == 2 && $resume->audit == '0') {
- return array('status' => 0, 'msg' => '简历审核未通过!');
- }
- }
- }
- }
- }
- }
- }
- //TODO 分站判断 - 判断简历是否可以显示
- $resume->fullname_ = $resume->fullname;
- $memberInfo = DB::table('member_infos')->where('uid', $resume->uid)->first(); //简历基本信息
- $members = Member::find($resume->uid);
- if ($members) {
- $resume->login_last_time = date('Y-m-d', $members->last_login_time);
- }
- $resume->education_cn = $memberInfo->education_cn; //学历
- $resume->experience = $memberInfo->experience; //工作经验——id
- $resume->experience_cn = $memberInfo->experience_cn; //工作经验
- $resume->sex_cn = $memberInfo->sex_cn;
- //教育经历
- $education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
- $education = $this->getDuration($education);
- $resume->education_list = $education;
- //工作经历
- $work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
- $work = $this->getDuration($work);
- $resume->work_list = $work;
- $resume->work_count = count($work);
- $work_duration = $this->totalWorkDuration($work); //工龄
- $resume->work_duration = $work_duration;
- //培训经历
- $train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
- $train = $this->getDuration($train);
- $resume->training_list = $train;
- //语言能力
- $language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id);
- $resume->language_list = $language;
- //证书
- $credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id);
- $resume->credent_list = $credent;
- //简历照片
- $img_map = array(
- array('resume_id', '=', $resume->id),
- array('uid', '=', $resume->uid)
- );
- if (config('aix.personal_set.per_set.show_set.resume_img_display') == 1) {
- $img_map[] = array('audit', '=', '2');
- } else {
- $img_map[] = array('audit', '<>', '0');
- }
- $images = DB::table('resume_imgs')->where($img_map)->get();
- if ($images->isNotEmpty()) {
- $resume->img_list = $images;
- } else {
- $resume->img_list = array();
- }
- $resume->age = date("Y") - $memberInfo->birthday; //年龄
- //tag
- if ($resume->tag_cn) {
- $tag_cn = explode(',', $resume->tag_cn);
- $resume->tag_cn = $tag_cn;
- } else {
- $resume->tag_cn = array();
- }
- $resume->refreshtime_cn = daterange(time(), strtotime($resume->updated_at), 'Y-m-d', "#FF3300");
- //判断手机、微信、邮箱是否验证
- $members = DB::table('members')->where('id', $resume->uid)->first();
- $resume->is_audit_mobile = $members->mobile_audit;
- //处理附件简历链接地址
- if ($resume->word_resume) {
- $resume->word_resume_url = upload_asset($resume->word_resume);
- }
- //处理微信二维码
- $resume->label_id = 0;
- $resume->label_type = 0;
- $resume->label_resume = '';
- $down_resume = false;
- $jobs_apply = false;
- if ($utype == 1) {
- if (array_get($request_all, 'from_down') == 1) {
- $down_resume = CompanyDownResume::find($request_all['down_id']);
- } elseif (array_get($request_all, 'from_apply') == 1) {
- $down_resume = CompanyDownResume::where(['company_uid' => $uid, 'resume_id' => $id])->first();
- $jobs_apply = PersonalJobsApply::find($request_all['personal_jobs_id']);
- } else {
- $down_resume = CompanyDownResume::where(['company_uid' => $uid, 'resume_id' => $id])->first();
- $jobs_apply = PersonalJobsApply::where(['company_id' => $uid, 'resume_id' => $id])->first();
- }
- }
- $resume->label_arr = array();
- //处理简历预览页面label 信息
- if (array_get($request_all, 'from_down') == 1) {
- $resume->label_arr = $this->companyDownResumeRepository->getStateArr();
- $resume->label_resume = 'down';
- $resume->label_type = 1;
- $resume->label_id = $down_resume->is_reply;
- } elseif (array_get($request_all, 'from_apply') == 1) {
- $resume->label_arr = $this->PersonalJobsApplyRepository->getStateArr();
- $resume->label_resume = 'apply';
- $resume->label_type = 2;
- $resume->label_id = $jobs_apply ? $jobs_apply->is_reply : '';
- } elseif (array_get($request_all, 'from_interviews') == 1) { //从收到简历投递的页面来的
- $resume->label_arr = $this->companyDownResumeRepository->getStateArr();
- $resume->label_resume = 'interviews';
- $resume->label_type = 0;
- $resume->label_id = $jobs_apply ? $jobs_apply->is_reply : '';
- }
- if (!$jobs_id && $resume->label_resume == 'apply') {
- $resume->label_resume = '';
- }
- $resume->show_contact = $this->getShowContact($resume, $down_resume, $jobs_apply, $user, $type);
- // dd($resume->show_contact);
- if ($resume->show_contact === false) { //处理联系信息
- if ($memberInfo->display_name == "2") {
- $resume->fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
- } elseif ($memberInfo->display_name == "3") {
- if ($resume->sex == 1) {
- $resume->fullname = cut_str($resume->fullname, 1, 0, "先生");
- } elseif ($resume->sex == 2) {
- $resume->fullname = cut_str($resume->fullname, 1, 0, "女士");
- }
- }
- $resume->telephone = contact_hide($memberInfo->phone, 2);
- $resume->email = $memberInfo->email ? contact_hide($memberInfo->email, 3) : '';
- $resume->qq = contact_hide($memberInfo->qq, 4);
- $resume->weixin = contact_hide($memberInfo->weixin, 5);
- } else {
- $resume->telephone = $memberInfo->phone;
- $resume->email = $memberInfo->email;
- $resume->qq = $memberInfo->qq;
- $resume->weixin = $memberInfo->weixin;
- }
- if (preg_match("/([\x81-\xfe][\x40-\xfe])/", $resume->weixin, $match)) {
- $resume->weixin = null;
- }
- $resume->telephone_ = $resume->telephone;
- $resume->email_ = $resume->email;
- //联系方式展现形式 -图形化
- if (config('aix.personal_set.per_set.contact_type_set.contact_img_resume') == 2) {
- $pwdhash = config('aix.system.site_other.site_other.pwb_hash');
- if ($resume->telephone) {
- $resume->telephone = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->telephone, $pwdhash), 'type' => 'phone')) . "' />";
- }
- if ($resume->email) {
- $resume->email = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->email, $pwdhash), 'type' => 'email')) . "' />";
- }
- if ($resume->qq) {
- $resume->qq = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->qq, $pwdhash), 'type' => 'qq')) . "' />";
- }
- if ($resume->weixin) {
- $resume->weixin = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->weixin, $pwdhash), 'type' => 'weixin')) . "' />";
- }
- }
- $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
- if ($memberInfo->sex == 1) {
- $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
- }
- //1.照片为空
- //2.照片主动不显示
- //3.照片审核不通过
- //4.先审核后显示:照片不是审核通过的(不等于1)
- if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
- $resume->photosrc = $avatar_default; //不显示
- $resume->photosrc_show = false;
- } else {
- $resume->photosrc = upload_asset($memberInfo->images); //显示
- $resume->photosrc_show = true;
- }
- //期望薪资
- $resume->wage_cn = '';
- if ($resume->wage > 0) {
- $wage_categories = $this->CategoryRepository->getCategories();
- if ($wage_categories) {
- if (config('aix.system.site_other.site_other.site_salary') == 1) {
- $resume->wage_cn = array_has($wage_categories['AIX_wage_k'], [$resume->wage]) ? $wage_categories['AIX_wage_k'][$resume->wage] : '';
- } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
- $resume->wage_cn = array_has($wage_categories['AIX_wage_c'], [$resume->wage]) ? $wage_categories['AIX_wage_c'][$resume->wage] : '';
- }
- }
- } else {
- //自定义薪资
- $resume->wage_cn = $this->dealWage($resume->wage, $resume->wage_min, $resume->wage_max);
- }
- //期望职位
- if (!$resume->intention_jobs) {
- $job_cates = Cache::get('jobs_cate_list');
- if (null === $job_cates) {
- $job_cates = $this->CategoryJobsRepository->jobsCateInfoCache();
- Cache::put('jobs_cate_list', $job_cates, '86400');
- }
- $i_ids = array();
- if ($resume->intention_jobs_id) {
- $i_ids = explode(',', $resume->intention_jobs_id);
- }
- $jobs_names = array();
- if (count($i_ids) > 0) {
- foreach ($i_ids as $key => $val) {
- $intention_jobs_id_arr = explode('.', $val);
- $count = count($intention_jobs_id_arr);
- if ($count > 0) {
- foreach ($intention_jobs_id_arr as $k => $v) {
- if ($v && array_get($job_cates['id'], $v)) {
- $jobs_names[$key] = $job_cates['id'][$v]['name'];
- }
- }
- }
- }
- }
- $resume->intention_jobs = implode('+', $jobs_names);
- }
- if (!$resume->trade_cn) {
- $resume->trade_cn = '不限';
- }
- //企业用户 - 处理查看简历记录
- if ($utype == 1) {
- $view_where = array(
- 'uid' => $uid,
- 'resume_id' => $resume->id
- );
- $view_log = $this->ViewResumeRepository->findViewResume($view_where);
- $stime = date('Y-m-d H:i:s', time());
- if ($view_log) {
- $set_data = array(
- 'created_at' => $stime
- );
- $this->ViewResumeRepository->update($set_data, $view_log->id);
- } else {
- $set_data = array(
- 'uid' => $uid,
- 'resume_id' => $resume->id,
- 'created_at' => $stime,
- 'updated_at' => $stime
- );
- $this->ViewResumeRepository->create($set_data);
- }
- if ($jobs_id) {
- if (!empty($guid)) {
- $apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id, $guid);
- } else {
- $apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id);
- }
- if ($apply_log) {
- //企业对申请职位的简历设为已看
- $set_where = array('id' => $apply_log->id, 'company_id' => $uid);
- $apply_data = array('personal_look' => 2);
- $set_rst = $this->PersonalJobsApplyRepository->setApply($set_where, $apply_data);
- //添加会员日志
- if ($set_rst !== false) {
- $user_info = array(
- 'uid' => $uid,
- 'utype' => 1,
- 'username' => $user->username,
- 'ip' => ip2long(\Illuminate\Support\Facades\Request::getClientIp()),
- 'log_address' => '本机地址'
- );
- $this->feedbackService->addMembersLog($user_info, '', '标记申请职位记录(职位id:' . $apply_log->id . ')');
- if (!$this->memberLogRepository->createLog($user, 1016, $apply_log->id)) {
- throw new \Exception("日志记失败!");
- }
- }
- }
- }
- }
- //个人醒目标签
- $PersonalServiceStickLog = PersonalServiceTagLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
- if ($PersonalServiceStickLog) {
- if ($PersonalServiceStickLog->endtime - time() > 0) {
- $resume->strong_tag = $PersonalServiceStickLog->tag_cn;
- }
- }
- //preview - 个人用户
- $resume->preview = 0;
- if ($utype == 2 && $user->id == $resume->uid) {
- $resume->preview = 1;
- }
- //简历是否已收藏 - 企业用户
- $resume->favor = 0;
- if ($utype == 1) {
- $favor = $this->companyFavoriteRepository->findFavorite($resume->id, $user->id);
- if ($favor) {
- $resume->favor = 1;
- }
- }
- //来源分站名称
- $subsites = Cache::get('subsites_list');
- if (array_has($subsites, $resume->subsite_id)) {
- $resume->subsite_cn = $subsites[$resume->subsite_id]['sitename'];
- } else {
- $resume->subsite_cn = '';
- }
- $tag_logs = array();
- $contentStatus = $this->CategoryService->connectStatus($resume->uid, $resume->id);
- return ['resume' => $resume, 'member_infos' => $memberInfo, 'members' => $members, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent, 'utype' => $utype, 'uid' => $uid, 'images' => $images, 'contentStatus' => $contentStatus, 'tag_log' => $tag_logs];
- }
- public function dealWage($wage, $minwage, $maxwage)
- {
- 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) {
- $wage_cn = $minwage . '/月';
- } else {
- if ($minwage > 0 && $maxwage == 0) {
- $wage_cn = $minwage . '以上/月';
- } else {
- $wage_cn = $minwage . '~' . $maxwage . '/月';
- }
- }
- return $wage_cn;
- }
- public function getShowContact($val, $down, $apply, $user = null, $type = null)
- {
- $show_contact = false;
- $route = Route::current()->action;
- $prefix = $route['prefix'];
- if (!$user) {
- //if (!auth('web-company')->check() && !auth('web-member')->check()) { //情景1:游客访问
- if ($prefix == '/content' && config('aix.personal_set.per_set.contact_set.show_resume_contact') == '0') { //web端
- $show_contact = true;
- }
- if ($prefix == 'mobile/content' && config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == '0') { //移动端
- $show_contact = true;
- }
- //} elseif (auth('web-member')->check() && auth('web-member')->user()->id==$val->uid) {
- } elseif ($user && $user->utype == 2 && $user->id == $val->uid) {
- //情景2:个人会员访问并且是该简历发布者
- $show_contact = true;
- //} elseif (auth('web-company')->check()) {
- } elseif ($user && $user->utype == 1) { //情景3:企业会员访问
- //情景3-1:其他企业会员
- if ($prefix == '/content' && (config('aix.personal_set.per_set.contact_set.show_resume_contact') == 1 || config('aix.personal_set.per_set.contact_set.show_resume_contact') == 0)) {
- $show_contact = true;
- }
- if ($prefix == 'mobile/content' && (config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == 1 || config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == 0)) {
- $show_contact = true;
- }
- if ($down) { //情景3-2:下载过该简历
- $show_contact = true;
- }
- if ($apply) {//情景3-3:该简历申请过当前企业发布的职位
- //判断会员套餐 - 收到简历的联系方式免费查看
- //$user = auth('web-company')->user();
- $user_setmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, $user->utype);
- if ($user_setmeal && $user_setmeal->show_apply_contact == 1) {
- $show_contact = true;
- }
- }
- //招聘会过来直接看
- if ($type == 1) {
- $show_contact = true;
- }
- }
- return $show_contact;
- }
- public function resumeDoc($id)
- {
- if (empty($id)) {
- return false;
- }
- $resume = $this->ResumeRepository->resumeShow($id);
- if (!$resume) {
- return false;
- }
- $education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
- $work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
- $train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
- $language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id); //语言能力
- $credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id); //获得证书
- return ['resume' => $resume, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent];
- }
- public function descript($res, $html)
- {
- $temp_path = "temp/" . uniqid() . '.doc';
- Storage::disk('public')->put($temp_path, $html);
- $filename = $res['resume']['member_infos']['realname'] . '.doc';
- return response()->download(
- Storage::disk('public')->path($temp_path),
- $filename)->deleteFileAfterSend(true);
- }
- public function delResume($id)
- {
- if (empty($id)) {
- throw new ResponseException('抱歉,搜索不到简历!', '', 400);
- }
- $count = $this->ResumeRepository->getResumeCount(auth('web-member')->user()->id);
- if ($count == 1) {
- return ['code' => 0, 'info' => '', 'data' => ['tips' => '该简历无法删除,请至少保留一份简历!', 'description' => '如果您目前暂无求职意向,将简历状态设置为【保密】即可免受企业骚扰。', 'hidden_val' => 0]];
- } else {
- return ['code' => 1, 'info' => '', 'data' => ['tips' => '您确定要删除该份简历吗?', 'description' => '如果您目前暂无求职意向,将简历状态设置为【保密】即可免受企业骚扰。', 'hidden_val' => 1]];
- }
- }
- public function setDelResume($id, $user)
- {
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- $resume = $this->ResumeRepository->getResume($id);
- if ($resume->def == 1) {
- $default = $this->ResumeRepository->getResumeInfo(['uid' => $user->id, 'def' => 0]);
- if (!$default) {
- throw new ResponseException('默认简历不能删除!');
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $this->ResumeRepository->delResume($id);
- $this->ResumeRepository->updateById(['def' => 1], $default->id);
- Report::where('utype', 2)->whereIn('utype_id', [$id])->delete();
- $this->antic_personnel($user->id,$p=null);
- event_search_update(Resume::class, (string)$id, 'delete');
- event_search_update(Resume::class, (string)$default->id, 'update');
- DB::commit();
- if (!$this->memberLogRepository->createLog($user, 2008, $id)) {
- throw NEW \Exception("日志记失败!");
- }
- return true;
- } catch (\Exception $e) {
- DB::rollback();
- return false;
- }
- } else {
- event_search_update(Resume::class, (string)$id, 'delete');
- if (!$this->memberLogRepository->createLog($user, 2008, $id)) {
- throw NEW \Exception("日志记失败!");
- }
- Report::where('utype', 2)->whereIn('utype_id', [$id])->delete();
- return $this->ResumeRepository->delResume($id);
- }
- }
- public function setDef($id, $user)
- {
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- if (empty($id)) {
- throw new ResponseException('抱歉,搜索不到简历!', '', 400);
- }
- $default = $this->ResumeRepository->getPersonInfo($user->id);
- $default_id = $default->id;
- DB::beginTransaction();//检查数据库事务
- try {
- $this->ResumeRepository->updateById(['def' => 0], $default_id);
- $this->ResumeRepository->updateById(['def' => 1], $id);
- DB::commit();
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2009, $id)) {
- throw new \Exception("日志记失败!");
- }
- return ['code' => 1, 'info' => '设置成功'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
- }
- }
- public function entrust($id, $user)
- {
- if (empty($id)) {
- throw new ResponseException('抱歉,搜索不到简历!', '', 400);
- }
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- $resume = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
- if ($resume) {
- if (($resume->entrust_end - time()) > 0) {
- $result = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
- return ['code' => 1, 'data' => $result];
- } else {
- return ['code' => 0, 'data' => $this->ResumeRepository->getArrayById($id)];
- }
- } else {
- return ['code' => 0, 'data' => $this->ResumeRepository->getArrayById($id)];
- }
- }
- public function setEntrust($id, $user)
- {
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- $entrust = request()->entrust;
- if (empty($entrust)) {
- throw new ResponseException('请正确选择委托时间!', '', 400);
- }
- $resume = $this->ResumeRepository->getArrayById($id);
- if (empty($resume)) {
- throw new ResponseException('简历不存在!', '', 400);
- }
- $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
- if ($resume_display != 2) {
- if ($resume['audit'] != 2) {
- throw new ResponseException('审核中或审核未通过的简历无法委托!', '', 400);
- }
- } else {
- if ($resume['audit'] == 0) {
- throw new ResponseException('审核未通过的简历无法委托!', '', 400);
- }
- }
- if ($resume['display'] != 1) {
- return ['code' => 0, 'info' => '简历已关闭,无法委托!'];
- }
- $newResume = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
- switch ($entrust) {
- case '3':
- $data['entrust_end'] = strtotime("+3 day");
- break;
- case '7':
- $data['entrust_end'] = strtotime("+7 day");
- break;
- case '14':
- $data['entrust_end'] = strtotime("+14 day");
- break;
- case '30':
- $data['entrust_end'] = strtotime("+30 day");
- break;
- default:
- $data['entrust_end'] = strtotime("+3 day");
- break;
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $this->ResumeRepository->updateById(['entrust' => $data['entrust_end']], $id);
- if ($newResume) {
- $data['entrust'] = $entrust;
- $data['entrust_start'] = time();
- $this->ResumeEntrustRepository->updateEntrust($id, $data);
- } else {
- $data['resume_id'] = $id;
- $data['uid'] = $user->id;
- $data['fullname'] = $resume['fullname'];
- $data['entrust'] = $entrust;
- $data['entrust_start'] = time();
- $this->ResumeEntrustRepository->addEnteust($data);
- }
- event_search_update(Resume::class, (string)$id, 'update');
- DB::commit();
- if (!$this->memberLogRepository->createLog($user, 2005, $id)) {
- throwException("日志失败!");
- }
- return ['code' => 1, 'info' => '委托成功'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
- }
- }
- public function setEntrustDel($id, $user)
- {
- if (empty($id)) {
- throw new ResponseException('抱歉,搜索不到简历!', '', 400);
- }
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($id, $array_id)) {
- throw new ResponseException('简历不存在');
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $this->ResumeRepository->updateWord($id, ['entrust' => 0]);
- $this->ResumeEntrustRepository->updateEntrust($id, ['entrust' => 0, 'entrust_end' => 0, 'entrust_start' => 0]);
- event_search_update(Resume::class, (string)$id, 'update');
- DB::commit();
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2006, $id)) {
- throwException("日志失败!");
- }
- return ['code' => 1, 'info' => '取消委托成功'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
- }
- }
- public function attentionMe($user, $all)
- {
- $param_array = array('resume_id', 'look', 'settr');
- $params = array();
- if ($all) {
- foreach ($all as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $data = [];
- $resume_id = [];
- $resume = $this->ResumeRepository->getSuccessResume($user->id, getResumeStatus());
- if (!$resume->isEmpty()) {
- $resume_id = array_column($resume->toArray(), 'id');
- }
- if (request()->resume_id) {
- $resume_id = explode(',', request()->resume_id);
- }
- if (request()->settr) {
- switch (request()->settr) {
- case '3':
- $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day"))];
- break;
- case '7':
- $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-7 day"))];
- break;
- case '15':
- $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-15 day"))];
- break;
- case '30':
- $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-30 day"))];
- break;
- default:
- $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day"))];
- break;
- }
- }
- $res = $this->ViewResumeRepository->getAttentMe($data, $resume_id);
- if ($res->total()) {
- foreach ($res as $key => $val) {
- $Result = $this->CompanyDownResumeService->getDownResume(['resume_id' => $val->resume_id, 'company_uid' => $val->uid]);
- if ($Result) {
- $res[$key]['status'] = 1;
- } else {
- $res[$key]['status'] = 0;
- }
- }
- }
- return ['content' => $res, 'params' => $params];
- }
- public function delAttention($id, $user)
- {
- if (empty($id)) {
- throw new ResponseException('关注企业不存在!', '', 400);
- }
- $res = ViewResume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- $res_k = string_to_array(',', $id);
- foreach ($res_k as $key => $val) {
- if (!in_array($val, $array_id)) {
- throw new ResponseException('关注企业不存在', '', 400);
- }
- }
- return ViewResume::destroy(explode(',', $id));
- }
- public function tagCn($user)
- {
- if (empty(request()->resume_id)) {
- return ['code' => 0, 'info' => '简历不存在!'];
- }
- $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res_k, 'id');
- if (!in_array(request()->resume_id, $array_id)) {
- return ['code' => 0, 'info' => '简历不存在!'];
- }
- $res = $this->ResumeRepository->getArrayById(request()->resume_id);
- $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
- if ($resume_display != 2) {
- if ($res['audit'] != 2) {
- return ['code' => 0, 'info' => '审核中或未通过的简历无法标签!'];
- }
- } else {
- if ($res['audit'] == 0) {
- return ['code' => 0, 'info' => '审核未通过的简历无法标签!'];
- }
- }
- if ($res['display'] != 1) {
- return ['code' => 0, 'info' => '简历已关闭,无法标签!'];
- }
- $person_tag = $this->CategoryRepository->getCategoryByAlias(['alias' => 'AIX_personaltag']);
- $service_tags = PersonalServiceTag::orderBy('list_order', 'desc')->get();
- $points = DB::table('members_points')->where(['uid' => auth('web-member')->user()->id, 'utype' => auth('web-member')->user()->utype])->first();
- return ['code' => 1, 'person_tag' => $person_tag, 'service_tag' => $service_tags, 'points' => $points, 'resume_id' => request()->resume_id];
- }
- public function resumeStick($user)
- {
- if (empty(request()->resume_id)) {
- return ['code' => 0, 'info' => '简历不存在!'];
- }
- $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res_k, 'id');
- if (!in_array(request()->resume_id, $array_id)) {
- return ['code' => 0, 'info' => '简历不存在!'];
- }
- $res = $this->ResumeRepository->getArrayById(request()->resume_id);
- $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
- if ($resume_display != 2) {
- if ($res['audit'] != 2) {
- return ['code' => 0, 'info' => '审核中或未通过的简历无法置顶!'];
- }
- } else {
- if ($res['audit'] == 0) {
- return ['code' => 0, 'info' => '审核未通过的简历无法置顶!'];
- }
- }
- if ($res['display'] != 1) {
- return ['code' => 0, 'info' => '简历已关闭,无法置顶!'];
- }
- $service_sticks = PersonalServiceStick::orderBy('list_order', 'desc')->get();
- $points = DB::table('members_points')->where(['uid' => auth('web-member')->user()->id, 'utype' => auth('web-member')->user()->utype])->first();
- return ['code' => 1, 'service_stick' => $service_sticks, 'points' => $points, 'resume_id' => request()->resume_id];
- }
- public function incrementAddSave($date, $user)
- {
- $resume_id = array_get($date, 'resume_id');
- if (empty($date['tag_id'])) {
- throw new ResponseException('请选择标签!', '', 400);
- }
- if (empty($resume_id)) {
- throw new ResponseException('请选择简历!', '', 400);
- }
- if (empty($date['days'])) {
- throw new ResponseException('请选择天数!', '', 400);
- }
- $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res_k, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在!', '', 400);
- }
- $res = $this->ResumeRepository->getArrayById($resume_id);
- $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
- if ($resume_display != 2) {
- if ($res['audit'] != 2) {
- throw new ResponseException('审核中或未通过的简历无法标签!', '', 400);
- }
- } else {
- if ($res['audit'] == 0) {
- throw new ResponseException('审核未通过的简历无法标签!', '', 400);
- }
- }
- if ($res['display'] != 1) {
- throw new ResponseException('简历已关闭,无法标签!', '', 400);
- }
- $categorys = Category::where('id', $date['tag_id'])->first();
- $personal_service_tags = PersonalServiceTag::where('days', $date['days'])->first();
- if (is_null($personal_service_tags)) {
- throw new ResponseException('请选择时长!', '', 400);
- }
- $POINTS = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
- if ($POINTS) {
- if ($POINTS->points < $personal_service_tags->points) {
- throw new ResponseException('积分不足!', '', 400);
- }
- } else {
- throw new ResponseException('积分不存在!', '', 400);
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $tag_logs = PersonalServiceTagLog::where(['resume_id' => $date['resume_id'], 'resume_uid' => $user->id])->first();
- if ($tag_logs) {
- $dat['days'] = $date['days'];
- $dat['points'] = $personal_service_tags->points;
- $dat['tag_id'] = $date['tag_id'];
- $dat['tag_cn'] = $categorys->demand;
- $dat['addtime'] = time();
- $dat['endtime'] = strtotime("+" . $date['days'] . " day");
- PersonalServiceTagLog::where(
- ['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
- )->update($dat);
- } else {
- $dat['resume_id'] = $date['resume_id'];
- $dat['resume_uid'] = $user->id;
- $dat['days'] = $date['days'];
- $dat['points'] = $personal_service_tags->points;
- $dat['tag_id'] = $date['tag_id'];
- $dat['tag_cn'] = $categorys->demand;
- $dat['addtime'] = time();
- $dat['endtime'] = strtotime("+" . $date['days'] . " day");
- PersonalServiceTagLog::create($dat);
- }
- MembersPoint::where(
- ['uid' => $user->id, 'utype' => $user->utype]
- )->decrement('points', $personal_service_tags->points);
- MembersHandsel::create(
- ['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => $categorys->demand, 'operate' => 2, 'points' => $personal_service_tags->points]
- );
- $order = new Order();
- $order->uid = $user->id;
- $order->utype = $user->utype;
- $order->order_type = 4;
- $order->pay_type = 1;
- $order->is_pay = 2;
- $order->amount = $personal_service_tags->points / config('aix.system.site_other.site_other.points_match');
- $order->pay_points = $personal_service_tags->points;
- $order->payment = 'points';
- $order->payment_cn = '积分';
- $order->discount = $categorys->demand;
- $order->payment_time = time();
- $order->service_name = "简历标签";
- $order->charge = json_encode($date);
- $order->save();
- $PayService = new PayService();
- $order->oid = $PayService->getTradeNo($order->id);
- $order->save();
- DB::commit();
- return ['code' => 1, 'info' => '兑换成功!'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function incrementStickSave($date, $user)
- {
- $resume_id = array_get($date, 'resume_id');
- if (empty($resume_id)) {
- throw new ResponseException('请选择简历!', '', 400);
- }
- if (empty($date['days'])) {
- throw new ResponseException('请选择天数!', '', 400);
- }
- $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res_k, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在!', '', 400);
- }
- $res = $this->ResumeRepository->getArrayById($resume_id);
- $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
- if ($resume_display != 2) {
- if ($res['audit'] != 2) {
- throw new ResponseException('审核中或未通过的简历无法置顶!', '', 400);
- }
- } else {
- if ($res['audit'] == 0) {
- throw new ResponseException('审核未通过的简历无法置顶!', '', 400);
- }
- }
- if ($res['display'] != 1) {
- throw new ResponseException('简历已关闭,无法置顶!', '', 400);
- }
- $personal_service_sticks = PersonalServiceStick::where('days', $date['days'])->first();
- if (is_null($personal_service_sticks)) {
- throw new ResponseException('请选择时长!', '', 400);
- }
- $POINTS = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
- if ($POINTS) {
- if ($POINTS->points < $personal_service_sticks->points) {
- throw new ResponseException('积分不足!', '', 400);
- }
- } else {
- throw new ResponseException('积分不存在!', '', 400);
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $stick_logs = PersonalServiceStickLog::where(
- ['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
- )->first();
- Resume::where('id', $date['resume_id'])->update(['stick' => 1, 'stime' => strtotime("+" . $date['days'] . " day")]);
- event_search_update(Resume::class, (string)$date['resume_id'], 'update');
- if ($stick_logs) {
- $dat['days'] = $date['days'];
- $dat['points'] = $personal_service_sticks->points;
- $dat['addtime'] = time();
- $dat['endtime'] = strtotime("+" . $date['days'] . " day");
- PersonalServiceStickLog::where(
- ['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
- )->update($dat);
- } else {
- $dat['resume_id'] = $date['resume_id'];
- $dat['resume_uid'] = $user->id;
- $dat['days'] = $date['days'];
- $dat['points'] = $personal_service_sticks->points;
- $dat['addtime'] = time();
- $dat['endtime'] = strtotime("+" . $date['days'] . " day");
- PersonalServiceStickLog::create($dat);
- }
- MembersPoint::where(
- ['uid' => $user->id, 'utype' => $user->utype]
- )->decrement('points', $personal_service_sticks->points);
- MembersHandsel::create(
- ['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => '简历置顶' . $date['days'] . '天', 'operate' => 2, 'points' => $personal_service_sticks->points]
- );
- $order = new Order();
- $order->uid = $user->id;
- $order->utype = $user->utype;
- $order->order_type = 3;
- $order->pay_type = 1;
- $order->is_pay = 2;
- $order->amount = $personal_service_sticks->points / config('aix.system.site_other.site_other.points_match');
- $order->pay_points = $personal_service_sticks->points;
- $order->payment = 'points';
- $order->payment_cn = '积分';
- $order->payment_time = time();
- $order->service_name = "简历置顶";
- $order->discount = '置顶' . $date['days'] . '天';
- $order->charge = json_encode($date);
- $order->save();
- $PayService = new PayService();
- $order->oid = $PayService->getTradeNo($order->id);
- $order->save();
- DB::commit();
- return ['code' => 1, 'info' => '兑换成功!'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function autoRefresh($date, $user)
- {
- $resume_id = $date['resume_id'];
- $auto_refresh = $date['auto_refresh'];
- $auto_apply = $date['auto_apply'];
- if (empty($resume_id)) {
- throw new ResponseException('简历不存在!', '', 400);
- }
- $uid = $user->id;
- $utype = $user->utype;
- $refreshtime = strtotime("+3 day");
- $Queue = QueueAutoRefresh::where(['pid' => $resume_id, 'utype' => 2])->first();
- $entrusts = ResumeEntrust::where(['resume_id' => $resume_id, 'uid' => $uid])->first();
- $resume = $this->ResumeRepository->getArrayById($resume_id);
- DB::beginTransaction();//检查数据库事务
- try {
- if ($auto_refresh == 1) {
- if ($Queue) {
- QueueAutoRefresh::where(['pid' => $resume_id, 'utype' => 2])->update(['start_time' => time(), 'refreshtime' => $refreshtime]);
- } else {
- $order['pid'] = $resume_id;
- $order['type'] = 2;
- $order['uid'] = $uid;
- $order['utype'] = $utype;
- $order['start_time'] = time();
- $order['refreshtime'] = $refreshtime;
- QueueAutoRefresh::create($order);
- }
- }
- if ($auto_apply == 1) {
- if ($entrusts) {
- ResumeEntrust::where(['resume_id' => $resume_id, 'uid' => $uid])->update(['entrust_start' => time(), 'entrust_end' => $refreshtime, 'entrust' => 3]);
- } else {
- $ord['resume_id'] = $resume_id;
- $ord['uid'] = $uid;
- $ord['fullname'] = $resume['fullname'];
- $ord['entrust'] = 3;
- $ord['entrust_start'] = time();
- $ord['entrust_end'] = $refreshtime;
- ResumeEntrust::create($ord);
- }
- $this->ResumeRepository->updateWord($resume_id, ['entrust' => $refreshtime]);
- }
- DB::commit();
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2027, $resume_id)) {
- throw new \Exception("日志记失败!");
- }
- return ['code' => 1, 'info' => '保存成功!'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function uploadImages($date, $user)
- {
- if (empty($date['resume_id'])) {
- throw new ResponseException('简历不存在!', '', 400);
- }
- if (empty($date['img'])) {
- throw new ResponseException('图片不存在!', '', 400);
- }
- $arr['uid'] = $user->id;
- $arr['resume_id'] = $date['resume_id'];
- $arr['img'] = $date['img'];
- $arr['created_at'] = date('Y-m-d H:i:s', time());
- $arr['updated_at'] = date('Y-m-d H:i:s', time());
- $resume_imgs = DB::table('resume_imgs')->where(['uid' => $user->id, 'resume_id' => $date['resume_id']])->first();
- DB::beginTransaction();//检查数据库事务
- try {
- if (empty($resume_imgs)) {
- $resumeArr = $this->ResumeRepository->getResumeById($date['resume_id']);
- if ($resumeArr->complete_percent + 5 <= 100) {
- if ($resumeArr->complete_percent + 5 >= 70 && $resumeArr->complete_percent + 5 < 90) {
- $this->TaskService->doTask(12);
- $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 2], $date['resume_id']);
- } elseif ($resumeArr->complete_percent + 5 >= 90 && $resumeArr->complete_percent + 5 <= 100) {
- $this->TaskService->doTask(11);
- $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 1], $date['resume_id']);
- } else {
- $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 0], $date['resume_id']);
- }
- }
- }
- $result = DB::table('resume_imgs')->insert($arr);
- if ($result) {
- $id = DB::getPdo()->lastInsertId();
- $das['audit'] = 1;
- $expires = config('aix.personal_set.per_set.per_set.resume_expires');
- if ($expires) {
- $das['expires'] = strtotime("+{$expires} days");
- }
- $this->ResumeRepository->updateById($das, $date['resume_id']);
- event_search_update(Resume::class, (string)$date['resume_id'], 'update');
- }
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2030, $date['resume_id'])) {
- throw new \Exception("日志记失败!");
- }
- DB::commit();
- return ['code' => 1, 'info' => $id];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => '上传失败!'];
- }
- }
- public function uploadFiles($date)
- {
- event_search_update(Resume::class, (string)$date['resume_id'], 'update');
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2030, $date['resume_id'])) {
- throw new \Exception("日志记失败!");
- }
- return $this->ResumeRepository->updateWord(
- $date['resume_id'],
- [
- 'word_resume' => $date['files'],
- 'word_resume_title' => $date['name'],
- 'word_resume_addtime' => time(),
- ]
- );
- }
- public function delFile($date)
- {
- event_search_update(Resume::class, (string)$date['resume_id'], 'update');
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2031, $date['resume_id'])) {
- throw new \Exception("日志记失败!");
- }
- return $this->ResumeRepository->updateWord(
- $date['resume_id'],
- [
- 'word_resume' => '',
- 'word_resume_title' => '',
- 'word_resume_addtime' => null,
- ]
- );
- }
- public function del_images($data)
- {
- if (empty($data['id'])) {
- throw new ResponseException('图片不存在!', '', 400);
- }
- $count = DB::table('resume_imgs')->where(['uid' => auth('web-member')->user()->id, 'resume_id' => $data['resume_id']])->count();
- DB::beginTransaction();//检查数据库事务
- try {
- $res = DB::table('resume_imgs')->where('id', $data['id'])->delete();
- if ($count == 1) {
- $resumeArr = $this->ResumeRepository->getResumeById($data['resume_id']);
- if ($resumeArr->complete_percent - 5 > 0) {
- if ($resumeArr->complete_percent - 5 >= 70 && $resumeArr->complete_percent - 5 < 90) {
- $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 2], $data['resume_id']);
- } elseif ($resumeArr->complete_percent - 5 >= 90 && $resumeArr->complete_percent - 15 <= 100) {
- $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 1], $data['resume_id']);
- } else {
- $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 0], $data['resume_id']);
- }
- event_search_update(Resume::class, (string)$data['resume_id'], 'update');
- }
- }
- DB::commit();
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2029, $data['resume_id'])) {
- throw new \Exception("日志记失败!");
- }
- return ['code' => 1, 'info' => $res];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => '上传失败!'];
- }
- }
- /**企业的邀请面试记录
- * @param $request
- * @return array
- */
- public function interviewJobs($request, $user)
- {
- $jobs_id = isset($request['jobs_id']) ? $request['jobs_id'] : 0;
- $stop = isset($request['stop']) ? $request['stop'] : 0;
- $look = isset($request['look']) ? $request['look'] : 0;
- $settr = isset($request['settr']) ? $request['settr'] : 0;
- $page = 10;
- $where['company_id'] = $user->id;
- $valid = ['1'];
- if ($stop) {
- $valid = ['1', '0'];
- }
- if ($jobs_id) {
- $where['jobs_id'] = $jobs_id;
- }
- if ($look) {
- $where['personal_look'] = $look;
- }
- if ($settr) {
- $where[] = ['interview_time', '>=', strtotime("-{$settr} day")];
- }
- // $where['result'] = 0;
- $jobs_map['company_id'] = $user->id;
- if (!$stop) {
- $jobs_map['valid'] = 1;
- }
- if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
- $jobs_map['audit'] = 1;
- }
- $param_array = array('jobs_id', 'stop', 'look', 'settr');
- $params = array();
- if ($request) {
- foreach ($request as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $jobs = $this->jobsRepository->jobsList($jobs_map);
- if ($jobs) {
- $jobs = $jobs->toArray();
- $jobsList = array_column($jobs, 'jobs_name', 'id');
- }
- $result = $this->CompanyInterviewRepository->interviewJobs($page, $where, $valid);
- return [
- 'result' => $result,
- 'jobsList' => $jobsList,
- 'params' => $params,
- 'stop' => $stop,
- 'jobs_id' => $jobs_id,
- ];
- }
- /**
- * 面试邀请详情
- * @param $request
- * @return \Illuminate\Http\JsonResponse
- * @throws \Throwable
- */
- public function interviewDetail($request)
- {
- if (!$id = $request->id) {
- return response()->json(['status' => 0, 'msg' => '请正确选择面试信息']);
- }
- $interviewInfo = $this->CompanyInterviewRepository->interviewDetail(['id' => $id]);
- if (!$interviewInfo) {
- return response()->json(['status' => 0, 'msg' => '面试信息不存在']);
- }
- $is_apply = 0;
- if ($this->PersonalJobsApplyRepository->findWhere(['resume_id' => $interviewInfo->resume_id, 'company_id' => auth('web-company')->user()->id])) {
- $is_apply = 1;
- }
- return response()->json(['status' => 1, 'msg' => '面试信息获取成功!', 'data' => view('app.company.ajax.ajax_show_interview', ['interviewInfo' => $interviewInfo, 'is_apply' => $is_apply])->render()]);
- }
- /**
- * 删除面试邀请
- * @param $request
- * @return array
- */
- public function interviewDel($request, $user)
- {
- $id = isset($request['id']) ? $request['id'] : 0;
- if (!$id) {
- return ['status' => 0, 'msg' => '请选择要删除的面试邀请!'];
- }
- $ids = is_array($id) ? $id : explode(',', $id);
- if (!$this->CompanyInterviewRepository->delInterview($ids, $user->id)) {
- return ['status' => 0, 'msg' => '删除失败!'];
- }
- if (!$this->memberLogRepository->createLog($user, 1011, $id)) {
- throw new \Exception('日志记录失败');
- }
- return ['status' => 1, 'msg' => '删除成功!'];
- }
- /**
- * 企业下载的简历
- * @param $request
- * @return array
- */
- public function resumeDown($request, $user)
- {
- $state_arr = array('1' => '可面试', '2' => '未接通', '3' => '不合适');
- $state = isset($request['state']) ? $request['state'] : '';
- $settr = isset($request['settr']) ? $request['settr'] : 0;
- if (isset($request['state'])) {
- $where['is_reply'] = $request['state'];
- }
- $map = [];
- if (isset($request['settr'])) {
- $map[] = ['down_addtime', '>=', strtotime("-{$request['settr']} day")];
- }
- $param_array = array('state', 'settr');
- $params = array();
- if ($request) {
- foreach ($request as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $page = 10;
- $where['company_uid'] = $user->id;
- $downList = $this->companyDownResumeRepository->downResume($where, $map, $page);
- // if ($downList->total()) {
- // foreach ($downList as $key => $val) {
- // if ($val->resumes) {
- // if ($val->resumes->display_name=="2") {
- // $val->resumes->fullname="N".str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
- // } elseif ($val->resumes->display_name=="3") {
- // if ($val->resumes->sex==1) {
- // $val->resumes->fullname=cut_str($val->resumes->fullname, 1, 0, "先生");
- // } elseif ($val->resumes->sex==2) {
- // $val->resumes->fullname=cut_str($val->resumes->fullname, 1, 0, "女士");
- // }
- // }
- // }
- // }
- // }
- return $res = [
- 'downList' => $downList,
- 'state_arr' => $state_arr,
- 'state' => $state,
- 'settr' => $settr,
- 'params' => $params,
- ];
- }
- public function resumeDownDel($request)
- {
- $user = auth('web-company')->user();
- $yid = $request->y_id ? $request->y_id : 0;
- if (!$yid) {
- return response()->json(['status' => 0, 'msg' => '请选择要删除的简历!']);
- }
- $ids = is_array($yid) ? $yid : explode(',', $yid);
- $where['company_uid'] = $user->id;
- if (false == $this->companyDownResumeRepository->resumeDownDel($ids, $where)) {
- return response()->json(['status' => 0, 'msg' => '简历删除失败!']);
- }
- if (!$this->memberLogRepository->createLog($user, 1017, $ids)) {
- throw new \Exception("日志记录失败!");
- }
- return response()->json(['status' => 1, 'msg' => '简历删除成功!']);
- }
- /**
- * 企业收藏的简历
- * @param $request
- * @return array
- */
- public function favoritesResume($request, $user, $type = 0)
- {
- $where = [];
- $map = [];
- $hasget = false;
- $settr = isset($request['settr']) ? $request['settr'] : 0;
- if ($settr) {
- $hasget = true;
- $where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
- }
- if ($type == 1) {
- $education = isset($request['education']) ? $request['education'] : 0;
- $experience = isset($request['experience']) ? $request['experience'] : 0;
- $eduArr = Category::where('alias', 'AIX_education')->pluck('demand', 'id')->toArray();
- $expArr = Category::where('alias', 'AIX_experience')->pluck('demand', 'id')->toArray();
- $education && $map['education'] = $education;
- $experience && $map['experience'] = $experience;
- $result['eduArr'] = $eduArr;
- $result['expArr'] = $expArr;
- $result['experience'] = $experience;
- $result['education'] = $education;
- }
- $page = 10;
- $param_array = array('settr', 'education', 'experience');
- $params = array();
- if ($request) {
- foreach ($request as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $favorityList = $this->companyFavoriteRepository->favorityList($where, $map, $user->id, $page);
- if ($favorityList->total()) {
- foreach ($favorityList as $key => $val) {
- if ($val->resumes) {
- if ($val->resumes->display_name == "2") {
- $val->resumes->fullname = "N" . str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
- } elseif ($val->resumes->display_name == "3") {
- if ($val->resumes->sex == 1) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
- } elseif ($val->resumes->sex == 2) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
- }
- }
- }
- }
- }
- $result['favorityList'] = $favorityList;
- $result['settr'] = $settr;
- $result['params'] = $params;
- $result['hasget'] = $hasget;
- return $result;
- }
- /**收藏简历操作
- * @param $request
- * @return \Illuminate\Http\JsonResponse
- * @throws \Prettus\Validator\Exceptions\ValidatorException
- */
- public function favoritesResumeSave($request)
- {
- $resume_id = $request->resume_id;
- if (!$resume_id) {
- return response()->json(['status' => 0, 'msg' => '请选择要收藏的简历!']);
- }
- $data['resume_id'] = $resume_id;
- $data['company_id'] = auth('web-company')->user()->id;
- if ($this->companyFavoriteRepository->findFavorite($resume_id, auth('web-company')->user()->id)) {
- return response()->json(['status' => 0, 'msg' => '已收藏该简历,请勿重复收藏!']);
- }
- if (!$this->companyFavoriteRepository->create($data)) {
- return response()->json(['status' => 0, 'msg' => '收藏简历失败!']);
- }
- return response()->json(['status' => 1, 'msg' => '收藏简历成功!']);
- }
- /**m删除企业收藏的简历
- * @param $ids
- * @param $user
- * @return \Illuminate\Http\JsonResponse
- * @throws \ErrorException
- * @throws \Prettus\Validator\Exceptions\ValidatorException
- */
- public function favoritesResumeDel($ids, $user)
- {
- $id = $ids;
- if (!$id) {
- return response()->json(['status' => 0, 'msg' => '请选择简历!']);
- }
- $ids = is_array($id) ? $id : explode(',', $id);
- if (!$this->companyFavoriteRepository->favoritesResumeDel($ids, $user->id)) {
- return response()->json(['status' => 0, 'msg' => '删除失败!']);
- }
- if (!$this->memberLogRepository->createLog($user, 1019, $ids)) {
- throw new \Exception("日志记录失败!");
- }
- return response()->json(['status' => 1, 'msg' => '删除成功!']);
- }
- /**浏览过的简历
- * @param $request
- * @return array
- */
- public function browseResume($request)
- {
- $settr = $request->settr ? $request->settr : 0;
- $map = [];
- if ($settr) {
- $map[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
- }
- $param_array = array('settr');
- $params = array();
- if ($request->all()) {
- foreach ($request->all() as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $page = 10;
- $browseList = $this->ViewResumeRepository->browseList($map, auth('web-company')->user()->id, $page);
- foreach ($browseList as $key => $val) {
- if ($val->resumes) {
- //查找企业是否收藏对应简历
- $val->is_favorite = 0;
- if ($this->companyFavoriteRepository->findFavorite($val->resumes->id, auth('web-company')->user()->id)) {
- $val->is_favorite = 1;
- }
- if ($val->resumes->display_name == "2") {
- $val->resumes->fullname = "N" . str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
- } elseif ($val->resumes->display_name == "3") {
- if ($val->resumes->sex == 1) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
- } elseif ($val->resumes->sex == 2) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
- }
- }
- }
- }
- $result = [
- 'settr' => $settr,
- 'browseList' => $browseList,
- 'params' => $params,
- ];
- return $result;
- }
- /**删除浏览过的简历
- * @param $request
- * @return \Illuminate\Http\JsonResponse
- */
- public function browseResumeDel($request, $user)
- {
- $id = $request->y_id;
- if (!$id) {
- return response()->json(['status' => 0, 'msg' => '请选择简历!']);
- }
- $ids = is_array($id) ? $id : explode(',', $id);
- if (!$this->ViewResumeRepository->browseResumeDel($ids, $user->id)) {
- return response()->json(['status' => 0, 'msg' => '删除失败!']);
- }
- if (!$this->memberLogRepository->createLog($user, 1020, $ids)) {
- throw new \Exception("日志记录失败!");
- }
- return response()->json(['status' => 1, 'msg' => '删除成功!']);
- }
- /**谁看过我
- * @param $request
- * @return array
- */
- public function browseJobs($request)
- {
- $settr = $request->settr ? $request->settr : 0;
- $map = [];
- if ($settr) {
- $map[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
- }
- $map['company_id'] = auth('web-company')->user()->id;
- $param_array = array('settr');
- $params = array();
- if ($request->all()) {
- foreach ($request->all() as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $page = 10;
- $result = $this->viewJobRepository->browseJobs($map, $page, $map['company_id']);
- foreach ($result as $key => $val) {
- if ($val->resumes) {
- //查找企业是否收藏对应简历
- $val->is_favorite = 0;
- if ($this->companyFavoriteRepository->findFavorite($val->resumes->id, auth('web-company')->user()->id)) {
- $val->is_favorite = 1;
- }
- if ($val->resumes->display_name == "2") {
- $val->resumes->fullname = "N" . str_pad($val->resumes->id, 7, "0", STR_PAD_LEFT);
- } elseif ($val->resumes->display_name == "3") {
- if ($val->resumes->sex == 1) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
- } elseif ($val->resumes->sex == 2) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
- }
- }
- }
- }
- return $res = [
- 'result' => $result,
- 'settr' => $settr,
- 'params' => $params,
- ];
- }
- /**删除谁看过我
- * @param $request
- * @return \Illuminate\Http\JsonResponse
- */
- public function browseJobsDel($request, $user)
- {
- $id = $request->y_id;
- if (!$id) {
- return response()->json(['status' => 0, 'msg' => '请选择简历!']);
- }
- $ids = is_array($id) ? $id : explode(',', $id);
- if (!$this->viewJobRepository->browseJobsDel($ids, $user->id)) {
- return response()->json(['status' => 0, 'msg' => '删除失败!']);
- }
- if (!$this->memberLogRepository->createLog($user, 1021, $ids)) {
- throw new \Exception("日志记录失败!");
- }
- return response()->json(['status' => 1, 'msg' => '删除成功!']);
- }
- /**面试结果反馈
- * @param $request
- * @return array
- */
- public function feedback($request)
- {
- $feedback = [1 => '面试通过', 2 => '面试未通过', 3 => '未参加面试', 4 => '面试时间变更'];
- $user = auth('web-company')->user();
- $type = $request->type ? $request->type : '';
- $settr = $request->settr ? $request->settr : '';
- $jobs_id = $request->jobs_id ? $request->jobs_id : 0;
- $is_pass = $request->is_pass ? $request->is_pass : 0;
- $where['company_id'] = $user->id;
- if ($type) {
- $where[] = ['result', '>', 0];
- } else {
- $where['result'] = 0;
- }
- $valid = ['1'];
- if ($jobs_id) {
- $where['jobs_id'] = $jobs_id;
- }
- if ($settr) {
- $where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
- }
- if ($is_pass) {
- $where['result'] = $is_pass;
- }
- $jobs_map['company_id'] = $user->id;
- $jobs_map['valid'] = 1;
- if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
- $jobs_map['audit'] = 1;
- }
- $param_array = array('type', 'jobs_id', 'settr');
- $params = array();
- if ($request->all()) {
- foreach ($request->all() as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $page = 10;
- $jobs = $this->jobsRepository->jobsList($jobs_map)->toArray();
- $jobsList = array_column($jobs, 'jobs_name', 'id');
- $result = $this->CompanyInterviewRepository->interviewJobs($page, $where, $valid);
- return $res = [
- 'result' => $result,
- 'type' => $type,
- 'jobsList' => $jobsList,
- 'params' => $params,
- 'jobs_id' => $jobs_id,
- 'feedback' => $feedback,
- 'is_pass' => $is_pass,
- ];
- }
- /**面试结果反馈操作
- * @param $id
- * @param $notes
- * @param $status
- * @return \Illuminate\Http\JsonResponse
- * @throws \Prettus\Validator\Exceptions\ValidatorException
- */
- public function feedbackModify($id, $notes, $status, $company_id)
- {
- $data = [
- 'explan' => $notes,
- 'result' => $status,
- ];
- $isOk = $this->CompanyInterviewRepository->InterviewUpdate($data, $id, $company_id);
- if (!$isOk) {
- return response()->json(['status' => 0, 'msg' => "修改反馈结果失败!"]);
- }
- return response()->json(['status' => 1, 'msg' => "修改反馈结果成功!"]);
- }
- /**简历回收站
- * @return array
- */
- public function recycle()
- {
- $user = auth('web-company')->user();
- $page = 10;
- $state_arr = ['1' => '合适', '2' => '不合适', '3' => '待定', '4' => '未接通'];
- $resumeList = $this->PersonalJobsApplyRepository->recycle($user->id, $page);
- return $result = [
- 'result' => $resumeList,
- 'state_arr' => $state_arr,
- ];
- }
- /**删除收到的简历
- * @param $id
- * @return \Illuminate\Http\JsonResponse
- */
- public function destroyJobsApply($id)
- {
- if (!$id) {
- return response()->json(['status' => 0, 'msg' => '请选择简历!']);
- }
- $ids = is_array($id) ? $id : explode(',', $id);
- if ($this->PersonalJobsApplyRepository->destroyJobsApply($ids)) {
- return response()->json(['status' => 1, 'msg' => '简历删除成功!']);
- }
- return response()->json(['status' => 0, 'msg' => '简历删除失败!']);
- }
- /**清空回收站
- * @return \Illuminate\Http\JsonResponse
- */
- public function clearRecycle()
- {
- $company_id = auth('web-company')->user()->id;
- if (!$company_id) {
- return response()->json(['status' => 0, 'msg' => '参数错误!']);
- }
- if ($this->PersonalJobsApplyRepository->clearRecycle($company_id)) {
- return response()->json(['status' => 1, 'msg' => '清空回收站成功!']);
- }
- return response()->json(['status' => 0, 'msg' => '清空回收站失败!']);
- }
- public function concern($request)
- {
- $user = auth('web-company')->user();
- $where['company_id'] = $user->id;
- $settr = $request->settr ? $request->settr : 0;
- if ($settr) {
- $where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
- }
- $param_array = array('settr');
- $params = array();
- if ($request->all()) {
- foreach ($request->all() as $k => $v) {
- if (in_array($k, $param_array)) {
- $params[$k] = $v;
- }
- }
- }
- $page = 10;
- $result = $this->personFocusComRepository->concern($where, $page);
- //企业收藏的简历
- $favoriteResume = $this->companyFavoriteRepository->findWhere(['company_id' => $user->id], ['resume_id'])->toArray();
- $resumeId = array_column($favoriteResume, 'resume_id');
- foreach ($result as $key => $val) {
- $val->is_favorite = 0;
- if ($val->resumes) {
- if (in_array($val->resumes->id, $resumeId)) {
- $val->is_favorite = 1;
- }
- if ($val->resumes->display_name == "2") {
- $val->resumes->fullname = "N" . str_pad($val->resumes->id, 7, "0", STR_PAD_LEFT);
- } elseif ($val->resumes->display_name == "3") {
- if ($val->resumes->sex == 1) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
- } elseif ($val->resumes->sex == 2) {
- $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
- }
- }
- }
- }
- return $res = [
- 'params' => $params,
- 'result' => $result,
- ];
- }
- public function concernDel($request, $user)
- {
- $yid = $request->y_id ? $request->y_id : 0;
- if (!$yid) {
- return response()->json(['status' => 0, 'msg' => "请选择删除的记录"]);
- }
- $ids = is_array($yid) ? $yid : explode(',', $yid);
- if (false == $this->personFocusComRepository->concernDel($ids, $user->id)) {
- return response()->json(['status' => 0, 'msg' => "删除记录失败"]);
- }
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2038, $yid)) {
- throw new \Exception("日志记失败!");
- }
- return response()->json(['status' => 1, 'msg' => "删除记录成功"]);
- }
- //导出Word简历
- public function saveDocResume($resume_id, $user = null)
- {
- if (!$resume_id) {
- throw new ResponseException('请选择简历!', '', 404);
- }
- $id = array($resume_id);
- $sqlin = implode(",", $id);
- if (!preg_match('/^(\d{1,10},)*(\d{1,10})$/', $sqlin)) {
- return false;
- }
- //获取简历信息
- $result = $this->ResumeRepository->getResumeList($id);
- if (!$result->toArray()) {
- return false;
- }
- $list = array();
- foreach ($result as $k => $n) {
- $memberInfo = $this->memberInfoRepository->findMemberInfo(array('uid' => $n->uid));//简历基本信息
- $val = $n;
- $val->education_list = $this->ResumeEducationRepository->getResumeEducationByResumeId($n->id); //教育经历
- $val->work_list = $this->ResumeWorkRepository->getResumeWorkByResumeId($n->id); //工作经历
- $val->training_list = $this->ResumeTrainRepository->getResumeTrainByResumeId($n->id); //培训经历
- $val->language_list = $this->ResumeLanguageRepository->getResumeLanByResumeId($n->id); //语言能力
- $val->credent_list = $this->ResumeCredentRepository->getResumeCredentByResumeId($n->id); //获得证书
- $val->age = date("Y") - $memberInfo->birthday;
- $val->education_cn = $memberInfo->education_cn; //学历
- $val->experience_cn = $memberInfo->experience_cn; //工作经验
- $val->sex_cn = $memberInfo->sex_cn; //性别
- $val->marriage_cn = $memberInfo->marriage_cn; //婚姻状况
- $val->residence_cn = $memberInfo->residence_cn ? $memberInfo->residence_cn : '保密';
- $val->householdaddress_cn = $memberInfo->householdaddress_cn ? $memberInfo->householdaddress_cn : '保密';
- $val->tagcn = preg_replace("/\d+/", '', $val->tag);
- $val->tagcn = preg_replace('/\,/', '', $val->tagcn);
- $val->tagcn = preg_replace('/\|/', ' ', $val->tagcn);
- $member = $this->memberRepository->getMemberById($n->uid);
- $val->last_login_time = date('Y-m-d', $member->last_login_time); // 最近登录时间
- //处理联系信息
- $val->has_down = false;
- $val->is_apply = false;
- $val->label_id = 0;
- if ($user && $user->utype == 1) {
- $user_id = $user->id;
- $val->has_down = $this->companyDownResumeRepository->getDownResume(array('resume_id' => $val->id, 'company_uid' => $user_id));
- $val->is_apply = $this->PersonalJobsApplyRepository->checkJobsApply($val->id, $user_id);
- }
- $val->show_contact = $this->getShowContact($val, $val->has_down, $val->is_apply, $user);
- if ($val->show_contact === false) {
- $val->telephone = contact_hide($memberInfo->phone, 2);
- $val->email = contact_hide($memberInfo->email, 3);
- $val->qq = contact_hide($memberInfo->qq, 4);
- $val->weixin = contact_hide($memberInfo->weixin, 5);
- if ($memberInfo->display_name == "2") {
- $val->fullname = "N" . str_pad($val->id, 7, "0", STR_PAD_LEFT);
- } elseif ($memberInfo->display_name == "3") {
- if ($val->sex == 1) {
- $val->fullname = cut_str($val->fullname, 1, 0, "先生");
- } elseif ($val->sex == 2) {
- $val->fullname = cut_str($val->fullname, 1, 0, "女士");
- }
- }
- }
- $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
- if ($memberInfo->sex == 1) {
- $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
- }
- if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
- $val->photosrc = public_data_path($avatar_default); //不显示
- } else {
- $val->photosrc = upload_asset($memberInfo->images); //显示
- }
- $list[] = $val;
- }
- //渲染word简历模板
- $view_data = array(
- 'list' => $list
- );
- $view_html = view('app.content.resume.word_resume', $view_data)->render();
- $temp_path = "temp/" . uniqid() . '.doc';
- Storage::disk('public')->put($temp_path, $view_html);
- $filename = $val->fullname . "的个人简历.doc";
- return response()->download(
- Storage::disk('public')->path($temp_path),
- $filename)->deleteFileAfterSend(true);
- }
- public function favorResume($resume_id, $user = null)
- {
- if (!$resume_id) {
- throw new ResponseException("请选择简历!");
- }
- /*$user = auth('web-company')->user();*/
- if (strpos($resume_id, ",")) {
- $resume_id = explode(",", $resume_id);
- }
- if (is_array($resume_id)) {
- return $this->addFavoritesBatch($resume_id, $user); //批量收藏简历
- } else {
- return $this->addOneFavor($resume_id, $user); //收藏单个简历
- }
- }
- //批量收藏简历
- public function addFavoritesBatch($resume_id, $com_user)
- {
- $num = 0;
- $insert_data = array();
- $inser_rid = array();
- $stime = date('Y-m-d H:i:s', time());
- foreach ($resume_id as $k => $v) {
- $v = intval($v);
- if (!$this->companyFavoriteRepository->findFavorite($v, $com_user->id)) {
- $insert_data[] = array(
- 'resume_id' => $v,
- 'company_id' => $com_user->id,
- 'created_at' => $stime,
- 'updated_at' => $stime
- );
- $inser_rid[] = $v;
- }
- }
- if (count($insert_data) == 0) {
- return array('status' => 0, 'msg' => '收藏失败!您已收藏选择的简历!');
- }
- $rst = $this->companyFavoriteRepository->insertData($insert_data);
- if ($rst) {
- //添加会员日志
- $this->memberLogRepository->createLog($com_user, 1018, [implode(',', $inser_rid), '', '']);
- return array('status' => 1, 'i' => count($insert_data), 'msg' => '成功收藏' . count($insert_data) . '份简历!');
- } else {
- return array('status' => 0, 'msg' => '收藏简历失败!');
- }
- }
- //收藏单个简历
- public function addOneFavor($resume_id, $com_user)
- {
- //判断是否收藏过当前简历
- $favor_info = $this->companyFavoriteRepository->findFavorite($resume_id, $com_user->id);
- if ($favor_info) {
- //return array('status'=>0,'msg'=>'收藏失败!您已收藏过该简历');
- //取消收藏
- $cancel_favor = $this->companyFavoriteRepository->cancelFavor(['resume_id' => $resume_id, 'company_id' => $com_user->id]);
- if (!$cancel_favor) {
- return array('status' => 0, 'msg' => '取消加入人才库失败!', 'data' => 'has');
- } else {
- return array('status' => 1, 'i' => 1, 'msg' => '取消加入人才库成功!', 'data' => 'has');
- }
- } else {
- //添加数据
- $stime = date('Y-m-d H:i:s', time());
- $insert_data = array(
- 'resume_id' => $resume_id,
- 'company_id' => $com_user->id,
- 'created_at' => $stime,
- 'updated_at' => $stime
- );
- $rst = $this->companyFavoriteRepository->create($insert_data);
- if ($rst === false) {
- return array('status' => 0, 'msg' => '加入人才库失败!', 'data' => 'no');
- } else {
- $this->memberLogRepository->createLog($com_user, 1018, [$resume_id, '', '']);
- return array('status' => 1, 'i' => 1, 'msg' => '加入人才库成功!', 'favor_id' => $rst->id, 'data' => 'no');
- }
- }
- }
- //获取指定条件的已收藏的简历
- public function getFavoritesResumes($where)
- {
- $rst = $this->companyFavoriteRepository->getFavoritesResumes($where);
- $list = array();
- if ($rst->toArray()) {
- foreach ($rst as $k => $v) {
- $list[$v->resume_id] = $v;
- }
- }
- return $list;
- }
- public function dealResumeAvator($member_info, $resume)
- {
- $default_avator = public_data_path('/data/upload/resource/no_photo_female.png');
- if ($member_info) {
- if ($member_info->sex == 1) {
- $default_avator = public_data_path('/data/upload/resource/no_photo_male.png');
- }
- if ($member_info->images == '' || $member_info->display_images == 2 || $member_info->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $member_info->photo_audit != 2)) {
- $resume_avator = $default_avator;
- } else {
- $resume_avator = upload_asset($member_info->images);
- }
- } else {
- $resume_avator = $default_avator;
- }
- return $resume_avator;
- }
- public function dealResumeDisplayName($resume)
- {
- $member_info = $resume['memberInfos'];
- if ($member_info) {
- if ($member_info->display_name == '2') {
- $fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
- } elseif ($member_info->display_name == '3') {
- if ($member_info->sex == 1) {
- $fullname = cut_str($resume->fullname, 1, 0, "先生");
- } else {
- $fullname = cut_str($resume->fullname, 1, 0, "女士");
- }
- } else {
- $fullname = $resume->fullname;
- }
- } else {
- $fullname = $resume->fullname;
- }
- return $fullname;
- }
- public function dealResumeFields($list)
- {
- $favor_resumes = array();
- $down_resumes = array();
- if (auth('web-company')->check()) {
- $favor_resumes = $this->getFavoritesResumes(array('company_id' => auth('web-company')->user()->id));
- $down_resumes = $this->companyDownResumeRepository->getDowmResumes(array('company_uid' => auth('web-company')->user()->id));
- }
- foreach ($list as $k => $v) {
- if ($favor_resumes && array_has($favor_resumes, $v->id)) {
- $list[$k]->has_favor = 1;
- } else {
- $list[$k]->has_favor = 0;
- }
- if ($down_resumes && array_has($down_resumes, $v->id)) {
- $list[$k]->has_down = 1;
- } else {
- $list[$k]->has_down = 0;
- }
- $resume_fileds = $this->dealResumes($v);
- foreach ($resume_fileds as $i => $filed) {
- $list[$k]->$i = $filed;
- }
- }
- return $list;
- }
- public function dealResumes($resume_info)
- {
- $data['resume_avator'] = $this->dealResumeAvator($resume_info->memberInfos, $resume_info);
- $data['resume_display_name'] = $this->dealResumeDisplayName($resume_info);
- //薪资待遇
- if ($resume_info->wage) {
- $wage_categories = $this->CategoryRepository->getCategories();
- if ($wage_categories) {
- if (config('aix.system.site_other.site_other.site_salary') == 1) {
- $data['wage_cn'] = array_has($wage_categories['AIX_wage_k'], [$resume_info['wage']]) ? $wage_categories['AIX_wage_k'][$resume_info['wage']] : '';
- } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
- $data['wage_cn'] = array_has($wage_categories['AIX_wage_c'], [$resume_info['wage']]) ? $wage_categories['AIX_wage_c'][$resume_info['wage']] : '';
- }
- }
- } else {
- $data['wage_cn'] = $this->dealWage($resume_info->wage, $resume_info->wage_min, $resume_info->wage_max);
- }
- return $data;
- }
- public function companyLabelResume($request)
- {
- $resume_id = $request->input('resume_id', 0);
- $label = $request->input('label', 0);
- $label_type = $request->input('label_type', 0);
- $user = auth('web-company')->user();
- $jobs_id = $request->jobs_id;
- if ($label_type == 1) { //简历下载
- $where = array('resume_id' => $resume_id, 'company_uid' => $user->id);
- $data = $this->companyDownResumeRepository->getDownResume($where);
- } else {
- //职位下载
- $where = array('resume_id' => $resume_id, 'jobs_id' => $jobs_id);
- $data = $this->PersonalJobsApplyRepository->getOne($where);
- }
- if ($data) {
- return $this->labelResume($data->id, $label_type, $user, $label);
- } else {
- return array('status' => '0', 'msg' => '参数错误!');
- }
- }
- public function labelResume($id, $label_type, $user, $label)
- {
- $data['is_reply'] = $label;
- $r = false;
- if ($label_type == 1) {
- $label_arr = $this->companyDownResumeRepository->getStateArr();
- $down_where = array('id' => $id, 'company_uid' => $user->id);
- $rst = $this->companyDownResumeRepository->updateData($down_where, $data);
- $type = '1030';
- } else {
- $label_arr = $this->PersonalJobsApplyRepository->getStateArr();
- $data['personal_look'] = 2;
- $data['reply_time'] = time();
- $old_apply_info = $this->PersonalJobsApplyRepository->getOne(array('id' => $id, 'is_reply' => 0));
- $apply_where = array('id' => $id);
- $rst = $this->PersonalJobsApplyRepository->setApply($apply_where, $data);
- if ($old_apply_info && ($data['reply_time'] - strtotime($old_apply_info->created_at) <= 3600 * 24 * 3)) {
- $r = true;
- }
- $type = '1029';
- }
- if ($rst === false) {
- return array('status' => 0, 'msg' => '标记失败');
- }
- $label_text = array_has($label_arr, $label) ? $label_arr[$label] : '';
- //添加日志记录
- $this->memberLogRepository->createLog($user, $type, [$id, $label_text, '']);
- return array('status' => 1, 'msg' => '标记成功', 'task' => $r);
- }
- public function dealAge($age)
- {
- $age_arr = array();
- $categories = $this->CategoryService->getCategories(array('AIX_age' => 100));
- if ($categories && array_has($categories, 'AIX_age')) {
- $age_category = $categories['AIX_age'];
- if ($age_category && array_get($age_category, $age)) {
- $age_info = $age_category[$age]['demand'];
- //处理年龄信息,获取最大年龄和最小年龄
- if (preg_match_all('(\d+)', $age_info, $reg)) {
- $reg = $reg[0];
- if (count($reg) > 1) {
- $max_age = date('Y', strtotime(' -' . $reg[0] . ' year'));
- $min_age = date('Y', strtotime(' -' . $reg[1] . ' year'));
- } else {
- $min_age = date('Y', strtotime(' -' . $reg[0] . ' year'));
- $max_age = '';
- }
- $age_arr = array('min_age' => $min_age, 'max_age' => $max_age);
- }
- }
- }
- return $age_arr;
- }
- public function getUserInfo($user, $resume_id)
- {
- $member = $this->memberInfoRepository->getMemberInfo($user->id);
- $resume = $this->ResumeRepository->getPersonInfo($user->id);
- $sign = $this->TaskLogRepository->getTaskLogCount($user->id, 3, $user->utype);
- $applyJobs = $this->PersonalJobsApplyRepository->getApplyJobs($user->id, getJobsStatus());
- $interview = $this->CompanyInterviewRepository->getInterview($user->id, getJobsStatus());
- $viewResume = $this->ViewResumeRepository->getViewResume($resume_id);
- $points = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
- if (time() > strtotime(date('Y-m-d 06:00:00')) && time() <= strtotime(date('Y-m-d 12:00:00'))) {
- $timeDate = '上午好!';
- } elseif (time() > strtotime(date('Y-m-d 12:00:00')) && time() <= strtotime(date('Y-m-d 18:00:00'))) {
- $timeDate = '下午好!';
- } else {
- $timeDate = '晚上好!';
- }
- return (object)['member' => $member, 'resume' => $resume, 'sign' => $sign, 'points' => $points, 'timeDate' => $timeDate, 'applyJobs' => $applyJobs, 'interview' => $interview, 'viewResume' => $viewResume];
- }
- public function incrementData($where, $num, $filed)
- {
- return $this->ResumeRepository->incrementData($where, $num, $filed);
- }
- public function getResumeInfo($resume_id)
- {
- return $this->ResumeRepository->getSuccessResumeByid(['id' => $resume_id], getResumeStatus());
- }
- public function getResumeAllInfo($resume_id)
- {
- if (!is_array($resume_id)) {
- $resume_ids = explode(',', $resume_id);
- }
- if (count($resume_ids) > 1) {
- return $this->ResumeRepository->getResumesWithInfo($resume_ids);
- } else {
- return $this->ResumeRepository->resumeShow($resume_id);
- }
- }
- public function getPersonApply($where)
- {
- return $this->PersonalJobsApplyRepository->applyJobs($where);
- }
- public function clearResumeStick()
- {
- $PersonalServiceStickLog = PersonalServiceStickLog::where('endtime', '<', time())->get()->toArray();
- $resume_id = array_unique(array_column($PersonalServiceStickLog, 'resume_id'));
- return $resume_id;
- }
- public function clearResumeExpires()
- {
- return $this->ResumeRepository->clearResumeExpires();
- }
- public function resumeAutoRefresh()
- {
- $res = $this->queueAutoRefreshRepository->resumeAutoRefresh();
- $resume_id = [];
- if ($res) {
- $resNum = config('aix.personal_set.per_set.per_set.refresh_resume_num');
- foreach ($res as $val) {
- if ($resNum == 0) {
- $resume_id[] = $val['pid'];
- } else {
- if (Cache::has($val['uid'] . $val['utype'])) {
- $value = Cache::get($val['uid'] . $val['utype']);
- } else {
- $value = 0;
- }
- if ($value < $resNum) {
- $resume_id[] = $val['pid'];
- }
- }
- }
- }
- return $resume_id;
- }
- public function resumeEntrust()
- {
- $res = $this->ResumeEntrustRepository->resumeEntrust();
- if ($res) {
- $apply_max = intval(config('aix.personal_set.per_set.per_set.apply_jobs_max'));
- $apply_space = intval(config('aix.personal_set.per_set.per_set.apply_job_space'));
- foreach ($res as $key => $val) {
- $num = PersonalJobsApply::where('personal_uid', $val['uid'])->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('created_at', '<=', date('Y-m-d 23:59:59'))->count();
- if ($num >= intval($apply_max / 2)) {
- continue;
- }
- $array = string_to_array(['.', ','], $val['resumes']['intention_jobs_id']);
- $nuk = 2;
- $inter_array = [];
- foreach ($array as $k1 => $v1) {
- if ($k1 == $nuk && !empty($v1)) {
- $inter_array[] = $v1;
- $nuk = $nuk + 3;
- }
- }
- $jobs_id = array_unique($inter_array);
- if ($jobs_id) {
- if ($apply_space > 0) {
- $personalJobsApply = PersonalJobsApply::where('resume_id', $val['resume_id'])->where('created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$apply_space} day")))->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("{$apply_space} day")))->get()->toArray();
- } else {
- $personalJobsApply = PersonalJobsApply::where('resume_id', $val['resume_id'])->get()->toArray();
- }
- $job_array_id = [];
- if (!empty($personalJobsApply)) {
- $job_array_id = array_column($personalJobsApply, 'jobs_id');
- }
- $jobs = Jobs::whereIn('subclass', $jobs_id)->where('valid', 1)
- ->where('display', 1)->whereIn('audit', getJobsStatus())->whereNotIn('id', $job_array_id)->orderBy('updated_at', 'desc')->get()->toArray();
- if ($jobs) {
- if ($apply_max > 0) {
- foreach ($jobs as $key1 => $val1) {
- if ($num >= intval($apply_max / 2)) {
- break;
- } else {
- $num++;
- PersonalJobsApply::create([
- 'resume_id' => $val['resume_id'],
- 'resume_name' => $val['resumes']['title'],
- 'personal_uid' => $val['resumes']['uid'],
- 'jobs_id' => $val1['id'],
- 'jobs_name' => $val1['jobs_name'],
- 'company_id' => $val1['company_id'],
- 'company_name' => $val1['company_name'],
- 'is_apply' => 2,
- ]);
- }
- }
- }
- }
- }
- }
- }
- return true;
- }
- public function padResumeShow($id, $type = 1, $jobs_id = '', $user)
- {
- $request_all = \Illuminate\Support\Facades\Request::all();
- $utype = 0;
- $uid = 0;
- $resume = $this->ResumeRepository->getResume($id);
- if (!$resume) {
- throw new ResponseException('简历不存在!', [], 404);
- }
- $subsite_type = Cache::get('subsite_type');
- if ($subsite_type) {
- check_url(Cache::get('subsite_id'), $resume->subsite_id); //判断分站是否可以访问
- }
- $resume->fullname_ = $resume->fullname;
- $memberInfo = DB::table('member_infos')->where('uid', $resume->uid)->first(); //简历基本信息
- $resume->education_cn = $memberInfo->education_cn; //学历
- $resume->experience_cn = $memberInfo->experience_cn; //工作经验
- $resume->sex_cn = $memberInfo->sex_cn;
- //教育经历
- $education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
- $education = $this->getDuration($education);
- $resume->education_list = $education;
- //工作经历
- $work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
- $work = $this->getDuration($work);
- $resume->work_list = $work;
- $resume->work_count = count($work);
- $work_duration = $this->totalWorkDuration($work); //工龄
- $resume->work_duration = $work_duration;
- //培训经历
- $train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
- $train = $this->getDuration($train);
- $resume->training_list = $train;
- //语言能力
- $language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id);
- $resume->language_list = $language;
- //证书
- $credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id);
- $resume->credent_list = $credent;
- //简历照片
- $img_map = array(
- array('resume_id', '=', $resume->id),
- array('uid', '=', $resume->uid)
- );
- if (config('aix.personal_set.per_set.show_set.resume_img_display') == 1) {
- $img_map[] = array('audit', '=', '2');
- } else {
- $img_map[] = array('audit', '<>', '0');
- }
- $images = DB::table('resume_imgs')->where($img_map)->get();
- $resume->img_list = $images;
- $resume->age = date("Y") - $memberInfo->birthday; //年龄
- //tag
- if ($resume->tag_cn) {
- $tag_cn = explode(',', $resume->tag_cn);
- $resume->tag_cn = $tag_cn;
- } else {
- $resume->tag_cn = array();
- }
- $resume->refreshtime_cn = daterange(time(), strtotime($resume->updated_at), 'Y-m-d', "#FF3300");
- //判断手机、微信、邮箱是否验证
- $members = DB::table('members')->where('id', $resume->uid)->first();
- $resume->is_audit_mobile = $members->mobile_audit;
- //处理附件简历链接地址
- if ($resume->word_resume) {
- $resume->word_resume_url = upload_asset($resume->word_resume);
- }
- //处理微信二维码
- $resume->label_id = 0;
- $resume->label_type = 0;
- $resume->label_resume = '';
- $down_resume = false;
- $jobs_apply = false;
- if ($user->utype == 1) {
- $user_id = $user->id;
- $down_resume = $this->companyDownResumeRepository->getDownResume(array('resume_id' => $resume->id, 'company_uid' => $user_id));
- if ($jobs_id) {
- //$jobs_apply = $this->PersonalJobsApplyRepository->checkJobsApply($resume->id, $user_id, $jobs_id);
- $jobs_apply = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id, $jobs_id);
- } else {
- //$jobs_apply = $this->PersonalJobsApplyRepository->checkJobsApply($resume->id, $user_id);
- $jobs_apply = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id);
- }
- }
- $resume->label_arr = array();
- //处理简历预览页面label 信息
- if (array_get($request_all, 'from_down') == 1) {
- $resume->label_arr = $this->companyDownResumeRepository->getStateArr();
- $resume->label_resume = 'down';
- $resume->label_type = 1;
- $resume->label_id = $down_resume->is_reply;
- } elseif (array_get($request_all, 'from_apply') == 1) {
- $resume->label_arr = $this->PersonalJobsApplyRepository->getStateArr();
- $resume->label_resume = 'apply';
- $resume->label_type = 2;
- $resume->label_id = $jobs_apply->is_reply;
- }
- if (!$jobs_id && $resume->label_resume == 'apply') {
- $resume->label_resume = '';
- }
- $resume->show_contact = $this->getShowContact($resume, $down_resume, $jobs_apply, $user);
- if ($type == 1) {
- if ($resume->show_contact === false) { //处理联系信息
- if ($memberInfo->display_name == "2") {
- $resume->fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
- } elseif ($memberInfo->display_name == "3") {
- if ($resume->sex == 1) {
- $resume->fullname = cut_str($resume->fullname, 1, 0, "先生");
- } elseif ($resume->sex == 2) {
- $resume->fullname = cut_str($resume->fullname, 1, 0, "女士");
- }
- }
- $resume->telephone = contact_hide($memberInfo->phone, 2);
- $resume->email = $memberInfo->email ? contact_hide($memberInfo->email, 3) : '';
- $resume->qq = contact_hide($memberInfo->qq, 4);
- $resume->weixin = contact_hide($memberInfo->weixin, 5);
- }
- }
- $resume->telephone_ = $resume->telephone;
- $resume->email_ = $resume->email;
- //联系方式展现形式 -图形化
- if (config('aix.personal_set.per_set.contact_type_set.contact_img_resume') == 2) {
- $pwdhash = config('aix.system.site_other.site_other.pwb_hash');
- if ($resume->telephone) {
- $resume->telephone = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->telephone, $pwdhash), 'type' => 'phone')) . "' />";
- }
- if ($resume->email) {
- $resume->email = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->email, $pwdhash), 'type' => 'email')) . "' />";
- }
- if ($resume->qq) {
- $resume->qq = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->qq, $pwdhash), 'type' => 'qq')) . "' />";
- }
- if ($resume->weixin) {
- $resume->weixin = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->weixin, $pwdhash), 'type' => 'weixin')) . "' />";
- }
- }
- $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
- if ($memberInfo->sex == 1) {
- $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
- }
- //1.照片为空
- //2.照片主动不显示
- //3.照片审核不通过
- //4.先审核后显示:照片不是审核通过的(不等于1)
- if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
- //不显示
- $resume->photosrc = $avatar_default;
- } else {
- //显示
- $resume->photosrc = upload_asset($memberInfo->images);
- }
- //期望薪资
- $wage_categories = $this->CategoryRepository->getCategories();
- if ($wage_categories) {
- if (config('aix.system.site_other.site_other.site_salary') == 1) {
- $resume->wage_cn = array_has($wage_categories['AIX_wage_k'], [$resume->wage]) ? $wage_categories['AIX_wage_k'][$resume->wage] : $resume->wage_cn;
- } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
- $resume->wage_cn = array_has($wage_categories['AIX_wage_c'], [$resume->wage]) ? $wage_categories['AIX_wage_c'][$resume->wage] : $resume->wage_cn;
- }
- }
- //期望职位
- if (!$resume->intention_jobs) {
- $job_cates = Cache::get('jobs_cate_list');
- if (null === $job_cates) {
- $job_cates = $this->CategoryJobsRepository->jobsCateInfoCache();
- Cache::put('jobs_cate_list', $job_cates, '86400');
- }
- $i_ids = array();
- if ($resume->intention_jobs_id) {
- $i_ids = explode(',', $resume->intention_jobs_id);
- }
- $jobs_names = array();
- if (count($i_ids) > 0) {
- foreach ($i_ids as $key => $val) {
- $intention_jobs_id_arr = explode('.', $val);
- $count = count($intention_jobs_id_arr);
- if ($count > 0) {
- foreach ($intention_jobs_id_arr as $k => $v) {
- if ($v && array_get($job_cates['id'], $v)) {
- $jobs_names[$key] = $job_cates['id'][$v]['name'];
- }
- }
- }
- }
- }
- $resume->intention_jobs = implode('+', $jobs_names);
- }
- if (!$resume->trade_cn) {
- $resume->trade_cn = '不限';
- }
- //企业用户 - 处理查看简历记录
- if (auth('web-company')->check()) {
- $view_where = array(
- 'uid' => $user->id,
- 'resume_id' => $resume->id
- );
- $view_log = $this->ViewResumeRepository->findViewResume($view_where);
- $stime = date('Y-m-d H:i:s', time());
- if ($view_log) {
- $set_data = array(
- 'created_at' => $stime
- );
- $this->ViewResumeRepository->update($set_data, $view_log->id);
- } else {
- $set_data = array(
- 'uid' => $user->id,
- 'resume_id' => $resume->id,
- 'created_at' => $stime,
- 'updated_at' => $stime
- );
- $this->ViewResumeRepository->create($set_data);
- }
- if ($jobs_id) {
- $apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id, $jobs_id);
- if ($apply_log) {
- //企业对申请职位的简历设为已看
- $set_where = array('id' => $apply_log->id, 'company_id' => $user->id);
- $apply_data = array('personal_look' => 2);
- $set_rst = $this->PersonalJobsApplyRepository->setApply($set_where, $apply_data);
- //添加会员日志
- if ($set_rst !== false) {
- $user_info = array(
- 'uid' => $user->id,
- 'utype' => 1,
- 'username' => $user->username,
- 'ip' => ip2long(\Illuminate\Support\Facades\Request::getClientIp()),
- 'log_address' => '本机地址'
- );
- $this->feedbackService->addMembersLog($user_info, '', '标记申请职位记录(职位id:' . $apply_log->id . ')');
- }
- }
- }
- }
- //个人醒目标签
- $PersonalServiceStickLog = PersonalServiceTagLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
- if ($PersonalServiceStickLog) {
- if ($PersonalServiceStickLog->endtime - time() > 0) {
- $resume->strong_tag = $PersonalServiceStickLog->tag_cn;
- }
- }
- $tag_logs = array();
- if (auth('web-member')->user()) {
- $uid = auth('web-member')->user()->id;
- $utype = 2;
- }
- if ($user) {
- $uid = $user->id;
- $utype = 1;
- }
- $contentStatus = $this->CategoryService->connectStatus($resume->uid, $resume->id);
- return ['resume' => $resume, 'member_infos' => $memberInfo, 'members' => $members, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent, 'utype' => $utype, 'uid' => $uid, 'images' => $images, 'contentStatus' => $contentStatus, 'tag_log' => $tag_logs];
- }
- public function getPersonInfo($id)
- {
- $member = $this->memberRepository->getMemberById($id);
- if (!$member) {
- return array('status' => 0, 'error' => '简历不存在');
- }
- $default_resume = $this->getDefResume($member);
- return array(
- 'user' => $member,
- 'resume' => $default_resume
- );
- }
- public function getPersonAvator($user = array())
- {
- $avator = '';
- if ($user) {
- $memberInfo = $this->memberInfoRepository->getMemberInfo($user->id);
- if ($memberInfo) {
- $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
- if ($memberInfo->sex == 1) {
- $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
- }
- /*if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
- $avator = $avatar_default;
- } else {
- $avator = upload_asset($memberInfo->images);
- }*/
- if ($memberInfo->images == '') {
- $avator = $avatar_default;
- } else {
- $avator = upload_asset($memberInfo->images);
- }
- }
- }
- return $avator;
- }
- public function getDefResume($user)
- {
- return $this->ResumeRepository->getPersonInfo($user->id);
- }
- public function addPadResume($data)
- {
- //简历信息
- if ($data['wage'] != 0) {
- $resume_data['wage_cn'] = get_category($data['wage']);
- $wage = explode('~', format_wage(get_category($data['wage'])));
- if (isset($wage[1])) {
- $resume_data['wage_max'] = intval($wage[1]);
- }
- $resume_data['wage_min'] = intval($wage[0]);
- } else {
- $resume_data['wage_cn'] = $data['wage_min'] . '~' . $data['wage_max'] . '/月';
- }
- if ($data['wage'] != -1) {
- $data['wage_cn'] = get_category($data['wage']);
- $wage = explode('~', format_wage(get_category($data['wage'])));
- if (isset($wage[1])) {
- $data['wage_max'] = intval($wage[1]);
- }
- $data['wage_min'] = intval($wage[0]);
- } else {
- $data['wage_cn'] = $data['wage_min'] . '~' . $data['wage_max'] . '/月';
- }
- $resume_data = [
- 'display' => $data['display'],
- 'audit' => 2,
- 'title' => '简历' . date('Ymd'),
- 'fullname' => $data['fullname'],
- 'sex' => $data['sex'] == '男' ? 1 : 2,
- 'sex_cn' => $data['sex'],
- 'nature' => $data['nature'],
- 'nature_cn' => get_category($data['nature']),
- 'trade' => $data['trade'],
- 'trade_cn' => get_category($data['trade']),
- 'birthdate' => $data['birthdate'],
- 'experience' => $data['experience'],
- 'experience_cn' => get_category($data['experience']),
- 'education' => $data['education'],
- 'education_cn' => get_category($data['education']),
- 'wage' => $data['wage'],
- 'wage_min' => $data['wage_min'],
- 'wage_max' => $data['wage_max'],
- 'wage_cn' => $data['wage_cn'],
- 'telephone' => $data['telephone'],
- 'email' => $data['email'],
- 'intention_jobs_id' => $data['intention_jobs_id'],
- 'intention_jobs' => get_job_category_cn($data['intention_jobs_id']),
- 'current' => $data['current'],
- 'current_cn' => get_category($data['current']),
- 'idcard' => $data['id_card'],
- 'level' => 0,
- 'complete_percent' => 40,
- 'marriage' => 3,
- 'marriage_cn' => '保密',
- 'residence' => get_district_cn($data['residence']),
- 'district' => $data['district'],
- 'district_cn' => get_district_cn($data['district']),
- 'subsite_id' => get_subsite_id(),
- ];
- if (empty($data['uid'])) {
- //注册用户
- $member_data = [
- 'mobile' => $data['telephone'],
- 'password' => substr($data['id_card'], -6),
- 'utype' => 2,
- 'reg_type' => 1,
- 'reg_source' => 1,
- 'id_card' => $data['id_card'],
- ];
- //用户信息
- $member_info_data = [
- 'realname' => $data['fullname'],
- 'id_card' => $data['id_card'],
- 'sex' => $data['sex'] == '男' ? 1 : 2,
- 'sex_cn' => $data['sex'],
- 'birthday' => $data['birthdate'],
- 'email' => $data['email'],
- 'phone' => $data['telephone'],
- 'experience' => $data['experience'],
- 'experience_cn' => get_category($data['experience']),
- 'education' => $data['education'],
- 'education_cn' => get_category($data['education']),
- 'residence' => $data['residence'],
- 'residence_cn' => get_district_cn($data['residence']),
- 'card_t_cn' => $data['card_t_cn'],
- ];
- DB::beginTransaction();//检查数据库事务
- try {
- //注册
- $member = $this->registerService->registerPerson($member_data);
- $this->memberRepository->updateInfo($member->id, ['email' => $data['email']]);
- //新建用户信息
- $this->memberInfoRepository->updateInfo($member_info_data, $member->id);
- //简历信息
- $resume_data['uid'] = $member->id;
- $resume = $this->ResumeRepository->resumeAdd($resume_data);
- $subsiteDefault = [
- 'subsite_id' => get_subsite_id(),
- 'resume_id' => $resume->id
- ];
- SubsiteResume::insert($subsiteDefault);
- //创建会员给积分
- $reg_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'reg', 'status' => 1]);
- $handsel['uid'] = $member->id;
- $handsel['utype'] = 2;
- $handsel['htype'] = 'reg';
- $handsel['htype_cn'] = '注册账号';
- $handsel['operate'] = 1;
- $handsel['points'] = $reg_point;
- $this->memberHandselRepository->addNew($handsel);
- $user_info_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'user_info', 'status' => 1]);
- $handsel['htype'] = 'user_info';
- $handsel['htype_cn'] = '完善基本资料';
- $handsel['points'] = $user_info_point;
- $this->memberHandselRepository->addNew($handsel);
- $verified_mobile_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'verified_mobile', 'status' => 1]);
- $handsel['htype'] = 'verified_mobile';
- $handsel['htype_cn'] = '验证手机';
- $handsel['points'] = $verified_mobile_point;
- $this->memberHandselRepository->addNew($handsel);
- $points = $verified_mobile_point + $user_info_point + $reg_point;
- $this->memberPointRepository->addNew(['uid' => $member->id, 'utype' => 2, 'points' => $points]);
- //发送短信
- $this->smsService->sendSms(
- $data['telephone'],
- Smser::TEMPLATE_SMS_QUICK_REGISTER,
- [
- 'sitename' => subsite_config('aix.system.site.site.site_name'),
- 'username' => $data['telephone'],
- 'password' => substr($data['id_card'], -6)
- ]);
- DB::commit();
- return true;
- } catch (\Exception $e) {
- DB::rollback();
- return false;
- }
- } else {
- $resume_data['uid'] = $data['uid'];
- $resume = $this->ResumeRepository->resumeAdd($resume_data);
- $subsiteDefault = [
- 'subsite_id' => get_subsite_id(),
- 'resume_id' => $resume->id
- ];
- SubsiteResume::insert($subsiteDefault);
- //发送短信
- $this->smsService->sendSms(
- $data['telephone'],
- Smser::TEMPLATE_SMS_QUICK_REGISTER,
- [
- 'sitename' => subsite_config('aix.system.site.site.site_name'),
- 'username' => $data['telephone'],
- 'password' => substr($data['id_card'], -6)
- ]);
- if ($resume) {
- return true;
- } else {
- return false;
- }
- }
- }
- public function resumeTpl($user, $resume_id)
- {
- if (empty($resume_id)) {
- throw new ResponseException('简历不存在!');
- }
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在!');
- }
- $resume = $this->ResumeRepository->find($resume_id);
- if (!$resume) {
- throw new ResponseException('简历不存在!');
- }
- $tpl = $this->personTplRepository->getTplByUid(['uid' => $user->id]);
- return ['tpl' => $tpl, 'resume_tpl' => $resume->tpl];
- }
- public function resumeTplUpdate($resume_id, $tpl, $user)
- {
- if (empty($resume_id)) {
- throw new ResponseException('简历不存在!');
- }
- $res = Resume::where(['uid' => $user->id])->get()->toArray();
- $array_id = array_column($res, 'id');
- if (!in_array($resume_id, $array_id)) {
- throw new ResponseException('简历不存在!');
- }
- if (empty($tpl)) {
- throw new ResponseException('模版不存在!');
- }
- if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2007, [$resume_id, $tpl])) {
- throw new \Exception("日志记失败!");
- }
- return $this->ResumeRepository->update(['tpl' => $tpl], $resume_id);
- }
- public function incrementTplPoints($user, $input)
- {
- if (empty($input['tplid'])) {
- throw new ResponseException('请选择模版!');
- }
- if (empty($input['payment_name']) || $input['payment_name'] != 'points') {
- throw new ResponseException('请选择积分兑换!');
- }
- $tpl = $this->tplRepository->find($input['tplid']);
- if (!$tpl) {
- throw new ResponseException('简历模版不存在!');
- }
- $POINTS = $this->memberPointRepository->getPointsById($user->id, $user->utype);
- if ($POINTS) {
- if ($POINTS->points < $tpl->price) {
- throw new ResponseException('积分不足!', '', 400);
- }
- } else {
- throw new ResponseException('积分不存在!', '', 400);
- }
- $personTpl = $this->personTplRepository->getTpl(['uid' => $user->id, 'tplid' => $input['tplid']]);
- if ($personTpl) {
- throw new ResponseException('该模版已经购买!', '', 400);
- }
- DB::beginTransaction();//检查数据库事务
- try {
- $this->personTplRepository->create(['uid' => $user->id, 'tplid' => $input['tplid']]);
- MembersPoint::where(
- ['uid' => $user->id, 'utype' => $user->utype]
- )->decrement('points', $tpl->price);
- MembersHandsel::create(
- ['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => '简历模版', 'operate' => 2, 'points' => $tpl->price]
- );
- $order = new Order();
- $order->uid = $user->id;
- $order->utype = $user->utype;
- $order->order_type = 5;
- $order->pay_type = 1;
- $order->is_pay = 2;
- $order->amount = $tpl->points / config('aix.system.site_other.site_other.points_match');
- $order->pay_points = $tpl->price;
- $order->payment = 'points';
- $order->payment_cn = '积分';
- $order->discount = '简历模版';
- $order->service_name = $tpl->name;
- $order->description = '购买服务:简历模板(' . $tpl->name . ')';
- $order->payment_time = time();
- $input['uid'] = $user->id;
- $input['utype'] = $user->utype;
- $order->charge = json_encode($input);
- $order->save();
- $PayService = new PayService();
- $order->oid = $PayService->getTradeNo($order->id);
- $order->save();
- DB::commit();
- return ['code' => 1, 'info' => '兑换成功!'];
- } catch (\Exception $e) {
- DB::rollback();
- return ['code' => 0, 'info' => $e->getMessage()];
- }
- }
- public function incrementTplPay($user, $input, $route)
- {
- $tplid = intval($input['tplid']);
- if (empty($tplid)) {
- throw new ResponseException('模板文件丢失!');
- }
- $tpl = $this->tplRepository->find($tplid);
- if (!$tpl) {
- throw new ResponseException('模板文件丢失!');
- }
- $personTpl = $this->personTplRepository->getTpl(['uid' => $user->id, 'tplid' => $tplid]);
- if ($personTpl) {
- throw new ResponseException('该模板已购买过!');
- }
- $paymenttpye = $this->paymentService->returnPayment($input['payment_name']);
- if (!$paymenttpye) {
- throw new ResponseException('支付方式错误!');
- }
- if (is_weixin()) {
- $type = 'wap';
- } else {
- if (strpos($route->uri, 'mobile') !== false) {
- $type = 'wap';
- } else {
- if ($input['payment_name'] == 'wechat') {
- $type = 'scan';
- } else {
- $type = 'web';
- }
- }
- }
- $order = new Order();
- $order->pay_type = 2;
- $order->amount = $input['amount'];
- $order->pay_points = 0;
- $is_deductible = '支付金额:' . $input['amount'] . '元';
- $order->description = '购买服务:简历模板(' . $tpl->name . ')' . $is_deductible;
- $order->discount = '简历模板';
- $order->service_name = $tpl->name;
- $order->order_type = 5;
- $order->pay_amount = $input['amount'];
- $order->payment = $input['payment_name'];
- if ($input['payment_name'] == 'alipay') {
- $order->payment_cn = '支付宝';
- } elseif ($input['payment_name'] == 'wechat') {
- $order->payment_cn = '微信';
- } else {
- $order->payment_cn = '线下转账';
- }
- $input['uid'] = $user->id;
- $input['utype'] = $user->utype;
- $order->charge = json_encode($input);
- $order->uid = $user->id;
- $order->utype = $user->utype;
- $order->save();
- $tradeNo = $this->payService->getTradeNo($order->id);
- $payOrder = new PayOrder();
- $payOrder->trade_no = $tradeNo;
- $payOrder->subject = '简历模板';
- $payOrder->detail = $order->description;
- $payOrder->price = $input['amount'];
- $payOrder->callback = "App\Services\Common\OrderService.incrementPersonTplUpdate";
- if ($type == 'web') {
- $payOrder->return_url = route('person.resume');
- }
- if ($type == 'wap') {
- if ($input['payment_name'] == 'wechat') {
- $payOrder->return_url = route('mobile.common.orderWechat', ['oid' => $payOrder->trade_no]);
- } else {
- $payOrder->return_url = route('mobile.person.resume');
- }
- }
- $result = $this->payService->pay($input['payment_name'], $type, $payOrder);
- $order->oid = $payOrder->trade_no;
- if ($user->email) {
- $this->emailService->sendMail($user->email, EmailService::TEMPLATE_MAIL_ORDER, [], ['oid' => $order->oid, 'paymenttpye' => $order->payment_cn, 'amount' => $order->amount, 'sitedomain' => route('person.index')]);
- }
- $order->save();
- if ($input['payment_name'] == 'wechat') {
- if ($type == 'wap') {
- return [
- 'code' => 'wechat',
- 'tradeCode' => $result,
- 'type' => $type
- ];
- } else {
- return [
- 'code' => 'wechat',
- 'tradeCode' => get_qrcode_html($result->code_url),
- 'tradeNo' => [
- 'number' => $payOrder->trade_no,
- ],
- 'type' => $type
- ];
- }
- } elseif ($input['payment_name'] == 'alipay') {
- return [
- 'code' => 'alipay',
- 'tradeCode' => $result,
- ];
- } else {
- return [
- 'code' => 'offline',
- 'tradeNo' => $tradeNo
- ];
- }
- }
- public function resumeDisplay($display, $id, $user)
- {
- if (empty($display) && $display != 0) {
- throw new ResponseException('简历状态错误!');
- }
- if (empty($id)) {
- throw new ResponseException('简历不存在!');
- }
- self::isOwn($id, $user);
- return $this->ResumeRepository->updateById(['display' => $display], $id);
- }
- public function resumeEntrustByAdmin($company_arr,$ids,$admin_name)
- {
- $res = $this->ResumeEntrustRepository->resumeEntrust();
- if($res){
- $apply_max = intval(config('aix.personal_set.per_set.per_set.apply_jobs_max'));
- $apply_space = intval(config('aix.personal_set.per_set.per_set.apply_job_space'));
- foreach ($res as $key=>$val) {
- $num = PersonalJobsApply::where('personal_uid',$val['uid'])->where('created_at','>=',date('Y-m-d 00:00:00'))->where('created_at','<=',date('Y-m-d 23:59:59'))->count();
- if($num >= intval($apply_max/2)){
- continue;
- }
- $array = string_to_array(['.',','], $val['resumes']['intention_jobs_id']);
- $nuk = 2;
- $inter_array = [];
- foreach ($array as $k1=>$v1) {
- if($k1==$nuk && !empty($v1)){
- $inter_array[] = $v1;
- $nuk = $nuk+3;
- }
- }
- $jobs_id = array_unique($inter_array);
- if($jobs_id){
- if($apply_space>0){
- $personalJobsApply = PersonalJobsApply::where('resume_id',$val['resume_id'])->where('created_at','>=',date('Y-m-d H:i:s', strtotime("-{$apply_space} day")))->where('created_at','<=',date('Y-m-d H:i:s', strtotime("{$apply_space} day")))->get()->toArray();
- }else{
- $personalJobsApply = PersonalJobsApply::where('resume_id',$val['resume_id'])->get()->toArray();
- }
- $job_array_id = [];
- if(!empty($personalJobsApply)){
- $job_array_id = array_column($personalJobsApply,'jobs_id');
- }
- $jobs = Jobs::whereIn('subclass', $jobs_id)->where('valid',1)
- ->where('display',1)->whereIn('audit', getJobsStatus())->whereIn('company_id', $company_arr)->whereNotIn('id', $job_array_id)->orderBy('updated_at', 'desc')->get()->toArray();
- if($jobs){
- if($apply_max>0){
- foreach ($jobs as $key1=>$val1) {
- if($num >= intval($apply_max/2)){
- break;
- }else{
- $num++;
- PersonalJobsApply::create([
- 'resume_id'=>$val['resume_id'],
- 'resume_name'=>$val['resumes']['title'],
- 'personal_uid'=>$val['resumes']['uid'],
- 'jobs_id'=>$val1['id'],
- 'jobs_name'=>$val1['jobs_name'],
- 'company_id'=>$val1['company_id'],
- 'company_name'=>$val1['company_name'],
- 'is_apply'=>2,
- ]);
- $info['talents_id'] = $ids;
- $info['log_class'] = 7;//日志类型
- $info['content'] = $admin_name . "向‘" . $val1['company_name'] . "’企业推送了此人才简历,推送成功";
- $info['log_time'] = time();
- $info['auth_man'] = $admin_name;
- PersonalTalentsLog::create($info);
- }
- }
- }
- }
- }
- }
- }
- return true;
- }
- //验证是否是自己的简历
- public function isOwn($resume_id, $user)
- {
- $resume = $this->ResumeRepository->getOneResume(['id' => $resume_id]);
- if (!$resume) {
- throw new ResponseException('简历不存在!');
- }
- if ($resume->uid != $user->id) {
- throw new ResponseException('对不起,您只能操作自己的简历!');
- }
- }
- }
|