企微短剧业务系统

VerifyH5SignMiddleware.php 770B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Illuminate\Http\Response;
  4. use Illuminate\Http\Request;
  5. use Closure;
  6. use App\Log;
  7. use App\Http\Controllers\Controller;
  8. use Illuminate\Support\Facades\Auth;
  9. class VerifyH5SignMiddleware
  10. {
  11. public function handle(Request $request, Closure $next)
  12. {
  13. $params = $request->all();
  14. if(!h5_verify_sign($params)){
  15. $data = Controller::returnValue(['msg' => '验签失败'], 4710);
  16. unset($params['sign']);
  17. $_sign = h5_set_sign($params);
  18. Log::logError('验签失败', [
  19. 'params' => $params,
  20. 'sign' => $_sign
  21. ], 'h5_verify_sign');
  22. return new Response($data);
  23. }
  24. return $next($request);
  25. }
  26. }