ResumeService.php 207 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759
  1. <?php
  2. namespace App\Services\Person;
  3. use Aix\Pay\Data\PayOrder;
  4. use App\Exceptions\ResponseException;
  5. use App\Models\Category;
  6. use App\Models\CompanyDownResume;
  7. use App\Models\Jobs;
  8. use App\Models\Member;
  9. use App\Models\MemberInfo;
  10. use App\Models\MembersHandsel;
  11. use App\Models\MembersPoint;
  12. use App\Models\Order;
  13. use App\Models\PersonalCategory;
  14. use App\Models\PersonalJobsApply;
  15. use App\Models\PersonalServiceStick;
  16. use App\Models\PersonalServiceStickLog;
  17. use App\Models\PersonalServiceTag;
  18. use App\Models\PersonalServiceTagLog;
  19. use App\Models\PersonalTalents;
  20. use App\Models\PersonalTalentsLog;
  21. use App\Models\QueueAutoRefresh;
  22. use App\Models\Report;
  23. use App\Models\Resume;
  24. use App\Models\ResumeAuthInfo;
  25. use App\Models\ResumeEntrust;
  26. use App\Models\ResumeImg;
  27. use App\Models\SubsiteResume;
  28. use App\Models\Task;
  29. use App\Models\ViewResume;
  30. use App\Repositories\CategoryDistrictRepository;
  31. use App\Repositories\CategoryJobsRepository;
  32. use App\Repositories\CategoryMajorRepository;
  33. use App\Repositories\CategoryRepository;
  34. use App\Repositories\CompanyDownResumeRepository;
  35. use App\Repositories\companyFavoriteRepository;
  36. use App\Repositories\CompanyInterviewRepository;
  37. use App\Repositories\JobsRepository;
  38. use App\Repositories\MemberPointRepository;
  39. use App\Repositories\PersonalJobsApplyRepository;
  40. use App\Repositories\PersonFocusComRepository;
  41. use App\Repositories\PersonTplRepository;
  42. use App\Repositories\PmsRepository;
  43. use App\Repositories\QueueAutoRefreshRepository;
  44. use App\Repositories\ResumeCredentRepository;
  45. use App\Repositories\ResumeEducationRepository;
  46. use App\Repositories\ResumeLanguageRepository;
  47. use App\Repositories\ResumeRepository;
  48. use App\Repositories\ResumeTrainRepository;
  49. use App\Repositories\ResumeWorkRepository;
  50. use App\Repositories\TaskLogRepository;
  51. use App\Repositories\TplRepository;
  52. use App\Repositories\ViewJobRepository;
  53. use App\Repositories\ViewResumeRepository;
  54. use App\Services\Common\CategoryService;
  55. use App\Services\Common\EmailService;
  56. use App\Services\Common\PaymentService;
  57. use App\Services\Common\PayService;
  58. use App\Services\Common\TaskService;
  59. use App\Services\Company\CompanyDownResumeService;
  60. use App\Services\Company\CompanyService;
  61. use Illuminate\Support\Facades\DB;
  62. use App\Repositories\ResumeEntrustRepository;
  63. use App\Repositories\TaskRepository;
  64. use App\Repositories\MemberHandselRepository;
  65. use Illuminate\Support\Facades\Cache;
  66. use Illuminate\Support\Facades\Route;
  67. use App\Services\Content\FeedbackService;
  68. use App\Repositories\MemberInfoRepository;
  69. use App\Repositories\MemberRepository;
  70. use App\Repositories\MemberSetmealRepository;
  71. use App\Repositories\MemberLogRepository;
  72. use App\Services\Auth\RegisterService;
  73. use App\Services\Common\SmsService;
  74. use Aix\Sms\Contracts\Smser;
  75. use Illuminate\Support\Facades\Storage;
  76. use SimpleSoftwareIO\QrCode\Facades\QrCode;
  77. class ResumeService
  78. {
  79. /**
  80. * @var $ResumeRepository
  81. */
  82. protected $ResumeRepository;
  83. protected $PersonalJobsApplyRepository;
  84. protected $ViewResumeRepository;
  85. protected $CompanyInterviewRepository;
  86. protected $CategoryRepository;
  87. protected $CategoryMajorRepository;
  88. protected $CategoryDistrictRepository;
  89. protected $CategoryJobsRepository;
  90. protected $TaskLogRepository;
  91. protected $TaskService;
  92. protected $ResumeEducationRepository;
  93. protected $ResumeWorkRepository;
  94. protected $ResumeTrainRepository;
  95. protected $ResumeLanguageRepository;
  96. protected $ResumeCredentRepository;
  97. protected $ResumeEntrustRepository;
  98. protected $CompanyDownResumeService;
  99. protected $CompanyService;
  100. protected $companyFavoriteRepository;
  101. protected $CategoryService;
  102. protected $jobsRepository;
  103. protected $companyDownResumeRepository;
  104. protected $viewJobRepository;
  105. protected $feedbackService;
  106. protected $memberInfoRepository;
  107. protected $memberRepository;
  108. protected $memberSetmealRepository;
  109. protected $memberLogRepository;
  110. protected $pmsRepository;
  111. protected $registerService;
  112. protected $personTplRepository;
  113. protected $tplRepository;
  114. protected $memberPointRepository;
  115. protected $paymentService;
  116. protected $payService;
  117. protected $taskRepository;
  118. protected $memberHandselRepository;
  119. protected $smsService;
  120. protected $queueAutoRefreshRepository;
  121. protected $emailService;
  122. /**
  123. * PersonalJobsApplyService constructor.
  124. * @param ResumeRepository $ResumeRepository
  125. * @param PersonalJobsApplyRepository $PersonalJobsApplyRepository
  126. * @param ViewResumeRepository $ViewResumeRepository
  127. * @param CompanyInterviewRepository $CompanyInterviewRepository
  128. * @param CategoryRepository $CategoryRepository
  129. * @param CategoryMajorRepository $CategoryMajorRepository
  130. * @param CategoryDistrictRepository $CategoryDistrictRepository
  131. * @param CategoryJobsRepository $CategoryJobsRepository
  132. * @param TaskLogRepository $TaskLogRepository
  133. * @param TaskService $TaskService
  134. * @param ResumeEducationRepository $ResumeEducationRepository
  135. * @param ResumeWorkRepository $ResumeWorkRepository
  136. * @param ResumeTrainRepository $ResumeTrainRepository
  137. * @param ResumeLanguageRepository $ResumeLanguageRepository
  138. * @param ResumeCredentRepository $ResumeCredentRepository
  139. * @param ResumeEntrustRepository $ResumeEntrustRepository
  140. * @param CompanyDownResumeService $CompanyDownResumeService
  141. * @param CompanyService $CompanyService
  142. * @param companyFavoriteRepository $companyFavoriteRepository
  143. * @param CategoryService $CategoryService
  144. * @param JobsRepository $jobsRepository
  145. * @param CompanyDownResumeRepository $companyDownResumeRepository
  146. * @param ViewJobRepository $viewJobRepository
  147. * @param ViewJobRepository $feedbackService
  148. * @param ViewJobRepository $memberInfoRepository
  149. * @param ViewJobRepository $memberRepository
  150. * @param MemberSetmealRepository $memberSetmealRepository
  151. * @param MemberLogRepository $memberLogRepository
  152. * @param PersonFocusComRepository $personFocusComRepository
  153. * @param pmsRepository $pmsRepository
  154. * @param registerService $registerService
  155. */
  156. public function __construct(
  157. ResumeRepository $ResumeRepository,
  158. PersonFocusComRepository $personFocusComRepository,
  159. ViewJobRepository $viewJobRepository,
  160. CompanyDownResumeRepository $companyDownResumeRepository,
  161. JobsRepository $jobsRepository,
  162. PersonalJobsApplyRepository $PersonalJobsApplyRepository,
  163. ViewResumeRepository $ViewResumeRepository,
  164. CompanyInterviewRepository $CompanyInterviewRepository,
  165. CategoryRepository $CategoryRepository,
  166. CategoryMajorRepository $CategoryMajorRepository,
  167. CategoryDistrictRepository $CategoryDistrictRepository,
  168. CategoryJobsRepository $CategoryJobsRepository,
  169. TaskLogRepository $TaskLogRepository,
  170. TaskService $TaskService,
  171. ResumeEducationRepository $ResumeEducationRepository,
  172. ResumeWorkRepository $ResumeWorkRepository,
  173. ResumeTrainRepository $ResumeTrainRepository,
  174. ResumeLanguageRepository $ResumeLanguageRepository,
  175. ResumeCredentRepository $ResumeCredentRepository,
  176. ResumeEntrustRepository $ResumeEntrustRepository,
  177. CompanyDownResumeService $CompanyDownResumeService,
  178. CompanyService $CompanyService,
  179. companyFavoriteRepository $companyFavoriteRepository,
  180. CategoryService $CategoryService,
  181. FeedbackService $feedbackService,
  182. MemberInfoRepository $memberInfoRepository,
  183. MemberRepository $memberRepository,
  184. MemberSetmealRepository $memberSetmealRepository,
  185. MemberLogRepository $memberLogRepository,
  186. PmsRepository $pmsRepository,
  187. RegisterService $registerService,
  188. PersonTplRepository $personTplRepository,
  189. TplRepository $tplRepository,
  190. MemberPointRepository $memberPointRepository,
  191. PaymentService $paymentService,
  192. PayService $payService,
  193. TaskRepository $taskRepository,
  194. MemberHandselRepository $memberHandselRepository,
  195. SmsService $smsService,
  196. QueueAutoRefreshRepository $queueAutoRefreshRepository,
  197. EmailService $emailService
  198. )
  199. {
  200. $this->ResumeRepository = $ResumeRepository;
  201. $this->PersonalJobsApplyRepository = $PersonalJobsApplyRepository;
  202. $this->ViewResumeRepository = $ViewResumeRepository;
  203. $this->CompanyInterviewRepository = $CompanyInterviewRepository;
  204. $this->CategoryRepository = $CategoryRepository;
  205. $this->CategoryMajorRepository = $CategoryMajorRepository;
  206. $this->CategoryDistrictRepository = $CategoryDistrictRepository;
  207. $this->CategoryJobsRepository = $CategoryJobsRepository;
  208. $this->TaskLogRepository = $TaskLogRepository;
  209. $this->TaskService = $TaskService;
  210. $this->ResumeEducationRepository = $ResumeEducationRepository;
  211. $this->ResumeWorkRepository = $ResumeWorkRepository;
  212. $this->ResumeTrainRepository = $ResumeTrainRepository;
  213. $this->ResumeLanguageRepository = $ResumeLanguageRepository;
  214. $this->ResumeCredentRepository = $ResumeCredentRepository;
  215. $this->ResumeEntrustRepository = $ResumeEntrustRepository;
  216. $this->CompanyDownResumeService = $CompanyDownResumeService;
  217. $this->CompanyService = $CompanyService;
  218. $this->companyFavoriteRepository = $companyFavoriteRepository;
  219. $this->CategoryService = $CategoryService;
  220. $this->jobsRepository = $jobsRepository;
  221. $this->companyDownResumeRepository = $companyDownResumeRepository;
  222. $this->viewJobRepository = $viewJobRepository;
  223. $this->feedbackService = $feedbackService;
  224. $this->memberInfoRepository = $memberInfoRepository;
  225. $this->memberRepository = $memberRepository;
  226. $this->memberSetmealRepository = $memberSetmealRepository;
  227. $this->memberLogRepository = $memberLogRepository;
  228. $this->personFocusComRepository = $personFocusComRepository;
  229. $this->pmsRepository = $pmsRepository;
  230. $this->registerService = $registerService;
  231. $this->personTplRepository = $personTplRepository;
  232. $this->tplRepository = $tplRepository;
  233. $this->memberPointRepository = $memberPointRepository;
  234. $this->paymentService = $paymentService;
  235. $this->payService = $payService;
  236. $this->taskRepository = $taskRepository;
  237. $this->memberHandselRepository = $memberHandselRepository;
  238. $this->smsService = $smsService;
  239. $this->queueAutoRefreshRepository = $queueAutoRefreshRepository;
  240. $this->emailService = $emailService;
  241. }
  242. public function loginValidate($user)
  243. {
  244. $member = $this->memberInfoRepository->getMemberInfo($user->id);
  245. $resume = $this->ResumeRepository->getPersonInfo($user->id);
  246. $resumeTitle = '简历' . date('Ymd');
  247. if ($resume) {
  248. $stick = PersonalServiceStickLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
  249. $intention_jobs_id = explode(',', $resume->intention_jobs_id);
  250. $intenionArrTwo = [];
  251. $intenionArrThree = [];
  252. foreach ($intention_jobs_id as $key => $val) {
  253. if (explode('.', $val)[2]) {
  254. $intenionArrThree[] = explode('.', $val)[2];
  255. } else {
  256. $intenionArrTwo[] = explode('.', $val)[1];
  257. }
  258. }
  259. //$recommend_jobs = $this->jobsRepository->recommendJobs($intenionArrTwo, $intenionArrThree, 1, getJobsStatus());
  260. } else {
  261. $stick = [];
  262. $recommend_jobs = [];
  263. }
  264. return [
  265. 'resume' => $resume,
  266. 'stick' => $stick,
  267. //'recommend_jobs'=>$recommend_jobs,
  268. 'resumeTitle' => $resumeTitle,
  269. 'member' => $member
  270. ];
  271. }
  272. public function popPms($user)
  273. {
  274. //获取当天
  275. //当天开始时间
  276. $start_time = strtotime(date("Y-m-d", time()));
  277. //当天结束之间
  278. $end_time = $start_time + 60 * 60 * 24;
  279. $data[] = ['new', 1];
  280. $data[] = ['msgtouid', $user->id];
  281. $data[] = ['utype', $user->utype];
  282. $data[] = ['msgtype', 2];
  283. $data[] = ['msgfromuid', 0];
  284. $data[] = ['msgfrom', 'admin'];
  285. /*$data[] = ['started_at', '>=', $start_time];
  286. $data[] = ['ended_at', '<', $end_time];*/
  287. $data[] = ['started_at', '<=', $start_time];
  288. $data[] = ['ended_at', '>=', $start_time];
  289. return $this->pmsRepository->findFirstPms($data);
  290. }
  291. public function popPmsRead($id)
  292. {
  293. return $this->pmsRepository->updateNewById($id, ['new' => 2]);
  294. }
  295. /* public function ajax_get_interest_jobs($date)
  296. {
  297. $type = $date['type'];
  298. $p = isset($date['p']) ? $date['p'] : 1;
  299. $user = auth('web-member')->user();
  300. if ($type=='recommend_jobs') {
  301. $resume =$this->ResumeRepository->getPersonInfo($user->id);
  302. if ($resume) {
  303. $intention_jobs_id = explode(',', $resume->intention_jobs_id);
  304. $intenionArrTwo = [];
  305. $intenionArrThree = [];
  306. foreach ($intention_jobs_id as $key => $val) {
  307. if (explode('.', $val)[2]) {
  308. $intenionArrThree[] = explode('.', $val)[2];
  309. } else {
  310. $intenionArrTwo[] = explode('.', $val)[1];
  311. }
  312. }
  313. $recommend_jobs = $this->jobsRepository->recommendJobs($intenionArrTwo, $intenionArrThree, $p, getJobsStatus());
  314. } else {
  315. $recommend_jobs = (object)[];
  316. }
  317. return $recommend_jobs;
  318. } elseif ($type=='nearby_jobs') {
  319. $baidu_api_result = _get_baidumap_api();
  320. $baidu_api_jsoninfo = json_decode($baidu_api_result, true);
  321. if ($baidu_api_jsoninfo['status']==0) {
  322. $lng = $baidu_api_jsoninfo['content']['point']['x'];
  323. $lat = $baidu_api_jsoninfo['content']['point']['y'];
  324. $squares = square_point($lng, $lat);
  325. $lngArr = [];
  326. $lngArr[] = $squares['lt']['lng'];
  327. $lngArr[] = $squares['rb']['lng'];
  328. $latArr = [];
  329. $latArr[] = $squares['rb']['lat'];
  330. $latArr[] = $squares['lt']['lat'];
  331. $nearby_jobs = $this->jobsRepository->nearbyJobs($lngArr, $latArr, $p, getJobsStatus());
  332. } else {
  333. $nearby_jobs = (object)[];
  334. }
  335. return $nearby_jobs;
  336. } else {
  337. $newJobsArr = strtotime('-1 days');
  338. $nearby_jobs = $this->jobsRepository->new_jobs($newJobsArr, $p, getJobsStatus());
  339. return $nearby_jobs;
  340. }
  341. }*/
  342. /**
  343. * 我的简历
  344. */
  345. public function myResume($user)
  346. {
  347. $uid = $user->id;
  348. $resuem = $this->ResumeRepository->getAllResume($uid);
  349. $resume_id = null;
  350. foreach ($resuem as $key => $val) {
  351. if ($val->def == 1) {
  352. $resume_id = $val->id;
  353. break;
  354. }
  355. }
  356. if (!$resume_id) {
  357. throw new ResponseException('抱歉,搜索不到简历!', '', 404);
  358. }
  359. $resumeArr = [];
  360. $countResume = 0;
  361. foreach ($resuem as $key => $val) {
  362. $countResume++;
  363. if ($val->level == 1) {
  364. $level = '(<span class="t2">优</span>)';
  365. } elseif ($val->level == 2) {
  366. $level = '(<span class="t3">良</span>)';
  367. } else {
  368. $level = '(<span class="t1">差</span>)';
  369. }
  370. if (config('aix.personal_set.per_set.show_set.resume_display') == 2) {
  371. if ($val->audit == 2) {
  372. $audit = '<span class="font_green">审核通过</span>';
  373. $state = 'state';
  374. $resumeStauts = true;
  375. } elseif ($val->audit == 0) {
  376. $state = 'state0';
  377. $audit = '<span class="font_red">审核未通过</span>';
  378. $resumeStauts = false;
  379. } else {
  380. $audit = '<span class="font_green">审核通过</span>';
  381. $state = 'state';
  382. $resumeStauts = true;
  383. }
  384. } else {
  385. if ($val->audit == 2) {
  386. $audit = '<span class="font_green">审核通过</span>';
  387. $state = 'state';
  388. $resumeStauts = true;
  389. } elseif ($val->audit == 0) {
  390. $state = 'state0';
  391. $audit = '<span class="font_red">审核未通过</span>';
  392. $resumeStauts = false;
  393. } else {
  394. $state = 'state1';
  395. $audit = '<span class="font_yellow">审核中</span>';
  396. $resumeStauts = false;
  397. }
  398. }
  399. $updated_at = date_format_new(strtotime($val->updated_at));
  400. $updated_time = $updated_at ? $updated_at : '';
  401. $expires = true;
  402. if ($val->expires && $val->expires < time()) {
  403. $expires = false;
  404. }
  405. if ($val->def == 1) {
  406. $resumeArr['default']['id'] = $val->id;
  407. $resumeArr['default']['lock'] = $val->display ? '' : 'close';
  408. $resumeArr['default']['complete_percent'] = $val->complete_percent . "%";
  409. $resumeArr['default']['level'] = $level;
  410. $resumeArr['default']['expires'] = $expires;
  411. $resumeArr['default']['audit'] = $audit;
  412. $resumeArr['default']['updated_at'] = $updated_time;
  413. $resumeArr['default']['title'] = $val->title;
  414. $resumeArr['default']['state'] = $state;
  415. $resumeArr['default']['resumeStauts'] = $resumeStauts;
  416. $resumeArr['default']['display'] = $val->display;
  417. $resumeArr['default']['tag'] = DB::table('personal_service_tag_logs')->where('resume_id', $val->id)->first();
  418. $resumeArr['default']['stick'] = DB::table('personal_service_stick_logs')->where('resume_id', $val->id)->first();
  419. $resumeArr['default']['viewResume'] = $this->ViewResumeRepository->getViewResume(explode(',', $val->id));
  420. $resumeArr['default']['viewResumeDown'] = CompanyDownResume::whereHas('resumes')->where('resume_id', $val->id)->count();
  421. if ($val->entrust) {
  422. $resumeArr['default']['entrust'] = $val->entrust - time();
  423. } else {
  424. $resumeArr['default']['entrust'] = 0;
  425. }
  426. } else {
  427. $resumeArr['noDefault'][$key]['id'] = $val->id;
  428. $resumeArr['noDefault'][$key]['lock'] = $val->display ? '' : 'close';
  429. $resumeArr['noDefault'][$key]['complete_percent'] = $val->complete_percent . "%";
  430. $resumeArr['noDefault'][$key]['level'] = $level;
  431. $resumeArr['noDefault'][$key]['expires'] = $expires;
  432. $resumeArr['noDefault'][$key]['audit'] = $audit;
  433. $resumeArr['noDefault'][$key]['updated_at'] = $updated_time;
  434. $resumeArr['noDefault'][$key]['title'] = $val->title;
  435. $resumeArr['noDefault'][$key]['state'] = $state;
  436. $resumeArr['noDefault'][$key]['resumeStauts'] = $resumeStauts;
  437. $resumeArr['noDefault'][$key]['display'] = $val->display;
  438. $resumeArr['noDefault'][$key]['tag'] = DB::table('personal_service_tag_logs')->where('resume_id', $val->id)->first();
  439. $resumeArr['noDefault'][$key]['stick'] = DB::table('personal_service_stick_logs')->where('resume_id', $val->id)->first();
  440. $resumeArr['noDefault'][$key]['viewResume'] = $this->ViewResumeRepository->getViewResume(explode(',', $val->id));
  441. $resumeArr['noDefault'][$key]['viewResumeDown'] = CompanyDownResume::whereHas('companys')->whereHas('resumes')->where('resume_id', $val->id)->count();
  442. if ($val->entrust) {
  443. $resumeArr['noDefault'][$key]['entrust'] = $val->entrust - time();
  444. } else {
  445. $resumeArr['noDefault'][$key]['entrust'] = 0;
  446. }
  447. }
  448. }
  449. $applyJobs = $this->PersonalJobsApplyRepository->getApplyJobsDef($resume_id, getJobsStatus());
  450. $interview = $this->CompanyInterviewRepository->getInterviewDef($resume_id, getJobsStatus());
  451. $viewResume = $this->ViewResumeRepository->getViewResume([$resume_id]);
  452. return ['resume' => $resumeArr, 'countResume' => $countResume, 'applyJobs' => $applyJobs, 'interview' => $interview, 'viewResume' => $viewResume];
  453. }
  454. public function signIn($user)
  455. {
  456. $signCount = $this->TaskLogRepository->getTaskLogCount($user->id, 3, $user->utype);
  457. if ($signCount) {
  458. return ['code' => 0, 'info' => '您今天已经签到过了!'];
  459. } else {
  460. $res = $this->TaskService->doTask(3, $user->id, $user->utype);
  461. if ($res['code'] == 1) {
  462. $this->memberLogRepository->createLog($user, 8003, "");
  463. return ['code' => 1, 'info' => $res['data']['points']];
  464. } else {
  465. return ['code' => 0, 'info' => $res['info']];
  466. }
  467. }
  468. }
  469. public function myAllResume($uid)
  470. {
  471. return $this->ResumeRepository->getAllResume($uid);
  472. }
  473. public function myResumeAjax($user)
  474. {
  475. $uid = $user->id;
  476. return $this->ResumeRepository->getSuccessResume($uid, getResumeStatus());
  477. }
  478. public function getSuccessResumeCount($user)
  479. {
  480. $resumeCount = $this->ResumeRepository->getSuccessResumeCount($user->id, getResumeStatus());
  481. $resumeList = $this->ResumeRepository->getSuccessResume($user->id, getResumeStatus());
  482. if ($resumeCount == 0) {
  483. return ['code' => 0, 'info' => '您没有审核通过的简历'];
  484. } else {
  485. return ['code' => 1, 'info' => $resumeList];
  486. }
  487. }
  488. public function resumeCreate($date, $user)
  489. {
  490. if (empty($date['education'])) {
  491. throw new ResponseException('最高学历不能为空!');
  492. }
  493. if (empty($date['experience'])) {
  494. throw new ResponseException('工作经验不能为空!');
  495. }
  496. if (!vali_person_reg($date['card_t_cn'], $date['id_card'])) {
  497. throw new ResponseException('证件号格式错误!');
  498. }
  499. if (isset($date['qq']) && !empty($date['qq'])) {
  500. if (!preg_match('/^\d*$/', $date['qq'])) {
  501. throw new ResponseException('qq号只能是数字!');
  502. }
  503. }
  504. if (isset($date['weixin']) && !empty($date['weixin'])) {
  505. if (preg_match('/[\x7f-\xff]/', $date['weixin'])) {
  506. throw new ResponseException('微信号不能含有中文!');
  507. }
  508. }
  509. if ($date['email']) {
  510. if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $date['email'])) {
  511. throw new ResponseException('邮箱格式不正确!');
  512. }
  513. $member_vali = Member::where(['email' => $date['email']])->whereNotIn('id', [$user->id])->get()->toArray();
  514. if (!empty($member_vali)) {
  515. throw new ResponseException('邮箱格已被使用!');
  516. }
  517. }
  518. $count = $this->ResumeRepository->getResumeCount($user->id);
  519. if ($count >= config('aix.personal_set.per_set.per_set.resume_max')) {
  520. throw new ResponseException('您最大可以创建' . config('aix.personal_set.per_set.per_set.resume_max') . '份简历', '', 400);
  521. }
  522. $member_info['uid'] = $user->id;
  523. if (isset($date['display_name'])) {
  524. $member_info['display_name'] = $date['display_name'];
  525. }
  526. $member_info['realname'] = $date['fullname'];
  527. if ($date['sex'] == 1) {
  528. $sex_cn = '男';
  529. } else {
  530. $sex_cn = '女';
  531. }
  532. $member_info['sex'] = $date['sex'];
  533. $member_info['sex_cn'] = $sex_cn;
  534. $member_info['birthday'] = $date['birthdate'];
  535. $member_info['card_t_cn'] = 306;
  536. $member_info['id_card'] = $date['id_card'];
  537. $member_info['residence'] = $date['residence'];
  538. $residenseArr = explode(',', $date['residence']);
  539. $residenseArrId = [];
  540. foreach ($residenseArr as $key => $val) {
  541. $residenseArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
  542. }
  543. $residenseRes = $this->CategoryDistrictRepository->getManydistrict($residenseArrId);
  544. $member_info['residence_cn'] = '';
  545. foreach ($residenseRes as $key => $val) {
  546. $nm = $this->CategoryDistrictRepository->getCategoryDistrict($val->parent_id);
  547. $member_info['residence_cn'] .= $nm->name . '-' . $val->name . '+';
  548. }
  549. $member_info['residence_cn'] = rtrim($member_info['residence_cn'], '+');
  550. $member_info['education'] = $date['education'];
  551. $educationArr = $this->CategoryRepository->getCategory($date['education']);
  552. $education_cn = $educationArr['demand'];
  553. $member_info['education_cn'] = $education_cn;
  554. if (isset($date['major']) && !empty($date['major'])) {
  555. $majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
  556. $major_cn = $majorArr['name'];
  557. $member_info['major'] = $date['major'];
  558. $member_info['major_cn'] = $major_cn;
  559. }
  560. $member_info['experience'] = $date['experience'];
  561. $experienceArr = $this->CategoryRepository->getCategory($date['experience']);
  562. $experience_cn = $experienceArr['demand'];
  563. $member_info['experience_cn'] = $experience_cn;
  564. $member_info['phone'] = $date['telephone'];
  565. $member_info['email'] = $date['email'] ? $date['email'] : '';
  566. if (isset($date['height'])) {
  567. $member_info['height'] = $date['height'];
  568. }
  569. if (isset($date['householdaddress'])) {
  570. $member_info['householdaddress'] = $date['householdaddress'];
  571. $member_info['householdaddress_cn'] = '';
  572. if (!empty($date['householdaddress'])) {
  573. $houseArr = explode(',', $date['householdaddress']);
  574. $houseArrId = [];
  575. foreach ($houseArr as $key => $val) {
  576. $houseArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
  577. }
  578. $houseRes = $this->CategoryDistrictRepository->getManydistrict($houseArrId);
  579. foreach ($houseRes as $key => $val) {
  580. $nm = $this->CategoryDistrictRepository->getCategoryDistrict($val->parent_id);
  581. $member_info['householdaddress_cn'] .= $nm->name . '-' . $val->name . '+';
  582. }
  583. $member_info['householdaddress_cn'] = rtrim($member_info['householdaddress_cn'], '+');
  584. $resume_arr['householdaddress'] = $member_info['householdaddress_cn'];
  585. $resumeArr['householdaddress'] = $member_info['householdaddress_cn'];
  586. }
  587. }
  588. if (isset($date['techlevel']) && $date['techlevel']) {
  589. $member_info['techlevel'] = $date['techlevel'];
  590. $member_info['techlevel_cn'] = get_category($date['techlevel']);
  591. }
  592. if (isset($date['qq'])) {
  593. $member_info['qq'] = $date['qq'];
  594. $resumeArr['qq'] = $date['qq'];
  595. $resume_arr['qq'] = $date['qq'];
  596. }
  597. if (isset($date['weixin'])) {
  598. $member_info['weixin'] = $date['weixin'];
  599. $resumeArr['weixin'] = $date['weixin'];
  600. $resume_arr['weixin'] = $date['weixin'];
  601. }
  602. if (isset($date['marriage'])) {
  603. if ($date['marriage'] == 1) {
  604. $member_info['marriage'] = $date['marriage'];
  605. $member_info['marriage_cn'] = '未婚';
  606. } elseif ($date['marriage'] == 2) {
  607. $member_info['marriage'] = $date['marriage'];
  608. $member_info['marriage_cn'] = '已婚';
  609. } else {
  610. $member_info['marriage'] = $date['marriage'];
  611. $member_info['marriage_cn'] = '保密';
  612. }
  613. }
  614. if ($date['card_t_cn'] == 306) {
  615. $card = strlen($date['id_card']) == 15 ? ('19' . substr($date['id_card'], 6, 2)) : substr($date['id_card'], 6, 4);
  616. if ($member_info['birthday'] != $card) {
  617. throw new ResponseException('出生年月和身份证不符合!');
  618. }
  619. }
  620. $resume_arr['uid'] = $user->id;
  621. if (isset($date['display_name'])) {
  622. $resume_arr['display_name'] = $date['display_name'];
  623. }
  624. $resume_arr['title'] = isset($date['title']) ? $date['title'] : '简历' . date('Ymd');
  625. $resume_arr['fullname'] = $date['fullname'];
  626. $resume_arr['sex'] = $date['sex'];
  627. $resume_arr['sex_cn'] = $sex_cn;
  628. $resume_arr['nature'] = $date['nature'];
  629. $natureArr = $this->CategoryRepository->getCategory($date['nature']);
  630. $resume_arr['nature_cn'] = $natureArr['demand'];
  631. $resume_arr['trade'] = $date['trade'];
  632. // $resume_arr['techlevel'] = $date['techlevel'];
  633. // $resume_arr['techlevel_cn'] = get_category($date['techlevel']);
  634. $trade_cn = '';
  635. if (!empty($date['trade'])) {
  636. $tradeArr = $this->CategoryRepository->getManyCategory(explode(',', $date['trade']));
  637. foreach ($tradeArr as $key => $val) {
  638. $trade_cn .= $val->demand . '+';
  639. }
  640. $resume_arr['trade_cn'] = rtrim($trade_cn, '+');
  641. }
  642. $resume_arr['birthdate'] = $date['birthdate'];
  643. $resume_arr['residence'] = $member_info['residence_cn'];
  644. if (isset($date['height'])) {
  645. $resume_arr['height'] = $date['height'];
  646. }
  647. if (isset($date['marriage'])) {
  648. if ($date['marriage'] == 1) {
  649. $resume_arr['marriage'] = $date['marriage'];
  650. $resume_arr['marriage_cn'] = '未婚';
  651. } elseif ($date['marriage'] == 2) {
  652. $resume_arr['marriage'] = $date['marriage'];
  653. $resume_arr['marriage_cn'] = '已婚';
  654. } else {
  655. $resume_arr['marriage'] = $date['marriage'];
  656. $resume_arr['marriage_cn'] = '保密';
  657. }
  658. }
  659. $resume_arr['experience'] = $date['experience'];
  660. $resume_arr['experience_cn'] = $experience_cn;
  661. $resume_arr['subsite_id'] = $user->subsite_id;
  662. $resume_arr['district'] = $date['district'];
  663. $resume_arr['expires'] = 0;
  664. $expires = config('aix.personal_set.per_set.per_set.resume_expires');
  665. if ($expires) {
  666. $resume_arr['expires'] = strtotime("+{$expires} days");
  667. }
  668. $districtArr = explode(',', $date['district']);
  669. $resumrArrId = [];
  670. foreach ($districtArr as $key => $val) {
  671. $resumrArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
  672. }
  673. $resumeRes = $this->CategoryDistrictRepository->getManydistrict($resumrArrId);
  674. $resume_arr['district_cn'] = '';
  675. foreach ($resumeRes as $key => $val) {
  676. $resume_arr['district_cn'] .= $val->name . '+';
  677. }
  678. $resume_arr['district_cn'] = rtrim($resume_arr['district_cn'], '+');
  679. if (intval($date['wage'])) {
  680. $resume_arr['wage'] = $date['wage'];
  681. $wageArr = $this->CategoryRepository->getCategory($date['wage']);
  682. $resume_arr['wage_cn'] = $wageArr['demand'];
  683. if ($date['wage'] == 61) {
  684. $resume_arr['wage_min'] = 10000;
  685. $resume_arr['wage_max'] = 0;
  686. } else {
  687. $resume_arr['wage_min'] = explode('~', format_wage($wageArr['demand']))[0];
  688. $resume_arr['wage_max'] = explode('~', format_wage($wageArr['demand']))[1];
  689. }
  690. } else {
  691. $resume_arr['wage'] = 0;
  692. $resume_arr['wage_min'] = intval($date['wage_min']);
  693. $resume_arr['wage_max'] = intval($date['wage_max']);
  694. $resume_arr['wage_cn'] = intval($date['wage_min']) . '~' . intval($date['wage_max']) . '/月';
  695. }
  696. $resume_arr['education'] = $date['education'];
  697. $resume_arr['education_cn'] = $education_cn;
  698. if (isset($date['major']) && !empty($date['major'])) {
  699. $majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
  700. $major_cn = $majorArr['name'];
  701. $resume_arr['major'] = $date['major'];
  702. $resume_arr['major_cn'] = $major_cn;
  703. }
  704. $resume_arr['telephone'] = $date['telephone'];
  705. $resume_arr['email'] = $date['email'] ? $date['email'] : '';
  706. $resume_arr['intention_jobs_id'] = $date['intention_jobs_id'];
  707. $jobsArr = explode(',', $date['intention_jobs_id']);
  708. $jobArrId = [];
  709. foreach ($jobsArr as $key => $val) {
  710. $jobArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
  711. }
  712. $jobsRes = $this->CategoryJobsRepository->getManyJobs($jobArrId);
  713. $resume_arr['intention_jobs'] = '';
  714. foreach ($jobsRes as $key => $val) {
  715. $resume_arr['intention_jobs'] .= $val->name . '+';
  716. }
  717. $resume_arr['intention_jobs'] = rtrim($resume_arr['intention_jobs'], '+');
  718. $resume_arr['current'] = $date['current'];
  719. $currentArr = $this->CategoryRepository->getCategory($date['current']);
  720. $resume_arr['current_cn'] = $currentArr['demand'];
  721. $memberInfo = $this->memberInfoRepository->findMemberInfo(['uid' => $user->id]);
  722. if (!isset($date['resume_id']) || empty($date['resume_id'])) { //一体机。
  723. $resume_arr['complete_percent'] = 35;
  724. $resume_arr['level'] = 0;
  725. $personInfo = $this->ResumeRepository->getPersonInfo($user->id);
  726. $personInfo ? $resume_arr['def'] = 0 : $resume_arr['def'] = 1;
  727. if ($memberInfo) {
  728. if ($memberInfo->images) {
  729. $resume_arr['complete_percent'] = 40;
  730. }
  731. }
  732. }
  733. $memData = [];
  734. $member = $this->memberRepository->getMemberById($user->id);
  735. if (!$member->mobile_audit) {
  736. $memData['mobile'] = $date['telephone'];
  737. }
  738. if (!$member->email_audit) {
  739. $memData['email'] = $date['email'] ? $date['email'] : '';
  740. }
  741. $getResume = $this->ResumeRepository->getResumes(['uid' => $user->id]);
  742. $this->TaskService->doTask(1);
  743. $this->TaskService->doTask(2);
  744. DB::beginTransaction();//检查数据库事务
  745. try {
  746. if ($memData) {
  747. $this->memberRepository->updateInfo($user->id, $memData);
  748. }
  749. $memberInfo ? $this->memberInfoRepository->updateInfo($member_info, $user->id) : $this->memberInfoRepository->createInfo($member_info);
  750. if (!$getResume->isEmpty()) {
  751. $resume_id = array_column($getResume->toArray(), 'id');
  752. if (isset($date['display_name'])) {
  753. $resumeArr['display_name'] = $date['display_name'];
  754. }
  755. $resumeArr['fullname'] = $date['fullname'];
  756. $resumeArr['sex'] = $date['sex'];
  757. $resumeArr['sex_cn'] = $sex_cn;
  758. $resumeArr['birthdate'] = $date['birthdate'];
  759. $resumeArr['residence'] = $member_info['residence_cn'];
  760. if (isset($date['height'])) {
  761. $resumeArr['height'] = $date['height'];
  762. }
  763. if (isset($date['marriage'])) {
  764. if ($date['marriage'] == 1) {
  765. $resumeArr['marriage'] = $date['marriage'];
  766. $resumeArr['marriage_cn'] = '未婚';
  767. } elseif ($date['marriage'] == 2) {
  768. $resumeArr['marriage'] = $date['marriage'];
  769. $resumeArr['marriage_cn'] = '已婚';
  770. } else {
  771. $resumeArr['marriage'] = $date['marriage'];
  772. $resumeArr['marriage_cn'] = '保密';
  773. }
  774. }
  775. $resumeArr['experience'] = $date['experience'];
  776. $resumeArr['experience_cn'] = $member_info['experience_cn'];
  777. $resumeArr['education'] = $date['education'];
  778. $resumeArr['education_cn'] = $education_cn;
  779. if (isset($date['major']) && !empty($date['major'])) {
  780. $majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
  781. $major_cn = $majorArr['name'];
  782. $resumeArr['major'] = $date['major'];
  783. $resumeArr['major_cn'] = $major_cn;
  784. }
  785. $resumeArr['telephone'] = $date['telephone'];
  786. $resumeArr['email'] = $date['email'] ? $date['email'] : '';
  787. $resumeArr['idcard'] = $date['id_card'];
  788. $this->ResumeRepository->updateAllResume($resume_id, $resumeArr);
  789. }
  790. if (isset($date['resume_id']) && !empty($date['resume_id'])) {
  791. $this->ResumeRepository->updateById($resume_arr, $date['resume_id']);
  792. $result = (object)[];
  793. $result->id = $date['resume_id'];
  794. } else {
  795. $result = $this->ResumeRepository->resumeAdd($resume_arr);
  796. //通过学历判断人才类别前置操作
  797. $this->edu_mate($resume_arr['education'], $user->id);
  798. }
  799. $subsiteDefault = [
  800. [
  801. 'subsite_id' => $user->subsite_id,
  802. 'resume_id' => $result->id,
  803. 'created_at' => date('Y-m-d H:i:s'),
  804. 'updated_at' => date('Y-m-d H:i:s'),
  805. ]
  806. ];
  807. $subsiteArr = [];
  808. if (isset($date['subsite']) && $date['subsite'] !== null) {
  809. $subsite = explode(',', $date['subsite']);
  810. foreach ($subsite as $key => $val) {
  811. $subsiteArr[$key]['subsite_id'] = $val;
  812. $subsiteArr[$key]['resume_id'] = $result->id;
  813. $subsiteArr[$key]['created_at'] = date('Y-m-d H:i:s');
  814. $subsiteArr[$key]['updated_at'] = date('Y-m-d H:i:s');
  815. }
  816. if (in_array($user->subsite_id, $subsite)) {
  817. $subsiteDefault = $subsiteArr;
  818. } else {
  819. $subsiteDefault = array_merge($subsiteDefault, $subsiteArr);
  820. }
  821. }
  822. SubsiteResume::insert($subsiteDefault);
  823. event_search_update(Resume::class, (string)$result->id, 'update');
  824. DB::commit();
  825. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2010, $result->id)) {
  826. throw new \Exception("日志记失败!");
  827. }
  828. return ['code' => 1, 'info' => $result->id];
  829. } catch (\Exception $e) {
  830. DB::rollback();
  831. return ['code' => 0, 'info' => $e->getMessage()];
  832. }
  833. }
  834. /**
  835. * 通过学历进行人才匹配前置方法
  836. */
  837. public function edu_mate($edu, $uid)
  838. {
  839. $edu_cn = Category::where('id', $edu)->value('demand');
  840. if ($edu_cn) {
  841. $where['name'] = $edu_cn;
  842. $p = PersonalCategory::where($where)->first();
  843. //学历信息
  844. $this->antic_personnel($uid, $p);
  845. }
  846. }
  847. /**
  848. * 最大人才类型预判断
  849. * 人才分类id,指当前被提交组里面的五类人才集合
  850. * 此功能是要指出最大的人才
  851. */
  852. public function antic_personnel($uid, $p = null)
  853. {
  854. //结合ResumeAuthInfo表与PersonalCategory表多表联查,找出当前简历的大分类
  855. $where['resume_auth_info.uid'] = $uid;
  856. //只取最高级别的人才等级排序id
  857. $p_id = ResumeAuthInfo::where($where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')->orderBy('personal_category.rc_order','desc')->first();
  858. #获取福建最高级别的人才等级id
  859. $fj_where = array('resume_auth_info.uid' => $uid, 'categorys.alias' => "RC_category_fj");
  860. $fj_info = ResumeAuthInfo::where($fj_where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')
  861. //->join(C('DB_PREFIX').'personal_category c on c.c_id = pc.rc_category_fj_id and c.c_alias = "RC_category_fj"','left')
  862. ->leftJoin('categorys', 'categorys.id', '=', 'personal_category.rc_category_fj_id')
  863. ->select('personal_category.rc_category_fj_id','personal_category.rc_category_fj','personal_category.rc_order')
  864. ->orderBy('categorys.order','desc')
  865. ->first();
  866. //获取泉州最高级别的人才等级id
  867. $qz_where = array('resume_auth_info.uid' => $uid, 'categorys.alias' => "RC_category_qz");
  868. $qz_info = ResumeAuthInfo::where($fj_where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')
  869. ->leftJoin('categorys', 'categorys.id', '=', 'personal_category.rc_category_qz_id')
  870. ->select('personal_category.rc_category_qz_id','personal_category.rc_category_qz','personal_category.rc_order')
  871. ->where($qz_where)
  872. ->orderBy('categorys.order','desc')
  873. ->first();
  874. //一共提交多少数据
  875. $count = ResumeAuthInfo::where(array('uid' => $uid))->count();
  876. //获取当前人才类别
  877. if ($p == null || $p == '' || empty($p)) {
  878. //找简历表的学历中文
  879. $infor = Resume::where(array("uid" => $uid, 'def' => 1))->first();
  880. if (!empty($infor->education_cn)) {
  881. $wheres['name'] = $infor->education_cn;
  882. $p = PersonalCategory::where($wheres)->first();
  883. }
  884. }
  885. if ($p_id && $p) {
  886. //如果荣誉..和学历都提交满足等级
  887. if ($p_id->rc_order >= $p->rc_order) {
  888. //新提交过来的等级判定信息
  889. $level_info = $p_id;
  890. } else {
  891. $level_info = $p;
  892. }
  893. $count += 1;
  894. } elseif ($p_id && !$p) {
  895. //如果只有荣誉..满足人才等级,学历不满足等级
  896. $level_info = $p_id;
  897. } elseif (!$p_id && $p) {
  898. //如果荣誉..不满足人才等级,学历满足等级
  899. $level_info = $p;
  900. $count += 1;
  901. } else {
  902. //如果荣誉..和学历都不满足人才等级
  903. $level_info = [];
  904. }
  905. //判断福建人才类别信息
  906. if ($fj_info && $p) {
  907. //如果荣誉..和学历都提交满足等级
  908. if ($fj_info['rc_order'] >= $p->rc_order) {
  909. $level_info['rc_fj_level'] = $fj_info->rc_category_fj;
  910. $level_info['rc_fj_level_id'] = $fj_info->rc_category_fj_id;
  911. } else {
  912. $level_info['rc_fj_level'] = $p->rc_category_fj;
  913. $level_info['rc_fj_level_id'] = $p->rc_category_fj_id;
  914. }
  915. } else if ($fj_info && !$p) {
  916. //如果只有荣誉..满足人才等级,学历不满足等级
  917. $level_info['rc_fj_level'] = $fj_info->rc_category_fj;
  918. $level_info['rc_fj_level_id'] = $fj_info->rc_category_fj_id;
  919. } else if (!$fj_info && $p) {
  920. //如果荣誉..不满足人才等级,学历满足等级
  921. $level_info['rc_fj_level'] = $p->rc_category_fj;
  922. $level_info['rc_fj_level_id'] = $p->rc_category_fj_id;
  923. }
  924. //判断泉州人才类别信息
  925. if ($qz_info && $p) {
  926. //如果荣誉..和学历都提交满足等级
  927. if ($qz_info['rc_order'] >= $p->rc_order) {
  928. $level_info['rc_qz_level'] = $qz_info->rc_category_qz;
  929. $level_info['rc_qz_level_id'] = $qz_info->rc_category_qz_id;
  930. } else {
  931. $level_info['rc_qz_level'] = $p->rc_category_qz;
  932. $level_info['rc_qz_level_id'] = $p->rc_category_qz_id;
  933. }
  934. } else if ($qz_info && !$p) {
  935. //如果只有荣誉..满足人才等级,学历不满足等级
  936. $level_info['rc_qz_level'] = $qz_info->rc_category_qz;
  937. $level_info['rc_qz_level_id'] = $qz_info->rc_category_qz_id;
  938. } else if (!$qz_info && $p) {
  939. //如果荣誉..不满足人才等级,学历满足等级
  940. $level_info['rc_qz_level'] = $p->rc_category_qz;
  941. $level_info['rc_qz_level_id'] = $p->rc_category_qz_id;
  942. }
  943. //会员名
  944. $username = Resume::where(array("uid" => $uid, 'def' => 1))->value('fullname');
  945. //身份证号
  946. $idcode = MemberInfo::where(array("uid" => $uid))->value("id_card");
  947. //判断人才等级表有没有这个人员记录
  948. $result = PersonalTalents::where(array("uid" => $uid))->first();
  949. if (!empty($level_info)) {
  950. $data['uid'] = $uid;
  951. $data['rc_username'] = $username;
  952. $data['rc_idcode'] = $idcode;
  953. $data['rc_level'] = $level_info['rc_category'];
  954. $data['rc_level_id'] = $level_info['rc_category_id'];
  955. $data['rc_fj_level'] = $level_info['rc_fj_level'];
  956. $data['rc_fj_level_id'] = $level_info['rc_fj_level_id'];
  957. $data['rc_qz_level'] = $level_info['rc_qz_level'];
  958. $data['rc_qz_level_id'] = $level_info['rc_qz_level_id'];
  959. $data['rc_sort'] = $level_info['rc_order'];
  960. $data['rc_audit'] = 2;
  961. $data['rc_where'] = 1;
  962. $data['rc_num'] = $count;
  963. $data['ifconform'] = 1;
  964. $data['personal_category_id'] = $level_info['id'];
  965. if ($result) {
  966. PersonalTalents::where(array("uid" => $uid))->update($data);
  967. if ($data['rc_sort'] != $result->rc_sort) {
  968. $info['talents_id'] = $result->id;
  969. $info['log_class'] = 1;//日志类型会员个人更新
  970. $info['content'] = $username . "更新人才资料,预判人才等级由‘" . $result->rc_level . "’转为‘" . $data['rc_level'] . "’,待重新审核";
  971. $info['log_time'] = time();
  972. $info['auth_man'] = $username;
  973. PersonalTalentsLog::create($info);
  974. }
  975. } else {
  976. $data['addtime'] = time();
  977. $res = PersonalTalents::create($data);
  978. $info['talents_id'] = $res->id;
  979. $info['log_class'] = 1;//日志类型会员个人更新
  980. $info['content'] = $username . "提交人才资料,预判人才等级为‘" . $data['rc_level'] . "’,待审核";
  981. $info['log_time'] = time();
  982. $info['auth_man'] = $username;
  983. PersonalTalentsLog::create($info);
  984. }
  985. return true;
  986. } else {
  987. $data['uid'] = $uid;
  988. $data['rc_username'] = $username;
  989. $data['rc_idcode'] = $idcode;
  990. $data['rc_level'] = '不符合人才标准';
  991. $data['rc_level_id'] = 0;
  992. $data['rc_sort'] = 0;
  993. $data['rc_audit'] = 2;
  994. $data['rc_where'] = 1;
  995. $data['rc_num'] = 0;
  996. $data['ifconform'] = 2;
  997. $data['personal_category_id'] = 0;
  998. if ($result) {
  999. PersonalTalents::where(array("uid" => $uid))->update($data);
  1000. $info['talents_id'] = $result->id;
  1001. $info['log_class'] = 1;//日志类型会员个人更新
  1002. $info['content'] = $username . "更新人才资料,预判人才等级由‘" . $result->rc_level . "’转为‘不符合人才等级’,待重新审核";
  1003. $info['log_time'] = time();
  1004. $info['auth_man'] = $username;
  1005. PersonalTalentsLog::create($info);
  1006. }
  1007. return true;
  1008. }
  1009. }
  1010. public function getResumeById($id, $user)
  1011. {
  1012. $resume = $this->ResumeRepository->getResume($id);
  1013. $memberInfo = DB::table('member_infos')->where('uid', $user->id)->first();
  1014. $imgs = ResumeImg::where(['uid' => $user->id, 'resume_id' => $id])->get();
  1015. $resume->district_keep = isset($resume->district) ? $resume->district : '';
  1016. return ['resume' => $resume, 'imgs' => $imgs, 'member' => $memberInfo];
  1017. }
  1018. public function updateTitle($title, $id, $user)
  1019. {
  1020. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  1021. $array_id = array_column($res, 'id');
  1022. if (!in_array($id, $array_id)) {
  1023. throw new ResponseException('简历不存在!');
  1024. }
  1025. $data['title'] = $title;
  1026. $data['audit'] = 1;
  1027. $expires = config('aix.personal_set.per_set.per_set.resume_expires');
  1028. if ($expires) {
  1029. $data['expires'] = strtotime("+{$expires} days");
  1030. }
  1031. event_search_update(Resume::class, (string)$id, 'update');
  1032. return $this->ResumeRepository->updateById($data, $id);
  1033. }
  1034. public function updateHunting($date, $user)
  1035. {
  1036. $currentArr = $this->CategoryRepository->getCategory($date['current']);
  1037. $date['current_cn'] = $currentArr['demand'];
  1038. $natureArr = $this->CategoryRepository->getCategory($date['nature']);
  1039. $date['nature_cn'] = $natureArr['demand'];
  1040. if (intval($date['wage'])) {
  1041. $wageArr = $this->CategoryRepository->getCategory($date['wage']);
  1042. $date['wage_cn'] = $wageArr['demand'];
  1043. if ($date['wage'] == 61) {
  1044. $date['wage_min'] = 10000;
  1045. $date['wage_max'] = 0;
  1046. } else {
  1047. $date['wage_min'] = explode('~', format_wage($wageArr['demand']))[0];
  1048. $date['wage_max'] = explode('~', format_wage($wageArr['demand']))[1];
  1049. }
  1050. } else {
  1051. $date['wage'] = 0;
  1052. $date['wage_min'] = intval($date['wage_min']);
  1053. $date['wage_max'] = intval($date['wage_max']);
  1054. $date['wage_cn'] = intval($date['wage_min']) . '~' . intval($date['wage_max']) . '/月';
  1055. }
  1056. if (!empty($date['trade'])) {
  1057. $tradeArr = $this->CategoryRepository->getManyCategory(explode(',', $date['trade']));
  1058. $date['trade_cn'] = '';
  1059. foreach ($tradeArr as $key => $val) {
  1060. $date['trade_cn'] .= $val->demand . '+';
  1061. }
  1062. $date['trade_cn'] = rtrim($date['trade_cn'], '+');
  1063. }
  1064. if (!empty($date['techlevel'])) {
  1065. $date['techlevel_cn'] = get_category($date['techlevel']);
  1066. }
  1067. $jobsArr = explode(',', $date['intention_jobs_id']);
  1068. $jobArrId = [];
  1069. foreach ($jobsArr as $key => $val) {
  1070. $jobArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
  1071. }
  1072. $jobsRes = $this->CategoryJobsRepository->getManyJobs($jobArrId);
  1073. $date['intention_jobs'] = '';
  1074. foreach ($jobsRes as $key => $val) {
  1075. $date['intention_jobs'] .= $val->name . '+';
  1076. }
  1077. $date['intention_jobs'] = rtrim($date['intention_jobs'], '+');
  1078. $districtArr = explode(',', $date['district']);
  1079. $resumrArrId = [];
  1080. foreach ($districtArr as $key => $val) {
  1081. $resumrArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
  1082. }
  1083. $resumeRes = $this->CategoryDistrictRepository->getManydistrict($resumrArrId);
  1084. $date['district_cn'] = '';
  1085. foreach ($resumeRes as $key => $val) {
  1086. $date['district_cn'] .= $val->name . '+';
  1087. }
  1088. $date['district_cn'] = rtrim($date['district_cn'], '+');
  1089. $date['audit'] = 1;
  1090. $expires = config('aix.personal_set.per_set.per_set.resume_expires');
  1091. if ($expires) {
  1092. $date['expires'] = strtotime("+{$expires} days");
  1093. }
  1094. if (array_has($date, 'subsite_id')) {
  1095. $subsite_id = $date['subsite_id'];
  1096. unset($date['subsite_id']);
  1097. $subsiteArr = SubsiteResume::where('resume_id', $date['id'])->get();
  1098. if (!$subsiteArr->isEmpty()) {
  1099. SubsiteResume::where('resume_id', $date['id'])->delete();
  1100. }
  1101. $subsiteDefault = [
  1102. [
  1103. 'subsite_id' => $user->subsite_id,
  1104. 'resume_id' => $date['id'],
  1105. 'created_at' => date('Y-m-d H:i:s'),
  1106. 'updated_at' => date('Y-m-d H:i:s'),
  1107. ]
  1108. ];
  1109. $subsiteArr = [];
  1110. if ($subsite_id !== null) {
  1111. $subsite = explode(',', $subsite_id);
  1112. foreach ($subsite as $key => $val) {
  1113. $subsiteArr[$key]['subsite_id'] = $val;
  1114. $subsiteArr[$key]['resume_id'] = $date['id'];
  1115. $subsiteArr[$key]['created_at'] = date('Y-m-d H:i:s');
  1116. $subsiteArr[$key]['updated_at'] = date('Y-m-d H:i:s');
  1117. }
  1118. if (in_array($user->subsite_id, $subsite)) {
  1119. $subsiteDefault = $subsiteArr;
  1120. } else {
  1121. $subsiteDefault = array_merge($subsiteDefault, $subsiteArr);
  1122. }
  1123. }
  1124. SubsiteResume::insert($subsiteDefault);
  1125. }
  1126. event_search_update(Resume::class, (string)$date['id'], 'update');
  1127. return $this->ResumeRepository->updateById($date, $date['id']);
  1128. }
  1129. public function updateSpecialty($data, $user)
  1130. {
  1131. if (!$data['specialty']) {
  1132. throw new ResponseException('请填写自我描述!');
  1133. }
  1134. $resume_id = array_get($data, 'id');
  1135. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  1136. $array_id = array_column($res, 'id');
  1137. if (!in_array($resume_id, $array_id)) {
  1138. throw new ResponseException('简历不存在!');
  1139. }
  1140. $res = $this->ResumeRepository->getResumeById($data['id']);
  1141. DB::beginTransaction();//检查数据库事务
  1142. try {
  1143. if (!$res->specialty) {
  1144. if ($res->complete_percent + 5 <= 100) {
  1145. if ($res->complete_percent + 5 >= 70 && $res->complete_percent + 5 < 90) {
  1146. $this->TaskService->doTask(12);
  1147. $data['complete_percent'] = $res->complete_percent + 5;
  1148. $data['level'] = 2;
  1149. } elseif ($res->complete_percent + 5 >= 90 && $res->complete_percent + 5 <= 100) {
  1150. $this->TaskService->doTask(11);
  1151. $data['complete_percent'] = $res->complete_percent + 5;
  1152. $data['level'] = 1;
  1153. } else {
  1154. $data['complete_percent'] = $res->complete_percent + 5;
  1155. $data['level'] = 0;
  1156. }
  1157. }
  1158. }
  1159. $data['audit'] = 1;
  1160. $expires = config('aix.personal_set.per_set.per_set.resume_expires');
  1161. if ($expires) {
  1162. $data['expires'] = strtotime("+{$expires} days");
  1163. }
  1164. event_search_update(Resume::class, (string)$data['id'], 'update');
  1165. $result = $this->ResumeRepository->updateById($data, $data['id']);
  1166. DB::commit();
  1167. return ['code' => 1, 'info' => $result];
  1168. } catch (\Exception $e) {
  1169. DB::rollback();
  1170. return ['code' => 0, 'info' => $e->getMessage()];
  1171. }
  1172. }
  1173. public function tagSave($data)
  1174. {
  1175. $resume_id = $data['resume_id'];
  1176. $tag = implode(',', $data['tag']);
  1177. $tag_cn = implode(',', $data['tag_cn']);
  1178. $resume = $this->ResumeRepository->getResumeById($resume_id);
  1179. DB::beginTransaction();//检查数据库事务
  1180. try {
  1181. $das['audit'] = 1;
  1182. $expires = config('aix.personal_set.per_set.per_set.resume_expires');
  1183. if ($expires) {
  1184. $das['expires'] = strtotime("+{$expires} days");
  1185. }
  1186. $this->ResumeRepository->updateById($das, $resume_id);
  1187. if (empty($resume->tag_cn)) {
  1188. if ($resume->complete_percent + 5 <= 100) {
  1189. if ($resume->complete_percent + 5 >= 70 && $resume->complete_percent + 5 < 90) {
  1190. $this->TaskService->doTask(12);
  1191. $result = $this->ResumeRepository->updateById([
  1192. 'complete_percent' => $resume->complete_percent + 5,
  1193. 'level' => 2,
  1194. 'tag' => $tag,
  1195. 'tag_cn' => $tag_cn,
  1196. ], $resume_id);
  1197. } elseif ($resume->complete_percent + 5 >= 90 && $resume->complete_percent + 5 <= 100) {
  1198. $this->TaskService->doTask(11);
  1199. $result = $this->ResumeRepository->updateById([
  1200. 'complete_percent' => $resume->complete_percent + 5,
  1201. 'level' => 1,
  1202. 'tag' => $tag,
  1203. 'tag_cn' => $tag_cn,
  1204. ], $resume_id);
  1205. } else {
  1206. $result = $this->ResumeRepository->updateById([
  1207. 'complete_percent' => $resume->complete_percent + 5,
  1208. 'level' => 0,
  1209. 'tag' => $tag,
  1210. 'tag_cn' => $tag_cn,
  1211. ], $resume_id);
  1212. }
  1213. }
  1214. } else {
  1215. $result = $this->ResumeRepository->updateById(['tag' => $tag, 'tag_cn' => $tag_cn], $resume_id);
  1216. }
  1217. event_search_update(Resume::class, (string)$resume_id, 'update');
  1218. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2028, $resume_id)) {
  1219. throw new \Exception("日志记失败!");
  1220. }
  1221. DB::commit();
  1222. return ['code' => 1, 'info' => $result];
  1223. } catch (\Exception $e) {
  1224. DB::rollback();
  1225. return ['code' => 0, 'info' => $e->getMessage()];
  1226. }
  1227. }
  1228. public function tagDelete($resume_id, $tag_cn, $user)
  1229. {
  1230. if (!$resume_id || !$tag_cn) {
  1231. throw new ResponseException('简历标签或简历不存在!');
  1232. }
  1233. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  1234. $array_id = array_column($res, 'id');
  1235. if (!in_array($resume_id, $array_id)) {
  1236. throw new ResponseException('简历不存在!');
  1237. }
  1238. DB::beginTransaction();//检查数据库事务
  1239. try {
  1240. $resume = $this->ResumeRepository->find($resume_id);
  1241. $resume_tag = isset($resume->tag) ? explode(',', $resume->tag) : [];
  1242. $resume_tag_cn = isset($resume->tag_cn) ? explode(',', $resume->tag_cn) : [];
  1243. foreach ($resume_tag_cn as $key => $val) {
  1244. if ($tag_cn == $val) {
  1245. unset($resume_tag_cn[$key]);
  1246. unset($resume_tag[$key]);
  1247. }
  1248. }
  1249. $res = $this->ResumeRepository->updateById(
  1250. ['tag' => implode(',', $resume_tag), 'tag_cn' => implode(',', $resume_tag_cn)], $resume_id);
  1251. DB::commit();
  1252. return ['code' => 1, 'info' => $res];
  1253. } catch (\Exception $e) {
  1254. DB::rollback();
  1255. return ['code' => 0, 'info' => $e->getMessage()];
  1256. }
  1257. }
  1258. public function resumeCopy($id, $user)
  1259. {
  1260. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  1261. $array_id = array_column($res, 'id');
  1262. if (!in_array($id, $array_id)) {
  1263. throw new ResponseException('简历不存在');
  1264. }
  1265. $resume_arr = []; //简历。
  1266. $res = $this->ResumeRepository->getArrayById($id);
  1267. $resume_arr['uid'] = $res['uid'];
  1268. $resume_arr['display_name'] = $res['display_name'];
  1269. $resume_arr['title'] = $res['title'];
  1270. $resume_arr['fullname'] = $res['fullname'];
  1271. $resume_arr['sex'] = $res['sex'];
  1272. $resume_arr['sex_cn'] = $res['sex_cn'];
  1273. $resume_arr['nature'] = $res['nature'];
  1274. $resume_arr['nature_cn'] = $res['nature_cn'];
  1275. $resume_arr['trade'] = $res['trade'];
  1276. $resume_arr['trade_cn'] = $res['trade_cn'];
  1277. $resume_arr['birthdate'] = $res['birthdate'];
  1278. $resume_arr['residence'] = $res['residence'];
  1279. $resume_arr['height'] = $res['height'];
  1280. $resume_arr['marriage'] = $res['marriage'];
  1281. $resume_arr['marriage_cn'] = $res['marriage_cn'];
  1282. $resume_arr['experience'] = $res['experience'];
  1283. $resume_arr['experience_cn'] = $res['experience_cn'];
  1284. $resume_arr['district'] = $res['district'];
  1285. $resume_arr['district_cn'] = $res['district_cn'];
  1286. $resume_arr['wage'] = $res['wage'];
  1287. $resume_arr['wage_cn'] = $res['wage_cn'];
  1288. $resume_arr['wage_min'] = $res['wage_min'];
  1289. $resume_arr['wage_max'] = $res['wage_max'];
  1290. $resume_arr['householdaddress'] = $res['householdaddress'];
  1291. $resume_arr['education'] = $res['education'];
  1292. $resume_arr['education_cn'] = $res['education_cn'];
  1293. $resume_arr['major'] = $res['major'];
  1294. $resume_arr['major_cn'] = $res['major_cn'];
  1295. $resume_arr['tag'] = $res['tag'];
  1296. $resume_arr['tag_cn'] = $res['tag_cn'];
  1297. $resume_arr['telephone'] = $res['telephone'];
  1298. $resume_arr['email'] = $res['email'];
  1299. $resume_arr['intention_jobs_id'] = $res['intention_jobs_id'];
  1300. $resume_arr['intention_jobs'] = $res['intention_jobs'];
  1301. $resume_arr['specialty'] = $res['specialty'];
  1302. $resume_arr['photo'] = $res['photo'];
  1303. $resume_arr['photo_audit'] = $res['photo_audit'];
  1304. $resume_arr['qq'] = $res['qq'];
  1305. $resume_arr['weixin'] = $res['weixin'];
  1306. $resume_arr['subsite_id'] = $res['subsite_id'];
  1307. $resume_arr['level'] = $res['level'];
  1308. $resume_arr['complete_percent'] = $res['complete_percent'];
  1309. $resume_arr['current'] = $res['current'];
  1310. $resume_arr['current_cn'] = $res['current_cn'];
  1311. $resume_arr['word_resume'] = $res['word_resume'];
  1312. $resume_arr['word_resume_title'] = $res['word_resume_title'];
  1313. $resume_arr['word_resume_addtime'] = $res['word_resume_addtime'];
  1314. $resume_arr['tpl'] = $res['tpl'];
  1315. $resume_arr['def'] = 0;
  1316. $resume_arr['is_quick'] = 1;
  1317. $Education = $this->ResumeEducationRepository->getEduByResumeU($id, $user->id);
  1318. $Education_arr = []; //教育。
  1319. $Work = $this->ResumeWorkRepository->getWorkByU($id, $user->id);
  1320. $Work_arr = []; //工作
  1321. $Train = $this->ResumeTrainRepository->getTrainByU($id, $user->id);
  1322. $Train_arr = []; //培训。
  1323. $Credent = $this->ResumeCredentRepository->getCredentByU($id, $user->id);
  1324. $Credent_arr = []; //证书。
  1325. $Language = $this->ResumeLanguageRepository->getCredentByU($id, $user->id);
  1326. $Language_arr = []; //语言。
  1327. $Imgs = DB::table('resume_imgs')->where(['resume_id' => $id, 'uid' => $user->id])->get();
  1328. $Imgs_arr = []; //照片。
  1329. $sub_resume_arr = []; //简历分站。
  1330. $subsiteResume = SubsiteResume::where('resume_id', $id)->get();
  1331. DB::beginTransaction();//检查数据库事务
  1332. try {
  1333. $resume_add = $this->ResumeRepository->resumeAdd($resume_arr);
  1334. $resume_id = $resume_add->id;
  1335. if (!$Education->isEmpty()) {
  1336. foreach ($Education as $key => $val) {
  1337. $Education_arr[$key]['uid'] = $val->uid;
  1338. $Education_arr[$key]['resume_id'] = $resume_id;
  1339. $Education_arr[$key]['startyear'] = $val->startyear;
  1340. $Education_arr[$key]['startmonth'] = $val->startmonth;
  1341. $Education_arr[$key]['endyear'] = $val->endyear;
  1342. $Education_arr[$key]['endmonth'] = $val->endmonth;
  1343. $Education_arr[$key]['school'] = $val->school;
  1344. $Education_arr[$key]['speciality'] = $val->speciality;
  1345. $Education_arr[$key]['education'] = $val->education;
  1346. $Education_arr[$key]['education_cn'] = $val->education_cn;
  1347. $Education_arr[$key]['todate'] = $val->todate;
  1348. $Education_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1349. $Education_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1350. }
  1351. }
  1352. if (!empty($Education_arr)) {
  1353. $this->ResumeEducationRepository->addInsert($Education_arr);
  1354. }
  1355. if (!$Work->isEmpty()) {
  1356. foreach ($Work as $key => $val) {
  1357. $Work_arr[$key]['uid'] = $val->uid;
  1358. $Work_arr[$key]['resume_id'] = $resume_id;
  1359. $Work_arr[$key]['startyear'] = $val->startyear;
  1360. $Work_arr[$key]['startmonth'] = $val->startmonth;
  1361. $Work_arr[$key]['endyear'] = $val->endyear;
  1362. $Work_arr[$key]['endmonth'] = $val->endmonth;
  1363. $Work_arr[$key]['companyname'] = $val->companyname;
  1364. $Work_arr[$key]['jobs'] = $val->jobs;
  1365. $Work_arr[$key]['achievements'] = $val->achievements;
  1366. $Work_arr[$key]['todate'] = $val->todate;
  1367. $Work_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1368. $Work_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1369. }
  1370. }
  1371. if (!empty($Work_arr)) {
  1372. $this->ResumeWorkRepository->addInsert($Work_arr);
  1373. }
  1374. if (!$Train->isEmpty()) {
  1375. foreach ($Train as $key => $val) {
  1376. $Train_arr[$key]['uid'] = $val->uid;
  1377. $Train_arr[$key]['resume_id'] = $resume_id;
  1378. $Train_arr[$key]['startyear'] = $val->startyear;
  1379. $Train_arr[$key]['startmonth'] = $val->startmonth;
  1380. $Train_arr[$key]['endyear'] = $val->endyear;
  1381. $Train_arr[$key]['endmonth'] = $val->endmonth;
  1382. $Train_arr[$key]['agency'] = $val->agency;
  1383. $Train_arr[$key]['course'] = $val->course;
  1384. $Train_arr[$key]['description'] = $val->description;
  1385. $Train_arr[$key]['todate'] = $val->todate;
  1386. $Train_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1387. $Train_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1388. }
  1389. }
  1390. if (!empty($Train_arr)) {
  1391. $this->ResumeTrainRepository->addInsert($Train_arr);
  1392. }
  1393. if (!$Credent->isEmpty()) {
  1394. foreach ($Credent as $key => $val) {
  1395. $Credent_arr[$key]['uid'] = $val->uid;
  1396. $Credent_arr[$key]['resume_id'] = $resume_id;
  1397. $Credent_arr[$key]['name'] = $val->name;
  1398. $Credent_arr[$key]['year'] = $val->year;
  1399. $Credent_arr[$key]['month'] = $val->month;
  1400. $Credent_arr[$key]['images'] = $val->images;
  1401. $Credent_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1402. $Credent_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1403. }
  1404. }
  1405. if (!empty($Credent_arr)) {
  1406. $this->ResumeCredentRepository->addInsert($Credent_arr);
  1407. }
  1408. if (!$Language->isEmpty()) {
  1409. foreach ($Language as $key => $val) {
  1410. $Language_arr[$key]['uid'] = $val->uid;
  1411. $Language_arr[$key]['resume_id'] = $resume_id;
  1412. $Language_arr[$key]['language'] = $val->language;
  1413. $Language_arr[$key]['language_cn'] = $val->language_cn;
  1414. $Language_arr[$key]['level'] = $val->level;
  1415. $Language_arr[$key]['level_cn'] = $val->level_cn;
  1416. $Language_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1417. $Language_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1418. }
  1419. }
  1420. if (!empty($Language_arr)) {
  1421. $this->ResumeLanguageRepository->resumeLanAdd($Language_arr);
  1422. }
  1423. if (!$Imgs->isEmpty()) {
  1424. foreach ($Imgs as $key => $val) {
  1425. $Imgs_arr[$key]['uid'] = $val->uid;
  1426. $Imgs_arr[$key]['resume_id'] = $resume_id;
  1427. $Imgs_arr[$key]['img'] = $val->img;
  1428. $Imgs_arr[$key]['title'] = $val->title;
  1429. $Imgs_arr[$key]['audit'] = $val->audit;
  1430. $Imgs_arr[$key]['subsite_id'] = $val->subsite_id;
  1431. $Imgs_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1432. $Imgs_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1433. }
  1434. }
  1435. if (!empty($Imgs_arr)) {
  1436. DB::table('resume_imgs')->insert($Imgs_arr);
  1437. }
  1438. if ($subsiteResume->isNotEmpty()) {
  1439. foreach ($subsiteResume as $key => $val) {
  1440. $sub_resume_arr[$key]['subsite_id'] = $val->subsite_id;
  1441. $sub_resume_arr[$key]['resume_id'] = $resume_id;
  1442. $sub_resume_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
  1443. $sub_resume_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
  1444. }
  1445. }
  1446. if (!empty($sub_resume_arr)) {
  1447. SubsiteResume::insert($sub_resume_arr);
  1448. }
  1449. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2011, [$id, $resume_id])) {
  1450. throw new \Exception("日志记失败!");
  1451. }
  1452. DB::commit();
  1453. return ['code' => 1, 'info' => $resume_id];
  1454. } catch (\Exception $e) {
  1455. DB::rollback();
  1456. return ['code' => 0, 'info' => $e->getMessage()];
  1457. }
  1458. }
  1459. public function saveBasicInfo($data, $user)
  1460. {
  1461. $resume_id = array_get($data, 'resume_id');
  1462. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  1463. $array_id = array_column($res, 'id');
  1464. if (!in_array($resume_id, $array_id)) {
  1465. throw new ResponseException('简历不存在');
  1466. }
  1467. $arr = $data;
  1468. unset($arr['resume_id']);
  1469. if (isset($data['marriage'])) {
  1470. if ($data['marriage'] == 1) {
  1471. $arr['marriage_cn'] = '未婚';
  1472. } elseif ($data['marriage'] == 2) {
  1473. $arr['marriage_cn'] = '已婚';
  1474. } else {
  1475. $arr['marriage_cn'] = '保密';
  1476. }
  1477. }
  1478. if (isset($data['sex'])) {
  1479. if ($data['sex'] == 1) {
  1480. $arr['sex_cn'] = '男';
  1481. } else {
  1482. $arr['sex_cn'] = '女';
  1483. }
  1484. }
  1485. if (isset($data['major'])) {
  1486. $currentArr = $this->CategoryMajorRepository->getCategoryMajor($data['major']);
  1487. $arr['major_cn'] = $currentArr['name'];
  1488. }
  1489. if (isset($data['education'])) {
  1490. $educationArr = $this->CategoryRepository->getCategory($data['education']);
  1491. $arr['education_cn'] = $educationArr['demand'];
  1492. }
  1493. if (isset($data['experience'])) {
  1494. $experienceArr = $this->CategoryRepository->getCategory($data['experience']);
  1495. $arr['experience_cn'] = $experienceArr['demand'];
  1496. }
  1497. $arr['audit'] = 1;
  1498. return $this->ResumeRepository->updateById($arr, $data['resume_id']);
  1499. }
  1500. public function refreshResume($id, $user)
  1501. {
  1502. $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
  1503. $array_id = array_column($res_k, 'id');
  1504. if (!in_array($id, $array_id)) {
  1505. throw new ResponseException('简历不存在');
  1506. }
  1507. $res = $this->ResumeRepository->getArrayById($id);
  1508. $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
  1509. if ($resume_display != 2) {
  1510. if ($res['audit'] != 2) {
  1511. return ['code' => 0, 'info' => '审核中或审核未通过的简历无法刷新!'];
  1512. }
  1513. } else {
  1514. if ($res['audit'] == 0) {
  1515. return ['code' => 0, 'info' => '审核未通过的简历无法刷新!'];
  1516. }
  1517. }
  1518. if ($res['display'] != 1) {
  1519. return ['code' => 0, 'info' => '简历已关闭,无法刷新!'];
  1520. }
  1521. $timeSpace = config('aix.personal_set.per_set.per_set.refresh_resume_space') * 60;
  1522. $duringtime = time() - strtotime($res['updated_at']);
  1523. if ($duringtime <= $timeSpace && $timeSpace != 0) {
  1524. return ['code' => 0, 'info' => config('aix.personal_set.per_set.per_set.refresh_resume_space') . '分钟内不允许重复刷新简历!'];
  1525. }
  1526. $resNum = config('aix.personal_set.per_set.per_set.refresh_resume_num');
  1527. $startTime = time();
  1528. $endTime = strtotime(date('Y-m-d 23:59:59', time()));
  1529. if (Cache::has($user->id . $user->utype)) {
  1530. $value = Cache::get($user->id . $user->utype);
  1531. } else {
  1532. $value = 0;
  1533. }
  1534. if ($resNum != 0 && $value >= $resNum) {
  1535. return ['code' => 0, 'info' => '每天最多可刷新 ' . $resNum . " 次,您今天已达到最大刷新次数!"];
  1536. }
  1537. $result = $this->ResumeRepository->updateById(['updated_at' => date('Y-m-d H:i:s', time())], $id);
  1538. event_search_update(Resume::class, (string)$id, 'update');
  1539. if ($result) {
  1540. $taskPoints = $this->TaskService->doTask(6, $user->id, $user->utype);
  1541. Cache::put($user->id . $user->utype, $value + 1, intval(($endTime - $startTime) / 60));
  1542. if ($taskPoints['code'] == 1) {
  1543. //写入刷新日志
  1544. $this->memberLogRepository->createLog($user, 1006, [$id, "手动刷新"]);
  1545. return ['code' => 1, 'info' => $taskPoints['data']['points']];
  1546. } else {
  1547. return ['code' => 0, 'info' => $taskPoints['info']];
  1548. }
  1549. } else {
  1550. return ['code' => 0, 'info' => '刷新失败'];
  1551. }
  1552. }
  1553. public function getDuration($list)
  1554. {
  1555. if ($list) {
  1556. foreach ($list as $key => $value) {
  1557. $start = $value['startyear'] . '-' . $value['startmonth'];
  1558. $end = $value['endyear'] . '-' . $value['endmonth'];
  1559. if ($value['todate'] == 1) {
  1560. $end = date('Y-m');
  1561. }
  1562. $list[$key]['duration'] = ddate($start, $end);
  1563. }
  1564. }
  1565. return $list;
  1566. }
  1567. public function totalWorkDuration($list)
  1568. {
  1569. $total_year = 0;
  1570. $total_month = 0;
  1571. $return = '';
  1572. if ($list) {
  1573. foreach ($list as $key => $value) {
  1574. $current_duration = strpos($value['duration'], '年');
  1575. if ($current_duration === false) {
  1576. $total_month += intval($value['duration']);
  1577. } else {
  1578. $arr = explode("年", $value['duration']);
  1579. $total_year += intval($arr[0]);
  1580. $total_month += intval($arr[1]);
  1581. }
  1582. }
  1583. }
  1584. $add_year = intval($total_month / 12);
  1585. $total_year += $add_year;
  1586. $total_month = intval($total_month % 12);
  1587. if ($total_year > 0) {
  1588. $return .= $total_year . '年';
  1589. }
  1590. if ($total_month > 0) {
  1591. $return .= $total_month . '个月';
  1592. }
  1593. return $return;
  1594. }
  1595. public function resumeShow($id, $jobs_id = '', $user = null, $type = '', $guid = 0)
  1596. {
  1597. $request_all = \Illuminate\Support\Facades\Request::all();
  1598. $utype = 0;
  1599. $uid = 0;
  1600. if ($user) {
  1601. $utype = $user->utype;
  1602. $uid = $user->id;
  1603. }
  1604. $resume = $this->ResumeRepository->getResume($id);
  1605. if (!$resume) {
  1606. return array('status' => 0, 'msg' => '简历不存在!');
  1607. }
  1608. if ($type != 1) {
  1609. if (!isset(request()->token)) {
  1610. if (!($user && $utype == 2 && $user->id == $resume->uid)) {
  1611. if (!($user && $user->utype == '1' && $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id))) {
  1612. if ($resume->display == 0) {
  1613. return array('status' => 0, 'msg' => '简历不公开!');
  1614. } else {
  1615. if ($type != 'qr') {
  1616. if (config('aix.personal_set.per_set.show_set.resume_display') == 1 && $resume->audit != '2') {
  1617. return array('status' => 0, 'msg' => '简历未审核通过!');
  1618. } elseif (config('aix.personal_set.per_set.show_set.resume_display') == 2 && $resume->audit == '0') {
  1619. return array('status' => 0, 'msg' => '简历审核未通过!');
  1620. }
  1621. }
  1622. }
  1623. }
  1624. }
  1625. }
  1626. }
  1627. //TODO 分站判断 - 判断简历是否可以显示
  1628. $resume->fullname_ = $resume->fullname;
  1629. $memberInfo = DB::table('member_infos')->where('uid', $resume->uid)->first(); //简历基本信息
  1630. $members = Member::find($resume->uid);
  1631. if ($members) {
  1632. $resume->login_last_time = date('Y-m-d', $members->last_login_time);
  1633. }
  1634. $resume->education_cn = $memberInfo->education_cn; //学历
  1635. $resume->experience = $memberInfo->experience; //工作经验——id
  1636. $resume->experience_cn = $memberInfo->experience_cn; //工作经验
  1637. $resume->sex_cn = $memberInfo->sex_cn;
  1638. //教育经历
  1639. $education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
  1640. $education = $this->getDuration($education);
  1641. $resume->education_list = $education;
  1642. //工作经历
  1643. $work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
  1644. $work = $this->getDuration($work);
  1645. $resume->work_list = $work;
  1646. $resume->work_count = count($work);
  1647. $work_duration = $this->totalWorkDuration($work); //工龄
  1648. $resume->work_duration = $work_duration;
  1649. //培训经历
  1650. $train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
  1651. $train = $this->getDuration($train);
  1652. $resume->training_list = $train;
  1653. //语言能力
  1654. $language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id);
  1655. $resume->language_list = $language;
  1656. //证书
  1657. $credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id);
  1658. $resume->credent_list = $credent;
  1659. //简历照片
  1660. $img_map = array(
  1661. array('resume_id', '=', $resume->id),
  1662. array('uid', '=', $resume->uid)
  1663. );
  1664. if (config('aix.personal_set.per_set.show_set.resume_img_display') == 1) {
  1665. $img_map[] = array('audit', '=', '2');
  1666. } else {
  1667. $img_map[] = array('audit', '<>', '0');
  1668. }
  1669. $images = DB::table('resume_imgs')->where($img_map)->get();
  1670. if ($images->isNotEmpty()) {
  1671. $resume->img_list = $images;
  1672. } else {
  1673. $resume->img_list = array();
  1674. }
  1675. $resume->age = date("Y") - $memberInfo->birthday; //年龄
  1676. //tag
  1677. if ($resume->tag_cn) {
  1678. $tag_cn = explode(',', $resume->tag_cn);
  1679. $resume->tag_cn = $tag_cn;
  1680. } else {
  1681. $resume->tag_cn = array();
  1682. }
  1683. $resume->refreshtime_cn = daterange(time(), strtotime($resume->updated_at), 'Y-m-d', "#FF3300");
  1684. //判断手机、微信、邮箱是否验证
  1685. $members = DB::table('members')->where('id', $resume->uid)->first();
  1686. $resume->is_audit_mobile = $members->mobile_audit;
  1687. //处理附件简历链接地址
  1688. if ($resume->word_resume) {
  1689. $resume->word_resume_url = upload_asset($resume->word_resume);
  1690. }
  1691. //处理微信二维码
  1692. $resume->label_id = 0;
  1693. $resume->label_type = 0;
  1694. $resume->label_resume = '';
  1695. $down_resume = false;
  1696. $jobs_apply = false;
  1697. if ($utype == 1) {
  1698. if (array_get($request_all, 'from_down') == 1) {
  1699. $down_resume = CompanyDownResume::find($request_all['down_id']);
  1700. } elseif (array_get($request_all, 'from_apply') == 1) {
  1701. $down_resume = CompanyDownResume::where(['company_uid' => $uid, 'resume_id' => $id])->first();
  1702. $jobs_apply = PersonalJobsApply::find($request_all['personal_jobs_id']);
  1703. } else {
  1704. $down_resume = CompanyDownResume::where(['company_uid' => $uid, 'resume_id' => $id])->first();
  1705. $jobs_apply = PersonalJobsApply::where(['company_id' => $uid, 'resume_id' => $id])->first();
  1706. }
  1707. }
  1708. $resume->label_arr = array();
  1709. //处理简历预览页面label 信息
  1710. if (array_get($request_all, 'from_down') == 1) {
  1711. $resume->label_arr = $this->companyDownResumeRepository->getStateArr();
  1712. $resume->label_resume = 'down';
  1713. $resume->label_type = 1;
  1714. $resume->label_id = $down_resume->is_reply;
  1715. } elseif (array_get($request_all, 'from_apply') == 1) {
  1716. $resume->label_arr = $this->PersonalJobsApplyRepository->getStateArr();
  1717. $resume->label_resume = 'apply';
  1718. $resume->label_type = 2;
  1719. $resume->label_id = $jobs_apply ? $jobs_apply->is_reply : '';
  1720. } elseif (array_get($request_all, 'from_interviews') == 1) { //从收到简历投递的页面来的
  1721. $resume->label_arr = $this->companyDownResumeRepository->getStateArr();
  1722. $resume->label_resume = 'interviews';
  1723. $resume->label_type = 0;
  1724. $resume->label_id = $jobs_apply ? $jobs_apply->is_reply : '';
  1725. }
  1726. if (!$jobs_id && $resume->label_resume == 'apply') {
  1727. $resume->label_resume = '';
  1728. }
  1729. $resume->show_contact = $this->getShowContact($resume, $down_resume, $jobs_apply, $user, $type);
  1730. // dd($resume->show_contact);
  1731. if ($resume->show_contact === false) { //处理联系信息
  1732. if ($memberInfo->display_name == "2") {
  1733. $resume->fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
  1734. } elseif ($memberInfo->display_name == "3") {
  1735. if ($resume->sex == 1) {
  1736. $resume->fullname = cut_str($resume->fullname, 1, 0, "先生");
  1737. } elseif ($resume->sex == 2) {
  1738. $resume->fullname = cut_str($resume->fullname, 1, 0, "女士");
  1739. }
  1740. }
  1741. $resume->telephone = contact_hide($memberInfo->phone, 2);
  1742. $resume->email = $memberInfo->email ? contact_hide($memberInfo->email, 3) : '';
  1743. $resume->qq = contact_hide($memberInfo->qq, 4);
  1744. $resume->weixin = contact_hide($memberInfo->weixin, 5);
  1745. } else {
  1746. $resume->telephone = $memberInfo->phone;
  1747. $resume->email = $memberInfo->email;
  1748. $resume->qq = $memberInfo->qq;
  1749. $resume->weixin = $memberInfo->weixin;
  1750. }
  1751. if (preg_match("/([\x81-\xfe][\x40-\xfe])/", $resume->weixin, $match)) {
  1752. $resume->weixin = null;
  1753. }
  1754. $resume->telephone_ = $resume->telephone;
  1755. $resume->email_ = $resume->email;
  1756. //联系方式展现形式 -图形化
  1757. if (config('aix.personal_set.per_set.contact_type_set.contact_img_resume') == 2) {
  1758. $pwdhash = config('aix.system.site_other.site_other.pwb_hash');
  1759. if ($resume->telephone) {
  1760. $resume->telephone = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->telephone, $pwdhash), 'type' => 'phone')) . "' />";
  1761. }
  1762. if ($resume->email) {
  1763. $resume->email = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->email, $pwdhash), 'type' => 'email')) . "' />";
  1764. }
  1765. if ($resume->qq) {
  1766. $resume->qq = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->qq, $pwdhash), 'type' => 'qq')) . "' />";
  1767. }
  1768. if ($resume->weixin) {
  1769. $resume->weixin = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->weixin, $pwdhash), 'type' => 'weixin')) . "' />";
  1770. }
  1771. }
  1772. $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
  1773. if ($memberInfo->sex == 1) {
  1774. $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
  1775. }
  1776. //1.照片为空
  1777. //2.照片主动不显示
  1778. //3.照片审核不通过
  1779. //4.先审核后显示:照片不是审核通过的(不等于1)
  1780. 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)) {
  1781. $resume->photosrc = $avatar_default; //不显示
  1782. $resume->photosrc_show = false;
  1783. } else {
  1784. $resume->photosrc = upload_asset($memberInfo->images); //显示
  1785. $resume->photosrc_show = true;
  1786. }
  1787. //期望薪资
  1788. $resume->wage_cn = '';
  1789. if ($resume->wage > 0) {
  1790. $wage_categories = $this->CategoryRepository->getCategories();
  1791. if ($wage_categories) {
  1792. if (config('aix.system.site_other.site_other.site_salary') == 1) {
  1793. $resume->wage_cn = array_has($wage_categories['AIX_wage_k'], [$resume->wage]) ? $wage_categories['AIX_wage_k'][$resume->wage] : '';
  1794. } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
  1795. $resume->wage_cn = array_has($wage_categories['AIX_wage_c'], [$resume->wage]) ? $wage_categories['AIX_wage_c'][$resume->wage] : '';
  1796. }
  1797. }
  1798. } else {
  1799. //自定义薪资
  1800. $resume->wage_cn = $this->dealWage($resume->wage, $resume->wage_min, $resume->wage_max);
  1801. }
  1802. //期望职位
  1803. if (!$resume->intention_jobs) {
  1804. $job_cates = Cache::get('jobs_cate_list');
  1805. if (null === $job_cates) {
  1806. $job_cates = $this->CategoryJobsRepository->jobsCateInfoCache();
  1807. Cache::put('jobs_cate_list', $job_cates, '86400');
  1808. }
  1809. $i_ids = array();
  1810. if ($resume->intention_jobs_id) {
  1811. $i_ids = explode(',', $resume->intention_jobs_id);
  1812. }
  1813. $jobs_names = array();
  1814. if (count($i_ids) > 0) {
  1815. foreach ($i_ids as $key => $val) {
  1816. $intention_jobs_id_arr = explode('.', $val);
  1817. $count = count($intention_jobs_id_arr);
  1818. if ($count > 0) {
  1819. foreach ($intention_jobs_id_arr as $k => $v) {
  1820. if ($v && array_get($job_cates['id'], $v)) {
  1821. $jobs_names[$key] = $job_cates['id'][$v]['name'];
  1822. }
  1823. }
  1824. }
  1825. }
  1826. }
  1827. $resume->intention_jobs = implode('+', $jobs_names);
  1828. }
  1829. if (!$resume->trade_cn) {
  1830. $resume->trade_cn = '不限';
  1831. }
  1832. //企业用户 - 处理查看简历记录
  1833. if ($utype == 1) {
  1834. $view_where = array(
  1835. 'uid' => $uid,
  1836. 'resume_id' => $resume->id
  1837. );
  1838. $view_log = $this->ViewResumeRepository->findViewResume($view_where);
  1839. $stime = date('Y-m-d H:i:s', time());
  1840. if ($view_log) {
  1841. $set_data = array(
  1842. 'created_at' => $stime
  1843. );
  1844. $this->ViewResumeRepository->update($set_data, $view_log->id);
  1845. } else {
  1846. $set_data = array(
  1847. 'uid' => $uid,
  1848. 'resume_id' => $resume->id,
  1849. 'created_at' => $stime,
  1850. 'updated_at' => $stime
  1851. );
  1852. $this->ViewResumeRepository->create($set_data);
  1853. }
  1854. if ($jobs_id) {
  1855. if (!empty($guid)) {
  1856. $apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id, $guid);
  1857. } else {
  1858. $apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id);
  1859. }
  1860. if ($apply_log) {
  1861. //企业对申请职位的简历设为已看
  1862. $set_where = array('id' => $apply_log->id, 'company_id' => $uid);
  1863. $apply_data = array('personal_look' => 2);
  1864. $set_rst = $this->PersonalJobsApplyRepository->setApply($set_where, $apply_data);
  1865. //添加会员日志
  1866. if ($set_rst !== false) {
  1867. $user_info = array(
  1868. 'uid' => $uid,
  1869. 'utype' => 1,
  1870. 'username' => $user->username,
  1871. 'ip' => ip2long(\Illuminate\Support\Facades\Request::getClientIp()),
  1872. 'log_address' => '本机地址'
  1873. );
  1874. $this->feedbackService->addMembersLog($user_info, '', '标记申请职位记录(职位id:' . $apply_log->id . ')');
  1875. if (!$this->memberLogRepository->createLog($user, 1016, $apply_log->id)) {
  1876. throw new \Exception("日志记失败!");
  1877. }
  1878. }
  1879. }
  1880. }
  1881. }
  1882. //个人醒目标签
  1883. $PersonalServiceStickLog = PersonalServiceTagLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
  1884. if ($PersonalServiceStickLog) {
  1885. if ($PersonalServiceStickLog->endtime - time() > 0) {
  1886. $resume->strong_tag = $PersonalServiceStickLog->tag_cn;
  1887. }
  1888. }
  1889. //preview - 个人用户
  1890. $resume->preview = 0;
  1891. if ($utype == 2 && $user->id == $resume->uid) {
  1892. $resume->preview = 1;
  1893. }
  1894. //简历是否已收藏 - 企业用户
  1895. $resume->favor = 0;
  1896. if ($utype == 1) {
  1897. $favor = $this->companyFavoriteRepository->findFavorite($resume->id, $user->id);
  1898. if ($favor) {
  1899. $resume->favor = 1;
  1900. }
  1901. }
  1902. //来源分站名称
  1903. $subsites = Cache::get('subsites_list');
  1904. if (array_has($subsites, $resume->subsite_id)) {
  1905. $resume->subsite_cn = $subsites[$resume->subsite_id]['sitename'];
  1906. } else {
  1907. $resume->subsite_cn = '';
  1908. }
  1909. $tag_logs = array();
  1910. $contentStatus = $this->CategoryService->connectStatus($resume->uid, $resume->id);
  1911. 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];
  1912. }
  1913. public function dealWage($wage, $minwage, $maxwage)
  1914. {
  1915. if (config('aix.system.site_other.site_other.site_salary') == 1) {
  1916. $minwage = $minwage % 1000 == 0 ? (($minwage / 1000) . 'K') : (round($minwage / 1000, 1) . 'K');
  1917. if ($minwage == 0) {
  1918. $maxwage = '以上';
  1919. } else {
  1920. $maxwage = $maxwage % 1000 == 0 ? (($maxwage / 1000) . 'K') : (round($maxwage / 1000, 1) . 'K');
  1921. }
  1922. } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
  1923. if ($minwage >= 10000) {
  1924. if ($minwage % 10000 == 0) {
  1925. $minwage = ($minwage / 10000) . '万';
  1926. } else {
  1927. $minwage = round($minwage / 10000, 1);
  1928. $minwage = strpos($minwage, '.') ? str_replace('.', '万', $minwage) : $minwage . '万';
  1929. }
  1930. } else {
  1931. if ($minwage % 1000 == 0) {
  1932. $minwage = ($minwage / 1000) . '千';
  1933. } else {
  1934. $minwage = round($minwage / 1000, 1);
  1935. $minwage = strpos($minwage, '.') ? str_replace('.', '千', $minwage) : $minwage . '千';
  1936. }
  1937. }
  1938. if ($maxwage > 0) {
  1939. if ($maxwage >= 10000) {
  1940. if ($maxwage % 10000 == 0) {
  1941. $maxwage = ($maxwage / 10000) . '万';
  1942. } else {
  1943. $maxwage = round($maxwage / 10000, 1);
  1944. $maxwage = strpos($maxwage, '.') ? str_replace('.', '万', $maxwage) : $maxwage . '万';
  1945. }
  1946. } elseif ($maxwage) {
  1947. if ($maxwage % 1000 == 0) {
  1948. $maxwage = ($maxwage / 1000) . '千';
  1949. } else {
  1950. $maxwage = round($maxwage / 1000, 1);
  1951. $maxwage = strpos($maxwage, '.') ? str_replace('.', '千', $maxwage) : $maxwage . '千';
  1952. }
  1953. } else {
  1954. $maxwage = '0';
  1955. }
  1956. } else {
  1957. $maxwage = '0';
  1958. }
  1959. }
  1960. if ($minwage == $maxwage) {
  1961. $wage_cn = $minwage . '/月';
  1962. } else {
  1963. if ($minwage > 0 && $maxwage == 0) {
  1964. $wage_cn = $minwage . '以上/月';
  1965. } else {
  1966. $wage_cn = $minwage . '~' . $maxwage . '/月';
  1967. }
  1968. }
  1969. return $wage_cn;
  1970. }
  1971. public function getShowContact($val, $down, $apply, $user = null, $type = null)
  1972. {
  1973. $show_contact = false;
  1974. $route = Route::current()->action;
  1975. $prefix = $route['prefix'];
  1976. if (!$user) {
  1977. //if (!auth('web-company')->check() && !auth('web-member')->check()) { //情景1:游客访问
  1978. if ($prefix == '/content' && config('aix.personal_set.per_set.contact_set.show_resume_contact') == '0') { //web端
  1979. $show_contact = true;
  1980. }
  1981. if ($prefix == 'mobile/content' && config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == '0') { //移动端
  1982. $show_contact = true;
  1983. }
  1984. //} elseif (auth('web-member')->check() && auth('web-member')->user()->id==$val->uid) {
  1985. } elseif ($user && $user->utype == 2 && $user->id == $val->uid) {
  1986. //情景2:个人会员访问并且是该简历发布者
  1987. $show_contact = true;
  1988. //} elseif (auth('web-company')->check()) {
  1989. } elseif ($user && $user->utype == 1) { //情景3:企业会员访问
  1990. //情景3-1:其他企业会员
  1991. 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)) {
  1992. $show_contact = true;
  1993. }
  1994. 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)) {
  1995. $show_contact = true;
  1996. }
  1997. if ($down) { //情景3-2:下载过该简历
  1998. $show_contact = true;
  1999. }
  2000. if ($apply) {//情景3-3:该简历申请过当前企业发布的职位
  2001. //判断会员套餐 - 收到简历的联系方式免费查看
  2002. //$user = auth('web-company')->user();
  2003. $user_setmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, $user->utype);
  2004. if ($user_setmeal && $user_setmeal->show_apply_contact == 1) {
  2005. $show_contact = true;
  2006. }
  2007. }
  2008. //招聘会过来直接看
  2009. if ($type == 1) {
  2010. $show_contact = true;
  2011. }
  2012. }
  2013. return $show_contact;
  2014. }
  2015. public function resumeDoc($id)
  2016. {
  2017. if (empty($id)) {
  2018. return false;
  2019. }
  2020. $resume = $this->ResumeRepository->resumeShow($id);
  2021. if (!$resume) {
  2022. return false;
  2023. }
  2024. $education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
  2025. $work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
  2026. $train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
  2027. $language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id); //语言能力
  2028. $credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id); //获得证书
  2029. return ['resume' => $resume, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent];
  2030. }
  2031. public function descript($res, $html)
  2032. {
  2033. $temp_path = "temp/" . uniqid() . '.doc';
  2034. Storage::disk('public')->put($temp_path, $html);
  2035. $filename = $res['resume']['member_infos']['realname'] . '.doc';
  2036. return response()->download(
  2037. Storage::disk('public')->path($temp_path),
  2038. $filename)->deleteFileAfterSend(true);
  2039. }
  2040. public function delResume($id)
  2041. {
  2042. if (empty($id)) {
  2043. throw new ResponseException('抱歉,搜索不到简历!', '', 400);
  2044. }
  2045. $count = $this->ResumeRepository->getResumeCount(auth('web-member')->user()->id);
  2046. if ($count == 1) {
  2047. return ['code' => 0, 'info' => '', 'data' => ['tips' => '该简历无法删除,请至少保留一份简历!', 'description' => '如果您目前暂无求职意向,将简历状态设置为【保密】即可免受企业骚扰。', 'hidden_val' => 0]];
  2048. } else {
  2049. return ['code' => 1, 'info' => '', 'data' => ['tips' => '您确定要删除该份简历吗?', 'description' => '如果您目前暂无求职意向,将简历状态设置为【保密】即可免受企业骚扰。', 'hidden_val' => 1]];
  2050. }
  2051. }
  2052. public function setDelResume($id, $user)
  2053. {
  2054. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  2055. $array_id = array_column($res, 'id');
  2056. if (!in_array($id, $array_id)) {
  2057. throw new ResponseException('简历不存在');
  2058. }
  2059. $resume = $this->ResumeRepository->getResume($id);
  2060. if ($resume->def == 1) {
  2061. $default = $this->ResumeRepository->getResumeInfo(['uid' => $user->id, 'def' => 0]);
  2062. if (!$default) {
  2063. throw new ResponseException('默认简历不能删除!');
  2064. }
  2065. DB::beginTransaction();//检查数据库事务
  2066. try {
  2067. $this->ResumeRepository->delResume($id);
  2068. $this->ResumeRepository->updateById(['def' => 1], $default->id);
  2069. Report::where('utype', 2)->whereIn('utype_id', [$id])->delete();
  2070. $this->antic_personnel($user->id,$p=null);
  2071. event_search_update(Resume::class, (string)$id, 'delete');
  2072. event_search_update(Resume::class, (string)$default->id, 'update');
  2073. DB::commit();
  2074. if (!$this->memberLogRepository->createLog($user, 2008, $id)) {
  2075. throw NEW \Exception("日志记失败!");
  2076. }
  2077. return true;
  2078. } catch (\Exception $e) {
  2079. DB::rollback();
  2080. return false;
  2081. }
  2082. } else {
  2083. event_search_update(Resume::class, (string)$id, 'delete');
  2084. if (!$this->memberLogRepository->createLog($user, 2008, $id)) {
  2085. throw NEW \Exception("日志记失败!");
  2086. }
  2087. Report::where('utype', 2)->whereIn('utype_id', [$id])->delete();
  2088. return $this->ResumeRepository->delResume($id);
  2089. }
  2090. }
  2091. public function setDef($id, $user)
  2092. {
  2093. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  2094. $array_id = array_column($res, 'id');
  2095. if (!in_array($id, $array_id)) {
  2096. throw new ResponseException('简历不存在');
  2097. }
  2098. if (empty($id)) {
  2099. throw new ResponseException('抱歉,搜索不到简历!', '', 400);
  2100. }
  2101. $default = $this->ResumeRepository->getPersonInfo($user->id);
  2102. $default_id = $default->id;
  2103. DB::beginTransaction();//检查数据库事务
  2104. try {
  2105. $this->ResumeRepository->updateById(['def' => 0], $default_id);
  2106. $this->ResumeRepository->updateById(['def' => 1], $id);
  2107. DB::commit();
  2108. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2009, $id)) {
  2109. throw new \Exception("日志记失败!");
  2110. }
  2111. return ['code' => 1, 'info' => '设置成功'];
  2112. } catch (\Exception $e) {
  2113. DB::rollback();
  2114. return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
  2115. }
  2116. }
  2117. public function entrust($id, $user)
  2118. {
  2119. if (empty($id)) {
  2120. throw new ResponseException('抱歉,搜索不到简历!', '', 400);
  2121. }
  2122. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  2123. $array_id = array_column($res, 'id');
  2124. if (!in_array($id, $array_id)) {
  2125. throw new ResponseException('简历不存在');
  2126. }
  2127. $resume = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
  2128. if ($resume) {
  2129. if (($resume->entrust_end - time()) > 0) {
  2130. $result = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
  2131. return ['code' => 1, 'data' => $result];
  2132. } else {
  2133. return ['code' => 0, 'data' => $this->ResumeRepository->getArrayById($id)];
  2134. }
  2135. } else {
  2136. return ['code' => 0, 'data' => $this->ResumeRepository->getArrayById($id)];
  2137. }
  2138. }
  2139. public function setEntrust($id, $user)
  2140. {
  2141. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  2142. $array_id = array_column($res, 'id');
  2143. if (!in_array($id, $array_id)) {
  2144. throw new ResponseException('简历不存在');
  2145. }
  2146. $entrust = request()->entrust;
  2147. if (empty($entrust)) {
  2148. throw new ResponseException('请正确选择委托时间!', '', 400);
  2149. }
  2150. $resume = $this->ResumeRepository->getArrayById($id);
  2151. if (empty($resume)) {
  2152. throw new ResponseException('简历不存在!', '', 400);
  2153. }
  2154. $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
  2155. if ($resume_display != 2) {
  2156. if ($resume['audit'] != 2) {
  2157. throw new ResponseException('审核中或审核未通过的简历无法委托!', '', 400);
  2158. }
  2159. } else {
  2160. if ($resume['audit'] == 0) {
  2161. throw new ResponseException('审核未通过的简历无法委托!', '', 400);
  2162. }
  2163. }
  2164. if ($resume['display'] != 1) {
  2165. return ['code' => 0, 'info' => '简历已关闭,无法委托!'];
  2166. }
  2167. $newResume = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
  2168. switch ($entrust) {
  2169. case '3':
  2170. $data['entrust_end'] = strtotime("+3 day");
  2171. break;
  2172. case '7':
  2173. $data['entrust_end'] = strtotime("+7 day");
  2174. break;
  2175. case '14':
  2176. $data['entrust_end'] = strtotime("+14 day");
  2177. break;
  2178. case '30':
  2179. $data['entrust_end'] = strtotime("+30 day");
  2180. break;
  2181. default:
  2182. $data['entrust_end'] = strtotime("+3 day");
  2183. break;
  2184. }
  2185. DB::beginTransaction();//检查数据库事务
  2186. try {
  2187. $this->ResumeRepository->updateById(['entrust' => $data['entrust_end']], $id);
  2188. if ($newResume) {
  2189. $data['entrust'] = $entrust;
  2190. $data['entrust_start'] = time();
  2191. $this->ResumeEntrustRepository->updateEntrust($id, $data);
  2192. } else {
  2193. $data['resume_id'] = $id;
  2194. $data['uid'] = $user->id;
  2195. $data['fullname'] = $resume['fullname'];
  2196. $data['entrust'] = $entrust;
  2197. $data['entrust_start'] = time();
  2198. $this->ResumeEntrustRepository->addEnteust($data);
  2199. }
  2200. event_search_update(Resume::class, (string)$id, 'update');
  2201. DB::commit();
  2202. if (!$this->memberLogRepository->createLog($user, 2005, $id)) {
  2203. throwException("日志失败!");
  2204. }
  2205. return ['code' => 1, 'info' => '委托成功'];
  2206. } catch (\Exception $e) {
  2207. DB::rollback();
  2208. return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
  2209. }
  2210. }
  2211. public function setEntrustDel($id, $user)
  2212. {
  2213. if (empty($id)) {
  2214. throw new ResponseException('抱歉,搜索不到简历!', '', 400);
  2215. }
  2216. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  2217. $array_id = array_column($res, 'id');
  2218. if (!in_array($id, $array_id)) {
  2219. throw new ResponseException('简历不存在');
  2220. }
  2221. DB::beginTransaction();//检查数据库事务
  2222. try {
  2223. $this->ResumeRepository->updateWord($id, ['entrust' => 0]);
  2224. $this->ResumeEntrustRepository->updateEntrust($id, ['entrust' => 0, 'entrust_end' => 0, 'entrust_start' => 0]);
  2225. event_search_update(Resume::class, (string)$id, 'update');
  2226. DB::commit();
  2227. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2006, $id)) {
  2228. throwException("日志失败!");
  2229. }
  2230. return ['code' => 1, 'info' => '取消委托成功'];
  2231. } catch (\Exception $e) {
  2232. DB::rollback();
  2233. return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
  2234. }
  2235. }
  2236. public function attentionMe($user, $all)
  2237. {
  2238. $param_array = array('resume_id', 'look', 'settr');
  2239. $params = array();
  2240. if ($all) {
  2241. foreach ($all as $k => $v) {
  2242. if (in_array($k, $param_array)) {
  2243. $params[$k] = $v;
  2244. }
  2245. }
  2246. }
  2247. $data = [];
  2248. $resume_id = [];
  2249. $resume = $this->ResumeRepository->getSuccessResume($user->id, getResumeStatus());
  2250. if (!$resume->isEmpty()) {
  2251. $resume_id = array_column($resume->toArray(), 'id');
  2252. }
  2253. if (request()->resume_id) {
  2254. $resume_id = explode(',', request()->resume_id);
  2255. }
  2256. if (request()->settr) {
  2257. switch (request()->settr) {
  2258. case '3':
  2259. $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day"))];
  2260. break;
  2261. case '7':
  2262. $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-7 day"))];
  2263. break;
  2264. case '15':
  2265. $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-15 day"))];
  2266. break;
  2267. case '30':
  2268. $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-30 day"))];
  2269. break;
  2270. default:
  2271. $data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day"))];
  2272. break;
  2273. }
  2274. }
  2275. $res = $this->ViewResumeRepository->getAttentMe($data, $resume_id);
  2276. if ($res->total()) {
  2277. foreach ($res as $key => $val) {
  2278. $Result = $this->CompanyDownResumeService->getDownResume(['resume_id' => $val->resume_id, 'company_uid' => $val->uid]);
  2279. if ($Result) {
  2280. $res[$key]['status'] = 1;
  2281. } else {
  2282. $res[$key]['status'] = 0;
  2283. }
  2284. }
  2285. }
  2286. return ['content' => $res, 'params' => $params];
  2287. }
  2288. public function delAttention($id, $user)
  2289. {
  2290. if (empty($id)) {
  2291. throw new ResponseException('关注企业不存在!', '', 400);
  2292. }
  2293. $res = ViewResume::where(['uid' => $user->id])->get()->toArray();
  2294. $array_id = array_column($res, 'id');
  2295. $res_k = string_to_array(',', $id);
  2296. foreach ($res_k as $key => $val) {
  2297. if (!in_array($val, $array_id)) {
  2298. throw new ResponseException('关注企业不存在', '', 400);
  2299. }
  2300. }
  2301. return ViewResume::destroy(explode(',', $id));
  2302. }
  2303. public function tagCn($user)
  2304. {
  2305. if (empty(request()->resume_id)) {
  2306. return ['code' => 0, 'info' => '简历不存在!'];
  2307. }
  2308. $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
  2309. $array_id = array_column($res_k, 'id');
  2310. if (!in_array(request()->resume_id, $array_id)) {
  2311. return ['code' => 0, 'info' => '简历不存在!'];
  2312. }
  2313. $res = $this->ResumeRepository->getArrayById(request()->resume_id);
  2314. $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
  2315. if ($resume_display != 2) {
  2316. if ($res['audit'] != 2) {
  2317. return ['code' => 0, 'info' => '审核中或未通过的简历无法标签!'];
  2318. }
  2319. } else {
  2320. if ($res['audit'] == 0) {
  2321. return ['code' => 0, 'info' => '审核未通过的简历无法标签!'];
  2322. }
  2323. }
  2324. if ($res['display'] != 1) {
  2325. return ['code' => 0, 'info' => '简历已关闭,无法标签!'];
  2326. }
  2327. $person_tag = $this->CategoryRepository->getCategoryByAlias(['alias' => 'AIX_personaltag']);
  2328. $service_tags = PersonalServiceTag::orderBy('list_order', 'desc')->get();
  2329. $points = DB::table('members_points')->where(['uid' => auth('web-member')->user()->id, 'utype' => auth('web-member')->user()->utype])->first();
  2330. return ['code' => 1, 'person_tag' => $person_tag, 'service_tag' => $service_tags, 'points' => $points, 'resume_id' => request()->resume_id];
  2331. }
  2332. public function resumeStick($user)
  2333. {
  2334. if (empty(request()->resume_id)) {
  2335. return ['code' => 0, 'info' => '简历不存在!'];
  2336. }
  2337. $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
  2338. $array_id = array_column($res_k, 'id');
  2339. if (!in_array(request()->resume_id, $array_id)) {
  2340. return ['code' => 0, 'info' => '简历不存在!'];
  2341. }
  2342. $res = $this->ResumeRepository->getArrayById(request()->resume_id);
  2343. $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
  2344. if ($resume_display != 2) {
  2345. if ($res['audit'] != 2) {
  2346. return ['code' => 0, 'info' => '审核中或未通过的简历无法置顶!'];
  2347. }
  2348. } else {
  2349. if ($res['audit'] == 0) {
  2350. return ['code' => 0, 'info' => '审核未通过的简历无法置顶!'];
  2351. }
  2352. }
  2353. if ($res['display'] != 1) {
  2354. return ['code' => 0, 'info' => '简历已关闭,无法置顶!'];
  2355. }
  2356. $service_sticks = PersonalServiceStick::orderBy('list_order', 'desc')->get();
  2357. $points = DB::table('members_points')->where(['uid' => auth('web-member')->user()->id, 'utype' => auth('web-member')->user()->utype])->first();
  2358. return ['code' => 1, 'service_stick' => $service_sticks, 'points' => $points, 'resume_id' => request()->resume_id];
  2359. }
  2360. public function incrementAddSave($date, $user)
  2361. {
  2362. $resume_id = array_get($date, 'resume_id');
  2363. if (empty($date['tag_id'])) {
  2364. throw new ResponseException('请选择标签!', '', 400);
  2365. }
  2366. if (empty($resume_id)) {
  2367. throw new ResponseException('请选择简历!', '', 400);
  2368. }
  2369. if (empty($date['days'])) {
  2370. throw new ResponseException('请选择天数!', '', 400);
  2371. }
  2372. $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
  2373. $array_id = array_column($res_k, 'id');
  2374. if (!in_array($resume_id, $array_id)) {
  2375. throw new ResponseException('简历不存在!', '', 400);
  2376. }
  2377. $res = $this->ResumeRepository->getArrayById($resume_id);
  2378. $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
  2379. if ($resume_display != 2) {
  2380. if ($res['audit'] != 2) {
  2381. throw new ResponseException('审核中或未通过的简历无法标签!', '', 400);
  2382. }
  2383. } else {
  2384. if ($res['audit'] == 0) {
  2385. throw new ResponseException('审核未通过的简历无法标签!', '', 400);
  2386. }
  2387. }
  2388. if ($res['display'] != 1) {
  2389. throw new ResponseException('简历已关闭,无法标签!', '', 400);
  2390. }
  2391. $categorys = Category::where('id', $date['tag_id'])->first();
  2392. $personal_service_tags = PersonalServiceTag::where('days', $date['days'])->first();
  2393. if (is_null($personal_service_tags)) {
  2394. throw new ResponseException('请选择时长!', '', 400);
  2395. }
  2396. $POINTS = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
  2397. if ($POINTS) {
  2398. if ($POINTS->points < $personal_service_tags->points) {
  2399. throw new ResponseException('积分不足!', '', 400);
  2400. }
  2401. } else {
  2402. throw new ResponseException('积分不存在!', '', 400);
  2403. }
  2404. DB::beginTransaction();//检查数据库事务
  2405. try {
  2406. $tag_logs = PersonalServiceTagLog::where(['resume_id' => $date['resume_id'], 'resume_uid' => $user->id])->first();
  2407. if ($tag_logs) {
  2408. $dat['days'] = $date['days'];
  2409. $dat['points'] = $personal_service_tags->points;
  2410. $dat['tag_id'] = $date['tag_id'];
  2411. $dat['tag_cn'] = $categorys->demand;
  2412. $dat['addtime'] = time();
  2413. $dat['endtime'] = strtotime("+" . $date['days'] . " day");
  2414. PersonalServiceTagLog::where(
  2415. ['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
  2416. )->update($dat);
  2417. } else {
  2418. $dat['resume_id'] = $date['resume_id'];
  2419. $dat['resume_uid'] = $user->id;
  2420. $dat['days'] = $date['days'];
  2421. $dat['points'] = $personal_service_tags->points;
  2422. $dat['tag_id'] = $date['tag_id'];
  2423. $dat['tag_cn'] = $categorys->demand;
  2424. $dat['addtime'] = time();
  2425. $dat['endtime'] = strtotime("+" . $date['days'] . " day");
  2426. PersonalServiceTagLog::create($dat);
  2427. }
  2428. MembersPoint::where(
  2429. ['uid' => $user->id, 'utype' => $user->utype]
  2430. )->decrement('points', $personal_service_tags->points);
  2431. MembersHandsel::create(
  2432. ['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => $categorys->demand, 'operate' => 2, 'points' => $personal_service_tags->points]
  2433. );
  2434. $order = new Order();
  2435. $order->uid = $user->id;
  2436. $order->utype = $user->utype;
  2437. $order->order_type = 4;
  2438. $order->pay_type = 1;
  2439. $order->is_pay = 2;
  2440. $order->amount = $personal_service_tags->points / config('aix.system.site_other.site_other.points_match');
  2441. $order->pay_points = $personal_service_tags->points;
  2442. $order->payment = 'points';
  2443. $order->payment_cn = '积分';
  2444. $order->discount = $categorys->demand;
  2445. $order->payment_time = time();
  2446. $order->service_name = "简历标签";
  2447. $order->charge = json_encode($date);
  2448. $order->save();
  2449. $PayService = new PayService();
  2450. $order->oid = $PayService->getTradeNo($order->id);
  2451. $order->save();
  2452. DB::commit();
  2453. return ['code' => 1, 'info' => '兑换成功!'];
  2454. } catch (\Exception $e) {
  2455. DB::rollback();
  2456. return ['code' => 0, 'info' => $e->getMessage()];
  2457. }
  2458. }
  2459. public function incrementStickSave($date, $user)
  2460. {
  2461. $resume_id = array_get($date, 'resume_id');
  2462. if (empty($resume_id)) {
  2463. throw new ResponseException('请选择简历!', '', 400);
  2464. }
  2465. if (empty($date['days'])) {
  2466. throw new ResponseException('请选择天数!', '', 400);
  2467. }
  2468. $res_k = Resume::where(['uid' => $user->id])->get()->toArray();
  2469. $array_id = array_column($res_k, 'id');
  2470. if (!in_array($resume_id, $array_id)) {
  2471. throw new ResponseException('简历不存在!', '', 400);
  2472. }
  2473. $res = $this->ResumeRepository->getArrayById($resume_id);
  2474. $resume_display = config('aix.personal_set.per_set.show_set.resume_display');
  2475. if ($resume_display != 2) {
  2476. if ($res['audit'] != 2) {
  2477. throw new ResponseException('审核中或未通过的简历无法置顶!', '', 400);
  2478. }
  2479. } else {
  2480. if ($res['audit'] == 0) {
  2481. throw new ResponseException('审核未通过的简历无法置顶!', '', 400);
  2482. }
  2483. }
  2484. if ($res['display'] != 1) {
  2485. throw new ResponseException('简历已关闭,无法置顶!', '', 400);
  2486. }
  2487. $personal_service_sticks = PersonalServiceStick::where('days', $date['days'])->first();
  2488. if (is_null($personal_service_sticks)) {
  2489. throw new ResponseException('请选择时长!', '', 400);
  2490. }
  2491. $POINTS = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
  2492. if ($POINTS) {
  2493. if ($POINTS->points < $personal_service_sticks->points) {
  2494. throw new ResponseException('积分不足!', '', 400);
  2495. }
  2496. } else {
  2497. throw new ResponseException('积分不存在!', '', 400);
  2498. }
  2499. DB::beginTransaction();//检查数据库事务
  2500. try {
  2501. $stick_logs = PersonalServiceStickLog::where(
  2502. ['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
  2503. )->first();
  2504. Resume::where('id', $date['resume_id'])->update(['stick' => 1, 'stime' => strtotime("+" . $date['days'] . " day")]);
  2505. event_search_update(Resume::class, (string)$date['resume_id'], 'update');
  2506. if ($stick_logs) {
  2507. $dat['days'] = $date['days'];
  2508. $dat['points'] = $personal_service_sticks->points;
  2509. $dat['addtime'] = time();
  2510. $dat['endtime'] = strtotime("+" . $date['days'] . " day");
  2511. PersonalServiceStickLog::where(
  2512. ['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
  2513. )->update($dat);
  2514. } else {
  2515. $dat['resume_id'] = $date['resume_id'];
  2516. $dat['resume_uid'] = $user->id;
  2517. $dat['days'] = $date['days'];
  2518. $dat['points'] = $personal_service_sticks->points;
  2519. $dat['addtime'] = time();
  2520. $dat['endtime'] = strtotime("+" . $date['days'] . " day");
  2521. PersonalServiceStickLog::create($dat);
  2522. }
  2523. MembersPoint::where(
  2524. ['uid' => $user->id, 'utype' => $user->utype]
  2525. )->decrement('points', $personal_service_sticks->points);
  2526. MembersHandsel::create(
  2527. ['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => '简历置顶' . $date['days'] . '天', 'operate' => 2, 'points' => $personal_service_sticks->points]
  2528. );
  2529. $order = new Order();
  2530. $order->uid = $user->id;
  2531. $order->utype = $user->utype;
  2532. $order->order_type = 3;
  2533. $order->pay_type = 1;
  2534. $order->is_pay = 2;
  2535. $order->amount = $personal_service_sticks->points / config('aix.system.site_other.site_other.points_match');
  2536. $order->pay_points = $personal_service_sticks->points;
  2537. $order->payment = 'points';
  2538. $order->payment_cn = '积分';
  2539. $order->payment_time = time();
  2540. $order->service_name = "简历置顶";
  2541. $order->discount = '置顶' . $date['days'] . '天';
  2542. $order->charge = json_encode($date);
  2543. $order->save();
  2544. $PayService = new PayService();
  2545. $order->oid = $PayService->getTradeNo($order->id);
  2546. $order->save();
  2547. DB::commit();
  2548. return ['code' => 1, 'info' => '兑换成功!'];
  2549. } catch (\Exception $e) {
  2550. DB::rollback();
  2551. return ['code' => 0, 'info' => $e->getMessage()];
  2552. }
  2553. }
  2554. public function autoRefresh($date, $user)
  2555. {
  2556. $resume_id = $date['resume_id'];
  2557. $auto_refresh = $date['auto_refresh'];
  2558. $auto_apply = $date['auto_apply'];
  2559. if (empty($resume_id)) {
  2560. throw new ResponseException('简历不存在!', '', 400);
  2561. }
  2562. $uid = $user->id;
  2563. $utype = $user->utype;
  2564. $refreshtime = strtotime("+3 day");
  2565. $Queue = QueueAutoRefresh::where(['pid' => $resume_id, 'utype' => 2])->first();
  2566. $entrusts = ResumeEntrust::where(['resume_id' => $resume_id, 'uid' => $uid])->first();
  2567. $resume = $this->ResumeRepository->getArrayById($resume_id);
  2568. DB::beginTransaction();//检查数据库事务
  2569. try {
  2570. if ($auto_refresh == 1) {
  2571. if ($Queue) {
  2572. QueueAutoRefresh::where(['pid' => $resume_id, 'utype' => 2])->update(['start_time' => time(), 'refreshtime' => $refreshtime]);
  2573. } else {
  2574. $order['pid'] = $resume_id;
  2575. $order['type'] = 2;
  2576. $order['uid'] = $uid;
  2577. $order['utype'] = $utype;
  2578. $order['start_time'] = time();
  2579. $order['refreshtime'] = $refreshtime;
  2580. QueueAutoRefresh::create($order);
  2581. }
  2582. }
  2583. if ($auto_apply == 1) {
  2584. if ($entrusts) {
  2585. ResumeEntrust::where(['resume_id' => $resume_id, 'uid' => $uid])->update(['entrust_start' => time(), 'entrust_end' => $refreshtime, 'entrust' => 3]);
  2586. } else {
  2587. $ord['resume_id'] = $resume_id;
  2588. $ord['uid'] = $uid;
  2589. $ord['fullname'] = $resume['fullname'];
  2590. $ord['entrust'] = 3;
  2591. $ord['entrust_start'] = time();
  2592. $ord['entrust_end'] = $refreshtime;
  2593. ResumeEntrust::create($ord);
  2594. }
  2595. $this->ResumeRepository->updateWord($resume_id, ['entrust' => $refreshtime]);
  2596. }
  2597. DB::commit();
  2598. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2027, $resume_id)) {
  2599. throw new \Exception("日志记失败!");
  2600. }
  2601. return ['code' => 1, 'info' => '保存成功!'];
  2602. } catch (\Exception $e) {
  2603. DB::rollback();
  2604. return ['code' => 0, 'info' => $e->getMessage()];
  2605. }
  2606. }
  2607. public function uploadImages($date, $user)
  2608. {
  2609. if (empty($date['resume_id'])) {
  2610. throw new ResponseException('简历不存在!', '', 400);
  2611. }
  2612. if (empty($date['img'])) {
  2613. throw new ResponseException('图片不存在!', '', 400);
  2614. }
  2615. $arr['uid'] = $user->id;
  2616. $arr['resume_id'] = $date['resume_id'];
  2617. $arr['img'] = $date['img'];
  2618. $arr['created_at'] = date('Y-m-d H:i:s', time());
  2619. $arr['updated_at'] = date('Y-m-d H:i:s', time());
  2620. $resume_imgs = DB::table('resume_imgs')->where(['uid' => $user->id, 'resume_id' => $date['resume_id']])->first();
  2621. DB::beginTransaction();//检查数据库事务
  2622. try {
  2623. if (empty($resume_imgs)) {
  2624. $resumeArr = $this->ResumeRepository->getResumeById($date['resume_id']);
  2625. if ($resumeArr->complete_percent + 5 <= 100) {
  2626. if ($resumeArr->complete_percent + 5 >= 70 && $resumeArr->complete_percent + 5 < 90) {
  2627. $this->TaskService->doTask(12);
  2628. $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 2], $date['resume_id']);
  2629. } elseif ($resumeArr->complete_percent + 5 >= 90 && $resumeArr->complete_percent + 5 <= 100) {
  2630. $this->TaskService->doTask(11);
  2631. $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 1], $date['resume_id']);
  2632. } else {
  2633. $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 0], $date['resume_id']);
  2634. }
  2635. }
  2636. }
  2637. $result = DB::table('resume_imgs')->insert($arr);
  2638. if ($result) {
  2639. $id = DB::getPdo()->lastInsertId();
  2640. $das['audit'] = 1;
  2641. $expires = config('aix.personal_set.per_set.per_set.resume_expires');
  2642. if ($expires) {
  2643. $das['expires'] = strtotime("+{$expires} days");
  2644. }
  2645. $this->ResumeRepository->updateById($das, $date['resume_id']);
  2646. event_search_update(Resume::class, (string)$date['resume_id'], 'update');
  2647. }
  2648. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2030, $date['resume_id'])) {
  2649. throw new \Exception("日志记失败!");
  2650. }
  2651. DB::commit();
  2652. return ['code' => 1, 'info' => $id];
  2653. } catch (\Exception $e) {
  2654. DB::rollback();
  2655. return ['code' => 0, 'info' => '上传失败!'];
  2656. }
  2657. }
  2658. public function uploadFiles($date)
  2659. {
  2660. event_search_update(Resume::class, (string)$date['resume_id'], 'update');
  2661. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2030, $date['resume_id'])) {
  2662. throw new \Exception("日志记失败!");
  2663. }
  2664. return $this->ResumeRepository->updateWord(
  2665. $date['resume_id'],
  2666. [
  2667. 'word_resume' => $date['files'],
  2668. 'word_resume_title' => $date['name'],
  2669. 'word_resume_addtime' => time(),
  2670. ]
  2671. );
  2672. }
  2673. public function delFile($date)
  2674. {
  2675. event_search_update(Resume::class, (string)$date['resume_id'], 'update');
  2676. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2031, $date['resume_id'])) {
  2677. throw new \Exception("日志记失败!");
  2678. }
  2679. return $this->ResumeRepository->updateWord(
  2680. $date['resume_id'],
  2681. [
  2682. 'word_resume' => '',
  2683. 'word_resume_title' => '',
  2684. 'word_resume_addtime' => null,
  2685. ]
  2686. );
  2687. }
  2688. public function del_images($data)
  2689. {
  2690. if (empty($data['id'])) {
  2691. throw new ResponseException('图片不存在!', '', 400);
  2692. }
  2693. $count = DB::table('resume_imgs')->where(['uid' => auth('web-member')->user()->id, 'resume_id' => $data['resume_id']])->count();
  2694. DB::beginTransaction();//检查数据库事务
  2695. try {
  2696. $res = DB::table('resume_imgs')->where('id', $data['id'])->delete();
  2697. if ($count == 1) {
  2698. $resumeArr = $this->ResumeRepository->getResumeById($data['resume_id']);
  2699. if ($resumeArr->complete_percent - 5 > 0) {
  2700. if ($resumeArr->complete_percent - 5 >= 70 && $resumeArr->complete_percent - 5 < 90) {
  2701. $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 2], $data['resume_id']);
  2702. } elseif ($resumeArr->complete_percent - 5 >= 90 && $resumeArr->complete_percent - 15 <= 100) {
  2703. $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 1], $data['resume_id']);
  2704. } else {
  2705. $this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 0], $data['resume_id']);
  2706. }
  2707. event_search_update(Resume::class, (string)$data['resume_id'], 'update');
  2708. }
  2709. }
  2710. DB::commit();
  2711. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2029, $data['resume_id'])) {
  2712. throw new \Exception("日志记失败!");
  2713. }
  2714. return ['code' => 1, 'info' => $res];
  2715. } catch (\Exception $e) {
  2716. DB::rollback();
  2717. return ['code' => 0, 'info' => '上传失败!'];
  2718. }
  2719. }
  2720. /**企业的邀请面试记录
  2721. * @param $request
  2722. * @return array
  2723. */
  2724. public function interviewJobs($request, $user)
  2725. {
  2726. $jobs_id = isset($request['jobs_id']) ? $request['jobs_id'] : 0;
  2727. $stop = isset($request['stop']) ? $request['stop'] : 0;
  2728. $look = isset($request['look']) ? $request['look'] : 0;
  2729. $settr = isset($request['settr']) ? $request['settr'] : 0;
  2730. $page = 10;
  2731. $where['company_id'] = $user->id;
  2732. $valid = ['1'];
  2733. if ($stop) {
  2734. $valid = ['1', '0'];
  2735. }
  2736. if ($jobs_id) {
  2737. $where['jobs_id'] = $jobs_id;
  2738. }
  2739. if ($look) {
  2740. $where['personal_look'] = $look;
  2741. }
  2742. if ($settr) {
  2743. $where[] = ['interview_time', '>=', strtotime("-{$settr} day")];
  2744. }
  2745. // $where['result'] = 0;
  2746. $jobs_map['company_id'] = $user->id;
  2747. if (!$stop) {
  2748. $jobs_map['valid'] = 1;
  2749. }
  2750. if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
  2751. $jobs_map['audit'] = 1;
  2752. }
  2753. $param_array = array('jobs_id', 'stop', 'look', 'settr');
  2754. $params = array();
  2755. if ($request) {
  2756. foreach ($request as $k => $v) {
  2757. if (in_array($k, $param_array)) {
  2758. $params[$k] = $v;
  2759. }
  2760. }
  2761. }
  2762. $jobs = $this->jobsRepository->jobsList($jobs_map);
  2763. if ($jobs) {
  2764. $jobs = $jobs->toArray();
  2765. $jobsList = array_column($jobs, 'jobs_name', 'id');
  2766. }
  2767. $result = $this->CompanyInterviewRepository->interviewJobs($page, $where, $valid);
  2768. return [
  2769. 'result' => $result,
  2770. 'jobsList' => $jobsList,
  2771. 'params' => $params,
  2772. 'stop' => $stop,
  2773. 'jobs_id' => $jobs_id,
  2774. ];
  2775. }
  2776. /**
  2777. * 面试邀请详情
  2778. * @param $request
  2779. * @return \Illuminate\Http\JsonResponse
  2780. * @throws \Throwable
  2781. */
  2782. public function interviewDetail($request)
  2783. {
  2784. if (!$id = $request->id) {
  2785. return response()->json(['status' => 0, 'msg' => '请正确选择面试信息']);
  2786. }
  2787. $interviewInfo = $this->CompanyInterviewRepository->interviewDetail(['id' => $id]);
  2788. if (!$interviewInfo) {
  2789. return response()->json(['status' => 0, 'msg' => '面试信息不存在']);
  2790. }
  2791. $is_apply = 0;
  2792. if ($this->PersonalJobsApplyRepository->findWhere(['resume_id' => $interviewInfo->resume_id, 'company_id' => auth('web-company')->user()->id])) {
  2793. $is_apply = 1;
  2794. }
  2795. return response()->json(['status' => 1, 'msg' => '面试信息获取成功!', 'data' => view('app.company.ajax.ajax_show_interview', ['interviewInfo' => $interviewInfo, 'is_apply' => $is_apply])->render()]);
  2796. }
  2797. /**
  2798. * 删除面试邀请
  2799. * @param $request
  2800. * @return array
  2801. */
  2802. public function interviewDel($request, $user)
  2803. {
  2804. $id = isset($request['id']) ? $request['id'] : 0;
  2805. if (!$id) {
  2806. return ['status' => 0, 'msg' => '请选择要删除的面试邀请!'];
  2807. }
  2808. $ids = is_array($id) ? $id : explode(',', $id);
  2809. if (!$this->CompanyInterviewRepository->delInterview($ids, $user->id)) {
  2810. return ['status' => 0, 'msg' => '删除失败!'];
  2811. }
  2812. if (!$this->memberLogRepository->createLog($user, 1011, $id)) {
  2813. throw new \Exception('日志记录失败');
  2814. }
  2815. return ['status' => 1, 'msg' => '删除成功!'];
  2816. }
  2817. /**
  2818. * 企业下载的简历
  2819. * @param $request
  2820. * @return array
  2821. */
  2822. public function resumeDown($request, $user)
  2823. {
  2824. $state_arr = array('1' => '可面试', '2' => '未接通', '3' => '不合适');
  2825. $state = isset($request['state']) ? $request['state'] : '';
  2826. $settr = isset($request['settr']) ? $request['settr'] : 0;
  2827. if (isset($request['state'])) {
  2828. $where['is_reply'] = $request['state'];
  2829. }
  2830. $map = [];
  2831. if (isset($request['settr'])) {
  2832. $map[] = ['down_addtime', '>=', strtotime("-{$request['settr']} day")];
  2833. }
  2834. $param_array = array('state', 'settr');
  2835. $params = array();
  2836. if ($request) {
  2837. foreach ($request as $k => $v) {
  2838. if (in_array($k, $param_array)) {
  2839. $params[$k] = $v;
  2840. }
  2841. }
  2842. }
  2843. $page = 10;
  2844. $where['company_uid'] = $user->id;
  2845. $downList = $this->companyDownResumeRepository->downResume($where, $map, $page);
  2846. // if ($downList->total()) {
  2847. // foreach ($downList as $key => $val) {
  2848. // if ($val->resumes) {
  2849. // if ($val->resumes->display_name=="2") {
  2850. // $val->resumes->fullname="N".str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
  2851. // } elseif ($val->resumes->display_name=="3") {
  2852. // if ($val->resumes->sex==1) {
  2853. // $val->resumes->fullname=cut_str($val->resumes->fullname, 1, 0, "先生");
  2854. // } elseif ($val->resumes->sex==2) {
  2855. // $val->resumes->fullname=cut_str($val->resumes->fullname, 1, 0, "女士");
  2856. // }
  2857. // }
  2858. // }
  2859. // }
  2860. // }
  2861. return $res = [
  2862. 'downList' => $downList,
  2863. 'state_arr' => $state_arr,
  2864. 'state' => $state,
  2865. 'settr' => $settr,
  2866. 'params' => $params,
  2867. ];
  2868. }
  2869. public function resumeDownDel($request)
  2870. {
  2871. $user = auth('web-company')->user();
  2872. $yid = $request->y_id ? $request->y_id : 0;
  2873. if (!$yid) {
  2874. return response()->json(['status' => 0, 'msg' => '请选择要删除的简历!']);
  2875. }
  2876. $ids = is_array($yid) ? $yid : explode(',', $yid);
  2877. $where['company_uid'] = $user->id;
  2878. if (false == $this->companyDownResumeRepository->resumeDownDel($ids, $where)) {
  2879. return response()->json(['status' => 0, 'msg' => '简历删除失败!']);
  2880. }
  2881. if (!$this->memberLogRepository->createLog($user, 1017, $ids)) {
  2882. throw new \Exception("日志记录失败!");
  2883. }
  2884. return response()->json(['status' => 1, 'msg' => '简历删除成功!']);
  2885. }
  2886. /**
  2887. * 企业收藏的简历
  2888. * @param $request
  2889. * @return array
  2890. */
  2891. public function favoritesResume($request, $user, $type = 0)
  2892. {
  2893. $where = [];
  2894. $map = [];
  2895. $hasget = false;
  2896. $settr = isset($request['settr']) ? $request['settr'] : 0;
  2897. if ($settr) {
  2898. $hasget = true;
  2899. $where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
  2900. }
  2901. if ($type == 1) {
  2902. $education = isset($request['education']) ? $request['education'] : 0;
  2903. $experience = isset($request['experience']) ? $request['experience'] : 0;
  2904. $eduArr = Category::where('alias', 'AIX_education')->pluck('demand', 'id')->toArray();
  2905. $expArr = Category::where('alias', 'AIX_experience')->pluck('demand', 'id')->toArray();
  2906. $education && $map['education'] = $education;
  2907. $experience && $map['experience'] = $experience;
  2908. $result['eduArr'] = $eduArr;
  2909. $result['expArr'] = $expArr;
  2910. $result['experience'] = $experience;
  2911. $result['education'] = $education;
  2912. }
  2913. $page = 10;
  2914. $param_array = array('settr', 'education', 'experience');
  2915. $params = array();
  2916. if ($request) {
  2917. foreach ($request as $k => $v) {
  2918. if (in_array($k, $param_array)) {
  2919. $params[$k] = $v;
  2920. }
  2921. }
  2922. }
  2923. $favorityList = $this->companyFavoriteRepository->favorityList($where, $map, $user->id, $page);
  2924. if ($favorityList->total()) {
  2925. foreach ($favorityList as $key => $val) {
  2926. if ($val->resumes) {
  2927. if ($val->resumes->display_name == "2") {
  2928. $val->resumes->fullname = "N" . str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
  2929. } elseif ($val->resumes->display_name == "3") {
  2930. if ($val->resumes->sex == 1) {
  2931. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
  2932. } elseif ($val->resumes->sex == 2) {
  2933. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
  2934. }
  2935. }
  2936. }
  2937. }
  2938. }
  2939. $result['favorityList'] = $favorityList;
  2940. $result['settr'] = $settr;
  2941. $result['params'] = $params;
  2942. $result['hasget'] = $hasget;
  2943. return $result;
  2944. }
  2945. /**收藏简历操作
  2946. * @param $request
  2947. * @return \Illuminate\Http\JsonResponse
  2948. * @throws \Prettus\Validator\Exceptions\ValidatorException
  2949. */
  2950. public function favoritesResumeSave($request)
  2951. {
  2952. $resume_id = $request->resume_id;
  2953. if (!$resume_id) {
  2954. return response()->json(['status' => 0, 'msg' => '请选择要收藏的简历!']);
  2955. }
  2956. $data['resume_id'] = $resume_id;
  2957. $data['company_id'] = auth('web-company')->user()->id;
  2958. if ($this->companyFavoriteRepository->findFavorite($resume_id, auth('web-company')->user()->id)) {
  2959. return response()->json(['status' => 0, 'msg' => '已收藏该简历,请勿重复收藏!']);
  2960. }
  2961. if (!$this->companyFavoriteRepository->create($data)) {
  2962. return response()->json(['status' => 0, 'msg' => '收藏简历失败!']);
  2963. }
  2964. return response()->json(['status' => 1, 'msg' => '收藏简历成功!']);
  2965. }
  2966. /**m删除企业收藏的简历
  2967. * @param $ids
  2968. * @param $user
  2969. * @return \Illuminate\Http\JsonResponse
  2970. * @throws \ErrorException
  2971. * @throws \Prettus\Validator\Exceptions\ValidatorException
  2972. */
  2973. public function favoritesResumeDel($ids, $user)
  2974. {
  2975. $id = $ids;
  2976. if (!$id) {
  2977. return response()->json(['status' => 0, 'msg' => '请选择简历!']);
  2978. }
  2979. $ids = is_array($id) ? $id : explode(',', $id);
  2980. if (!$this->companyFavoriteRepository->favoritesResumeDel($ids, $user->id)) {
  2981. return response()->json(['status' => 0, 'msg' => '删除失败!']);
  2982. }
  2983. if (!$this->memberLogRepository->createLog($user, 1019, $ids)) {
  2984. throw new \Exception("日志记录失败!");
  2985. }
  2986. return response()->json(['status' => 1, 'msg' => '删除成功!']);
  2987. }
  2988. /**浏览过的简历
  2989. * @param $request
  2990. * @return array
  2991. */
  2992. public function browseResume($request)
  2993. {
  2994. $settr = $request->settr ? $request->settr : 0;
  2995. $map = [];
  2996. if ($settr) {
  2997. $map[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
  2998. }
  2999. $param_array = array('settr');
  3000. $params = array();
  3001. if ($request->all()) {
  3002. foreach ($request->all() as $k => $v) {
  3003. if (in_array($k, $param_array)) {
  3004. $params[$k] = $v;
  3005. }
  3006. }
  3007. }
  3008. $page = 10;
  3009. $browseList = $this->ViewResumeRepository->browseList($map, auth('web-company')->user()->id, $page);
  3010. foreach ($browseList as $key => $val) {
  3011. if ($val->resumes) {
  3012. //查找企业是否收藏对应简历
  3013. $val->is_favorite = 0;
  3014. if ($this->companyFavoriteRepository->findFavorite($val->resumes->id, auth('web-company')->user()->id)) {
  3015. $val->is_favorite = 1;
  3016. }
  3017. if ($val->resumes->display_name == "2") {
  3018. $val->resumes->fullname = "N" . str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
  3019. } elseif ($val->resumes->display_name == "3") {
  3020. if ($val->resumes->sex == 1) {
  3021. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
  3022. } elseif ($val->resumes->sex == 2) {
  3023. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
  3024. }
  3025. }
  3026. }
  3027. }
  3028. $result = [
  3029. 'settr' => $settr,
  3030. 'browseList' => $browseList,
  3031. 'params' => $params,
  3032. ];
  3033. return $result;
  3034. }
  3035. /**删除浏览过的简历
  3036. * @param $request
  3037. * @return \Illuminate\Http\JsonResponse
  3038. */
  3039. public function browseResumeDel($request, $user)
  3040. {
  3041. $id = $request->y_id;
  3042. if (!$id) {
  3043. return response()->json(['status' => 0, 'msg' => '请选择简历!']);
  3044. }
  3045. $ids = is_array($id) ? $id : explode(',', $id);
  3046. if (!$this->ViewResumeRepository->browseResumeDel($ids, $user->id)) {
  3047. return response()->json(['status' => 0, 'msg' => '删除失败!']);
  3048. }
  3049. if (!$this->memberLogRepository->createLog($user, 1020, $ids)) {
  3050. throw new \Exception("日志记录失败!");
  3051. }
  3052. return response()->json(['status' => 1, 'msg' => '删除成功!']);
  3053. }
  3054. /**谁看过我
  3055. * @param $request
  3056. * @return array
  3057. */
  3058. public function browseJobs($request)
  3059. {
  3060. $settr = $request->settr ? $request->settr : 0;
  3061. $map = [];
  3062. if ($settr) {
  3063. $map[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
  3064. }
  3065. $map['company_id'] = auth('web-company')->user()->id;
  3066. $param_array = array('settr');
  3067. $params = array();
  3068. if ($request->all()) {
  3069. foreach ($request->all() as $k => $v) {
  3070. if (in_array($k, $param_array)) {
  3071. $params[$k] = $v;
  3072. }
  3073. }
  3074. }
  3075. $page = 10;
  3076. $result = $this->viewJobRepository->browseJobs($map, $page, $map['company_id']);
  3077. foreach ($result as $key => $val) {
  3078. if ($val->resumes) {
  3079. //查找企业是否收藏对应简历
  3080. $val->is_favorite = 0;
  3081. if ($this->companyFavoriteRepository->findFavorite($val->resumes->id, auth('web-company')->user()->id)) {
  3082. $val->is_favorite = 1;
  3083. }
  3084. if ($val->resumes->display_name == "2") {
  3085. $val->resumes->fullname = "N" . str_pad($val->resumes->id, 7, "0", STR_PAD_LEFT);
  3086. } elseif ($val->resumes->display_name == "3") {
  3087. if ($val->resumes->sex == 1) {
  3088. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
  3089. } elseif ($val->resumes->sex == 2) {
  3090. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
  3091. }
  3092. }
  3093. }
  3094. }
  3095. return $res = [
  3096. 'result' => $result,
  3097. 'settr' => $settr,
  3098. 'params' => $params,
  3099. ];
  3100. }
  3101. /**删除谁看过我
  3102. * @param $request
  3103. * @return \Illuminate\Http\JsonResponse
  3104. */
  3105. public function browseJobsDel($request, $user)
  3106. {
  3107. $id = $request->y_id;
  3108. if (!$id) {
  3109. return response()->json(['status' => 0, 'msg' => '请选择简历!']);
  3110. }
  3111. $ids = is_array($id) ? $id : explode(',', $id);
  3112. if (!$this->viewJobRepository->browseJobsDel($ids, $user->id)) {
  3113. return response()->json(['status' => 0, 'msg' => '删除失败!']);
  3114. }
  3115. if (!$this->memberLogRepository->createLog($user, 1021, $ids)) {
  3116. throw new \Exception("日志记录失败!");
  3117. }
  3118. return response()->json(['status' => 1, 'msg' => '删除成功!']);
  3119. }
  3120. /**面试结果反馈
  3121. * @param $request
  3122. * @return array
  3123. */
  3124. public function feedback($request)
  3125. {
  3126. $feedback = [1 => '面试通过', 2 => '面试未通过', 3 => '未参加面试', 4 => '面试时间变更'];
  3127. $user = auth('web-company')->user();
  3128. $type = $request->type ? $request->type : '';
  3129. $settr = $request->settr ? $request->settr : '';
  3130. $jobs_id = $request->jobs_id ? $request->jobs_id : 0;
  3131. $is_pass = $request->is_pass ? $request->is_pass : 0;
  3132. $where['company_id'] = $user->id;
  3133. if ($type) {
  3134. $where[] = ['result', '>', 0];
  3135. } else {
  3136. $where['result'] = 0;
  3137. }
  3138. $valid = ['1'];
  3139. if ($jobs_id) {
  3140. $where['jobs_id'] = $jobs_id;
  3141. }
  3142. if ($settr) {
  3143. $where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
  3144. }
  3145. if ($is_pass) {
  3146. $where['result'] = $is_pass;
  3147. }
  3148. $jobs_map['company_id'] = $user->id;
  3149. $jobs_map['valid'] = 1;
  3150. if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
  3151. $jobs_map['audit'] = 1;
  3152. }
  3153. $param_array = array('type', 'jobs_id', 'settr');
  3154. $params = array();
  3155. if ($request->all()) {
  3156. foreach ($request->all() as $k => $v) {
  3157. if (in_array($k, $param_array)) {
  3158. $params[$k] = $v;
  3159. }
  3160. }
  3161. }
  3162. $page = 10;
  3163. $jobs = $this->jobsRepository->jobsList($jobs_map)->toArray();
  3164. $jobsList = array_column($jobs, 'jobs_name', 'id');
  3165. $result = $this->CompanyInterviewRepository->interviewJobs($page, $where, $valid);
  3166. return $res = [
  3167. 'result' => $result,
  3168. 'type' => $type,
  3169. 'jobsList' => $jobsList,
  3170. 'params' => $params,
  3171. 'jobs_id' => $jobs_id,
  3172. 'feedback' => $feedback,
  3173. 'is_pass' => $is_pass,
  3174. ];
  3175. }
  3176. /**面试结果反馈操作
  3177. * @param $id
  3178. * @param $notes
  3179. * @param $status
  3180. * @return \Illuminate\Http\JsonResponse
  3181. * @throws \Prettus\Validator\Exceptions\ValidatorException
  3182. */
  3183. public function feedbackModify($id, $notes, $status, $company_id)
  3184. {
  3185. $data = [
  3186. 'explan' => $notes,
  3187. 'result' => $status,
  3188. ];
  3189. $isOk = $this->CompanyInterviewRepository->InterviewUpdate($data, $id, $company_id);
  3190. if (!$isOk) {
  3191. return response()->json(['status' => 0, 'msg' => "修改反馈结果失败!"]);
  3192. }
  3193. return response()->json(['status' => 1, 'msg' => "修改反馈结果成功!"]);
  3194. }
  3195. /**简历回收站
  3196. * @return array
  3197. */
  3198. public function recycle()
  3199. {
  3200. $user = auth('web-company')->user();
  3201. $page = 10;
  3202. $state_arr = ['1' => '合适', '2' => '不合适', '3' => '待定', '4' => '未接通'];
  3203. $resumeList = $this->PersonalJobsApplyRepository->recycle($user->id, $page);
  3204. return $result = [
  3205. 'result' => $resumeList,
  3206. 'state_arr' => $state_arr,
  3207. ];
  3208. }
  3209. /**删除收到的简历
  3210. * @param $id
  3211. * @return \Illuminate\Http\JsonResponse
  3212. */
  3213. public function destroyJobsApply($id)
  3214. {
  3215. if (!$id) {
  3216. return response()->json(['status' => 0, 'msg' => '请选择简历!']);
  3217. }
  3218. $ids = is_array($id) ? $id : explode(',', $id);
  3219. if ($this->PersonalJobsApplyRepository->destroyJobsApply($ids)) {
  3220. return response()->json(['status' => 1, 'msg' => '简历删除成功!']);
  3221. }
  3222. return response()->json(['status' => 0, 'msg' => '简历删除失败!']);
  3223. }
  3224. /**清空回收站
  3225. * @return \Illuminate\Http\JsonResponse
  3226. */
  3227. public function clearRecycle()
  3228. {
  3229. $company_id = auth('web-company')->user()->id;
  3230. if (!$company_id) {
  3231. return response()->json(['status' => 0, 'msg' => '参数错误!']);
  3232. }
  3233. if ($this->PersonalJobsApplyRepository->clearRecycle($company_id)) {
  3234. return response()->json(['status' => 1, 'msg' => '清空回收站成功!']);
  3235. }
  3236. return response()->json(['status' => 0, 'msg' => '清空回收站失败!']);
  3237. }
  3238. public function concern($request)
  3239. {
  3240. $user = auth('web-company')->user();
  3241. $where['company_id'] = $user->id;
  3242. $settr = $request->settr ? $request->settr : 0;
  3243. if ($settr) {
  3244. $where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
  3245. }
  3246. $param_array = array('settr');
  3247. $params = array();
  3248. if ($request->all()) {
  3249. foreach ($request->all() as $k => $v) {
  3250. if (in_array($k, $param_array)) {
  3251. $params[$k] = $v;
  3252. }
  3253. }
  3254. }
  3255. $page = 10;
  3256. $result = $this->personFocusComRepository->concern($where, $page);
  3257. //企业收藏的简历
  3258. $favoriteResume = $this->companyFavoriteRepository->findWhere(['company_id' => $user->id], ['resume_id'])->toArray();
  3259. $resumeId = array_column($favoriteResume, 'resume_id');
  3260. foreach ($result as $key => $val) {
  3261. $val->is_favorite = 0;
  3262. if ($val->resumes) {
  3263. if (in_array($val->resumes->id, $resumeId)) {
  3264. $val->is_favorite = 1;
  3265. }
  3266. if ($val->resumes->display_name == "2") {
  3267. $val->resumes->fullname = "N" . str_pad($val->resumes->id, 7, "0", STR_PAD_LEFT);
  3268. } elseif ($val->resumes->display_name == "3") {
  3269. if ($val->resumes->sex == 1) {
  3270. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
  3271. } elseif ($val->resumes->sex == 2) {
  3272. $val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
  3273. }
  3274. }
  3275. }
  3276. }
  3277. return $res = [
  3278. 'params' => $params,
  3279. 'result' => $result,
  3280. ];
  3281. }
  3282. public function concernDel($request, $user)
  3283. {
  3284. $yid = $request->y_id ? $request->y_id : 0;
  3285. if (!$yid) {
  3286. return response()->json(['status' => 0, 'msg' => "请选择删除的记录"]);
  3287. }
  3288. $ids = is_array($yid) ? $yid : explode(',', $yid);
  3289. if (false == $this->personFocusComRepository->concernDel($ids, $user->id)) {
  3290. return response()->json(['status' => 0, 'msg' => "删除记录失败"]);
  3291. }
  3292. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2038, $yid)) {
  3293. throw new \Exception("日志记失败!");
  3294. }
  3295. return response()->json(['status' => 1, 'msg' => "删除记录成功"]);
  3296. }
  3297. //导出Word简历
  3298. public function saveDocResume($resume_id, $user = null)
  3299. {
  3300. if (!$resume_id) {
  3301. throw new ResponseException('请选择简历!', '', 404);
  3302. }
  3303. $id = array($resume_id);
  3304. $sqlin = implode(",", $id);
  3305. if (!preg_match('/^(\d{1,10},)*(\d{1,10})$/', $sqlin)) {
  3306. return false;
  3307. }
  3308. //获取简历信息
  3309. $result = $this->ResumeRepository->getResumeList($id);
  3310. if (!$result->toArray()) {
  3311. return false;
  3312. }
  3313. $list = array();
  3314. foreach ($result as $k => $n) {
  3315. $memberInfo = $this->memberInfoRepository->findMemberInfo(array('uid' => $n->uid));//简历基本信息
  3316. $val = $n;
  3317. $val->education_list = $this->ResumeEducationRepository->getResumeEducationByResumeId($n->id); //教育经历
  3318. $val->work_list = $this->ResumeWorkRepository->getResumeWorkByResumeId($n->id); //工作经历
  3319. $val->training_list = $this->ResumeTrainRepository->getResumeTrainByResumeId($n->id); //培训经历
  3320. $val->language_list = $this->ResumeLanguageRepository->getResumeLanByResumeId($n->id); //语言能力
  3321. $val->credent_list = $this->ResumeCredentRepository->getResumeCredentByResumeId($n->id); //获得证书
  3322. $val->age = date("Y") - $memberInfo->birthday;
  3323. $val->education_cn = $memberInfo->education_cn; //学历
  3324. $val->experience_cn = $memberInfo->experience_cn; //工作经验
  3325. $val->sex_cn = $memberInfo->sex_cn; //性别
  3326. $val->marriage_cn = $memberInfo->marriage_cn; //婚姻状况
  3327. $val->residence_cn = $memberInfo->residence_cn ? $memberInfo->residence_cn : '保密';
  3328. $val->householdaddress_cn = $memberInfo->householdaddress_cn ? $memberInfo->householdaddress_cn : '保密';
  3329. $val->tagcn = preg_replace("/\d+/", '', $val->tag);
  3330. $val->tagcn = preg_replace('/\,/', '', $val->tagcn);
  3331. $val->tagcn = preg_replace('/\|/', '&nbsp;&nbsp;&nbsp;', $val->tagcn);
  3332. $member = $this->memberRepository->getMemberById($n->uid);
  3333. $val->last_login_time = date('Y-m-d', $member->last_login_time); // 最近登录时间
  3334. //处理联系信息
  3335. $val->has_down = false;
  3336. $val->is_apply = false;
  3337. $val->label_id = 0;
  3338. if ($user && $user->utype == 1) {
  3339. $user_id = $user->id;
  3340. $val->has_down = $this->companyDownResumeRepository->getDownResume(array('resume_id' => $val->id, 'company_uid' => $user_id));
  3341. $val->is_apply = $this->PersonalJobsApplyRepository->checkJobsApply($val->id, $user_id);
  3342. }
  3343. $val->show_contact = $this->getShowContact($val, $val->has_down, $val->is_apply, $user);
  3344. if ($val->show_contact === false) {
  3345. $val->telephone = contact_hide($memberInfo->phone, 2);
  3346. $val->email = contact_hide($memberInfo->email, 3);
  3347. $val->qq = contact_hide($memberInfo->qq, 4);
  3348. $val->weixin = contact_hide($memberInfo->weixin, 5);
  3349. if ($memberInfo->display_name == "2") {
  3350. $val->fullname = "N" . str_pad($val->id, 7, "0", STR_PAD_LEFT);
  3351. } elseif ($memberInfo->display_name == "3") {
  3352. if ($val->sex == 1) {
  3353. $val->fullname = cut_str($val->fullname, 1, 0, "先生");
  3354. } elseif ($val->sex == 2) {
  3355. $val->fullname = cut_str($val->fullname, 1, 0, "女士");
  3356. }
  3357. }
  3358. }
  3359. $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
  3360. if ($memberInfo->sex == 1) {
  3361. $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
  3362. }
  3363. 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)) {
  3364. $val->photosrc = public_data_path($avatar_default); //不显示
  3365. } else {
  3366. $val->photosrc = upload_asset($memberInfo->images); //显示
  3367. }
  3368. $list[] = $val;
  3369. }
  3370. //渲染word简历模板
  3371. $view_data = array(
  3372. 'list' => $list
  3373. );
  3374. $view_html = view('app.content.resume.word_resume', $view_data)->render();
  3375. $temp_path = "temp/" . uniqid() . '.doc';
  3376. Storage::disk('public')->put($temp_path, $view_html);
  3377. $filename = $val->fullname . "的个人简历.doc";
  3378. return response()->download(
  3379. Storage::disk('public')->path($temp_path),
  3380. $filename)->deleteFileAfterSend(true);
  3381. }
  3382. public function favorResume($resume_id, $user = null)
  3383. {
  3384. if (!$resume_id) {
  3385. throw new ResponseException("请选择简历!");
  3386. }
  3387. /*$user = auth('web-company')->user();*/
  3388. if (strpos($resume_id, ",")) {
  3389. $resume_id = explode(",", $resume_id);
  3390. }
  3391. if (is_array($resume_id)) {
  3392. return $this->addFavoritesBatch($resume_id, $user); //批量收藏简历
  3393. } else {
  3394. return $this->addOneFavor($resume_id, $user); //收藏单个简历
  3395. }
  3396. }
  3397. //批量收藏简历
  3398. public function addFavoritesBatch($resume_id, $com_user)
  3399. {
  3400. $num = 0;
  3401. $insert_data = array();
  3402. $inser_rid = array();
  3403. $stime = date('Y-m-d H:i:s', time());
  3404. foreach ($resume_id as $k => $v) {
  3405. $v = intval($v);
  3406. if (!$this->companyFavoriteRepository->findFavorite($v, $com_user->id)) {
  3407. $insert_data[] = array(
  3408. 'resume_id' => $v,
  3409. 'company_id' => $com_user->id,
  3410. 'created_at' => $stime,
  3411. 'updated_at' => $stime
  3412. );
  3413. $inser_rid[] = $v;
  3414. }
  3415. }
  3416. if (count($insert_data) == 0) {
  3417. return array('status' => 0, 'msg' => '收藏失败!您已收藏选择的简历!');
  3418. }
  3419. $rst = $this->companyFavoriteRepository->insertData($insert_data);
  3420. if ($rst) {
  3421. //添加会员日志
  3422. $this->memberLogRepository->createLog($com_user, 1018, [implode(',', $inser_rid), '', '']);
  3423. return array('status' => 1, 'i' => count($insert_data), 'msg' => '成功收藏' . count($insert_data) . '份简历!');
  3424. } else {
  3425. return array('status' => 0, 'msg' => '收藏简历失败!');
  3426. }
  3427. }
  3428. //收藏单个简历
  3429. public function addOneFavor($resume_id, $com_user)
  3430. {
  3431. //判断是否收藏过当前简历
  3432. $favor_info = $this->companyFavoriteRepository->findFavorite($resume_id, $com_user->id);
  3433. if ($favor_info) {
  3434. //return array('status'=>0,'msg'=>'收藏失败!您已收藏过该简历');
  3435. //取消收藏
  3436. $cancel_favor = $this->companyFavoriteRepository->cancelFavor(['resume_id' => $resume_id, 'company_id' => $com_user->id]);
  3437. if (!$cancel_favor) {
  3438. return array('status' => 0, 'msg' => '取消加入人才库失败!', 'data' => 'has');
  3439. } else {
  3440. return array('status' => 1, 'i' => 1, 'msg' => '取消加入人才库成功!', 'data' => 'has');
  3441. }
  3442. } else {
  3443. //添加数据
  3444. $stime = date('Y-m-d H:i:s', time());
  3445. $insert_data = array(
  3446. 'resume_id' => $resume_id,
  3447. 'company_id' => $com_user->id,
  3448. 'created_at' => $stime,
  3449. 'updated_at' => $stime
  3450. );
  3451. $rst = $this->companyFavoriteRepository->create($insert_data);
  3452. if ($rst === false) {
  3453. return array('status' => 0, 'msg' => '加入人才库失败!', 'data' => 'no');
  3454. } else {
  3455. $this->memberLogRepository->createLog($com_user, 1018, [$resume_id, '', '']);
  3456. return array('status' => 1, 'i' => 1, 'msg' => '加入人才库成功!', 'favor_id' => $rst->id, 'data' => 'no');
  3457. }
  3458. }
  3459. }
  3460. //获取指定条件的已收藏的简历
  3461. public function getFavoritesResumes($where)
  3462. {
  3463. $rst = $this->companyFavoriteRepository->getFavoritesResumes($where);
  3464. $list = array();
  3465. if ($rst->toArray()) {
  3466. foreach ($rst as $k => $v) {
  3467. $list[$v->resume_id] = $v;
  3468. }
  3469. }
  3470. return $list;
  3471. }
  3472. public function dealResumeAvator($member_info, $resume)
  3473. {
  3474. $default_avator = public_data_path('/data/upload/resource/no_photo_female.png');
  3475. if ($member_info) {
  3476. if ($member_info->sex == 1) {
  3477. $default_avator = public_data_path('/data/upload/resource/no_photo_male.png');
  3478. }
  3479. 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)) {
  3480. $resume_avator = $default_avator;
  3481. } else {
  3482. $resume_avator = upload_asset($member_info->images);
  3483. }
  3484. } else {
  3485. $resume_avator = $default_avator;
  3486. }
  3487. return $resume_avator;
  3488. }
  3489. public function dealResumeDisplayName($resume)
  3490. {
  3491. $member_info = $resume['memberInfos'];
  3492. if ($member_info) {
  3493. if ($member_info->display_name == '2') {
  3494. $fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
  3495. } elseif ($member_info->display_name == '3') {
  3496. if ($member_info->sex == 1) {
  3497. $fullname = cut_str($resume->fullname, 1, 0, "先生");
  3498. } else {
  3499. $fullname = cut_str($resume->fullname, 1, 0, "女士");
  3500. }
  3501. } else {
  3502. $fullname = $resume->fullname;
  3503. }
  3504. } else {
  3505. $fullname = $resume->fullname;
  3506. }
  3507. return $fullname;
  3508. }
  3509. public function dealResumeFields($list)
  3510. {
  3511. $favor_resumes = array();
  3512. $down_resumes = array();
  3513. if (auth('web-company')->check()) {
  3514. $favor_resumes = $this->getFavoritesResumes(array('company_id' => auth('web-company')->user()->id));
  3515. $down_resumes = $this->companyDownResumeRepository->getDowmResumes(array('company_uid' => auth('web-company')->user()->id));
  3516. }
  3517. foreach ($list as $k => $v) {
  3518. if ($favor_resumes && array_has($favor_resumes, $v->id)) {
  3519. $list[$k]->has_favor = 1;
  3520. } else {
  3521. $list[$k]->has_favor = 0;
  3522. }
  3523. if ($down_resumes && array_has($down_resumes, $v->id)) {
  3524. $list[$k]->has_down = 1;
  3525. } else {
  3526. $list[$k]->has_down = 0;
  3527. }
  3528. $resume_fileds = $this->dealResumes($v);
  3529. foreach ($resume_fileds as $i => $filed) {
  3530. $list[$k]->$i = $filed;
  3531. }
  3532. }
  3533. return $list;
  3534. }
  3535. public function dealResumes($resume_info)
  3536. {
  3537. $data['resume_avator'] = $this->dealResumeAvator($resume_info->memberInfos, $resume_info);
  3538. $data['resume_display_name'] = $this->dealResumeDisplayName($resume_info);
  3539. //薪资待遇
  3540. if ($resume_info->wage) {
  3541. $wage_categories = $this->CategoryRepository->getCategories();
  3542. if ($wage_categories) {
  3543. if (config('aix.system.site_other.site_other.site_salary') == 1) {
  3544. $data['wage_cn'] = array_has($wage_categories['AIX_wage_k'], [$resume_info['wage']]) ? $wage_categories['AIX_wage_k'][$resume_info['wage']] : '';
  3545. } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
  3546. $data['wage_cn'] = array_has($wage_categories['AIX_wage_c'], [$resume_info['wage']]) ? $wage_categories['AIX_wage_c'][$resume_info['wage']] : '';
  3547. }
  3548. }
  3549. } else {
  3550. $data['wage_cn'] = $this->dealWage($resume_info->wage, $resume_info->wage_min, $resume_info->wage_max);
  3551. }
  3552. return $data;
  3553. }
  3554. public function companyLabelResume($request)
  3555. {
  3556. $resume_id = $request->input('resume_id', 0);
  3557. $label = $request->input('label', 0);
  3558. $label_type = $request->input('label_type', 0);
  3559. $user = auth('web-company')->user();
  3560. $jobs_id = $request->jobs_id;
  3561. if ($label_type == 1) { //简历下载
  3562. $where = array('resume_id' => $resume_id, 'company_uid' => $user->id);
  3563. $data = $this->companyDownResumeRepository->getDownResume($where);
  3564. } else {
  3565. //职位下载
  3566. $where = array('resume_id' => $resume_id, 'jobs_id' => $jobs_id);
  3567. $data = $this->PersonalJobsApplyRepository->getOne($where);
  3568. }
  3569. if ($data) {
  3570. return $this->labelResume($data->id, $label_type, $user, $label);
  3571. } else {
  3572. return array('status' => '0', 'msg' => '参数错误!');
  3573. }
  3574. }
  3575. public function labelResume($id, $label_type, $user, $label)
  3576. {
  3577. $data['is_reply'] = $label;
  3578. $r = false;
  3579. if ($label_type == 1) {
  3580. $label_arr = $this->companyDownResumeRepository->getStateArr();
  3581. $down_where = array('id' => $id, 'company_uid' => $user->id);
  3582. $rst = $this->companyDownResumeRepository->updateData($down_where, $data);
  3583. $type = '1030';
  3584. } else {
  3585. $label_arr = $this->PersonalJobsApplyRepository->getStateArr();
  3586. $data['personal_look'] = 2;
  3587. $data['reply_time'] = time();
  3588. $old_apply_info = $this->PersonalJobsApplyRepository->getOne(array('id' => $id, 'is_reply' => 0));
  3589. $apply_where = array('id' => $id);
  3590. $rst = $this->PersonalJobsApplyRepository->setApply($apply_where, $data);
  3591. if ($old_apply_info && ($data['reply_time'] - strtotime($old_apply_info->created_at) <= 3600 * 24 * 3)) {
  3592. $r = true;
  3593. }
  3594. $type = '1029';
  3595. }
  3596. if ($rst === false) {
  3597. return array('status' => 0, 'msg' => '标记失败');
  3598. }
  3599. $label_text = array_has($label_arr, $label) ? $label_arr[$label] : '';
  3600. //添加日志记录
  3601. $this->memberLogRepository->createLog($user, $type, [$id, $label_text, '']);
  3602. return array('status' => 1, 'msg' => '标记成功', 'task' => $r);
  3603. }
  3604. public function dealAge($age)
  3605. {
  3606. $age_arr = array();
  3607. $categories = $this->CategoryService->getCategories(array('AIX_age' => 100));
  3608. if ($categories && array_has($categories, 'AIX_age')) {
  3609. $age_category = $categories['AIX_age'];
  3610. if ($age_category && array_get($age_category, $age)) {
  3611. $age_info = $age_category[$age]['demand'];
  3612. //处理年龄信息,获取最大年龄和最小年龄
  3613. if (preg_match_all('(\d+)', $age_info, $reg)) {
  3614. $reg = $reg[0];
  3615. if (count($reg) > 1) {
  3616. $max_age = date('Y', strtotime(' -' . $reg[0] . ' year'));
  3617. $min_age = date('Y', strtotime(' -' . $reg[1] . ' year'));
  3618. } else {
  3619. $min_age = date('Y', strtotime(' -' . $reg[0] . ' year'));
  3620. $max_age = '';
  3621. }
  3622. $age_arr = array('min_age' => $min_age, 'max_age' => $max_age);
  3623. }
  3624. }
  3625. }
  3626. return $age_arr;
  3627. }
  3628. public function getUserInfo($user, $resume_id)
  3629. {
  3630. $member = $this->memberInfoRepository->getMemberInfo($user->id);
  3631. $resume = $this->ResumeRepository->getPersonInfo($user->id);
  3632. $sign = $this->TaskLogRepository->getTaskLogCount($user->id, 3, $user->utype);
  3633. $applyJobs = $this->PersonalJobsApplyRepository->getApplyJobs($user->id, getJobsStatus());
  3634. $interview = $this->CompanyInterviewRepository->getInterview($user->id, getJobsStatus());
  3635. $viewResume = $this->ViewResumeRepository->getViewResume($resume_id);
  3636. $points = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
  3637. if (time() > strtotime(date('Y-m-d 06:00:00')) && time() <= strtotime(date('Y-m-d 12:00:00'))) {
  3638. $timeDate = '上午好!';
  3639. } elseif (time() > strtotime(date('Y-m-d 12:00:00')) && time() <= strtotime(date('Y-m-d 18:00:00'))) {
  3640. $timeDate = '下午好!';
  3641. } else {
  3642. $timeDate = '晚上好!';
  3643. }
  3644. return (object)['member' => $member, 'resume' => $resume, 'sign' => $sign, 'points' => $points, 'timeDate' => $timeDate, 'applyJobs' => $applyJobs, 'interview' => $interview, 'viewResume' => $viewResume];
  3645. }
  3646. public function incrementData($where, $num, $filed)
  3647. {
  3648. return $this->ResumeRepository->incrementData($where, $num, $filed);
  3649. }
  3650. public function getResumeInfo($resume_id)
  3651. {
  3652. return $this->ResumeRepository->getSuccessResumeByid(['id' => $resume_id], getResumeStatus());
  3653. }
  3654. public function getResumeAllInfo($resume_id)
  3655. {
  3656. if (!is_array($resume_id)) {
  3657. $resume_ids = explode(',', $resume_id);
  3658. }
  3659. if (count($resume_ids) > 1) {
  3660. return $this->ResumeRepository->getResumesWithInfo($resume_ids);
  3661. } else {
  3662. return $this->ResumeRepository->resumeShow($resume_id);
  3663. }
  3664. }
  3665. public function getPersonApply($where)
  3666. {
  3667. return $this->PersonalJobsApplyRepository->applyJobs($where);
  3668. }
  3669. public function clearResumeStick()
  3670. {
  3671. $PersonalServiceStickLog = PersonalServiceStickLog::where('endtime', '<', time())->get()->toArray();
  3672. $resume_id = array_unique(array_column($PersonalServiceStickLog, 'resume_id'));
  3673. return $resume_id;
  3674. }
  3675. public function clearResumeExpires()
  3676. {
  3677. return $this->ResumeRepository->clearResumeExpires();
  3678. }
  3679. public function resumeAutoRefresh()
  3680. {
  3681. $res = $this->queueAutoRefreshRepository->resumeAutoRefresh();
  3682. $resume_id = [];
  3683. if ($res) {
  3684. $resNum = config('aix.personal_set.per_set.per_set.refresh_resume_num');
  3685. foreach ($res as $val) {
  3686. if ($resNum == 0) {
  3687. $resume_id[] = $val['pid'];
  3688. } else {
  3689. if (Cache::has($val['uid'] . $val['utype'])) {
  3690. $value = Cache::get($val['uid'] . $val['utype']);
  3691. } else {
  3692. $value = 0;
  3693. }
  3694. if ($value < $resNum) {
  3695. $resume_id[] = $val['pid'];
  3696. }
  3697. }
  3698. }
  3699. }
  3700. return $resume_id;
  3701. }
  3702. public function resumeEntrust()
  3703. {
  3704. $res = $this->ResumeEntrustRepository->resumeEntrust();
  3705. if ($res) {
  3706. $apply_max = intval(config('aix.personal_set.per_set.per_set.apply_jobs_max'));
  3707. $apply_space = intval(config('aix.personal_set.per_set.per_set.apply_job_space'));
  3708. foreach ($res as $key => $val) {
  3709. $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();
  3710. if ($num >= intval($apply_max / 2)) {
  3711. continue;
  3712. }
  3713. $array = string_to_array(['.', ','], $val['resumes']['intention_jobs_id']);
  3714. $nuk = 2;
  3715. $inter_array = [];
  3716. foreach ($array as $k1 => $v1) {
  3717. if ($k1 == $nuk && !empty($v1)) {
  3718. $inter_array[] = $v1;
  3719. $nuk = $nuk + 3;
  3720. }
  3721. }
  3722. $jobs_id = array_unique($inter_array);
  3723. if ($jobs_id) {
  3724. if ($apply_space > 0) {
  3725. $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();
  3726. } else {
  3727. $personalJobsApply = PersonalJobsApply::where('resume_id', $val['resume_id'])->get()->toArray();
  3728. }
  3729. $job_array_id = [];
  3730. if (!empty($personalJobsApply)) {
  3731. $job_array_id = array_column($personalJobsApply, 'jobs_id');
  3732. }
  3733. $jobs = Jobs::whereIn('subclass', $jobs_id)->where('valid', 1)
  3734. ->where('display', 1)->whereIn('audit', getJobsStatus())->whereNotIn('id', $job_array_id)->orderBy('updated_at', 'desc')->get()->toArray();
  3735. if ($jobs) {
  3736. if ($apply_max > 0) {
  3737. foreach ($jobs as $key1 => $val1) {
  3738. if ($num >= intval($apply_max / 2)) {
  3739. break;
  3740. } else {
  3741. $num++;
  3742. PersonalJobsApply::create([
  3743. 'resume_id' => $val['resume_id'],
  3744. 'resume_name' => $val['resumes']['title'],
  3745. 'personal_uid' => $val['resumes']['uid'],
  3746. 'jobs_id' => $val1['id'],
  3747. 'jobs_name' => $val1['jobs_name'],
  3748. 'company_id' => $val1['company_id'],
  3749. 'company_name' => $val1['company_name'],
  3750. 'is_apply' => 2,
  3751. ]);
  3752. }
  3753. }
  3754. }
  3755. }
  3756. }
  3757. }
  3758. }
  3759. return true;
  3760. }
  3761. public function padResumeShow($id, $type = 1, $jobs_id = '', $user)
  3762. {
  3763. $request_all = \Illuminate\Support\Facades\Request::all();
  3764. $utype = 0;
  3765. $uid = 0;
  3766. $resume = $this->ResumeRepository->getResume($id);
  3767. if (!$resume) {
  3768. throw new ResponseException('简历不存在!', [], 404);
  3769. }
  3770. $subsite_type = Cache::get('subsite_type');
  3771. if ($subsite_type) {
  3772. check_url(Cache::get('subsite_id'), $resume->subsite_id); //判断分站是否可以访问
  3773. }
  3774. $resume->fullname_ = $resume->fullname;
  3775. $memberInfo = DB::table('member_infos')->where('uid', $resume->uid)->first(); //简历基本信息
  3776. $resume->education_cn = $memberInfo->education_cn; //学历
  3777. $resume->experience_cn = $memberInfo->experience_cn; //工作经验
  3778. $resume->sex_cn = $memberInfo->sex_cn;
  3779. //教育经历
  3780. $education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
  3781. $education = $this->getDuration($education);
  3782. $resume->education_list = $education;
  3783. //工作经历
  3784. $work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
  3785. $work = $this->getDuration($work);
  3786. $resume->work_list = $work;
  3787. $resume->work_count = count($work);
  3788. $work_duration = $this->totalWorkDuration($work); //工龄
  3789. $resume->work_duration = $work_duration;
  3790. //培训经历
  3791. $train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
  3792. $train = $this->getDuration($train);
  3793. $resume->training_list = $train;
  3794. //语言能力
  3795. $language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id);
  3796. $resume->language_list = $language;
  3797. //证书
  3798. $credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id);
  3799. $resume->credent_list = $credent;
  3800. //简历照片
  3801. $img_map = array(
  3802. array('resume_id', '=', $resume->id),
  3803. array('uid', '=', $resume->uid)
  3804. );
  3805. if (config('aix.personal_set.per_set.show_set.resume_img_display') == 1) {
  3806. $img_map[] = array('audit', '=', '2');
  3807. } else {
  3808. $img_map[] = array('audit', '<>', '0');
  3809. }
  3810. $images = DB::table('resume_imgs')->where($img_map)->get();
  3811. $resume->img_list = $images;
  3812. $resume->age = date("Y") - $memberInfo->birthday; //年龄
  3813. //tag
  3814. if ($resume->tag_cn) {
  3815. $tag_cn = explode(',', $resume->tag_cn);
  3816. $resume->tag_cn = $tag_cn;
  3817. } else {
  3818. $resume->tag_cn = array();
  3819. }
  3820. $resume->refreshtime_cn = daterange(time(), strtotime($resume->updated_at), 'Y-m-d', "#FF3300");
  3821. //判断手机、微信、邮箱是否验证
  3822. $members = DB::table('members')->where('id', $resume->uid)->first();
  3823. $resume->is_audit_mobile = $members->mobile_audit;
  3824. //处理附件简历链接地址
  3825. if ($resume->word_resume) {
  3826. $resume->word_resume_url = upload_asset($resume->word_resume);
  3827. }
  3828. //处理微信二维码
  3829. $resume->label_id = 0;
  3830. $resume->label_type = 0;
  3831. $resume->label_resume = '';
  3832. $down_resume = false;
  3833. $jobs_apply = false;
  3834. if ($user->utype == 1) {
  3835. $user_id = $user->id;
  3836. $down_resume = $this->companyDownResumeRepository->getDownResume(array('resume_id' => $resume->id, 'company_uid' => $user_id));
  3837. if ($jobs_id) {
  3838. //$jobs_apply = $this->PersonalJobsApplyRepository->checkJobsApply($resume->id, $user_id, $jobs_id);
  3839. $jobs_apply = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id, $jobs_id);
  3840. } else {
  3841. //$jobs_apply = $this->PersonalJobsApplyRepository->checkJobsApply($resume->id, $user_id);
  3842. $jobs_apply = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id);
  3843. }
  3844. }
  3845. $resume->label_arr = array();
  3846. //处理简历预览页面label 信息
  3847. if (array_get($request_all, 'from_down') == 1) {
  3848. $resume->label_arr = $this->companyDownResumeRepository->getStateArr();
  3849. $resume->label_resume = 'down';
  3850. $resume->label_type = 1;
  3851. $resume->label_id = $down_resume->is_reply;
  3852. } elseif (array_get($request_all, 'from_apply') == 1) {
  3853. $resume->label_arr = $this->PersonalJobsApplyRepository->getStateArr();
  3854. $resume->label_resume = 'apply';
  3855. $resume->label_type = 2;
  3856. $resume->label_id = $jobs_apply->is_reply;
  3857. }
  3858. if (!$jobs_id && $resume->label_resume == 'apply') {
  3859. $resume->label_resume = '';
  3860. }
  3861. $resume->show_contact = $this->getShowContact($resume, $down_resume, $jobs_apply, $user);
  3862. if ($type == 1) {
  3863. if ($resume->show_contact === false) { //处理联系信息
  3864. if ($memberInfo->display_name == "2") {
  3865. $resume->fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
  3866. } elseif ($memberInfo->display_name == "3") {
  3867. if ($resume->sex == 1) {
  3868. $resume->fullname = cut_str($resume->fullname, 1, 0, "先生");
  3869. } elseif ($resume->sex == 2) {
  3870. $resume->fullname = cut_str($resume->fullname, 1, 0, "女士");
  3871. }
  3872. }
  3873. $resume->telephone = contact_hide($memberInfo->phone, 2);
  3874. $resume->email = $memberInfo->email ? contact_hide($memberInfo->email, 3) : '';
  3875. $resume->qq = contact_hide($memberInfo->qq, 4);
  3876. $resume->weixin = contact_hide($memberInfo->weixin, 5);
  3877. }
  3878. }
  3879. $resume->telephone_ = $resume->telephone;
  3880. $resume->email_ = $resume->email;
  3881. //联系方式展现形式 -图形化
  3882. if (config('aix.personal_set.per_set.contact_type_set.contact_img_resume') == 2) {
  3883. $pwdhash = config('aix.system.site_other.site_other.pwb_hash');
  3884. if ($resume->telephone) {
  3885. $resume->telephone = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->telephone, $pwdhash), 'type' => 'phone')) . "' />";
  3886. }
  3887. if ($resume->email) {
  3888. $resume->email = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->email, $pwdhash), 'type' => 'email')) . "' />";
  3889. }
  3890. if ($resume->qq) {
  3891. $resume->qq = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->qq, $pwdhash), 'type' => 'qq')) . "' />";
  3892. }
  3893. if ($resume->weixin) {
  3894. $resume->weixin = "<img src='" . route('common.contact_img', array('text' => encrypt($resume->weixin, $pwdhash), 'type' => 'weixin')) . "' />";
  3895. }
  3896. }
  3897. $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
  3898. if ($memberInfo->sex == 1) {
  3899. $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
  3900. }
  3901. //1.照片为空
  3902. //2.照片主动不显示
  3903. //3.照片审核不通过
  3904. //4.先审核后显示:照片不是审核通过的(不等于1)
  3905. 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)) {
  3906. //不显示
  3907. $resume->photosrc = $avatar_default;
  3908. } else {
  3909. //显示
  3910. $resume->photosrc = upload_asset($memberInfo->images);
  3911. }
  3912. //期望薪资
  3913. $wage_categories = $this->CategoryRepository->getCategories();
  3914. if ($wage_categories) {
  3915. if (config('aix.system.site_other.site_other.site_salary') == 1) {
  3916. $resume->wage_cn = array_has($wage_categories['AIX_wage_k'], [$resume->wage]) ? $wage_categories['AIX_wage_k'][$resume->wage] : $resume->wage_cn;
  3917. } elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
  3918. $resume->wage_cn = array_has($wage_categories['AIX_wage_c'], [$resume->wage]) ? $wage_categories['AIX_wage_c'][$resume->wage] : $resume->wage_cn;
  3919. }
  3920. }
  3921. //期望职位
  3922. if (!$resume->intention_jobs) {
  3923. $job_cates = Cache::get('jobs_cate_list');
  3924. if (null === $job_cates) {
  3925. $job_cates = $this->CategoryJobsRepository->jobsCateInfoCache();
  3926. Cache::put('jobs_cate_list', $job_cates, '86400');
  3927. }
  3928. $i_ids = array();
  3929. if ($resume->intention_jobs_id) {
  3930. $i_ids = explode(',', $resume->intention_jobs_id);
  3931. }
  3932. $jobs_names = array();
  3933. if (count($i_ids) > 0) {
  3934. foreach ($i_ids as $key => $val) {
  3935. $intention_jobs_id_arr = explode('.', $val);
  3936. $count = count($intention_jobs_id_arr);
  3937. if ($count > 0) {
  3938. foreach ($intention_jobs_id_arr as $k => $v) {
  3939. if ($v && array_get($job_cates['id'], $v)) {
  3940. $jobs_names[$key] = $job_cates['id'][$v]['name'];
  3941. }
  3942. }
  3943. }
  3944. }
  3945. }
  3946. $resume->intention_jobs = implode('+', $jobs_names);
  3947. }
  3948. if (!$resume->trade_cn) {
  3949. $resume->trade_cn = '不限';
  3950. }
  3951. //企业用户 - 处理查看简历记录
  3952. if (auth('web-company')->check()) {
  3953. $view_where = array(
  3954. 'uid' => $user->id,
  3955. 'resume_id' => $resume->id
  3956. );
  3957. $view_log = $this->ViewResumeRepository->findViewResume($view_where);
  3958. $stime = date('Y-m-d H:i:s', time());
  3959. if ($view_log) {
  3960. $set_data = array(
  3961. 'created_at' => $stime
  3962. );
  3963. $this->ViewResumeRepository->update($set_data, $view_log->id);
  3964. } else {
  3965. $set_data = array(
  3966. 'uid' => $user->id,
  3967. 'resume_id' => $resume->id,
  3968. 'created_at' => $stime,
  3969. 'updated_at' => $stime
  3970. );
  3971. $this->ViewResumeRepository->create($set_data);
  3972. }
  3973. if ($jobs_id) {
  3974. $apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id, $jobs_id);
  3975. if ($apply_log) {
  3976. //企业对申请职位的简历设为已看
  3977. $set_where = array('id' => $apply_log->id, 'company_id' => $user->id);
  3978. $apply_data = array('personal_look' => 2);
  3979. $set_rst = $this->PersonalJobsApplyRepository->setApply($set_where, $apply_data);
  3980. //添加会员日志
  3981. if ($set_rst !== false) {
  3982. $user_info = array(
  3983. 'uid' => $user->id,
  3984. 'utype' => 1,
  3985. 'username' => $user->username,
  3986. 'ip' => ip2long(\Illuminate\Support\Facades\Request::getClientIp()),
  3987. 'log_address' => '本机地址'
  3988. );
  3989. $this->feedbackService->addMembersLog($user_info, '', '标记申请职位记录(职位id:' . $apply_log->id . ')');
  3990. }
  3991. }
  3992. }
  3993. }
  3994. //个人醒目标签
  3995. $PersonalServiceStickLog = PersonalServiceTagLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
  3996. if ($PersonalServiceStickLog) {
  3997. if ($PersonalServiceStickLog->endtime - time() > 0) {
  3998. $resume->strong_tag = $PersonalServiceStickLog->tag_cn;
  3999. }
  4000. }
  4001. $tag_logs = array();
  4002. if (auth('web-member')->user()) {
  4003. $uid = auth('web-member')->user()->id;
  4004. $utype = 2;
  4005. }
  4006. if ($user) {
  4007. $uid = $user->id;
  4008. $utype = 1;
  4009. }
  4010. $contentStatus = $this->CategoryService->connectStatus($resume->uid, $resume->id);
  4011. 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];
  4012. }
  4013. public function getPersonInfo($id)
  4014. {
  4015. $member = $this->memberRepository->getMemberById($id);
  4016. if (!$member) {
  4017. return array('status' => 0, 'error' => '简历不存在');
  4018. }
  4019. $default_resume = $this->getDefResume($member);
  4020. return array(
  4021. 'user' => $member,
  4022. 'resume' => $default_resume
  4023. );
  4024. }
  4025. public function getPersonAvator($user = array())
  4026. {
  4027. $avator = '';
  4028. if ($user) {
  4029. $memberInfo = $this->memberInfoRepository->getMemberInfo($user->id);
  4030. if ($memberInfo) {
  4031. $avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
  4032. if ($memberInfo->sex == 1) {
  4033. $avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
  4034. }
  4035. /*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)) {
  4036. $avator = $avatar_default;
  4037. } else {
  4038. $avator = upload_asset($memberInfo->images);
  4039. }*/
  4040. if ($memberInfo->images == '') {
  4041. $avator = $avatar_default;
  4042. } else {
  4043. $avator = upload_asset($memberInfo->images);
  4044. }
  4045. }
  4046. }
  4047. return $avator;
  4048. }
  4049. public function getDefResume($user)
  4050. {
  4051. return $this->ResumeRepository->getPersonInfo($user->id);
  4052. }
  4053. public function addPadResume($data)
  4054. {
  4055. //简历信息
  4056. if ($data['wage'] != 0) {
  4057. $resume_data['wage_cn'] = get_category($data['wage']);
  4058. $wage = explode('~', format_wage(get_category($data['wage'])));
  4059. if (isset($wage[1])) {
  4060. $resume_data['wage_max'] = intval($wage[1]);
  4061. }
  4062. $resume_data['wage_min'] = intval($wage[0]);
  4063. } else {
  4064. $resume_data['wage_cn'] = $data['wage_min'] . '~' . $data['wage_max'] . '/月';
  4065. }
  4066. if ($data['wage'] != -1) {
  4067. $data['wage_cn'] = get_category($data['wage']);
  4068. $wage = explode('~', format_wage(get_category($data['wage'])));
  4069. if (isset($wage[1])) {
  4070. $data['wage_max'] = intval($wage[1]);
  4071. }
  4072. $data['wage_min'] = intval($wage[0]);
  4073. } else {
  4074. $data['wage_cn'] = $data['wage_min'] . '~' . $data['wage_max'] . '/月';
  4075. }
  4076. $resume_data = [
  4077. 'display' => $data['display'],
  4078. 'audit' => 2,
  4079. 'title' => '简历' . date('Ymd'),
  4080. 'fullname' => $data['fullname'],
  4081. 'sex' => $data['sex'] == '男' ? 1 : 2,
  4082. 'sex_cn' => $data['sex'],
  4083. 'nature' => $data['nature'],
  4084. 'nature_cn' => get_category($data['nature']),
  4085. 'trade' => $data['trade'],
  4086. 'trade_cn' => get_category($data['trade']),
  4087. 'birthdate' => $data['birthdate'],
  4088. 'experience' => $data['experience'],
  4089. 'experience_cn' => get_category($data['experience']),
  4090. 'education' => $data['education'],
  4091. 'education_cn' => get_category($data['education']),
  4092. 'wage' => $data['wage'],
  4093. 'wage_min' => $data['wage_min'],
  4094. 'wage_max' => $data['wage_max'],
  4095. 'wage_cn' => $data['wage_cn'],
  4096. 'telephone' => $data['telephone'],
  4097. 'email' => $data['email'],
  4098. 'intention_jobs_id' => $data['intention_jobs_id'],
  4099. 'intention_jobs' => get_job_category_cn($data['intention_jobs_id']),
  4100. 'current' => $data['current'],
  4101. 'current_cn' => get_category($data['current']),
  4102. 'idcard' => $data['id_card'],
  4103. 'level' => 0,
  4104. 'complete_percent' => 40,
  4105. 'marriage' => 3,
  4106. 'marriage_cn' => '保密',
  4107. 'residence' => get_district_cn($data['residence']),
  4108. 'district' => $data['district'],
  4109. 'district_cn' => get_district_cn($data['district']),
  4110. 'subsite_id' => get_subsite_id(),
  4111. ];
  4112. if (empty($data['uid'])) {
  4113. //注册用户
  4114. $member_data = [
  4115. 'mobile' => $data['telephone'],
  4116. 'password' => substr($data['id_card'], -6),
  4117. 'utype' => 2,
  4118. 'reg_type' => 1,
  4119. 'reg_source' => 1,
  4120. 'id_card' => $data['id_card'],
  4121. ];
  4122. //用户信息
  4123. $member_info_data = [
  4124. 'realname' => $data['fullname'],
  4125. 'id_card' => $data['id_card'],
  4126. 'sex' => $data['sex'] == '男' ? 1 : 2,
  4127. 'sex_cn' => $data['sex'],
  4128. 'birthday' => $data['birthdate'],
  4129. 'email' => $data['email'],
  4130. 'phone' => $data['telephone'],
  4131. 'experience' => $data['experience'],
  4132. 'experience_cn' => get_category($data['experience']),
  4133. 'education' => $data['education'],
  4134. 'education_cn' => get_category($data['education']),
  4135. 'residence' => $data['residence'],
  4136. 'residence_cn' => get_district_cn($data['residence']),
  4137. 'card_t_cn' => $data['card_t_cn'],
  4138. ];
  4139. DB::beginTransaction();//检查数据库事务
  4140. try {
  4141. //注册
  4142. $member = $this->registerService->registerPerson($member_data);
  4143. $this->memberRepository->updateInfo($member->id, ['email' => $data['email']]);
  4144. //新建用户信息
  4145. $this->memberInfoRepository->updateInfo($member_info_data, $member->id);
  4146. //简历信息
  4147. $resume_data['uid'] = $member->id;
  4148. $resume = $this->ResumeRepository->resumeAdd($resume_data);
  4149. $subsiteDefault = [
  4150. 'subsite_id' => get_subsite_id(),
  4151. 'resume_id' => $resume->id
  4152. ];
  4153. SubsiteResume::insert($subsiteDefault);
  4154. //创建会员给积分
  4155. $reg_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'reg', 'status' => 1]);
  4156. $handsel['uid'] = $member->id;
  4157. $handsel['utype'] = 2;
  4158. $handsel['htype'] = 'reg';
  4159. $handsel['htype_cn'] = '注册账号';
  4160. $handsel['operate'] = 1;
  4161. $handsel['points'] = $reg_point;
  4162. $this->memberHandselRepository->addNew($handsel);
  4163. $user_info_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'user_info', 'status' => 1]);
  4164. $handsel['htype'] = 'user_info';
  4165. $handsel['htype_cn'] = '完善基本资料';
  4166. $handsel['points'] = $user_info_point;
  4167. $this->memberHandselRepository->addNew($handsel);
  4168. $verified_mobile_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'verified_mobile', 'status' => 1]);
  4169. $handsel['htype'] = 'verified_mobile';
  4170. $handsel['htype_cn'] = '验证手机';
  4171. $handsel['points'] = $verified_mobile_point;
  4172. $this->memberHandselRepository->addNew($handsel);
  4173. $points = $verified_mobile_point + $user_info_point + $reg_point;
  4174. $this->memberPointRepository->addNew(['uid' => $member->id, 'utype' => 2, 'points' => $points]);
  4175. //发送短信
  4176. $this->smsService->sendSms(
  4177. $data['telephone'],
  4178. Smser::TEMPLATE_SMS_QUICK_REGISTER,
  4179. [
  4180. 'sitename' => subsite_config('aix.system.site.site.site_name'),
  4181. 'username' => $data['telephone'],
  4182. 'password' => substr($data['id_card'], -6)
  4183. ]);
  4184. DB::commit();
  4185. return true;
  4186. } catch (\Exception $e) {
  4187. DB::rollback();
  4188. return false;
  4189. }
  4190. } else {
  4191. $resume_data['uid'] = $data['uid'];
  4192. $resume = $this->ResumeRepository->resumeAdd($resume_data);
  4193. $subsiteDefault = [
  4194. 'subsite_id' => get_subsite_id(),
  4195. 'resume_id' => $resume->id
  4196. ];
  4197. SubsiteResume::insert($subsiteDefault);
  4198. //发送短信
  4199. $this->smsService->sendSms(
  4200. $data['telephone'],
  4201. Smser::TEMPLATE_SMS_QUICK_REGISTER,
  4202. [
  4203. 'sitename' => subsite_config('aix.system.site.site.site_name'),
  4204. 'username' => $data['telephone'],
  4205. 'password' => substr($data['id_card'], -6)
  4206. ]);
  4207. if ($resume) {
  4208. return true;
  4209. } else {
  4210. return false;
  4211. }
  4212. }
  4213. }
  4214. public function resumeTpl($user, $resume_id)
  4215. {
  4216. if (empty($resume_id)) {
  4217. throw new ResponseException('简历不存在!');
  4218. }
  4219. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  4220. $array_id = array_column($res, 'id');
  4221. if (!in_array($resume_id, $array_id)) {
  4222. throw new ResponseException('简历不存在!');
  4223. }
  4224. $resume = $this->ResumeRepository->find($resume_id);
  4225. if (!$resume) {
  4226. throw new ResponseException('简历不存在!');
  4227. }
  4228. $tpl = $this->personTplRepository->getTplByUid(['uid' => $user->id]);
  4229. return ['tpl' => $tpl, 'resume_tpl' => $resume->tpl];
  4230. }
  4231. public function resumeTplUpdate($resume_id, $tpl, $user)
  4232. {
  4233. if (empty($resume_id)) {
  4234. throw new ResponseException('简历不存在!');
  4235. }
  4236. $res = Resume::where(['uid' => $user->id])->get()->toArray();
  4237. $array_id = array_column($res, 'id');
  4238. if (!in_array($resume_id, $array_id)) {
  4239. throw new ResponseException('简历不存在!');
  4240. }
  4241. if (empty($tpl)) {
  4242. throw new ResponseException('模版不存在!');
  4243. }
  4244. if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2007, [$resume_id, $tpl])) {
  4245. throw new \Exception("日志记失败!");
  4246. }
  4247. return $this->ResumeRepository->update(['tpl' => $tpl], $resume_id);
  4248. }
  4249. public function incrementTplPoints($user, $input)
  4250. {
  4251. if (empty($input['tplid'])) {
  4252. throw new ResponseException('请选择模版!');
  4253. }
  4254. if (empty($input['payment_name']) || $input['payment_name'] != 'points') {
  4255. throw new ResponseException('请选择积分兑换!');
  4256. }
  4257. $tpl = $this->tplRepository->find($input['tplid']);
  4258. if (!$tpl) {
  4259. throw new ResponseException('简历模版不存在!');
  4260. }
  4261. $POINTS = $this->memberPointRepository->getPointsById($user->id, $user->utype);
  4262. if ($POINTS) {
  4263. if ($POINTS->points < $tpl->price) {
  4264. throw new ResponseException('积分不足!', '', 400);
  4265. }
  4266. } else {
  4267. throw new ResponseException('积分不存在!', '', 400);
  4268. }
  4269. $personTpl = $this->personTplRepository->getTpl(['uid' => $user->id, 'tplid' => $input['tplid']]);
  4270. if ($personTpl) {
  4271. throw new ResponseException('该模版已经购买!', '', 400);
  4272. }
  4273. DB::beginTransaction();//检查数据库事务
  4274. try {
  4275. $this->personTplRepository->create(['uid' => $user->id, 'tplid' => $input['tplid']]);
  4276. MembersPoint::where(
  4277. ['uid' => $user->id, 'utype' => $user->utype]
  4278. )->decrement('points', $tpl->price);
  4279. MembersHandsel::create(
  4280. ['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => '简历模版', 'operate' => 2, 'points' => $tpl->price]
  4281. );
  4282. $order = new Order();
  4283. $order->uid = $user->id;
  4284. $order->utype = $user->utype;
  4285. $order->order_type = 5;
  4286. $order->pay_type = 1;
  4287. $order->is_pay = 2;
  4288. $order->amount = $tpl->points / config('aix.system.site_other.site_other.points_match');
  4289. $order->pay_points = $tpl->price;
  4290. $order->payment = 'points';
  4291. $order->payment_cn = '积分';
  4292. $order->discount = '简历模版';
  4293. $order->service_name = $tpl->name;
  4294. $order->description = '购买服务:简历模板(' . $tpl->name . ')';
  4295. $order->payment_time = time();
  4296. $input['uid'] = $user->id;
  4297. $input['utype'] = $user->utype;
  4298. $order->charge = json_encode($input);
  4299. $order->save();
  4300. $PayService = new PayService();
  4301. $order->oid = $PayService->getTradeNo($order->id);
  4302. $order->save();
  4303. DB::commit();
  4304. return ['code' => 1, 'info' => '兑换成功!'];
  4305. } catch (\Exception $e) {
  4306. DB::rollback();
  4307. return ['code' => 0, 'info' => $e->getMessage()];
  4308. }
  4309. }
  4310. public function incrementTplPay($user, $input, $route)
  4311. {
  4312. $tplid = intval($input['tplid']);
  4313. if (empty($tplid)) {
  4314. throw new ResponseException('模板文件丢失!');
  4315. }
  4316. $tpl = $this->tplRepository->find($tplid);
  4317. if (!$tpl) {
  4318. throw new ResponseException('模板文件丢失!');
  4319. }
  4320. $personTpl = $this->personTplRepository->getTpl(['uid' => $user->id, 'tplid' => $tplid]);
  4321. if ($personTpl) {
  4322. throw new ResponseException('该模板已购买过!');
  4323. }
  4324. $paymenttpye = $this->paymentService->returnPayment($input['payment_name']);
  4325. if (!$paymenttpye) {
  4326. throw new ResponseException('支付方式错误!');
  4327. }
  4328. if (is_weixin()) {
  4329. $type = 'wap';
  4330. } else {
  4331. if (strpos($route->uri, 'mobile') !== false) {
  4332. $type = 'wap';
  4333. } else {
  4334. if ($input['payment_name'] == 'wechat') {
  4335. $type = 'scan';
  4336. } else {
  4337. $type = 'web';
  4338. }
  4339. }
  4340. }
  4341. $order = new Order();
  4342. $order->pay_type = 2;
  4343. $order->amount = $input['amount'];
  4344. $order->pay_points = 0;
  4345. $is_deductible = '支付金额:' . $input['amount'] . '元';
  4346. $order->description = '购买服务:简历模板(' . $tpl->name . ')' . $is_deductible;
  4347. $order->discount = '简历模板';
  4348. $order->service_name = $tpl->name;
  4349. $order->order_type = 5;
  4350. $order->pay_amount = $input['amount'];
  4351. $order->payment = $input['payment_name'];
  4352. if ($input['payment_name'] == 'alipay') {
  4353. $order->payment_cn = '支付宝';
  4354. } elseif ($input['payment_name'] == 'wechat') {
  4355. $order->payment_cn = '微信';
  4356. } else {
  4357. $order->payment_cn = '线下转账';
  4358. }
  4359. $input['uid'] = $user->id;
  4360. $input['utype'] = $user->utype;
  4361. $order->charge = json_encode($input);
  4362. $order->uid = $user->id;
  4363. $order->utype = $user->utype;
  4364. $order->save();
  4365. $tradeNo = $this->payService->getTradeNo($order->id);
  4366. $payOrder = new PayOrder();
  4367. $payOrder->trade_no = $tradeNo;
  4368. $payOrder->subject = '简历模板';
  4369. $payOrder->detail = $order->description;
  4370. $payOrder->price = $input['amount'];
  4371. $payOrder->callback = "App\Services\Common\OrderService.incrementPersonTplUpdate";
  4372. if ($type == 'web') {
  4373. $payOrder->return_url = route('person.resume');
  4374. }
  4375. if ($type == 'wap') {
  4376. if ($input['payment_name'] == 'wechat') {
  4377. $payOrder->return_url = route('mobile.common.orderWechat', ['oid' => $payOrder->trade_no]);
  4378. } else {
  4379. $payOrder->return_url = route('mobile.person.resume');
  4380. }
  4381. }
  4382. $result = $this->payService->pay($input['payment_name'], $type, $payOrder);
  4383. $order->oid = $payOrder->trade_no;
  4384. if ($user->email) {
  4385. $this->emailService->sendMail($user->email, EmailService::TEMPLATE_MAIL_ORDER, [], ['oid' => $order->oid, 'paymenttpye' => $order->payment_cn, 'amount' => $order->amount, 'sitedomain' => route('person.index')]);
  4386. }
  4387. $order->save();
  4388. if ($input['payment_name'] == 'wechat') {
  4389. if ($type == 'wap') {
  4390. return [
  4391. 'code' => 'wechat',
  4392. 'tradeCode' => $result,
  4393. 'type' => $type
  4394. ];
  4395. } else {
  4396. return [
  4397. 'code' => 'wechat',
  4398. 'tradeCode' => get_qrcode_html($result->code_url),
  4399. 'tradeNo' => [
  4400. 'number' => $payOrder->trade_no,
  4401. ],
  4402. 'type' => $type
  4403. ];
  4404. }
  4405. } elseif ($input['payment_name'] == 'alipay') {
  4406. return [
  4407. 'code' => 'alipay',
  4408. 'tradeCode' => $result,
  4409. ];
  4410. } else {
  4411. return [
  4412. 'code' => 'offline',
  4413. 'tradeNo' => $tradeNo
  4414. ];
  4415. }
  4416. }
  4417. public function resumeDisplay($display, $id, $user)
  4418. {
  4419. if (empty($display) && $display != 0) {
  4420. throw new ResponseException('简历状态错误!');
  4421. }
  4422. if (empty($id)) {
  4423. throw new ResponseException('简历不存在!');
  4424. }
  4425. self::isOwn($id, $user);
  4426. return $this->ResumeRepository->updateById(['display' => $display], $id);
  4427. }
  4428. public function resumeEntrustByAdmin($company_arr,$ids,$admin_name)
  4429. {
  4430. $res = $this->ResumeEntrustRepository->resumeEntrust();
  4431. if($res){
  4432. $apply_max = intval(config('aix.personal_set.per_set.per_set.apply_jobs_max'));
  4433. $apply_space = intval(config('aix.personal_set.per_set.per_set.apply_job_space'));
  4434. foreach ($res as $key=>$val) {
  4435. $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();
  4436. if($num >= intval($apply_max/2)){
  4437. continue;
  4438. }
  4439. $array = string_to_array(['.',','], $val['resumes']['intention_jobs_id']);
  4440. $nuk = 2;
  4441. $inter_array = [];
  4442. foreach ($array as $k1=>$v1) {
  4443. if($k1==$nuk && !empty($v1)){
  4444. $inter_array[] = $v1;
  4445. $nuk = $nuk+3;
  4446. }
  4447. }
  4448. $jobs_id = array_unique($inter_array);
  4449. if($jobs_id){
  4450. if($apply_space>0){
  4451. $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();
  4452. }else{
  4453. $personalJobsApply = PersonalJobsApply::where('resume_id',$val['resume_id'])->get()->toArray();
  4454. }
  4455. $job_array_id = [];
  4456. if(!empty($personalJobsApply)){
  4457. $job_array_id = array_column($personalJobsApply,'jobs_id');
  4458. }
  4459. $jobs = Jobs::whereIn('subclass', $jobs_id)->where('valid',1)
  4460. ->where('display',1)->whereIn('audit', getJobsStatus())->whereIn('company_id', $company_arr)->whereNotIn('id', $job_array_id)->orderBy('updated_at', 'desc')->get()->toArray();
  4461. if($jobs){
  4462. if($apply_max>0){
  4463. foreach ($jobs as $key1=>$val1) {
  4464. if($num >= intval($apply_max/2)){
  4465. break;
  4466. }else{
  4467. $num++;
  4468. PersonalJobsApply::create([
  4469. 'resume_id'=>$val['resume_id'],
  4470. 'resume_name'=>$val['resumes']['title'],
  4471. 'personal_uid'=>$val['resumes']['uid'],
  4472. 'jobs_id'=>$val1['id'],
  4473. 'jobs_name'=>$val1['jobs_name'],
  4474. 'company_id'=>$val1['company_id'],
  4475. 'company_name'=>$val1['company_name'],
  4476. 'is_apply'=>2,
  4477. ]);
  4478. $info['talents_id'] = $ids;
  4479. $info['log_class'] = 7;//日志类型
  4480. $info['content'] = $admin_name . "向‘" . $val1['company_name'] . "’企业推送了此人才简历,推送成功";
  4481. $info['log_time'] = time();
  4482. $info['auth_man'] = $admin_name;
  4483. PersonalTalentsLog::create($info);
  4484. }
  4485. }
  4486. }
  4487. }
  4488. }
  4489. }
  4490. }
  4491. return true;
  4492. }
  4493. //验证是否是自己的简历
  4494. public function isOwn($resume_id, $user)
  4495. {
  4496. $resume = $this->ResumeRepository->getOneResume(['id' => $resume_id]);
  4497. if (!$resume) {
  4498. throw new ResponseException('简历不存在!');
  4499. }
  4500. if ($resume->uid != $user->id) {
  4501. throw new ResponseException('对不起,您只能操作自己的简历!');
  4502. }
  4503. }
  4504. }