rkljw 6 kuukautta sitten
vanhempi
sitoutus
806d06b04a

+ 13 - 6
.gitignore

@@ -1,9 +1,16 @@
-/vendor/
+# Build and Release Folders
+bin-debug/
+bin-release/
+[Oo]bj/
+[Bb]in/
 
-public/
-public
-runtime/
-runtime
+# Other files and folders
 
-.env
+# Executables
 
+vendor
+runtime
+.env
+# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
+# should NOT be excluded as they contain compiler settings and other important
+# information for Eclipse / Flash Builder.

+ 36 - 0
README.en.md

@@ -0,0 +1,36 @@
+# news_producer
+
+#### Description
+新闻资讯
+
+#### Software Architecture
+Software architecture description
+
+#### Installation
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### Instructions
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### Contribution
+
+1.  Fork the repository
+2.  Create Feat_xxx branch
+3.  Commit your code
+4.  Create Pull Request
+
+
+#### Gitee Feature
+
+1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
+2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
+3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
+4.  The most valuable open source project [GVP](https://gitee.com/gvp)
+5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
+6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 345 - 0
app/JsonRpc/CollectorService.php

@@ -0,0 +1,345 @@
+<?php
+namespace App\JsonRpc;
+
+use App\Model\ArticleData;
+use App\Model\OldModel\Article as OldArticle;
+use App\Model\Article;
+use App\Model\Rule;
+use App\Model\Web;
+use Hyperf\DbConnection\Db;
+use Hyperf\RpcServer\Annotation\RpcService;
+use App\Tools\Result;
+use QL\QueryList;
+use Swoole\Coroutine;
+
+
+#[RpcService(name: "CollectorService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
+class CollectorService implements CollectorServiceInterface
+{
+
+    /**
+     * 添加网站
+     * @param array $data
+     * @return array|mixed
+     */
+    public function addWeb(array $data): array
+    {
+        $where = [
+            'name' => $data['name']
+        ];
+        $isweb = Web::where($where)->first();
+        if(empty($isweb)){
+            date_default_timezone_set('Asia/Shanghai');
+            $time = time();
+            $catetime = date('Y-m-d H:i:s', $time);
+            $data['created_at'] = $catetime;
+            $web = Web::insert($data);
+            
+        }else{
+            return Result::error('此网站已存在,不可重复添加!');
+        }
+        if(empty($web)){
+            return Result::error('添加失败');
+        }
+        return Result::success('添加成功');
+    }
+    /**
+     * 获取并搜索网站
+     * @param array $data
+     * @return array|mixed
+     */
+    public function getWeb(array $data): array
+    {
+        
+        if(isset($data['keyWord'])){
+            $where = [
+                ['name','like','%'.$data['keyWord'].'%']
+            ];
+            $webss = Web::where($where)->first();
+            if(empty($webss)){
+                return Result::error('未查找到相关网站!');
+            }
+        }else{
+            $web = Web::get();
+        }
+        
+        if(empty($web)){
+            return Result::error('您还未添加网站,请先去添加!');
+            
+        }
+        
+        return Result::success($web);
+    }
+    /**
+     * 修改网站
+     * @param array $data
+     * @return array|mixed
+     */
+    public function upWeb(array $data): array
+    {
+        $web = Web::where('id',$data['id'])->first();
+        if(empty($web)){
+            return Result::error('请输入正确的网站id!');
+            
+        }else{
+            $id = Web::where('id',$data['id'])->update($data);
+            if(empty($id)){
+                return Result::error('无法修改!');
+            }
+        }
+        return Result::success($id);
+    }
+    /**
+     * 删除网站
+     * @param array $data
+     * @return array|mixed
+     */
+    public function delWeb(array $data): array
+    {
+        $web = Web::where('id',$data['id'])->first();
+        if(empty($web)){
+            return Result::error('请输入正确的网站id!');
+            
+        }else{
+            $id = Web::where('id',$data['id'])->delete();
+            if(empty($id)){
+                return Result::error('无法删除!');
+            }
+        }
+        return Result::success($id);
+    }
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function sendCrawler(array $data): array
+    {
+        //通过规则id 查询规则类型
+        $where = [
+            'rule.id'=>$data['id']
+        ];
+        $info = Rule::where($where)->leftJoin('web','rule.web_id','web.id')
+            ->select("rule.*","web.name as web_name","web.url as web_url","web.type as web_type")
+            ->first();
+        $info = $info->toArray();
+
+        switch ($info['web_type']){
+            case 1:
+                var_dump("wojinlailaile======",$info);
+                Rule::where(['id'=>$data['id']])->update(['status'=>1]);
+                $data['copyfrom'] = $info['web_name'];
+                $data['author'] = '刘德华';
+                $data['first_url'] = $info['first_url'];
+                $data['second_start'] = $info['second_start'];
+                $data['second_num'] = $info['second_num'];
+                $data['second_end'] = $info['second_end'];
+                $data['end_pagenum']= $info['end_pagenum'];
+                $data['rule_id']= $data['id'];
+                $data['admin_user_id']= $data['admin_user_id'];
+//                $data['newUrlStr'] =
+                $urlList = $this->addUrlArr($data);
+                if($urlList){
+                    foreach ($urlList as $val){
+                        var_dump("单列表地址:",$val);
+                        $this->ruleCollection($val,$data);
+                    }
+                }
+                Rule::where(['id'=>$data['id']])->update(['status'=>2]);
+                break;
+            case 2:
+
+                $wecUrl = $info['first_url'];//'https://www.ndcpa.gov.cn/queryList';
+                $parames = json_decode($info['parameter'],true);
+                $parames['webSiteCode'] = [trim($parames['webSiteCode'], "[]")]; //['jbkzzx'];//
+                $parames['channelCode'] =  [trim($parames['channelCode'], "[]")]; // ['c100008'];//
+                $other = [
+                    'web_url'=>$info['web_url'],
+                    'copyfrom'=>$info['web_name'],
+                    'admin_user_id'=>$data['admin_user_id'],
+                    'rule_id'=>$data['id']
+                ];
+                var_dump("开始调用接口方法====",$parames);
+//                die;
+                $this->foreachCurl($wecUrl,$parames,$other);
+
+        }
+        return  Result::success([]);
+    }
+
+    /**
+     * 把可采集的列表页连接 打包成一个大数组
+     * @return void
+     */
+    public function addUrlArr($data)
+    {
+        $arrList = [];
+        array_push($arrList,$data['first_url']);
+
+            $exit = false;
+            $i = 0;
+            while(!$exit){
+                $i++;
+                $url = $data['second_start'].$i.$data['second_end'];
+                $respon1 = Result::pageExists($url);
+                var_dump("采集地址:",$respon1,$url);
+//                Coroutine::sleep(2);
+                if ($i==intval($data['end_pagenum'])-1) {
+                    $exit = true;
+//                    Coroutine::exit(); // 退出循环
+                }else{
+                    array_push($arrList,$url);
+                }
+            }
+
+
+        return $arrList;
+    }
+
+    /**
+     * 按照规则采集数据
+     * @return void
+     */
+    public function ruleCollection($url,$data)
+    {
+        var_dump("采集参数:",$data);
+        $list = QueryList::get($url);
+        $dataList = $list->rules([
+            'title' => ['a', 'text'],
+            'link'  => ['a', 'href'],
+        ])->range('.list1 li')->query()->getData();
+        var_dump("采集的内容:",$dataList);
+//        var_dump("====",$dataList);die;
+        $firstUrlArr =  explode("/", $url);
+        array_pop($firstUrlArr);
+        $firstUrlArr = implode('/',$firstUrlArr);
+
+        $dataList = $dataList->toArray();
+        if($dataList){
+            foreach ($dataList as $tiem){
+                $newUrl =  substr($tiem['link'], 1);
+                $newUrlStr = $firstUrlArr.$newUrl;
+                $detailContent = QueryList::get($newUrlStr);
+                $detailData = $detailContent->rules([
+                    'title'=>['h1','text'],
+                    'content'=>['.TRS_UEDITOR','html'],
+                ])->range(".news-details")->query()->getData();
+
+                $detailData = $detailData->toArray();
+                var_dump("内容详情:",$detailData,$newUrlStr);
+                if($detailData){
+                    foreach ($detailData as $val){
+                        var_dump("进没进foreach:",$newUrlStr,$val);
+                        $data['fromurl'] = $newUrlStr;
+                        $data['title'] = $val['title'];
+                        $data['content'] = $val['content'];
+                        $data['newUrlStr'] = $newUrlStr;
+                        $data['source'] = '';
+                        $data['introduce'] = $val['title']??'';
+                        $data['keyword'] = $val['title']??'';
+                        $data['copyfrom'] = $data['copyfrom'];
+                        $data['source'] = $data['source']??$data['copyfrom'];
+                        $data['admin_user_id'] = $data['admin_user_id']??'';
+                        $data['rule_id'] = $data['rule_id']??'';
+//                        $data['copyfrom'] = $data['copyfrom'];
+                        var_dump("要插入的数据:",$data);
+                        $this->insertArticleData($data);
+                    }
+                }
+
+            }
+//
+        }
+    }
+
+    /**
+     * 插入数据
+     * @param $data
+     * @return void
+     */
+    public function insertArticleData($data=[])
+    {
+        if($data){
+            Db::beginTransaction();
+            try{
+                $articleInfo =  Article::where(['title'=>$data['title']])->first();
+                var_dump("获取详情:",$articleInfo,$data);
+                if(empty($articleInfo)){
+                    $insertData = [];
+                    $insertData['fromurl'] =$data['newUrlStr'];
+                    $insertData['oldtitle'] =$data['title'];
+                    $insertData['title'] = $data['title'];
+                    $insertData['copyfrom'] =  $data['copyfrom'];
+                    $insertData['author'] = $data['author'];
+                    $insertData['introduce'] = $data['title'];
+                    $insertData['keyword'] = $data['title'];
+                    $insertData['source'] = isset($data['source']) && $data['source']!=''? $data['source']:$data['copyfrom'];
+                    $insertData['admin_user_id'] = $data['admin_user_id'];
+                    $insertData['rule_id'] = $data['rule_id'];
+//                    var_dump("插入Article:",$insertData);
+                    $article_id = Article::insertGetId($insertData);
+                    $insertDataDetail = [];
+                    $insertDataDetail['article_id'] = $article_id;
+                    $insertDataDetail['content'] = $data['content'];
+                    var_dump("插入ArticleData:",$insertDataDetail);
+                    ArticleData::insertGetId($insertDataDetail);
+//                        Coroutine::sleep(2);
+//                    var_dump("插入成功一次:",$article_id,$insertDataDetail);
+                }
+                Db::commit();
+            }catch (\Exception $e){
+                Db::rollBack();
+                var_dump("插入失败:",$e->getMessage());
+            }
+
+        }else{
+            var_dump("没有数据可以插入:");
+        }
+
+    }
+
+    /**
+     * 分页采集
+     * @return void
+     */
+    public function foreachCurl($wecUrl,$parames,$other,&$page=1)
+    {
+        $options = [
+            CURLOPT_HEADER => true, // 如果想包含头部信息在响应中,可以设置为true
+            CURLOPT_TIMEOUT => 30 // 设置请求超时时间为30秒
+        ];
+        $result = Result::http_post($wecUrl,$parames,$options);
+        $result = json_decode($result['response'],true);
+        var_dump("获取数据:",$result);
+        if($result['data'] && $result['data']['results']){
+            $dataList  = $result['data']['results'];
+//            var_dump("取数据结构体:",$dataList);
+            foreach ($dataList as $val){
+//                var_dump("进入循环插入:",$val);
+                $newUrlStr = json_decode($val['source']['urls'],true);
+                $newUrlStr = $other['web_url'].$newUrlStr['common'];
+//                var_dump("来源地址:",$newUrlStr);
+                $insertData = [
+                    'newUrlStr'=>$newUrlStr,
+                    'title'=>$val['source']['title']??'',
+                    'source'=>$val['source']['contentSource']??'',
+                    'copyfrom'=>$other['copyfrom']??'',
+                    'content'=>$val['source']['content']['content']??'',
+                    'admin_user_id'=>$other['admin_user_id']??'',
+                    'rule_id'=>$other['rule_id']??'',
+                    'author'=>'冯蕊'
+                ];
+//                var_dump("调用插入数据方法,组装数据:",$insertData);
+                $this->insertArticleData($insertData);
+            }
+        }
+        $pages = intval($parames['current']);
+        $pages =  $pages+1;
+        $parames['current'] = $pages;
+        $twoResult = Result::http_post($wecUrl,$parames,$options);
+        if($result['data'] && $result['data']['results'] && count($result['data']['results'])>0){
+            var_dump("分页测试:",$parames,$parames['current']);
+            $this->foreachCurl($wecUrl,$parames,$other,$pages);
+        }
+//        var_dump("正确的数据:",$result);
+    }
+}

+ 34 - 0
app/JsonRpc/CollectorServiceInterface.php

@@ -0,0 +1,34 @@
+<?php
+namespace App\JsonRpc;
+interface CollectorServiceInterface
+{
+    
+    /**
+     * @param array $data
+     *  @return array
+    */
+    public function addWeb(array $data):array;
+    /**
+     * @param array $data
+     *  @return array
+    */
+    public function getWeb(array $data):array;
+     /**
+     * @param array $data
+     *  @return array
+    */
+    public function upWeb(array $data):array;
+    /**
+     * @param array $data
+     *  @return array
+    */
+    public function delWeb(array $data):array;
+     /**
+     * @param array $data
+     * @return array
+     */
+    public function sendCrawler(array $data): array;
+
+}
+
+

+ 0 - 32
app/JsonRpc/CrawlerService.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\JsonRpc;
-
-use App\Model\Article;
-use App\Model\OldModel\Article as OLDArticle;
-use Hyperf\RpcServer\Annotation\RpcService;
-use App\Tools\Result;
-
-
-#[RpcService(name: "CrawlerService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
-class CrawlerService implements CrawlerServiceInterface
-{
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function sendCrawler(array $data): array
-    {
-        $result =  Article::get();
-        $b = OLDArticle::get();
-        $a = [
-            'old'=>$b,
-            'new'=>$result
-        ];
-        return  Result::success($a);
-    }
-
-
-
-}

+ 0 - 12
app/JsonRpc/CrawlerServiceInterface.php

@@ -1,12 +0,0 @@
-<?php
-
-namespace App\JsonRpc;
-interface CrawlerServiceInterface
-{
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function sendCrawler(array $data): array;
-
-}

+ 0 - 1
app/Model/Article.php

@@ -24,5 +24,4 @@ class Article extends Model
      * The attributes that should be cast to native types.
      */
     protected array $casts = [];
-
 }

+ 27 - 0
app/Model/ArticleData.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class ArticleData extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'article_data';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 1 - 1
app/Model/OldModel/Article.php

@@ -14,8 +14,8 @@ class Article extends Model
      * The table associated with the model.
      */
     protected ?string $table = 'article';
+    protected ?string $connection = 'secondary';
 
-    protected ?string$connection = 'secondary';
     /**
      * The attributes that are mass assignable.
      */

+ 27 - 0
app/Model/Rule.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Rule extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'rule';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Web.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Web extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'web';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 32 - 0
app/Service/QueueService.php

@@ -0,0 +1,32 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Service;
+
+use App\Job\ExampleJob;
+use Hyperf\AsyncQueue\Driver\DriverFactory;
+use Hyperf\AsyncQueue\Driver\DriverInterface;
+
+class QueueService
+{
+    protected DriverInterface $driver;
+
+    public function __construct(DriverFactory $driverFactory)
+    {
+        $this->driver = $driverFactory->get('default');
+    }
+
+    /**
+     * 生产消息.
+     * @param $params 数据
+     * @param int $delay 延时时间 单位秒
+     */
+    public function push($params, int $delay = 0): bool
+    {
+        // 这里的 `ExampleJob` 会被序列化存到 Redis 中,所以内部变量最好只传入普通数据
+        // 同理,如果内部使用了注解 @Value 会把对应对象一起序列化,导致消息体变大。
+        // 所以这里也不推荐使用 `make` 方法来创建 `Job` 对象。
+        return $this->driver->push(new ExampleJob($params), $delay);
+    }
+}

+ 111 - 0
app/Tools/Result.php

@@ -23,4 +23,115 @@ class Result
             'data' => $data,
         ];
     }
+
+    //判断连接是否正确
+    public static function pageExists($url) {
+        $ch = curl_init();
+
+        // 设置 cURL 选项
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回响应作为字符串,而不是直接输出
+        curl_setopt($ch, CURLOPT_NOBODY, false); // 如果你想检查内容,设置为 false
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // 允许重定向
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100); // 设置连接超时时间
+        curl_setopt($ch, CURLOPT_TIMEOUT, 200); // 设置读取数据的超时时间
+        curl_setopt($ch, CURLOPT_FAILONERROR, true); // 在发生错误时返回 FALSE
+        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'); // 设置用户代理,模拟浏览器请求
+
+        // 执行 cURL 请求
+        $response = curl_exec($ch);
+
+        // 检查是否有 cURL 错误发生
+        if (curl_errno($ch)) {
+            curl_close($ch);
+            return false;
+        }
+
+        // 获取 HTTP 状态码
+        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+
+        // 关闭 cURL
+        curl_close($ch);
+
+        // 判断 HTTP 状态码是否在 200-299 范围内(表示成功)
+        // 或者你可以根据需要调整这个范围,比如包括 301, 302 重定向等
+        return $httpCode;
+    }
+
+    public static function http_get($url)
+    {
+        $oCurl = curl_init();
+        if (stripos($url, "https://") !== false) {
+            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
+            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
+        }
+        curl_setopt($oCurl, CURLOPT_URL, $url);
+        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
+        $sContent = curl_exec($oCurl);
+        $aStatus = curl_getinfo($oCurl);
+        curl_close($oCurl);
+        if (intval($aStatus["http_code"]) == 200) {
+            return $sContent;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * POST 请求
+     * @param string $url
+     * @param array $param
+     * @param boolean $post_file 是否文件上传
+     * @return string content
+     */
+    public static function http_post($url, $data, $options = [])
+    {
+
+        // 初始化CURL会话
+        $ch = curl_init($url);
+
+        // 设置CURL选项
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 将curl_exec()获取的信息以文件流的形式返回,而不是直接输出。
+        curl_setopt($ch, CURLOPT_HEADER, false); // 将curl_exec()获取的信息以文件流的形式返回,而不是直接输出。
+        curl_setopt($ch, CURLOPT_POST, true); // 发送一个常规的POST请求。
+        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); // 要传递的POST数据,这里使用http_build_query将数组转换为URL编码的查询字符串。
+
+        // 如果有额外的CURL选项,则合并它们
+        if (!empty($options)) {
+            curl_setopt_array($ch, $options);
+        }
+
+        // 执行CURL会话并获取响应
+        $response = curl_exec($ch);
+        // 检查是否有CURL错误
+        if (curl_errno($ch)) {
+            $error_msg = curl_error($ch);
+            curl_close($ch);
+            throw new Exception("CURL Error: $error_msg");
+        }
+
+        // 获取HTTP状态码
+        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+
+        // 关闭CURL会话
+        curl_close($ch);
+
+        // 返回一个包含响应和HTTP状态码的数组
+        $responseBody = $response;
+        $headerEnd = strpos($response, "\r\n\r\n");
+
+        if ($headerEnd !== false) {
+            // 去除响应头,只保留响应体
+            $responseBody = substr($response, $headerEnd + 4); // +4 是因为 "\r\n\r\n" 有4个字符
+//            echo $responseBody; // 输出:This is the response body.
+        } else {
+            // 如果没有找到空行,可能响应格式不正确或没有响应头
+//            echo "No headers found in response.";
+        }
+        return [
+            'response' => $responseBody,
+            'http_code' => $http_code
+        ];
+    }
 }

+ 3 - 2
composer.json

@@ -14,6 +14,7 @@
     "require": {
         "php": ">=8.1",
         "doctrine/annotations": "^2.0",
+        "hyperf/async-queue": "^3.1",
         "hyperf/cache": "~3.1.0",
         "hyperf/command": "~3.1.0",
         "hyperf/config": "~3.1.0",
@@ -30,14 +31,14 @@
         "hyperf/logger": "~3.1.0",
         "hyperf/memory": "~3.1.0",
         "hyperf/nacos": "^3.1",
-        "hyperf/paginator": "^3.1",
         "hyperf/process": "~3.1.0",
         "hyperf/redis": "~3.1.0",
         "hyperf/rpc-server": "*",
         "hyperf/service-governance": "^3.1",
         "hyperf/service-governance-consul": "^3.1",
         "hyperf/service-governance-nacos": "^3.1",
-        "hyperf/utils": "^3.1"
+        "hyperf/utils": "^3.1",
+        "jaeger/querylist": "^4.4"
     },
     "require-dev": {
         "friendsofphp/php-cs-fixer": "^3.0",

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 247 - 171
composer.lock


+ 30 - 0
config/autoload/async_queue.php

@@ -0,0 +1,30 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * This file is part of Hyperf.
+ *
+ * @link     https://www.hyperf.io
+ * @document https://hyperf.wiki
+ * @contact  group@hyperf.io
+ * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
+ */
+use Hyperf\AsyncQueue\Driver\RedisDriver;
+
+return [
+    'default' => [
+        'driver' => RedisDriver::class,
+        'redis' => [
+            'pool' => 'default',
+        ],
+        'channel' => '{queue}',
+        'timeout' => 2,
+        'retry_seconds' => 5,
+        'handle_timeout' => 10,
+        'processes' => 1,
+        'concurrent' => [
+            'limit' => 10,
+        ],
+        'max_messages' => 0,
+    ],
+];

+ 3 - 3
config/autoload/databases.php

@@ -15,8 +15,8 @@ return [
     'default' => [
         'driver' => env('DB_DRIVER2', 'mysql'),
         'host' => env('DB_HOST2', 'localhost'),
-        'database' => env('DB_DATABASE2', 'collector'),
-        'port' => env('DB_PORT2', 13306),
+        'database' => env('DB_DATABASE2', 'hyperf'),
+        'port' => env('DB_PORT2', 3306),
         'username' => env('DB_USERNAME2', 'root'),
         'password' => env('DB_PASSWORD2', ''),
         'charset' => env('DB_CHARSET2', 'utf8'),
@@ -44,7 +44,7 @@ return [
     'secondary' => [
         'driver' => env('DB_DRIVER', 'mysql'),
         'host' => env('DB_HOST', 'localhost'),
-        'database' => env('DB_DATABASE', 'collector'),
+        'database' => env('DB_DATABASE', 'hyperf'),
         'port' => env('DB_PORT', 3306),
         'username' => env('DB_USERNAME', 'root'),
         'password' => env('DB_PASSWORD', ''),

+ 1 - 0
config/autoload/processes.php

@@ -10,4 +10,5 @@ declare(strict_types=1);
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
 return [
+//    Hyperf\AsyncQueue\Process\ConsumerProcess::class, //异步消费进程
 ];

+ 1 - 1
runtime/container/aspects.cache

@@ -1 +1 @@
-a:8:{i:0;s:35:"Hyperf\Cache\Aspect\CacheableAspect";i:1;s:36:"Hyperf\Cache\Aspect\CacheAheadAspect";i:2;s:36:"Hyperf\Cache\Aspect\CacheEvictAspect";i:3;s:34:"Hyperf\Cache\Aspect\CachePutAspect";i:4;s:35:"Hyperf\Cache\Aspect\FailCacheAspect";i:5;s:36:"Hyperf\Config\Annotation\ValueAspect";i:6;s:44:"Hyperf\DbConnection\Aspect\TransactionAspect";i:7;s:33:"Hyperf\Di\Annotation\InjectAspect";}
+a:9:{i:0;s:41:"Hyperf\AsyncQueue\Aspect\AsyncQueueAspect";i:1;s:35:"Hyperf\Cache\Aspect\CacheableAspect";i:2;s:36:"Hyperf\Cache\Aspect\CacheAheadAspect";i:3;s:36:"Hyperf\Cache\Aspect\CacheEvictAspect";i:4;s:34:"Hyperf\Cache\Aspect\CachePutAspect";i:5;s:35:"Hyperf\Cache\Aspect\FailCacheAspect";i:6;s:36:"Hyperf\Config\Annotation\ValueAspect";i:7;s:44:"Hyperf\DbConnection\Aspect\TransactionAspect";i:8;s:33:"Hyperf\Di\Annotation\InjectAspect";}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
runtime/container/classes.cache


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
runtime/container/scan.cache


+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-60755
+97083

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 7352
runtime/logs/hyperf.log


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä