| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 | <?phpnamespace App\Http\Controllers\Web\Person;use App\Http\Controllers\Web\WebBaseController;use App\Models\PersonJobsSubscribe;use App\Models\Resume;use App\Services\Common\CategoryService;use App\Services\Person\PersonFavoriteService;use App\Services\Person\ResumeService;use App\Validators\PersonValidatorRequest;class PersonFavoriteController extends WebBaseController{    /**     * @var PersonFavoriteService     */    protected $PersonFavoriteService;    protected $resumeService;    protected $categoryService;    /**     * PersonFavoriteController constructor.     * @param PersonFavoriteService $PersonFavoriteService     * @param ResumeService $resumeService     * @param CategoryService $categoryService     */    public function __construct(PersonFavoriteService $PersonFavoriteService, ResumeService $resumeService, CategoryService $categoryService)    {        $this->PersonFavoriteService = $PersonFavoriteService;        $this->resumeService = $resumeService;        $this->categoryService = $categoryService;    }    public function jobsF()    {        $res = $this->PersonFavoriteService->jobsF(auth('web-member')->user());        return view('app.person.jobs_favorite', ['content'=>$res]);    }    public function delPersonFavorite()    {        if (request()->method()=='POST') {            $res = $this->PersonFavoriteService->delPersonFavorite(request()->id,auth('web-member')->user());            if ($res) {                return $this->sendSuccessResponse('删除成功');            } else {                return $this->sendErrorResponse('删除失败');            }        } else {            return view('app.person.ajax.resume_delete', ['tpis'=>'删除后将无法恢复,您确定要删除选中的收藏职位吗?']);        }    }    public function resumeApply()    {        if (request()->method()=='POST') {            $res = $this->PersonFavoriteService->resumeApply(request()->all(), auth('web-member')->user());            if ($res['code']==1) {                return $this->sendSuccessResponse($res['info']);            } else {                return $this->sendErrorResponse($res['info']);            }        } else {            $timeG = config('aix.personal_set.per_set.per_set.apply_job_space');            if ($timeG>0) {                $res = $this->resumeService->getSuccessResumeCount(auth('web-member')->user());                if ($res['code']==0) {                    return json_encode(['code'=>0,'info'=>$res['info']]);                } elseif ($res['code']==1) {                    $html = view('app.person.ajax.apply_resume', ['resume'=>$res['info'],'timeG'=>$timeG])->render();                    return json_encode(['code'=>1,'info'=>$html]);                } else {                    $html = view('app.person.ajax.resume_tip', ['resume'=>$res['info'],'tpis'=>$timeG.'天内已投递的职位不再投递!'])->render();                    return json_encode(['code'=>1,'info'=>$html]);                }            } else {                return json_encode(['code'=>0,'info'=>'投递功能已关闭!']);            }        }    }    public function attentionCom()    {        $res = $this->PersonFavoriteService->attentionCom(auth('web-member')->user());        return view('app.person.attention_com', ['content'=>$res]);    }    public function deleteCompany()    {        $res = $this->PersonFavoriteService->deleteCompany(request()->id,auth('web-member')->user());        if ($res) {            return $this->sendSuccessResponse('删除成功');        } else {            return $this->sendErrorResponse('删除失败');        }    }    public function getJobsSub()    {        $res = $this->PersonFavoriteService->getJobsSub();        $count = $this->PersonFavoriteService->getCount();        return view('app.person.attention_sub', ['content'=>$res,'count'=>$count]);    }    public function getJobsSubEdit()    {        $back_url = \Illuminate\Support\Facades\URL::previous();        if(request()->id){            $sub_info = PersonJobsSubscribe::find(request()->id);            if(!$sub_info){                return $this->showMessage('对不起,您只能查看自己的职位订阅器!', $back_url, true, '上一页', '3');            }            if($sub_info->uid!=auth('web-member')->user()->id){                return $this->showMessage('对不起,您只能查看自己的职位订阅器!', $back_url, true, '上一页', '3');            }        }        $res = $this->PersonFavoriteService->getJobsSubEdit(request()->id);        $district = $this->categoryService->getDefaultDistrict();        return view('app.person.attention_sub_edit', ['content'=>$res['sub'],'defaultCity'=>$district->defaultCity]);    }    public function getJobsSubAdd(PersonValidatorRequest $request)    {        if($request->id) {            $id = $request->id;            $user = auth('web-member')->user();            $this->PersonFavoriteService->isOwn($id,$user);        }        $res= $this->PersonFavoriteService->getJobsSubAdd($request->all(), auth('web-member')->user());        if ($res) {            return $this->sendSuccessResponse('更新成功');        } else {            return $this->sendErrorResponse('更新失败');        }    }    public function getJobsSubout()    {        $id = request()->get('id');        $user = auth('web-member')->user();        $this->PersonFavoriteService->isOwn($id,$user);        $res= $this->PersonFavoriteService->getJobsSubout(request()->all());        if ($res['code']==1) {            return $this->sendSuccessResponse($res['data']);        } else {            return $this->sendErrorResponse('退订失败');        }    }    public function getJobsAddVar()    {        $res= $this->PersonFavoriteService->getJobsAddVar();        if ($res) {            return $this->sendSuccessResponse('ok');        } else {            return $this->sendErrorResponse('您最多可以添加 5 个职位订阅器');        }    }    public function getJobsSubDel()    {        if (request()->method()=='POST') {            $id = request()->get('id');            $user = auth('web-member')->user();            $this->PersonFavoriteService->isOwn($id,$user);            $res= $this->PersonFavoriteService->getJobsSubDel(request()->id);            if ($res) {                return $this->sendSuccessResponse('删除成功');            } else {                return $this->sendErrorResponse('删除失败');            }        } else {            return view('app.person.ajax.resume_delete', ['tpis'=>'删除后将无法恢复,您确定要删除该订阅器吗?']);        }    }}
 |