ApiV3Status.php 806 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\common\services\wechatApiV3;
  3. class ApiV3Status
  4. {
  5. /**
  6. * 判定成功的http状态码
  7. */
  8. const SUCCESS_HTTP_CODE = [
  9. 200,204
  10. ];
  11. const NO_CHECK_SIGN_ERROR_CODE = [
  12. 'PARAM_ERROR',' SIGN_ERROR','INVALID_REQUEST'
  13. ];
  14. /**
  15. * @param $http_status
  16. * @return int
  17. */
  18. public static function returnCode($http_status):int
  19. {
  20. if (in_array($http_status,self::SUCCESS_HTTP_CODE)) {
  21. return 1;
  22. }
  23. return 0;
  24. }
  25. /**
  26. * 是否需要应答验签
  27. * @param $err_code
  28. * @return bool
  29. */
  30. public static function isCheckSign($err_code):bool
  31. {
  32. if (in_array($err_code,self::NO_CHECK_SIGN_ERROR_CODE)) {
  33. return false;
  34. }
  35. return true;
  36. }
  37. }