|
...
|
...
|
@@ -68,39 +68,31 @@ class TranslateController extends BaseController |
|
|
|
$this->map['type'] = 1;
|
|
|
|
$data = $translate->formatQuery($this->map)->with('translate_data')->get()->toArray();
|
|
|
|
$keyModel = new TranslateKey();
|
|
|
|
$keyList = $keyModel->list();
|
|
|
|
$keyList = $keyModel->list([],'id',['*'],'asc');
|
|
|
|
if(empty($data) && empty($keyList)){
|
|
|
|
$this->response('导出数据为空',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
if(empty($data)){
|
|
|
|
foreach ($keyList as $values){
|
|
|
|
$key_data = json_decode($values['proof_key'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
$resData['route'] = $values['url'];
|
|
|
|
$resData['source'] = $values['source'];
|
|
|
|
$resData['source_id'] = $values['source_id'];
|
|
|
|
$resData['is_list'] = $values['is_list'];
|
|
|
|
$resData['is_custom'] = $values['is_custom'];
|
|
|
|
$resData['page'] = $values['page'];
|
|
|
|
foreach ($key_data as $key_val){
|
|
|
|
$resData['data'][] = [$key_val => ''];
|
|
|
|
}
|
|
|
|
$res_data[] = $resData;
|
|
|
|
}
|
|
|
|
$res_data = $this->resEmptyData($keyList);
|
|
|
|
$this->response('success',Code::SUCCESS,$res_data);
|
|
|
|
}
|
|
|
|
if(empty($keyList)){
|
|
|
|
foreach ($data as $values){
|
|
|
|
$resData['route'] = $values['url'];
|
|
|
|
$resData['source'] = $values['source'];
|
|
|
|
$resData['source_id'] = $values['source_id'];
|
|
|
|
$resData['is_list'] = $values['is_list'];
|
|
|
|
$resData['is_custom'] = $values['is_custom'];
|
|
|
|
$resData['page'] = $values['page'];
|
|
|
|
$resData['data'] = json_decode($values['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
$res_data[] = $resData;
|
|
|
|
}
|
|
|
|
$res_data = $this->resEmptyKey($data);
|
|
|
|
$this->response('success',Code::SUCCESS,$res_data);
|
|
|
|
}
|
|
|
|
$res_data = $this->resData($keyList,$data);
|
|
|
|
$this->response('success',Code::SUCCESS,$res_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :都不为处理数据
|
|
|
|
* @name :resData
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/11/22 17:50
|
|
|
|
*/
|
|
|
|
public function resData($keyList,$data){
|
|
|
|
$result_key_data = [];
|
|
|
|
foreach ($data as $values){
|
|
|
|
$resData['route'] = $values['url'];
|
|
|
|
$resData['source'] = $values['source'];
|
|
...
|
...
|
@@ -120,13 +112,81 @@ class TranslateController extends BaseController |
|
|
|
}
|
|
|
|
}
|
|
|
|
$resData['data'] = $translate_data;
|
|
|
|
//去除,已匹配的页面统计出来
|
|
|
|
$result_key_data[] = $v1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$res_data[] = $resData;
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$res_data);
|
|
|
|
// 排除掉 $result_key_data 中的元素
|
|
|
|
$result = array_udiff($keyList, $result_key_data, function ($a, $b) {
|
|
|
|
return strcmp(json_encode($a), json_encode($b));
|
|
|
|
});
|
|
|
|
$result_key_list = array_values($result); // 重置键名
|
|
|
|
if(!empty($result_key_list)){
|
|
|
|
foreach ($result_key_list as $values){
|
|
|
|
$resData['route'] = $values['url'];
|
|
|
|
$resData['source'] = $values['source'];
|
|
|
|
$resData['source_id'] = $values['source_id'];
|
|
|
|
$resData['is_list'] = $values['is_list'];
|
|
|
|
$resData['is_custom'] = $values['is_custom'];
|
|
|
|
$resData['page'] = $values['page'];
|
|
|
|
$key_data = json_decode($values['proof_key'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
foreach ($key_data as $key_val){
|
|
|
|
$resData['data'][] = [$key_val => ''];
|
|
|
|
}
|
|
|
|
$res_data[] = $resData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $res_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :data值为空 按原key返回
|
|
|
|
* @name :resEmptyKeyList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/11/22 17:45
|
|
|
|
*/
|
|
|
|
public function resEmptyData($keyList){
|
|
|
|
$res_data = [];
|
|
|
|
foreach ($keyList as $values){
|
|
|
|
$key_data = json_decode($values['proof_key'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
$resData['route'] = $values['url'];
|
|
|
|
$resData['source'] = $values['source'];
|
|
|
|
$resData['source_id'] = $values['source_id'];
|
|
|
|
$resData['is_list'] = $values['is_list'];
|
|
|
|
$resData['is_custom'] = $values['is_custom'];
|
|
|
|
$resData['page'] = $values['page'];
|
|
|
|
foreach ($key_data as $key_val){
|
|
|
|
$resData['data'][] = [$key_val => ''];
|
|
|
|
}
|
|
|
|
$res_data[] = $resData;
|
|
|
|
}
|
|
|
|
return $res_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :key为空 直接返回data
|
|
|
|
* @name :resEmptyKey
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/11/22 17:48
|
|
|
|
*/
|
|
|
|
public function resEmptyKey($data){
|
|
|
|
$res_data = [];
|
|
|
|
foreach ($data as $values){
|
|
|
|
$resData['route'] = $values['url'];
|
|
|
|
$resData['source'] = $values['source'];
|
|
|
|
$resData['source_id'] = $values['source_id'];
|
|
|
|
$resData['is_list'] = $values['is_list'];
|
|
|
|
$resData['is_custom'] = $values['is_custom'];
|
|
|
|
$resData['page'] = $values['page'];
|
|
|
|
$resData['data'] = json_decode($values['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
$res_data[] = $resData;
|
|
|
|
}
|
|
|
|
return $res_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :图片列表
|
...
|
...
|
|