123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace app\service\api;
- use app\service\ConfServiceFacade;
- use laytp\traits\Error;
- use think\facade\Cache;
- use think\facade\Config;
- use think\facade\Request;
- require_once IA_ROOT_WK.'/extend/baiduai/AipImageCensor.php';
- class ImageCensor
- {
- use Error;
- /**
- * phpmailer对象
- */
- protected $client;
- protected $conf;
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->conf = ConfServiceFacade::groupGet('system.ai');
- $this->client = new \AipImageCensor($this->conf['app_id'],$this->conf['api_key'],$this->conf['secret_key']);
- }
- /**
- * 人脸检测
- * @param $image //图片链接
- */
- public function imageCensorUserDefined($image) {
- return $this->client->imageCensorUserDefined($image);
- }
- /**
- * 营业执照识别接口
- * @param $image //图片链接
- */
- public function textCensorUserDefined($image) {
- if(empty($this->conf['app_id'])){
- return true;
- }
- return $this->client->textCensorUserDefined($image);
- }
- }
|