作者 李宇航

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

Lyh server



查看合并请求 !2846
@@ -21,8 +21,11 @@ use App\Models\Project\Payment; @@ -21,8 +21,11 @@ use App\Models\Project\Payment;
21 use App\Models\Project\Project; 21 use App\Models\Project\Project;
22 use App\Models\Project\ProjectAiSetting; 22 use App\Models\Project\ProjectAiSetting;
23 use App\Models\Project\ProjectWhiteHatAffix; 23 use App\Models\Project\ProjectWhiteHatAffix;
  24 +use App\Models\RouteMap\RouteMap;
24 use App\Models\Template\BTemplateMain; 25 use App\Models\Template\BTemplateMain;
25 use App\Models\Template\TemplateTypeMain; 26 use App\Models\Template\TemplateTypeMain;
  27 +use App\Models\WebSetting\Translate;
  28 +use App\Models\WebSetting\TranslateData;
26 use App\Models\WebSetting\WebSetting; 29 use App\Models\WebSetting\WebSetting;
27 use App\Models\WorkOrder\TicketLog; 30 use App\Models\WorkOrder\TicketLog;
28 use App\Models\WorkOrder\Tickets; 31 use App\Models\WorkOrder\Tickets;
@@ -51,30 +54,7 @@ class lyhDemo extends Command @@ -51,30 +54,7 @@ class lyhDemo extends Command
51 protected $description = '更新路由'; 54 protected $description = '更新路由';
52 55
53 public function handle(){ 56 public function handle(){
54 - $projectModel = new Payment();  
55 - $lists = $projectModel->list(['renewal_record'=>['not like','"expire_at": null']]);  
56 - foreach ($lists as $item){  
57 - foreach ($item['renewal_record'] as $key => $val){  
58 - if(!isset($val['end_time']) && !empty($val['expire_at'])){  
59 - $val['end_time'] = $val['expire_at'];  
60 - }  
61 - $item['renewal_record'][$key] = $val;  
62 - }  
63 - $projectModel->edit(['renewal_record'=>json_encode($item['renewal_record'],true)],['id'=>$item['id']]);  
64 - }  
65 - return true;  
66 - }  
67 -  
68 - public function getExpectResult(){  
69 - $geo_service = new GeoService();  
70 - $question = 'Top AI Coffee Robot';  
71 - $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.";  
72 - $expect = "While I don't have specific information on the RobotAnno coffee machine, in general";  
73 - $str = "客户提出的问题:{$question},客户得到的回复:{$answer},客户需要预期:{$expect},请分析得到的回复和预期是否一致,仅回复我是或者否";  
74 - $data = $geo_service->getChatResult($str, 'gpt-4o-mini');  
75 - if(isset($data['text']) && $data['text'] == '是'){  
76 -  
77 - } 57 + return $this->translate_action();
78 } 58 }
79 59
80 /** 60 /**
@@ -257,9 +237,77 @@ class lyhDemo extends Command @@ -257,9 +237,77 @@ class lyhDemo extends Command
257 echo "字段 $field 小写替换出错:" . $e->getMessage() . PHP_EOL; 237 echo "字段 $field 小写替换出错:" . $e->getMessage() . PHP_EOL;
258 } 238 }
259 } 239 }
260 -  
261 echo '执行结束' . PHP_EOL; 240 echo '执行结束' . PHP_EOL;
  241 + DB::disconnect('custom_mysql');
  242 + }
262 243
  244 + public function translate_action()
  245 + {
  246 + ProjectServer::useProject(655);
  247 + $this->model = new Translate();
  248 + $lists = DB::connection('custom_mysql')->table('gl_translate_copy1')->where('url','!=','All')->get();
  249 + foreach ($lists as $item) {
  250 + $sourceInfo = $this->getRouteSource($item['url']);
  251 + $info = $this->model->read(['language_id'=>$item['language_id'],'source_id'=>$sourceInfo['source_id'],'url'=>$item['url'],'project_id'=>655,'type'=>$item['type']]);
  252 + if($info === false){
  253 + $param = [
  254 + 'type'=>$item['type'] ?? 1,
  255 + 'project_id'=>655,
  256 + 'url'=>$item['url'],
  257 + 'language_id'=>$item['language_id'],
  258 + 'alias'=>$item['alias'],
  259 + 'source'=>$sourceInfo['source'],
  260 + 'source_id'=>$sourceInfo['source_id'],
  261 + 'is_list'=>$sourceInfo['is_list'],
  262 + 'is_custom'=>$sourceInfo['is_custom'],
  263 + 'page'=>$sendData['page'] ?? 0
  264 + ];
  265 + $id = $this->model->addReturnId($param);
  266 + TranslateData::insert(['trans_id'=>$id,'data'=>$item['data']]);
  267 + }else{
  268 + TranslateData::where(['trans_id'=>$info['id']])->update(['data'=>$item['data']]);
  269 + }
  270 + }
263 DB::disconnect('custom_mysql'); 271 DB::disconnect('custom_mysql');
264 } 272 }
  273 +
  274 + public function getRouteSource($route){
  275 + $routes = $route;
  276 + $data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0,'page'=>0];
  277 + if(strtolower($route) == 'all'){
  278 + return $this->success($data);
  279 + }
  280 + if($route == 'index' || $route == '/'){
  281 + $data['source'] = 1;
  282 + return $this->success($data);
  283 + }
  284 + $route = basename($route);
  285 + $page = 0;
  286 + if (is_numeric($route)) {
  287 + $arr = explode('/',$routes);
  288 + $page = $route;
  289 + $route = $arr[0];
  290 + }
  291 + $routeModel = new RouteMap();
  292 + $routeInfo = $routeModel->read(['route'=>$route]);
  293 + if($routeInfo === false){
  294 + if(in_array($route,['products','news','blog'])){
  295 + //固定路由
  296 + $data['page'] = $page;
  297 + $data['is_list'] = 1;
  298 + if($route == 'products'){
  299 + $data['source'] = 2;
  300 + }elseif ($route == 'news'){
  301 + $data['source'] = 4;
  302 + }else{
  303 + $data['source'] = 3;
  304 + }
  305 + return $this->success($data);
  306 + }
  307 + return $data;
  308 + }
  309 + $data = $this->resultData($routeInfo,$data);
  310 + $data['page'] = $page;
  311 + return $data;
  312 + }
265 } 313 }
@@ -48,7 +48,7 @@ class CountLogic extends BaseLogic @@ -48,7 +48,7 @@ class CountLogic extends BaseLogic
48 $domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分 48 $domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分
49 $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']); 49 $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']);
50 if($inquiry_list !== false){ 50 if($inquiry_list !== false){
51 - if($inquiry_list['status'] != 400){ 51 + if(isset($inquiry_list['status']) && $inquiry_list['status'] != 400){
52 $info['inquiry_num'] = $inquiry_list['data']['count']; 52 $info['inquiry_num'] = $inquiry_list['data']['count'];
53 Cache::add('inquiry_num_'.$this->user['project_id'],$inquiry_list['data']['count'],3600); 53 Cache::add('inquiry_num_'.$this->user['project_id'],$inquiry_list['data']['count'],3600);
54 } 54 }