|
...
|
...
|
@@ -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,133 @@ 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()->toArray();
|
|
|
|
foreach ($lists as $item) {
|
|
|
|
$item = (array)$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 $data;
|
|
|
|
}
|
|
|
|
if($route == 'index' || $route == '/'){
|
|
|
|
$data['source'] = 1;
|
|
|
|
return $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 $data;
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
$data = $this->resultData($routeInfo,$data);
|
|
|
|
$data['page'] = $page;
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function resultData($routeInfo,$data){
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PAGE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>9,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_BLOG){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_BLOG_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_NEWS){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_NEWS_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_KEYWORD){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>8,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_MODULE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($routeInfo['source'] == RouteMap::SOURCE_MODULE_CATE){
|
|
|
|
if($routeInfo['source_id']){
|
|
|
|
$data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|