|
@@ -164,6 +164,34 @@ class Apic
|
|
|
Lang::load(APP_PATH . $this->request->module() . '/lang/' . $lang . '/' . str_replace('.', '/', $name) . '.php');
|
|
|
}
|
|
|
|
|
|
+ //结果集信息里,多个字段需要翻译
|
|
|
+ protected function list_lang($list,$field){
|
|
|
+ if(!$list || empty($list)){
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+ foreach($list as $vo => $info){
|
|
|
+ $list[$vo] = $this->info_lang($info,$field);
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+ //单条信息里,多个字段需要翻译
|
|
|
+ protected function info_lang($data,$field){
|
|
|
+ if(!$data || empty($data)){
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+ foreach($data as $key => $val){
|
|
|
+ if(in_array($key,$field)){
|
|
|
+ if($this->lang == 'EN'){
|
|
|
+ $data[$key] = $data[$key.'_en'];
|
|
|
+ unset($data[$key.'_en']);
|
|
|
+ }else{
|
|
|
+ unset($data[$key.'_en']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 操作成功返回的数据
|
|
|
* @param string $msg 提示信息
|