标签处理

This commit is contained in:
2025-03-27 14:05:14 +08:00
parent 16a7ea2976
commit 80a7541d0c
2 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -59,11 +59,18 @@ class Customer extends Model
return $date->format(Carbon::parse($date)->toDateTimeString());
}
public static function getCustomer($customer,$request = null)
/**
* @param $customer
* @param $request
* @param $tag 是否返回客户标签
* @return mixed
*/
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';
if ($customer['grade']<=2) {
$customer['follow'] = 0;
@@ -94,8 +101,7 @@ class Customer extends Model
$customer['channel_name'] = empty($customer['channel_id'])?'':Channel::where(['id'=>$customer['channel_id']])->value('name');
// $customer['last_follow'] = $last_follow;
if (!empty($request)) {
$language = $request->user['language'] ?: 'en';
if ($tag) {
foreach ($customer['tags'] as &$tag) {
$tag['names'] = unserialize($tag['names']);
$tag['name'] = $tag['names'][$language];