Merge branch 'feature/en' into develop
This commit is contained in:
@@ -41,10 +41,14 @@ class AreaController
|
|||||||
|
|
||||||
public function getCountry (Request $request)
|
public function getCountry (Request $request)
|
||||||
{
|
{
|
||||||
$level = Util::getParam($request,'level')?:1;
|
|
||||||
$list = Country::get()->toArray();
|
$list = Country::get()->toArray();
|
||||||
|
$language = 'en_addr';
|
||||||
|
if($request->user['language'] == 'zh_CN'){
|
||||||
|
$language = 'cn_addr';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($list as &$row) {
|
foreach ($list as &$row) {
|
||||||
$row['name'] = $row['cn_addr'];
|
$row['name'] = $row[$language];
|
||||||
}
|
}
|
||||||
return Util::success($list);
|
return Util::success($list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ class CarTypeController
|
|||||||
public function getAll(Request $request)
|
public function getAll(Request $request)
|
||||||
{
|
{
|
||||||
$list = CarType::getAll();
|
$list = CarType::getAll();
|
||||||
|
|
||||||
|
if($request->user['language'] != 'zh_CN'){
|
||||||
|
foreach ($list as $key => &$value) {
|
||||||
|
$value['name'] = $value['name_en'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Util::success($list);
|
return Util::success($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ class CustomerController
|
|||||||
public function getGrade(Request $request)
|
public function getGrade(Request $request)
|
||||||
{
|
{
|
||||||
$grade = [];
|
$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[] = [
|
$grade[] = [
|
||||||
'id' => $key,
|
'id' => $key,
|
||||||
'name' => $value,
|
'name' => $value,
|
||||||
@@ -45,7 +49,11 @@ class CustomerController
|
|||||||
public function getMagnitude(Request $request)
|
public function getMagnitude(Request $request)
|
||||||
{
|
{
|
||||||
$grade = [];
|
$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[] = [
|
$grade[] = [
|
||||||
'id' => $key,
|
'id' => $key,
|
||||||
'name' => $value,
|
'name' => $value,
|
||||||
@@ -62,6 +70,13 @@ class CustomerController
|
|||||||
public function getChannel(Request $request)
|
public function getChannel(Request $request)
|
||||||
{
|
{
|
||||||
$list = Channel::getAll();
|
$list = Channel::getAll();
|
||||||
|
|
||||||
|
if($request->user['language'] != 'zh_CN'){
|
||||||
|
foreach ($list as $key => &$value) {
|
||||||
|
$value['name'] = $value['name_en'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Util::success($list);
|
return Util::success($list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class CarType extends Model
|
|||||||
|
|
||||||
public static function getAll()
|
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;
|
return $list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ class Channel extends Model
|
|||||||
|
|
||||||
public static function getAll()
|
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;
|
return $list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+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) {
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ class Constants
|
|||||||
self::CUSTOMER_GRADE_SALES => '售后阶段',
|
self::CUSTOMER_GRADE_SALES => '售后阶段',
|
||||||
self::CUSTOMER_GRADE_LOSS => '停滞或流失',
|
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; // 金牌商机
|
public const CUSTOMER_MAGNITUDE_INITIAL = 0; // 金牌商机
|
||||||
@@ -30,6 +38,11 @@ class Constants
|
|||||||
self::CUSTOMER_MAGNITUDE_COMMUNICATE => '银牌商机',
|
self::CUSTOMER_MAGNITUDE_COMMUNICATE => '银牌商机',
|
||||||
self::CUSTOMER_MAGNITUDE_PLAN => '铜牌商机',
|
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_VISIT => '线下拜访',
|
||||||
self::CUSTOMER_FOLLOW_UP => '线上跟进',
|
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; // 未知
|
public const CUSTOMER_SEX_UNKNOWN = 0; // 未知
|
||||||
@@ -51,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