12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Http\Middleware;
- use App\Repositories\MemberSetmealRepository;
- use Closure;
- class MobileCompanyAuth
- {
- protected $memberSetmealRepositorywhere;
- /**
- * CompanyAuth constructor.
- * @param MemberSetmealRepository $memberSetmealRepository
- */
- public function __construct(MemberSetmealRepository $memberSetmealRepository)
- {
- $this->memberSetmealRepository = $memberSetmealRepository;
- }
- /**
- * Handle an incoming request.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @return mixed
- */
- public function handle($request, Closure $next)
- {
- $companyInfo = auth('web-company')->user();
- $mySetmeal = $this->memberSetmealRepository->findWhere(['uid'=>$companyInfo->id]);
- if ($mySetmeal[0]->setmeal_id > 0 && $mySetmeal[0]->expire ==1 && $mySetmeal[0]->is_free == 0 && $mySetmeal[0]->endtime!=0) {
- return redirect()->route('mobile.firm.service.setmeal')->with('message', "会员套餐已到期,请续费");
- }
- if (!$companyInfo->nature || !$companyInfo->scale || !$companyInfo->organization_code || !$companyInfo->district || !$companyInfo->trade) {
- return redirect()->route('mobile.firm.info')->with('message', "请完善企业基本信息后,再进行其他操作");
- }
- if (config('aix.companyset.audit.checkset.login_com_audit_certificate') == 1) {
- if ($companyInfo->audit != 1) {
- return redirect()->route('mobile.firm.com.auth')->with('message', "请上传企业营业执照或审核通过后,再进行其他操作");
- }
- }
- if (config('aix.companyset.audit.checkset.login_com_audit_mobile') == 1) {
- if ($companyInfo->mobile_audit == 0) {
- return redirect()->route('mobile.firm.com.security')->with('message', "您的手机号未认证,认证后才能进行其他操作");
- }
- }
- return $next($request);
- }
- }
|