作者 lyh

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

@@ -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 }
@@ -197,7 +197,9 @@ class ProductLogic extends BaseLogic @@ -197,7 +197,9 @@ class ProductLogic extends BaseLogic
197 * @time :2023/7/29 15:03 197 * @time :2023/7/29 15:03
198 */ 198 */
199 public function setCopyProduct(){ 199 public function setCopyProduct(){
200 - $info = $this->model->read(['id'=>$this->param['id']]); 200 + $info = Product::withoutCasts()->find($this->param['id']);
  201 + var_dump($info);
  202 + die();
201 $param = $this->setProductParams($info); 203 $param = $this->setProductParams($info);
202 $save_id = $this->model->insertGetId($param); 204 $save_id = $this->model->insertGetId($param);
203 $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']); 205 $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']);