Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
chenbo 2023-10-20 17:48:16 +08:00
commit c731fa3976
15 changed files with 60 additions and 22 deletions

View File

@ -114,7 +114,7 @@ class XunFeiController extends BaseApiController
foreach($data_field as $k=>$v) {
$demand .= $k . '' . $v . '';
}
$question = "分析以下{$type_name}信息【{$demand}】请问有那些商机?";
$question = "根据以下{$type_name}信息【{$demand}】请问有那些商机?";
$chat=new ChatClient($this->app_id,$this->api_key,$this->api_secret);
$client = new Client($chat->assembleAuthUrl('wss://spark-api.xf-yun.com/v2.1/chat'));
// 连接到 WebSocket 服务器

View File

@ -8,12 +8,19 @@ use app\common\model\Company;
use app\common\model\im\UserImMessage;
use app\common\model\user\User;
use GatewayClient\Gateway;
use think\App;
use think\facade\Db;
use think\response\Json;
class ImController extends BaseLikeAdminController
{
//获取场景值
public function __construct(App $app)
{
parent::__construct($app);
Gateway::$registerAddress = "172.19.97.179:1256";
}
//获取场景值
private function sceneText($scene): string
{
if($scene == 0){

View File

@ -34,7 +34,7 @@ class AiAianalyse
foreach($data_field as $k=>$v) {
$demand .= $k . '' . $v . '';
}
$question = "分析以下{$type_name}信息【{$demand}】请问有那些商机?需要购买哪些商品?";
$question = "根据以下{$type_name}信息【{$demand}】请问有那些商机?需要购买哪些商品?";
try {
$chat=new ChatClient($this->app_id,$this->api_key,$this->api_secret);
$client = new Client($chat->assembleAuthUrl('wss://spark-api.xf-yun.com/v2.1/chat'));

20
composer.lock generated
View File

@ -5301,11 +5301,22 @@
{
"name": "textalk/websocket",
"version": "1.6.3",
"source": {
"type": "git",
"url": "https://github.com/Textalk/websocket-php.git",
"reference": "67de79745b1a357caf812bfc44e0abf481cee012"
},
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/textalk/websocket/1.6.3/textalk-websocket-1.6.3.zip",
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/67de79745b1a357caf812bfc44e0abf481cee012",
"reference": "67de79745b1a357caf812bfc44e0abf481cee012",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.4 | ^8.0",
@ -5325,6 +5336,7 @@
"WebSocket\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
@ -5337,6 +5349,10 @@
}
],
"description": "WebSocket client and server",
"support": {
"issues": "https://github.com/Textalk/websocket-php/issues",
"source": "https://github.com/Textalk/websocket-php/tree/1.6.3"
},
"time": "2022-11-07T18:59:33+00:00"
},
{

View File

@ -17,7 +17,7 @@ $worker->name = 'PushBusinessWorker';
$worker->count = 4;
// 服务注册地址
$worker->registerAddress = '127.0.0.1:1236';
$worker->registerAddress = '172.19.97.179:1256';
// 注册服务类
$worker->eventHandler = 'workerim\Events';

View File

@ -10,21 +10,20 @@ require_once __DIR__ . '/../../vendor/autoload.php';
$gateway = new Gateway("Websocket://0.0.0.0:8282");
// gateway名称status方便查看
$gateway->name = 'worker_im';
$gateway->name = 'worker_task_im';
// gateway进程数一般设置2个就足够
$gateway->count = 4;
// 本机ip分布式部署时使用内网ip
//ce_shi
$gateway->lanIp = '172.19.97.179';
// 内部通讯起始端口,假如$gateway->count=2起始端口为2900
// 则一般会使用2900 2901 2902 2903 4个端口作为内部通讯端口
$gateway->startPort = 2900;
// 则一般会使用3900 3901 3902 3903 4个端口作为内部通讯端口
$gateway->startPort = 3900;
// 服务注册地址
$gateway->registerAddress = '127.0.0.1:1236';
$gateway->registerAddress = '172.19.97.179:1256';
// 心跳间隔
$gateway->pingInterval = 20;

View File

@ -6,7 +6,7 @@ use \GatewayWorker\Register;
require_once __DIR__ . '/../../vendor/autoload.php';
// register 必须是text协议切记不能将register端口开放给外网
$register = new Register('text://127.0.0.1:1236');
$register = new Register('text://172.19.97.179:1256');
// 如果不是在根目录启动则运行runAll方法
if(!defined('GLOBAL_START'))

View File

@ -5610,11 +5610,22 @@
"name": "textalk/websocket",
"version": "1.6.3",
"version_normalized": "1.6.3.0",
"source": {
"type": "git",
"url": "https://github.com/Textalk/websocket-php.git",
"reference": "67de79745b1a357caf812bfc44e0abf481cee012"
},
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/textalk/websocket/1.6.3/textalk-websocket-1.6.3.zip",
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/67de79745b1a357caf812bfc44e0abf481cee012",
"reference": "67de79745b1a357caf812bfc44e0abf481cee012",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.4 | ^8.0",
@ -5636,6 +5647,7 @@
"WebSocket\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
@ -5648,6 +5660,10 @@
}
],
"description": "WebSocket client and server",
"support": {
"issues": "https://github.com/Textalk/websocket-php/issues",
"source": "https://github.com/Textalk/websocket-php/tree/1.6.3"
},
"install-path": "../textalk/websocket"
},
{

View File

@ -3,7 +3,7 @@
'name' => 'topthink/think',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'a33f154b3124fdc0dfd6899f4340ae6e48e88e3a',
'reference' => 'a000ab203c7a08f4790746e40d2de9aa33cfc61d',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -775,7 +775,7 @@
'topthink/think' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'a33f154b3124fdc0dfd6899f4340ae6e48e88e3a',
'reference' => 'a000ab203c7a08f4790746e40d2de9aa33cfc61d',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2023-10-17 09:37:44
// This file is automatically generated at:2023-10-20 16:31:01
declare (strict_types = 1);
return array (
0 => 'think\\app\\Service',

View File

@ -43,7 +43,7 @@ class BusinessWorker extends Worker
*
* @var string|array
*/
public $registerAddress = '127.0.0.1:1236';
public $registerAddress = '172.19.97.179:1256';
/**
* 事件处理类,默认是 Event

View File

@ -83,7 +83,7 @@ class Gateway extends Worker
*
* @var string|array
*/
public $registerAddress = '127.0.0.1:1236';
public $registerAddress = '172.19.97.179:1256';
/**
* 是否可以平滑重启gateway 不能平滑重启,否则会导致连接断开

View File

@ -34,7 +34,7 @@ class Gateway
*
* @var string|array
*/
public static $registerAddress = '127.0.0.1:1236';
public static $registerAddress = '172.19.97.179:1256';
/**
* 秘钥

View File

@ -36,7 +36,7 @@ class Gateway
*
* @var string|array
*/
public static $registerAddress = '127.0.0.1:1236';
public static $registerAddress = '172.19.97.179:1256';
/**
* 秘钥

View File

@ -64,7 +64,7 @@ require_once '真实路径/vendor/autoload.php';
* === 如果GatewayClient和GatewayWorker在同一台服务器 ===
* GatewayClient和Register服务都在一台服务器上ip填写127.0.0.1及即可,无需其它设置。
**/
Gateway::$registerAddress = '127.0.0.1:1236';
Gateway::$registerAddress = '172.19.97.179:1256';
// GatewayClient支持GatewayWorker中的所有接口(Gateway::closeCurrentClient Gateway::sendToCurrentClient除外)
Gateway::sendToAll($data);