1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * Created by PhpStorm.
- * User: ZhangHao
- * Date: 2019/7/24
- * Time: 16:21
- */
- namespace App\Http\Controllers\Api\Common;
- use App\Http\Controllers\Api\ApiBaseController;
- use Illuminate\Support\Facades\Cache;
- use App\Repositories\Jobfair\JobfairRepository;
- class QrcodeController extends ApiBaseController
- {
- /**
- * @var JobfairRepository
- */
- protected $jobfairRepository;
- /**
- * JobfairRepository constructor.
- * @param JobfairRepository $jobfairRepository
- */
- public function __construct(JobfairRepository $jobfairRepository)
- {
- $this->jobfairRepository = $jobfairRepository;
- }
- public function qrcode()
- {
- $hashid = request()->input('hashid');
- if(Cache::pull($hashid)){
- $res = hashid_decode($hashid);
- $where = [
- ['holddate_start', '<', strtotime("+60 minute")],
- ['holddate_end', '>', time()],
- ['display', '=', 1],
- ['subsite_id', '=', get_subsite_id()],
- ];
- $compant_where = [
- 'company_id' => $res['id']
- ];
- $jobfair = $this->jobfairRepository->getOneCompanyOpenJobfair($where,$compant_where);
- if($jobfair){
- $data = [
- 'status'=>1,
- 'jobfair_id'=>$jobfair->id
- ];
- return $this->sendSuccessResponse($data);
- }else{
- $data = [
- 'status'=>2,
- ];
- return $this->sendSuccessResponse($data);
- }
- } else {
- $data = [
- 'status'=>0,
- ];
- return $this->sendSuccessResponse($data);
- }
- }
- }
|