From 1e890f8f063623bdfd1d2c0b566b376733b67583 Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Thu, 27 Mar 2025 14:27:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=AF=AD=E8=A8=80=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/Customer.php | 20 +++++++++++--------- config/constants/Constants.php | 6 ++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/model/Customer.php b/app/model/Customer.php index 86adea5..d5f4985 100644 --- a/app/model/Customer.php +++ b/app/model/Customer.php @@ -67,20 +67,20 @@ class Customer extends Model */ public static function getCustomer($customer, $request, $tag = false) { - $customer['grade_txt'] = Constants::GRADE[$customer['grade']]; - $customer['magnitude_txt'] = Constants::MAGNITUDE[$customer['magnitude']]; - $customer['sex_txt'] = Constants::SEX[$customer['sex']]; $language = $request->user['language'] ?: 'en'; + $customer['grade_txt'] = $language=='en'?Constants::GRADE_EN[$customer['grade']]:Constants::GRADE[$customer['grade']]; + $customer['magnitude_txt'] = $language=='en'?Constants::MAGNITUDE_EN[$customer['magnitude']]:Constants::MAGNITUDE[$customer['magnitude']]; + $customer['sex_txt'] = $language=='en'?Constants::SEX_EN[$customer['sex']]:Constants::SEX[$customer['sex']]; if ($customer['grade']<=2) { $customer['follow'] = 0; - $customer['follow_txt'] = '跟进中'; + $customer['follow_txt'] = ($language == 'en' ? 'Following' : '跟进中'); }elseif ($customer['grade']<5) { $customer['follow'] = 1; - $customer['follow_txt'] = '已成交'; + $customer['follow_txt'] = ($language == 'en' ? 'transacted' : '已成交'); }else{ $customer['follow'] = 2; - $customer['follow_txt'] = '已流失'; + $customer['follow_txt'] = ($language == 'en' ? 'lost' : '已流失'); } $where = [ @@ -96,9 +96,11 @@ class Customer extends Model // $customer['updated_at'] = Util::timeTotDate($customer['updated_at']); $customer = Util::formatDate($customer,['follow_last']); - $customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value('name'); - $customer['country_name'] = empty($customer['country_id'])?'':Country::where(['id'=>$customer['country_id']])->value('cn_addr'); - $customer['channel_name'] = empty($customer['channel_id'])?'':Channel::where(['id'=>$customer['channel_id']])->value('name'); + $nameLang = $language=='en'?'name_en':'name'; + $countryLang = $language=='en'?'en_addr':'cn_addr'; + $customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value($nameLang); + $customer['country_name'] = empty($customer['country_id'])?'':Country::where(['id'=>$customer['country_id']])->value($countryLang); + $customer['channel_name'] = empty($customer['channel_id'])?'':Channel::where(['id'=>$customer['channel_id']])->value($nameLang); // $customer['last_follow'] = $last_follow; if ($tag) { diff --git a/config/constants/Constants.php b/config/constants/Constants.php index 0883ea5..36a21e5 100644 --- a/config/constants/Constants.php +++ b/config/constants/Constants.php @@ -68,4 +68,10 @@ class Constants self::CUSTOMER_SEX_MAN => '男', self::CUSTOMER_SEX_WOMAN => '女', ]; + + public const SEX_EN = [ + self::CUSTOMER_SEX_UNKNOWN => 'unknown', + self::CUSTOMER_SEX_MAN => 'man', + self::CUSTOMER_SEX_WOMAN => 'woman', + ]; } \ No newline at end of file