作者 赵彬吉

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -17,7 +17,14 @@ class Translate @@ -17,7 +17,14 @@ class Translate
17 { 17 {
18 //接口地址 18 //接口地址
19 // public static $url = 'https://translate.hbb618.cn/translates'; 19 // public static $url = 'https://translate.hbb618.cn/translates';
20 - public static $url = 'https://api.cmer.com/translates'; 20 + public static $url = 'https://api.cmer.com/';
  21 +
  22 + public static $header = array(
  23 + 'accept: application/json',
  24 + 'Content-Type: application/json',
  25 + 'apikey: UkzZljFv83Z2qBi5YR1o3f2otAVWtug6',
  26 + 'X-CmerApi-Host:ai_translate.p.cmer.com'
  27 + );
21 28
22 public static $tls_list = [ 29 public static $tls_list = [
23 'en' => [ 30 'en' => [
@@ -734,7 +741,7 @@ class Translate @@ -734,7 +741,7 @@ class Translate
734 'sl' => 'auto', 741 'sl' => 'auto',
735 'tls' => $tls, 742 'tls' => $tls,
736 ]; 743 ];
737 - return Http::post(self::$url.$action, $data); 744 + return http_post(self::$url.$action, json_encode($data),self::$header);
738 } 745 }
739 746
740 /** 747 /**
@@ -749,11 +756,8 @@ class Translate @@ -749,11 +756,8 @@ class Translate
749 if (!$texts) { 756 if (!$texts) {
750 return ''; 757 return '';
751 } 758 }
752 -  
753 - $retsult = self::translate($texts, $tls)->json();  
754 -  
755 - return $retsult[0]['texts'] ?? '';  
756 - 759 + $result = self::translate($texts, $tls);
  760 + return $result[0]['texts'] ?? '';
757 } 761 }
758 /** 762 /**
759 * 翻译带源语种 763 * 翻译带源语种
@@ -772,7 +776,7 @@ class Translate @@ -772,7 +776,7 @@ class Translate
772 'sl' => 'auto', 776 'sl' => 'auto',
773 'tl' => $tl, 777 'tl' => $tl,
774 ]; 778 ];
775 - return Http::post(self::$url . $action, $data); 779 + return http_post(self::$url.$action, json_encode($data),self::$header);
776 } 780 }
777 781
778 } 782 }
@@ -286,14 +286,20 @@ class ProductLogic extends BaseLogic @@ -286,14 +286,20 @@ class ProductLogic extends BaseLogic
286 'created_at'=>date('Y-m-d H:i:s'), 286 'created_at'=>date('Y-m-d H:i:s'),
287 'updated_at'=>date('Y-m-d H:i:s'), 287 'updated_at'=>date('Y-m-d H:i:s'),
288 ]; 288 ];
289 - if(!empty($info['thumb'])){  
290 - $param['thumb']= Arr::a2s($info['thumb']);  
291 - }  
292 - if(!empty($info['gallery'])){  
293 - $param['gallery']= Arr::a2s($info['gallery']); 289 + if(isset($info['icon']) && !empty($info['icon'])){
  290 + foreach ($info['icon'] as $k1 => $v1){
  291 + $info['icon'][$k1] = str_replace_url($v1);
  292 + }
  293 + $param['icon'] = Arr::a2s($info['icon'] ?? '');
294 } 294 }
295 - if(!empty($info['icon'])){  
296 - $param['icon']= Arr::a2s($info['icon']); 295 + //产品图
  296 + if(isset($info['gallery']) && !empty($info['gallery'])){
  297 + foreach ($info['gallery'] as $k => $v){
  298 + $v['url'] = str_replace_url($v['url']);
  299 + $info['gallery'][$k] = $v;
  300 + }
  301 + $param['thumb'] = Arr::a2s($info['gallery'][0] ?? '');
  302 + $param['gallery'] = Arr::a2s($info['gallery'] ?? '');
297 } 303 }
298 return $param; 304 return $param;
299 } 305 }