获取客户详情语言处理

This commit is contained in:
2025-03-27 14:27:06 +08:00
parent fa27b28ca8
commit 1e890f8f06
2 changed files with 17 additions and 9 deletions
+11 -9
View File
@@ -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) {