diff --git a/app/controller/AreaController.php b/app/controller/AreaController.php index 68eeb95..9b0d979 100644 --- a/app/controller/AreaController.php +++ b/app/controller/AreaController.php @@ -41,10 +41,14 @@ class AreaController public function getCountry (Request $request) { - $level = Util::getParam($request,'level')?:1; $list = Country::get()->toArray(); + $language = 'en_addr'; + if($request->user['language'] == 'zh_CN'){ + $language = 'cn_addr'; + } + foreach ($list as &$row) { - $row['name'] = $row['cn_addr']; + $row['name'] = $row[$language]; } return Util::success($list); } diff --git a/app/controller/CarTypeController.php b/app/controller/CarTypeController.php index 573c39b..bb022a0 100644 --- a/app/controller/CarTypeController.php +++ b/app/controller/CarTypeController.php @@ -16,6 +16,13 @@ class CarTypeController public function getAll(Request $request) { $list = CarType::getAll(); + + if($request->user['language'] != 'zh_CN'){ + foreach ($list as $key => &$value) { + $value['name'] = $value['name_en']; + } + } + return Util::success($list); } diff --git a/app/controller/CustomerController.php b/app/controller/CustomerController.php index 2ce3c6c..fa1b67f 100644 --- a/app/controller/CustomerController.php +++ b/app/controller/CustomerController.php @@ -20,7 +20,11 @@ class CustomerController public function getGrade(Request $request) { $grade = []; - foreach (Constants::GRADE as $key => $value) { + $gradeConstants = Constants::GRADE_EN; + if($request->user['language'] == 'zh_CN'){ + $gradeConstants = Constants::GRADE; + } + foreach ($gradeConstants as $key => $value) { $grade[] = [ 'id' => $key, 'name' => $value, @@ -37,7 +41,11 @@ class CustomerController public function getMagnitude(Request $request) { $grade = []; - foreach (Constants::MAGNITUDE as $key => $value) { + $magnitudeConstants = Constants::MAGNITUDE_EN; + if($request->user['language'] == 'zh_CN'){ + $magnitudeConstants = Constants::MAGNITUDE; + } + foreach ($magnitudeConstants as $key => $value) { $grade[] = [ 'id' => $key, 'name' => $value, @@ -54,6 +62,13 @@ class CustomerController public function getChannel(Request $request) { $list = Channel::getAll(); + + if($request->user['language'] != 'zh_CN'){ + foreach ($list as $key => &$value) { + $value['name'] = $value['name_en']; + } + } + return Util::success($list); } diff --git a/app/model/CarType.php b/app/model/CarType.php index a4a4f95..b6f2efb 100644 --- a/app/model/CarType.php +++ b/app/model/CarType.php @@ -30,7 +30,7 @@ class CarType extends Model public static function getAll() { - $list = self::get()->select('id','name','status')->where('status',0)->toArray(); + $list = self::get()->select('id','name','name_en','status')->where('status',0)->toArray(); return $list; } } \ No newline at end of file diff --git a/app/model/Channel.php b/app/model/Channel.php index a9bba9e..74ee009 100644 --- a/app/model/Channel.php +++ b/app/model/Channel.php @@ -42,7 +42,7 @@ class Channel extends Model public static function getAll() { - $list = self::get()->select('id','name','status')->where('status',0)->toArray(); + $list = self::get()->select('id','name','name_en','status')->where('status',0)->toArray(); return $list; } } \ No newline at end of file diff --git a/config/constants/Constants.php b/config/constants/Constants.php index 9fd41a9..0883ea5 100644 --- a/config/constants/Constants.php +++ b/config/constants/Constants.php @@ -19,6 +19,14 @@ class Constants self::CUSTOMER_GRADE_SALES => '售后阶段', self::CUSTOMER_GRADE_LOSS => '停滞或流失', ]; + public const GRADE_EN = [ + self::CUSTOMER_GRADE_INITIAL => 'Initial contact', + self::CUSTOMER_GRADE_COMMUNICATE => 'Demand Chat', + self::CUSTOMER_GRADE_PLAN => 'promotion of the plan', + self::CUSTOMER_GRADE_DEAL => 'Transaction Stage', + self::CUSTOMER_GRADE_SALES => 'After Sales', + self::CUSTOMER_GRADE_LOSS => 'Stagnation or loss', + ]; //客户重要性 public const CUSTOMER_MAGNITUDE_INITIAL = 0; // 金牌商机 @@ -30,6 +38,11 @@ class Constants self::CUSTOMER_MAGNITUDE_COMMUNICATE => '银牌商机', self::CUSTOMER_MAGNITUDE_PLAN => '铜牌商机', ]; + public const MAGNITUDE_EN = [ + self::CUSTOMER_MAGNITUDE_INITIAL => 'Gold Medal', + self::CUSTOMER_MAGNITUDE_COMMUNICATE => 'Silver Medal', + self::CUSTOMER_MAGNITUDE_PLAN => 'Bronze Medal', + ]; //跟进类型 @@ -40,6 +53,10 @@ class Constants self::CUSTOMER_FOLLOW_VISIT => '线下拜访', self::CUSTOMER_FOLLOW_UP => '线上跟进', ]; + public const FOLLOW_EN = [ + self::CUSTOMER_FOLLOW_VISIT => 'Visit', + self::CUSTOMER_FOLLOW_UP => 'On line', + ]; //跟进类型 public const CUSTOMER_SEX_UNKNOWN = 0; // 未知