| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838 | 
							- <?php
 
- /**
 
-  * Created by PhpStorm.
 
-  * User: michaelwu
 
-  * Date: 2018/10/31
 
-  * Time: 10:02
 
-  */
 
- namespace App\Http\Controllers\Web\Company;
 
- use Aix\Sms\Contracts\Smser;
 
- use App\Http\Controllers\Web\WebBaseController;
 
- use App\Models\ZhoushanData;
 
- use App\Repositories\AuditReasonsRepository;
 
- use App\Repositories\MemberLogRepository;
 
- use App\Services\Common\EmailService;
 
- use App\Services\Common\SmsService;
 
- use App\Services\Common\TaskService;
 
- use App\Services\Company\CompanyConsultantService;
 
- use App\Services\Company\CompanyImgService;
 
- use App\Services\Company\CompanyService;
 
- use App\Services\Company\JobsService;
 
- use App\Services\Common\SearchService;
 
- use App\Services\Organization\OrganizationService;
 
- use App\Services\Organization\ServiceService;
 
- use App\Services\Company\DispensingService;
 
- use App\Validators\CompanyValidatorRequest;
 
- use Illuminate\Http\Request;
 
- use Illuminate\Support\Facades\Cache;
 
- use Illuminate\Support\Facades\DB;
 
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
 
- use Illuminate\Support\Facades\Validator;
 
- class CompanyController extends WebBaseController
 
- {
 
-     protected $companyService;
 
-     protected $companyImgService;
 
-     protected $auditReasonsRepository;
 
-     protected $emailService;
 
-     protected $smsService;
 
-     protected $jobsService;
 
-     protected $taskService;
 
-     protected $searchService;
 
-     protected $recommend_limit;
 
-     protected $recommend_need_limit;
 
-     protected $companyConsultantService;
 
-     protected $memberLogRepository;
 
-     protected $organizationService;
 
-     protected $serviceService;
 
-     protected $dispensingService;
 
-     /**
 
-      * CompanyController constructor.
 
-      * @param $companyService
 
-      * @param $companyImgService
 
-      * @param $auditReasonsRepository
 
-      * @param $emailService
 
-      * @param $smsService
 
-      * @param $jobsService
 
-      * @param $taskService
 
-      * @param $searchService
 
-      */
 
-     public function __construct(MemberLogRepository $memberLogRepository, CompanyService $companyService, TaskService $taskService, JobsService $jobsService, SmsService $smsService, EmailService $emailService, CompanyImgService $companyImgService, AuditReasonsRepository $auditReasonsRepository, SearchService $searchService, CompanyConsultantService $companyConsultantService, OrganizationService $organizationService, ServiceService $serviceService, DispensingService $dispensingService)
 
-     {
 
-         $this->companyService           = $companyService;
 
-         $this->companyImgService        = $companyImgService;
 
-         $this->auditReasonsRepository   = $auditReasonsRepository;
 
-         $this->emailService             = $emailService;
 
-         $this->smsService               = $smsService;
 
-         $this->jobsService              = $jobsService;
 
-         $this->taskService              = $taskService;
 
-         $this->searchService            = $searchService;
 
-         $this->recommend_limit          = 10;
 
-         $this->recommend_need_limit     = 50;
 
-         $this->companyConsultantService = $companyConsultantService;
 
-         $this->memberLogRepository      = $memberLogRepository;
 
-         $this->organizationService      = $organizationService;
 
-         $this->serviceService           = $serviceService;
 
-         $this->dispensingService        = $dispensingService;
 
-     }
 
-     //会员中心
 
-     public function index()
 
-     {
 
-         $user       = auth('web-company')->user();
 
-         $res        = $this->companyService->index($user);
 
-         $jobs_total = $this->jobsService->jobsTotal($user->id);
 
-         if (Cache::has('recommend_click_resumes_' . get_subsite_id())) {
 
-             Cache::forget('recommend_click_resumes_' . get_subsite_id());
 
-         }
 
-         //用于匹配简历的职位
 
-         $recommend_rst            = $this->getRecommendResumes($this->recommend_limit);    //获取推荐简历
 
-         $res['recommend_resumes'] = $recommend_rst['resumes'];
 
-         $res['match_job']         = $recommend_rst['match_job'];
 
-         $res['jobsCount']         = $jobs_total;
 
-         $res['has_job']           = $recommend_rst['has_job'];
 
-         $res['consultant']        = $this->companyConsultantService->getCompanyConsultant(auth('web-company')->user());
 
-         return view('app.company.company_index', $res);
 
-     }
 
-     //薪动餐饮
 
-     public function join(Request $request)
 
-     {
 
-         $status = $request->input('status');
 
-         $user   = auth('web-company')->user();
 
-         DB::table('companys')->where('id', $user->id)->update(['is_restaurant' => $status]);
 
-         return response()->json(['code'=>0,'message'=>'操作成功']);
 
-     }
 
-     public function ajaxSms()
 
-     {
 
-         $res = $this->companyService->ajaxSms(auth('web-company')->user());
 
-         if ($res['id']) {
 
-             $html           = view('app.company.ajax.ajax_sms', ['info' => $res['message']])->render();
 
-             $res['message'] = $html;
 
-             return response()->json($res);
 
-         }
 
-         return response()->json($res);
 
-     }
 
-     public function getRecommendResumes($limit = 10)
 
-     {
 
-         $need_limit      = $this->recommend_need_limit;
 
-         $list            = [];
 
-         $user            = auth('web-company')->user();
 
-         $has_job         = 1;
 
-         $recommend_order = $this->companyService->getRecommendorder($user);
 
-         $recommend_where = $this->companyService->getRecommendWhere($user);
 
-         if ($recommend_where) {
 
-             //添加30天的时间限制
 
-             $recommend_where['and'][] = ['updated_at', '>=', date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-30 day"))))];
 
-             $recommend_resume_lists = $this->searchService->getRecommends($user, 'Resume', $recommend_where, $recommend_order, '', $limit);
 
-             $rids                   = $recommend_resume_lists->pluck('id')->toArray();
 
-             if ($recommend_resume_lists->total() >= $limit) {
 
-                 $list = array_slice($recommend_resume_lists->items(), 0, $limit);
 
-             } else {
 
-                 //获取点击量高的简历
 
-                 $click_where   = $this->companyService->getRecommendResumeWhere([]);
 
-                 $click_resumes = $this->searchService->search('Resume', $click_where, $recommend_order, '', $need_limit);
 
-                 $click_resumes = $click_resumes->items();
 
-                 Cache::forever('recommend_click_resumes_' . get_subsite_id(), $click_resumes);
 
-                 //去除已有简历
 
-                 if ($click_resumes && $rids) {
 
-                     foreach ($click_resumes as $k => $v) {
 
-                         if (in_array($v->id, $rids)) {
 
-                             unset($click_resumes[$k]);
 
-                         }
 
-                     }
 
-                 }
 
-                 $recommend_resumes = $recommend_resume_lists->items();
 
-                 $recommend_total   = $recommend_resume_lists->total();
 
-                 $need_resumes      = array_slice($click_resumes, 0, $need_limit - $recommend_total);
 
-                 $all_resumes       = array_merge($recommend_resumes, $need_resumes);
 
-                 $list              = array_slice($all_resumes, 0, $limit);
 
-             }
 
-         } else {
 
-             //没有可匹配的职位
 
-             $has_job = 0;
 
-         }
 
-         return [
 
-             'resumes'   => $list,
 
-             'match_job' => [],
 
-             'has_job'   => $has_job,
 
-         ];
 
-     }
 
-     public function ajaxGetRecommendResumes(Request $request)
 
-     {
 
-         $limit      = $this->recommend_limit;
 
-         $need_limit = $this->recommend_need_limit;
 
-         $page       = $request->input('page');
 
-         $has_job    = 1;
 
-         $user       = auth('web-company')->user();
 
-         $order_by   = $this->companyService->getRecommendorder($user);
 
-         $list       = [];
 
-         $recommend_where = $this->companyService->getRecommendWhere($user);
 
-         if ($recommend_where) {
 
-             $recommend_where['and'][] = ['updated_at', '>=', date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-30 day"))))];
 
-             $recommend_resume_lists = $this->searchService->getRecommends($user, 'Resume', $recommend_where, $order_by, '', $need_limit, 1);
 
-             $rids                   = $recommend_resume_lists->pluck('id')->toArray();
 
-             $next_page              = (int)$page + 1;
 
-             if ($recommend_resume_lists->total() >= $next_page * $limit) {
 
-                 $list = array_slice($recommend_resume_lists->items(), $page * $limit, $limit);
 
-             } else {
 
-                 $click_resumes = Cache::get('recommend_click_resumes_' . get_subsite_id());
 
-                 if ($click_resumes === null) {
 
-                     $click_resumes = $this->searchService->getClickResumes($order_by, [], $need_limit);
 
-                     Cache::forever('recommend_click_resumes_' . get_subsite_id(), $click_resumes);
 
-                 }
 
-                 if ($click_resumes && $rids) {
 
-                     foreach ($click_resumes as $k => $v) {
 
-                         if (in_array($v->id, $rids)) {
 
-                             unset($click_resumes[$k]);
 
-                         }
 
-                     }
 
-                 }
 
-                 $recommend_resumes = $recommend_resume_lists->items();
 
-                 $recommend_total   = $recommend_resume_lists->total();
 
-                 $need_resumes      = array_slice($click_resumes, 0, $need_limit - $recommend_total);
 
-                 $all_resumes       = array_merge($recommend_resumes, $need_resumes);
 
-                 $list              = array_slice($all_resumes, $page * $limit, $limit);
 
-                 if (!$list) {
 
-                     $list      = array_slice($all_resumes, 0, $limit);
 
-                     $next_page = 1;
 
-                 }
 
-             }
 
-         } else {
 
-             $has_job = 0;
 
-         }
 
-         $match_job                = 0;
 
-         $recommend_rst['resumes'] = $list;
 
-         $recommend_rst['has_job'] = $has_job;
 
-         $html                     = view('app.company.ajax.ajax_resume_list', $recommend_rst)->render();
 
-         $return_data              = ['status' => 1, 'html' => $html, 'match_job' => $match_job, 'page' => $next_page];
 
-         return response()->json($return_data);
 
-     }
 
-     public function ajaxGetStatistics(Request $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->companyService->ajaxGetStatistics($request->all(), $user);
 
-     }
 
-     /**
 
-      *企业会员中心首页一键刷新职位
 
-      */
 
-     public function jobsRefreshAll()
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->jobsService->jobsRefreshAll($user);
 
-     }
 
-     /**企业信息
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      * @throws \App\Exceptions\ResponseException
 
-      */
 
-     public function companyInfo()
 
-     {
 
-         $user        = auth('web-company')->user();
 
-         $companyInfo = $this->companyService->companyInfo($user);
 
-         return view('app.company.company_info', $companyInfo);
 
-     }
 
-     /**
 
-      * @param CompanyValidatorRequest $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Throwable
 
-      */
 
-     public function companySave(CompanyValidatorRequest $request)
 
-     {
 
-         $data = $request->except('_method', '_token');
 
-         $res  = $this->companyService->companySave($data, auth('web-company')->user());
 
-         return response()->json($res);
 
-     }
 
-     /**修改企业手机==企业中心
 
-      * @param Request $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Throwable
 
-      */
 
-     public function modifyMobile(Request $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         if ($request->method() == 'GET') {
 
-             $mobile = $this->companyService->authMobile($user);
 
-             return response()->json(['status' => 1, 'data' => view('app.company.ajax.ajax_auth_mobile', $mobile)->render()]);
 
-         }
 
-         return $this->companyService->verifyCode($request->mobile, $user);
 
-     }
 
-     /**
 
-      * @保存企业logo
 
-      * @param Request $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function attach(Request $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->companyService->saveLogo($request->all(), $user);
 
-     }
 
-     /**删除企业Logo
 
-      * @param Request $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function logoDel()
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->companyService->logoDel($user);
 
-     }
 
-     /**企业风采
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      */
 
-     public function companyImg()
 
-     {
 
-         $user = auth('web-company')->user();
 
-         $res  = $this->companyImgService->list($user->id);
 
-         return view('app.company.company_img', ['imgList' => $res]);
 
-     }
 
-     /**
 
-      * 保存企业风采
 
-      * @param Request $request
 
-      * @return mixed
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function saveImg(Request $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->companyImgService->saveImg($request->image, $user);
 
-     }
 
-     /**
 
-      * 修改备注模态框
 
-      * @param Request $request
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      * @throws \Throwable
 
-      */
 
-     public function remark(Request $request)
 
-     {
 
-         $res = $this->companyImgService->companyImg($request->id);
 
-         return $res;
 
-     }
 
-     /**
 
-      * 保存备注
 
-      * @param CompanyValidatorRequest $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      */
 
-     public function saveRemark(CompanyValidatorRequest $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->companyImgService->saveRemark($request, $user);
 
-     }
 
-     /**
 
-      * 删除企业风采
 
-      * @param $id
 
-      * @param Request $request
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
 
-      */
 
-     public function delImg($id, Request $request)
 
-     {
 
-         if ($request->type) {
 
-             $user = auth('web-company')->user();
 
-             return $this->companyImgService->delImg($id, $user);
 
-         }
 
-         $tip = '被删除后将无法恢复,您确定要删除该风采照片吗?';
 
-         return view('app.company.ajax.ajax_warning', ['tip' => $tip]);
 
-     }
 
-     /**
 
-      * 企业认证
 
-      * @param $anew
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      * @throws \App\Exceptions\ResponseException
 
-      */
 
-     public function companyAuth($anew = '')
 
-     {
 
-         $user                = auth('web-company')->user();
 
-         $companyInfo         = $this->companyService->getInfoById($user);
 
-         $companyInfo->reason = $this->auditReasonsRepository->getAuditReasons(auth('web-company')->user()->id, 8);
 
-         if ($anew == 'anew') {
 
-             $companyInfo->audit = 0;
 
-         }
 
-         return view('app.company.company_auth', ['companyInfo' => $companyInfo, 'anew' => $anew]);
 
-     }
 
-     public function certificate(Request $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         return $this->companyService->certificate($request->certificate_img_up, $user);
 
-     }
 
-     /**
 
-      *  账户安全
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      * @throws \App\Exceptions\ResponseException
 
-      */
 
-     public function companySecurity()
 
-     {
 
-         $user        = auth('web-company')->user();
 
-         $companyInfo = $this->companyService->companySecurity($user);
 
-         return view('app.company.company_security', $companyInfo);
 
-     }
 
-     /**企业登录日志
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      * @throws \App\Exceptions\ResponseException
 
-      */
 
-     public function loginLog()
 
-     {
 
-         $user                    = auth('web-company')->user();
 
-         $loginLog                = $this->companyService->companyLoginLog($user);
 
-         $companyInfo             = $user;
 
-         $companyInfo['loginLog'] = $loginLog;
 
-         return view('app.company.login_log', ['companyInfo' => $companyInfo]);
 
-     }
 
-     /**我的消息
 
-      * @param $request
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      */
 
-     public function companyPms(Request $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         $data = $request->all();
 
-         $res  = $this->companyService->comPms($data, $user);
 
-         return view('app.company.company_pms', $res);
 
-     }
 
-     public function pmsRead(Request $request)
 
-     {
 
-         $id = $request->id;
 
-         return $this->companyService->pmsRead($id);
 
-     }
 
-     public function msgSend()
 
-     {
 
-         $res = $this->companyService->msgSend(auth('web-company')->user(), request()->all());
 
-         if ($res) {
 
-             $this->taskService->doTask(32);
 
-             return $this->sendSuccessResponse($res);
 
-         } else {
 
-             return $this->sendErrorResponse('回复失败!');
 
-         }
 
-     }
 
-     public function msgDelete()
 
-     {
 
-         if (request()->method() == 'POST') {
 
-             $res = $this->companyService->msgDelete(request()->all());
 
-             if ($res) {
 
-                 return $this->sendSuccessResponse('删除成功!');
 
-             } else {
 
-                 return $this->sendErrorResponse('删除失败!');
 
-             }
 
-         } else {
 
-             return view('app.person.ajax.resume_delete', ['tpis' => '删除后将无法恢复,您确定要删除选择的咨询消息吗?']);
 
-         }
 
-     }
 
-     public function companyPmsDel(Request $request)
 
-     {
 
-         if ($request->method() == 'POST') {
 
-             $user = auth('web-company')->user();
 
-             return $this->companyService->companyPmsDel($request, $user);
 
-         }
 
-         $tip = "被删除后将无法恢复,您确定要删除选中的系统消息吗?";
 
-         return response()->json(['status' => 1, 'data' => ['html' => view('app.company.ajax.ajax_warning', ['tip' => $tip])->render()]]);
 
-     }
 
-     public function companyPmsCheck(Request $request)
 
-     {
 
-         return $this->companyService->companyPmsCheck($request);
 
-     }
 
-     /**
 
-      *
 
-      */
 
-     public function companyPmsConsult()
 
-     {
 
-         $res = $this->companyService->companyPmsConsult(auth('web-company')->user());
 
-         return view('app.company.company_pmsconsult', ['content' => $res]);
 
-     }
 
-     /**
 
-      * 修改用户名
 
-      * */
 
-     public function modifyUsername()
 
-     {
 
-         $user = auth('web-company')->user();
 
-         $res  = $this->companyService->modifyUserName($user);
 
-         return view('app.company.ajax.username', $res);
 
-     }
 
-     /** 修改用户名
 
-      * @param CompanyValidatorRequest $request
 
-      * @return CompanyController|\Illuminate\Http\JsonResponse
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function saveUsername(CompanyValidatorRequest $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         if (!$this->companyService->saveUsername($request->username, $user)) {
 
-             return $this->sendErrorResponse('用户名修改失败!');
 
-         }
 
-         return $this->sendSuccessResponse('用户名修改成功!');
 
-     }
 
-     /**修改密码
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      */
 
-     public function modifyPwd()
 
-     {
 
-         return view('app.company.ajax.ajax_modify_pwd');
 
-     }
 
-     /**修改密码======保存密码
 
-      * @param CompanyValidatorRequest $request
 
-      * @return CompanyController|\Illuminate\Http\JsonResponse
 
-      * @throws \App\Exceptions\ResponseException
 
-      * @throws \Prettus\Validator\Exceptions\ValidatorException
 
-      */
 
-     public function savePwd(CompanyValidatorRequest $request)
 
-     {
 
-         $user = auth('web-company')->user();
 
-         if (!$this->companyService->savePwd($user, $request->oldpassword, $request->password, $request->password1)) {
 
-             return $this->sendErrorResponse('密码修改失败!');
 
-         }
 
-         if ($user->mobile) {
 
-             $this->smsService->sendSms($user->mobile, Smser::TEMPLATE_SMS_EDITPWD, ['sitename' => subsite_config('aix.system.site.site.site_name'), 'newpassword' => $request->password]);
 
-         }
 
-         return $this->sendSuccessResponse('密码修改成功!');
 
-     }
 
-     /**
 
-      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 
-      * @手机认证弹窗
 
-      */
 
-     public function authMobile()
 
-     {
 
-         $user   = auth('web-company')->user();
 
-         $mobile = $this->companyService->authMobile($user);
 
-         return view('app.company.ajax.ajax_auth_mobile', $mobile);
 
-     }
 
-     /**
 
-      * @param CompanyValidatorRequest $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \App\Exceptions\ResponseException
 
-      */
 
-     public function verifyCode(CompanyValidatorRequest $request)
 
-     {
 
-         $mobile = $request->mobile;
 
-         $id     = $request->id;
 
-         if (!$this->companyService->checkMobileAudit($id, $mobile)->isEmpty()) {
 
-             return response()->json(['status' => 0, 'msg' => '手机已验证']);
 
-         }
 
-         $this->smsService->sendAuthSms($mobile, smser::TEMPLATE_AUTH_CHECK);
 
-         return response()->json(['status' => 1]);
 
-     }
 
-     public function mobileAudit(CompanyValidatorRequest $request)
 
-     {
 
-         $user       = auth('web-company')->user();
 
-         $mobile     = $request->mobile;
 
-         $verifyCode = $request->verifycode;
 
-         $res        = $this->smsService->checkAuthSms($mobile, smser::TEMPLATE_AUTH_CHECK, $verifyCode);
 
-         if (!$res) {
 
-             return response()->json(['status' => 0, 'msg' => '验证码错误']);
 
-         }
 
-         $res = $this->companyService->verifyCode($mobile, $user);
 
-         if ($res['status'] == 1) {
 
-             $this->memberLogRepository->createLog($user, 8002, "");
 
-             if (isset($res['data'])) {
 
-                 return response()->json(['status' => 1, 'msg' => '手机认证成功', 'data' => ['mobile' => $mobile, 'points' => $res['data']['points']]]);
 
-             } else {
 
-                 return response()->json(['status' => 1, 'msg' => '手机认证成功', 'data' => ['mobile' => $mobile]]);
 
-             }
 
-         } else {
 
-             return response()->json(['status' => 0, 'msg' => '手机认证失败']);
 
-         }
 
-     }
 
-     /**邮箱认证
 
-      * @return \Illuminate\Http\JsonResponse
 
-      * @throws \Throwable
 
-      */
 
-     public function authEmail()
 
-     {
 
-         $user = auth('web-company')->user();
 
-         if (!$email = $this->companyService->authEmail($user)) {
 
-             return response()->json(['status' => 0, 'msg' => '参数错误!']);
 
-         }
 
-         return response()->json(['status' => 1, 'msg' => '查询成功!', 'data' => view('app.company.ajax.ajax_auth_email', $email)->render()]);
 
-     }
 
-     /**认证Email 及修改状态
 
-      * @param CompanyValidatorRequest $request
 
-      * @return \Illuminate\Http\JsonResponse
 
-      */
 
-     public function emailSend(CompanyValidatorRequest $request)
 
-     {
 
-         $email = $request->email;
 
-         $id    = $request->id;
 
-         if (!$this->companyService->checkEmailAudit($id, $email)->isEmpty()) {
 
-             return response()->json(['status' => 0, 'msg' => 'email已验证!']);
 
-         }
 
-         $user = auth('web-company')->user();
 
-         $this->memberLogRepository->createLog($user, 8001, "");
 
-         $this->emailService->setAuthTag('company')
 
-             ->setCallback('App\Services\Company\CompanyService', 'sendAuthEmailHook', [$email, auth('web-company')->user()])
 
-             ->sendAuthMail($email, EmailService::TEMPLATE_VALIDATION);
 
-         return response()->json(['status' => 1]);
 
-     }
 
-     /**签到
 
-      * @return \Illuminate\Http\JsonResponse
 
-      */
 
-     public function sign()
 
-     {
 
-         $user = auth('web-company')->user();
 
-         $res  = $this->companyService->signIn($user);
 
-         return response()->json(['status' => $res['code'], 'msg' => $res['msg'], 'data' => $res['info']]);
 
-     }
 
-     public function ajaxResumeSearch(Request $request)
 
-     {
 
-         $key         = $request->input('key', '');
 
-         $search_type = $request->input('search_type', 'precise');
 
-         return response()->json(['status' => 1, 'data' => route(url_rewrite('AIX_resumelist'), ['key' => $key, 'search_type' => $search_type])]);
 
-     }
 
-     public function unBindThird(Request $request)
 
-     {
 
-         $alias = $request->alias;
 
-         $user  = auth('web-company')->user();
 
-         return $this->companyService->unBindThird($alias, $user);
 
-     }
 
-     //企业联系人信息
 
-     public function contact(Request $request)
 
-     {
 
-         $user        = auth('web-company')->user();
 
-         $contacts    = $this->companyService->companyContact($user, 10);
 
-         $return_data = [
 
-             'contacts' => $contacts,
 
-         ];
 
-         return view('app.company.company_contact', $return_data);
 
-     }
 
-     //企业联系人信息ajax请求
 
-     public function ContactAjax()
 
-     {
 
-         $user     = auth('web-company')->user();
 
-         $contacts = $this->companyService->companyContact($user, 10);
 
-         return response()->json($contacts);
 
-     }
 
-     public function showContact(Request $request)
 
-     {
 
-         $id  = $request->input('id');
 
-         $rst = $this->companyService->getContactInfo($id, auth('web-company')->user());
 
-         if (array_has($rst, 'status') && $rst['status'] == 1) {
 
-             $contact      = $rst['contact'];
 
-             $landline_tel = dealContactPhone($contact->landline_tel);
 
-             $html         = view('app.company.ajax.show_contact', ['contact' => $contact, 'landline_tel' => $landline_tel])->render();
 
-             $return_data  = ['status' => 1, 'data' => $html];
 
-             return response()->json($return_data);
 
-         } else {
 
-             return response()->json($rst);
 
-         }
 
-     }
 
-     public function deleteContact(Request $request)
 
-     {
 
-         $id  = $request->input('id');
 
-         $ids = is_array($id) ? $id : explode(",", $id);
 
-         return $this->companyService->companyContactDel($ids, auth('web-company')->user());
 
-     }
 
-     public function editContact(Request $request)
 
-     {
 
-         if ($request->method() == 'POST') {
 
-             $user = auth('web-company')->user();
 
-             $id   = $request->input('id');
 
-             $data = $request->except('_token', '_method');
 
-             $rst  = $this->companyService->updateContact($data, $user);
 
-             if ($rst) {
 
-                 $return_data = ['status' => 1, 'msg' => '修改成功'];
 
-             } else {
 
-                 $return_data = ['status' => 0, 'msg' => '修改失败'];
 
-             }
 
-             return response()->json($return_data);
 
-         } else {
 
-             $id  = $request->input('id');
 
-             $rst = $this->companyService->getContactInfo($id, auth('web-company')->user());
 
-             if (array_has($rst, 'status') == 1) {
 
-                 $return_data = ['contact' => $rst['contact']];
 
-                 $html        = view('app.company.ajax.add_contact', $return_data)->render();
 
-                 $return_data = ['status' => 1, 'data' => $html];
 
-                 return response()->json($return_data);
 
-             } else {
 
-                 return $rst;
 
-             }
 
-         }
 
-     }
 
-     public function addContact(Request $request)
 
-     {
 
-         if ($request->method() == 'POST') {
 
-             $contact   = $request->input('contact', '');
 
-             $telephone = $request->input('telephone', '');
 
-             $tel_first = $request->input('tel_first', '');
 
-             $tel_next  = $request->input('tel_next', '');
 
-             $tel_last  = $request->input('tel_last', '');
 
-             $email     = $request->input('email', '');
 
-             $qq        = $request->input('qq', '');
 
-             $address   = $request->input('address', '');
 
-             if (!$contact) {
 
-                 $return_data = ['status' => 0, 'msg' => '请输入联系人信息'];
 
-             }
 
-             //座机和手机号至少填写一项
 
-             if (!$email) {
 
-                 $return_data = ['status' => 0, 'msg' => '请输入联系邮箱'];
 
-             }
 
-             if (!$address) {
 
-                 $return_data = ['status' => 0, 'msg' => '请输入联系地址'];
 
-             }
 
-             if (!empty($tel_first) && !empty($tel_next)) {
 
-                 $landline_tel = $tel_first . "-" . $tel_next;
 
-                 if (!empty($tel_last)) {
 
-                     $landline_tel .= "-" . $tel_last;
 
-                 }
 
-             } else {
 
-                 $landline_tel = "";
 
-             }
 
-             $set_data = [
 
-                 'company_id'   => (int)auth('web-company')->user()->id,
 
-                 'contact'      => $contact,
 
-                 'telephone'    => $telephone,
 
-                 'landline_tel' => $landline_tel,
 
-                 'email'        => $email,
 
-                 'qq'           => $qq,
 
-                 'address'      => $address,
 
-             ];
 
-             $rst      = $this->companyService->addContact($set_data);
 
-             if ($rst) {
 
-                 $return_data = ['status' => 1, 'msg' => '添加成功'];
 
-             } else {
 
-                 $return_data = ['status' => 0, 'msg' => '添加失败'];
 
-             }
 
-             return response()->json($return_data);
 
-         } else {
 
-             $return_data = ['contact' => ''];
 
-             $html        = view('app.company.ajax.add_contact', $return_data)->render();
 
-             $return_data = ['status' => 1, 'data' => $html];
 
-             return response()->json($return_data);
 
-         }
 
-     }
 
-     public function myCode(Request $requset)
 
-     {
 
-         $id   = $requset->id ? $requset->id : 0;
 
-         $user = $this->getLoginUser();
 
-         if ($user->id != $id) {
 
-             return response()->json(['status' => 0, 'img' => '企业不存在!']);
 
-         }
 
-         return response()->json(['status' => 1, 'img' => get_qrcode_html(route('mobile.firm.com.wzp.index', ['id' => $id]))]);
 
-     }
 
-     //服务广场
 
-     public function square()
 
-     {
 
-         return view('app.company.company_square');
 
-     }
 
-     public function share()
 
-     {
 
-         $service_list = $this->serviceService->list();
 
-         return view('app.company.company_share', ['service_list' => $service_list]);
 
-     }
 
-     public function dispensing()
 
-     {
 
-         return view('app.company.company_dispensing');
 
-     }
 
-     public function dispensingList()
 
-     {
 
-         $user           = auth('web-company')->user();
 
-         $dispensingList = $this->dispensingService->list($user);
 
-         return view('app.company.company_dispensingList', ['dispensing' => $dispensingList]);
 
-     }
 
-     public function dispensingAdd(Request $request)
 
-     {
 
-         $data = $request->except('_method', '_token');
 
-         return $this->dispensingService->save($data, auth('web-company')->user());
 
-     }
 
-     public function dispensingEdit(Request $request)
 
-     {
 
-         if (request()->method() == 'POST') {
 
-             $data = $request->except('_method', '_token');
 
-             return $this->dispensingService->save($data, auth('web-company')->user());
 
-         } else {
 
-             $id             = $request->input('id');
 
-             $user           = auth('web-company')->user();
 
-             $where['id']    = $id;
 
-             $where['uid']   = $user->id;
 
-             $dispensingInfo = $this->dispensingService->dispensingInfo($where);
 
-             if (!$dispensingInfo) {
 
-                 return $this->showMessage('没有这个需求!', route('com.dispensingList'), true);
 
-             }
 
-             return view('app.company.company_dispensingEdit', ['dispensing' => $dispensingInfo]);
 
-         }
 
-     }
 
-     public function dispensingDel(Request $request)
 
-     {
 
-         $id   = $request->id;
 
-         $user = auth('web-company')->user();
 
-         return $this->dispensingService->dispensingDel($id, $user);
 
-     }
 
- }
 
 
  |