国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace WeMini;
  3. if (!defined('DEDEINC')) exit('dedebiz');
  4. use WeChat\Contracts\BasicWeChat;
  5. /**
  6. * 小程序内容安全
  7. * Class Security
  8. * @package WeMini
  9. */
  10. class Security extends BasicWeChat
  11. {
  12. /**
  13. * 校验一张图片是否含有违法违规内容
  14. * @param string $media 要检测的图片文件,格式支持PNG、JPEG、JPG、GIF,图片尺寸不超过 750px x 1334px
  15. * @return array
  16. * @throws \WeChat\Exceptions\InvalidResponseException
  17. * @throws \WeChat\Exceptions\LocalCacheException
  18. */
  19. public function imgSecCheck($media)
  20. {
  21. $url = 'https://api.weixin.qq.com/wxa/img_sec_check?access_token=ACCESS_TOKEN';
  22. return $this->callPostApi($url, ['media' => $media], false);
  23. }
  24. /**
  25. * 异步校验图片/音频是否含有违法违规内容
  26. * @param string $media_url
  27. * @param string $media_type
  28. * @return array
  29. * @throws \WeChat\Exceptions\InvalidResponseException
  30. * @throws \WeChat\Exceptions\LocalCacheException
  31. */
  32. public function mediaCheckAsync($media_url, $media_type)
  33. {
  34. $url = 'https://api.weixin.qq.com/wxa/media_check_async?access_token=ACCESS_TOKEN';
  35. return $this->callPostApi($url, ['media_url' => $media_url, 'media_type' => $media_type], true);
  36. }
  37. /**
  38. * 检查一段文本是否含有违法违规内容
  39. * @param string $content
  40. * @return array
  41. * @throws \WeChat\Exceptions\InvalidResponseException
  42. * @throws \WeChat\Exceptions\LocalCacheException
  43. */
  44. public function msgSecCheck($content)
  45. {
  46. $url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN';
  47. return $this->callPostApi($url, ['content' => $content], true);
  48. }
  49. }