获取客户详情语言处理
This commit is contained in:
+11
-9
@@ -67,20 +67,20 @@ class Customer extends Model
|
|||||||
*/
|
*/
|
||||||
public static function getCustomer($customer, $request, $tag = false)
|
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';
|
$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) {
|
if ($customer['grade']<=2) {
|
||||||
$customer['follow'] = 0;
|
$customer['follow'] = 0;
|
||||||
$customer['follow_txt'] = '跟进中';
|
$customer['follow_txt'] = ($language == 'en' ? 'Following' : '跟进中');
|
||||||
}elseif ($customer['grade']<5) {
|
}elseif ($customer['grade']<5) {
|
||||||
$customer['follow'] = 1;
|
$customer['follow'] = 1;
|
||||||
$customer['follow_txt'] = '已成交';
|
$customer['follow_txt'] = ($language == 'en' ? 'transacted' : '已成交');
|
||||||
}else{
|
}else{
|
||||||
$customer['follow'] = 2;
|
$customer['follow'] = 2;
|
||||||
$customer['follow_txt'] = '已流失';
|
$customer['follow_txt'] = ($language == 'en' ? 'lost' : '已流失');
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = [
|
$where = [
|
||||||
@@ -96,9 +96,11 @@ class Customer extends Model
|
|||||||
// $customer['updated_at'] = Util::timeTotDate($customer['updated_at']);
|
// $customer['updated_at'] = Util::timeTotDate($customer['updated_at']);
|
||||||
|
|
||||||
$customer = Util::formatDate($customer,['follow_last']);
|
$customer = Util::formatDate($customer,['follow_last']);
|
||||||
$customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value('name');
|
$nameLang = $language=='en'?'name_en':'name';
|
||||||
$customer['country_name'] = empty($customer['country_id'])?'':Country::where(['id'=>$customer['country_id']])->value('cn_addr');
|
$countryLang = $language=='en'?'en_addr':'cn_addr';
|
||||||
$customer['channel_name'] = empty($customer['channel_id'])?'':Channel::where(['id'=>$customer['channel_id']])->value('name');
|
$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;
|
// $customer['last_follow'] = $last_follow;
|
||||||
|
|
||||||
if ($tag) {
|
if ($tag) {
|
||||||
|
|||||||
@@ -68,4 +68,10 @@ class Constants
|
|||||||
self::CUSTOMER_SEX_MAN => '男',
|
self::CUSTOMER_SEX_MAN => '男',
|
||||||
self::CUSTOMER_SEX_WOMAN => '女',
|
self::CUSTOMER_SEX_WOMAN => '女',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public const SEX_EN = [
|
||||||
|
self::CUSTOMER_SEX_UNKNOWN => 'unknown',
|
||||||
|
self::CUSTOMER_SEX_MAN => 'man',
|
||||||
|
self::CUSTOMER_SEX_WOMAN => 'woman',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user