作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2846
... ... @@ -21,8 +21,11 @@ use App\Models\Project\Payment;
use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
use App\Models\Project\ProjectWhiteHatAffix;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplateMain;
use App\Models\Template\TemplateTypeMain;
use App\Models\WebSetting\Translate;
use App\Models\WebSetting\TranslateData;
use App\Models\WebSetting\WebSetting;
use App\Models\WorkOrder\TicketLog;
use App\Models\WorkOrder\Tickets;
... ... @@ -51,30 +54,7 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
$projectModel = new Payment();
$lists = $projectModel->list(['renewal_record'=>['not like','"expire_at": null']]);
foreach ($lists as $item){
foreach ($item['renewal_record'] as $key => $val){
if(!isset($val['end_time']) && !empty($val['expire_at'])){
$val['end_time'] = $val['expire_at'];
}
$item['renewal_record'][$key] = $val;
}
$projectModel->edit(['renewal_record'=>json_encode($item['renewal_record'],true)],['id'=>$item['id']]);
}
return true;
}
public function getExpectResult(){
$geo_service = new GeoService();
$question = 'Top AI Coffee Robot';
$answer = "Top AI Coffee Robot\" refers to advanced robotic systems that combine **precision automation, artificial intelligence, and specialty coffee expertise** to create high-quality beverages with minimal human intervention. Here's a breakdown of key features, leading examples, and benefits:\n\n### Core Features of Top AI Coffee Robots:\n1. **AI-Driven Customization** \n - Analyzes user preferences (strength, milk type, sweetness) via app profiles or voice commands. \n - Learns from feedback to refine future orders (e.g., \"less bitter than last time\"). \n2. **Robotic Precision Brewing** \n - Industrial arms handle grinding, tamping, steaming milk, and latte art with sub-millimeter accuracy. \n - Sensors monitor temperature, extraction time, and pressure for optimal flavor.";
$expect = "While I don't have specific information on the RobotAnno coffee machine, in general";
$str = "客户提出的问题:{$question},客户得到的回复:{$answer},客户需要预期:{$expect},请分析得到的回复和预期是否一致,仅回复我是或者否";
$data = $geo_service->getChatResult($str, 'gpt-4o-mini');
if(isset($data['text']) && $data['text'] == '是'){
}
return $this->translate_action();
}
/**
... ... @@ -257,9 +237,77 @@ class lyhDemo extends Command
echo "字段 $field 小写替换出错:" . $e->getMessage() . PHP_EOL;
}
}
echo '执行结束' . PHP_EOL;
DB::disconnect('custom_mysql');
}
public function translate_action()
{
ProjectServer::useProject(655);
$this->model = new Translate();
$lists = DB::connection('custom_mysql')->table('gl_translate_copy1')->where('url','!=','All')->get();
foreach ($lists as $item) {
$sourceInfo = $this->getRouteSource($item['url']);
$info = $this->model->read(['language_id'=>$item['language_id'],'source_id'=>$sourceInfo['source_id'],'url'=>$item['url'],'project_id'=>655,'type'=>$item['type']]);
if($info === false){
$param = [
'type'=>$item['type'] ?? 1,
'project_id'=>655,
'url'=>$item['url'],
'language_id'=>$item['language_id'],
'alias'=>$item['alias'],
'source'=>$sourceInfo['source'],
'source_id'=>$sourceInfo['source_id'],
'is_list'=>$sourceInfo['is_list'],
'is_custom'=>$sourceInfo['is_custom'],
'page'=>$sendData['page'] ?? 0
];
$id = $this->model->addReturnId($param);
TranslateData::insert(['trans_id'=>$id,'data'=>$item['data']]);
}else{
TranslateData::where(['trans_id'=>$info['id']])->update(['data'=>$item['data']]);
}
}
DB::disconnect('custom_mysql');
}
public function getRouteSource($route){
$routes = $route;
$data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0,'page'=>0];
if(strtolower($route) == 'all'){
return $this->success($data);
}
if($route == 'index' || $route == '/'){
$data['source'] = 1;
return $this->success($data);
}
$route = basename($route);
$page = 0;
if (is_numeric($route)) {
$arr = explode('/',$routes);
$page = $route;
$route = $arr[0];
}
$routeModel = new RouteMap();
$routeInfo = $routeModel->read(['route'=>$route]);
if($routeInfo === false){
if(in_array($route,['products','news','blog'])){
//固定路由
$data['page'] = $page;
$data['is_list'] = 1;
if($route == 'products'){
$data['source'] = 2;
}elseif ($route == 'news'){
$data['source'] = 4;
}else{
$data['source'] = 3;
}
return $this->success($data);
}
return $data;
}
$data = $this->resultData($routeInfo,$data);
$data['page'] = $page;
return $data;
}
}
... ...
... ... @@ -48,7 +48,7 @@ class CountLogic extends BaseLogic
$domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']);
if($inquiry_list !== false){
if($inquiry_list['status'] != 400){
if(isset($inquiry_list['status']) && $inquiry_list['status'] != 400){
$info['inquiry_num'] = $inquiry_list['data']['count'];
Cache::add('inquiry_num_'.$this->user['project_id'],$inquiry_list['data']['count'],3600);
}
... ...