<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ? 1.獲取AccessToken 封裝類 ~~~php <?php namespace app\api\controller; use app\common\controller\Api; use think\Db; class Accesstoken extends Api{ protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; protected $appid; protected $secret; protected $accessUrl; public function __construct() { $this->appid=config('wxinfo.appId'); $this->secret=config('wxinfo.secretId'); $this->accessUrl = Config('wxinfo.accessUrl'); } public function get_access_token() { $res=Db::name('access_token')->find(); if($res){ if(time()>$res['create_time']+7000){ $access_token=self::create_access_token(); }else{ $access_token=$res['access_token']; } }else{ $access_token=$this->create_access_token(); } return $access_token; } public function create_access_token() { $url = sprintf($this->accessUrl,$this->appid,$this->secret); $result = $this->https_request($url); $wxResult = json_decode($result,true); if(empty($wxResult)){ return ['code'=>400,'msg'=>'獲取AccessToken異常']; } $access_token=Db::name('access_token')->find(); if($access_token){ $res=Db::name('access_token')->where('id',$access_token['id'])->update(['access_token'=>$wxResult['access_token'],'create_time'=>time()]); }else{ $res=Db::name('access_token')->insert(['access_token'=>$wxResult['access_token'],'create_time'=>time()]); } if($res){ return $wxResult['access_token']; }else{ return false; } } #curl protected function https_request($url,$data = null){ if(function_exists('curl_init')){ $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1); if (!empty($data)){ curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); curl_close($curl); return $output; }else{ return false; } } } ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊并拖拽以移動") 2.處理審核代碼 ~~~php /*檢測文本發布內容安全*/ $token=new Accesstoken(); $access_token=$token->get_access_token(); $url='https://api.weixin.qq.com/wxa/msg_sec_check?access_token='.$access_token; $res = $this->https_request($url,json_encode(['content'=>$data['title']],JSON_UNESCAPED_UNICODE)); $resArr = json_decode($res,true); if (isset($resArr['errcode']) && $resArr['errcode'] == 0){ }else{ return json(['code'=>400,'msg'=>'含有違法違規內容,不可發布']); } $res = $this->https_request($url,json_encode(['content'=>$data['content']],JSON_UNESCAPED_UNICODE)); $resArr = json_decode($res,true); if (isset($resArr['errcode']) && $resArr['errcode'] == 0){ }else{ return json(['code'=>400,'msg'=>'含有違法違規內容,不可發布']); } /*檢測圖片發布內容安全*/ if($img){ $newurl='https://api.weixin.qq.com/wxa/media_check_async?access_token='.$access_token; $list=explode(",",$img); foreach ($list as $k=>$v){ $res = $this->https_request($newurl,json_encode(['media_url'=>$v,'media_type'=>2],JSON_UNESCAPED_UNICODE)); $resimgArr = json_decode($res,true); trace('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'); trace($v); trace($resimgArr); trace('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'); if (isset($resimgArr['errcode']) && $resimgArr['errcode'] == 0){ }else{ return json(['code'=>400,'msg'=>'圖片含有違法違規內容,不可發布']); } } } #curl protected function https_request($url,$data = null){ if(function_exists('curl_init')){ $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1); if (!empty($data)){ curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); curl_close($curl); return $output; }else{ return false; } } ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊并拖拽以移動") 3.騰訊內容安全文檔地址 [https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.imgSecCheck.html](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.imgSecCheck.html "https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.imgSecCheck.html") [security.mediaCheckAsync | 微信開放文檔](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html "security.mediaCheckAsync | 微信開放文檔") [security.msgSecCheck | 微信開放文檔](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.msgSecCheck.html "security.msgSecCheck | 微信開放文檔") ### 目前使用的是 security.mediaCheckAsync 跟?security.msgSecCheck,并且內容還要后臺人工審核 ,security.mediaCheckAsync是異步的,不能及時反饋,所以彈框提示信息是這樣的: 發布內容有圖片,等待騰訊審核成功后可以顯示 ?
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看