This commit is contained in:
2025-07-10 14:27:56 +08:00
parent 9f077f7572
commit a45d586f07
13 changed files with 179 additions and 34 deletions
+17 -5
View File
@@ -39,9 +39,9 @@ class FollowController extends BaseController
public function list(Request $request)
{
try {
$data = $this->validate(new FollowValidate(), $request->get(), 'upwd_list');
$result = (new FollowService())->list($request->all());
return $this->success($this->page($result));
$data = $this->validate(new FollowValidate(), $request->get(), 'list');
$result = (new FollowService())->list($request->all(),$request->user->uid);
return $this->success($result);
} catch (\Throwable $e) {
return $this->error($e->getMessage());
}
@@ -69,7 +69,7 @@ class FollowController extends BaseController
return $this->error('记录不存在');
}
$res = Follow::getFollow($res);
$res = FollowService::getFollow($res);
return $this->success($res);
}
@@ -96,7 +96,7 @@ class FollowController extends BaseController
}
$data = [
'user_id'=>$request->user['id'],
'user_id'=>$request->user->uid,
'customer_id'=>$customer_id,
'type'=>$type,
'picture'=>$picture,
@@ -117,6 +117,18 @@ class FollowController extends BaseController
$customer->warn = 0;
$customer->save();
$follow_next = Util::getParam($request, 'follow_next', 0);
$follow_remark = Util::getParam($request, 'follow_remark', 0);
if($res && (!empty($follow_next))){
$data = [
'follow_next' => $follow_next,
'follow_remark' => $follow_remark,
'warn' => 0,
];
$res = Customer::where('id', $customer_id)
->update($data);
}
if ($res) {
return $this->success($res,trans('save_success'));
} else {
+1 -1
View File
@@ -17,7 +17,7 @@ class Customer extends Model
*
* @var string
*/
protected $table = 'customer';
protected $table = 'crm_customer';
/**
* The primary key associated with the table.
+1 -1
View File
@@ -17,7 +17,7 @@ class CustomerHis extends Model
*
* @var string
*/
protected $table = 'customer_his';
protected $table = 'crm_customer_his';
/**
* The primary key associated with the table.
+1 -12
View File
@@ -16,7 +16,7 @@ class Follow extends Model
*
* @var string
*/
protected $table = 'follow';
protected $table = 'crm_follow';
/**
* The primary key associated with the table.
@@ -47,15 +47,4 @@ class Follow extends Model
// 'updated_at' => 'timestamp', // 指定序列化格式
// 'created_at' => 'timestamp', // 指定序列化格式
];
public static function getFollow($follow,$domain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com')
{
$follow['type_txt'] = Constants::FOLLOW[$follow['type']];
$follow['firstFollowtime'] = $follow['follow_time'];
$ossservice = new OssService();
$oss_picture = $ossservice->generatePrivateUrl($follow['picture'],86400);
$follow['oss_picture'] = $oss_picture;
// $follow = Util::formatDate($follow);
return $follow;
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ class Tag extends Model
*
* @var string
*/
protected $table = 'tag';
protected $table = 'crm_tag';
/**
* The primary key associated with the table.
+1 -1
View File
@@ -17,7 +17,7 @@ class TagGroup extends Model
*
* @var string
*/
protected $table = 'tag_group';
protected $table = 'crm_tag_group';
/**
* The primary key associated with the table.
+23 -12
View File
@@ -2,13 +2,15 @@
namespace app\crm\service;
use app\common\service\OssService;
use app\crm\model\Follow;
use app\crm\utils\Util;
use config\constants\Constants;
class FollowService
{
public function list($param)
public function list($param, $userId)
{
@@ -22,16 +24,9 @@ class FollowService
$where['customer_id'] = $customer_id;
//用户角色
$userId = $request->user['id'];
if(Util::isEmpty($userId)){
return $this->error(trans('user_none'));
}
if($request->user['role']!=1){
$where['user_id'] = $userId;
}
//跟进id
$id = Util::getParam($request,'id');
$id = $param['id']??null;
if(!Util::isEmpty($id)){
$where['id'] = $id;
}
@@ -43,11 +38,27 @@ class FollowService
// $host = $request->host();
$url = 'http:'.$request->url();
// $url = 'http:'.$request->url();
foreach ($data as &$value){
$value = Follow::getFollow($value);
$value = self::getFollow($value);
}
return $this->success($data,trans('success'));
return $data;
}
public static function getFollow($follow,$domain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com')
{
$follow['type_txt'] = Constants::FOLLOW[$follow['type']];
$follow['firstFollowtime'] = $follow['follow_time'];
$oss_picture = '';
if(!empty($follow['picture'])){
$ossservice = new OssService();
$oss_picture = $ossservice->generatePrivateUrl($follow['picture'],86400);
}
$follow['oss_picture'] = $oss_picture;
// $follow = Util::formatDate($follow);
return $follow;
}
}
+1 -1
View File
@@ -16,6 +16,6 @@ class FollowValidate extends Validate
];
protected $scene = [
'upwd_list' => ['customer_id'],
'list' => ['customer_id'],
];
}
+9
View File
@@ -65,3 +65,12 @@ Route::group('/ticket', function () {
});
//crm
Route::group('/crm', function () {
Route::any('/follow/list', [app\crm\controller\FollowController::class, 'list']);
Route::any('/follow/detail', [app\crm\controller\FollowController::class, 'detail']);
Route::any('/follow/add', [app\crm\controller\FollowController::class, 'save']);
Route::any('/follow/getFollowType', [app\crm\controller\FollowController::class, 'getFollowType']);
Route::any('/follow/getFollowType', [app\crm\controller\FollowController::class, 'getFollowType']);
});
+31
View File
@@ -2,4 +2,35 @@
return [
'status_not_modified' => 'الدولة لا يمكن تعديلها عكسيا',
'success' => ' النجاح',
'fail' => ' الفشل',
'login_success' => ' تم تسجيل الدخول بنجاح',
'password_error' => ' كلمة المرور غير صحيحة',
'user_none' => ' المستخدم غير موجود',
'user_id' => ' معرف المستخدم',
'user_login' => ' الرجاء تسجيل الدخول أولاً',
'not_null' => ' لا يمكن أن يكون فارغًا',
'code_error' => ' رمز التحقق غير صحيح',
'format_error' => ' تنسيق غير صحيح',
'email_repeat' => ' البريد الإلكتروني مكرر',
'email_error' => ' تنسيق البريد الإلكتروني غير صحيح',
'save_success' => ' تم الحفظ بنجاح',
'save_fail' => ' فشل الحفظ',
'register_success' => ' تم التسجيل بنجاح',
'register_fail' => ' فشل التسجيل',
'language_success' => ' تم تغيير اللغة بنجاح',
'language_fail' => ' فشل تغيير اللغة',
'param_error' => ' خطأ في المعلمات',
'required_not_null' => ' الحقول المطلوبة لا يمكن أن تكون فارغة',
'picture_not_null' => ' لا يمكن أن تكون الصورة فارغة',
'contacts_not_null' => ' لا يمكن أن يكون جهة الاتصال أو البريد الإلكتروني أو الهاتف فارغين جميعًا في نفس الوقت',
'car_type_not_null' => ' لا يمكن أن تكون التفضيلات فارغة',
'channel_not_null' => ' لا يمكن أن تكون القناة فارغة',
'email_consistent' => ' البريد الإلكتروني غير متطابق',
'sign_not_null' => ' لم يتم تعيين الشركة التابعة',
'password_short' => ' لا يمكن أن تكون كلمة المرور أقل من 6 أحرف',
'id_empty' => ' لا يمكن أن يكون المعرف فارغًا',
'customer_id' => ' معرف العميل',
'tag_group_id' => ' معرف مجموعة العلامات',
'claim_fail' => ' لا يمكن استلام العملاء الذين لديهم مالك بالفعل',
];
+31
View File
@@ -2,4 +2,35 @@
return [
'status_not_modified' => 'The status cannot be reversed for modification',
'success' => ' success',
'fail' => ' fail',
'login_success' => ' login success',
'password_error' => ' password error',
'user_none' => ' user none',
'user_id' => ' user ID',
'user_login' => ' Please log in first',
'not_null' => ' not null',
'code_error' => ' code error',
'format_error' => ' format error',
'email_repeat' => ' email repeat',
'email_error' => ' Email format error',
'save_success' => ' save success',
'save_fail' => ' save fail',
'register_success' => ' register success',
'register_fail' => ' register fail',
'language_success' => ' Successfully switched languages',
'language_fail' => ' Language switching failed',
'param_error' => ' param error',
'required_not_null' => ' required not_ ull',
'picture_not_null' => ' picture not null',
'contacts_not_null' => ' Contact person, email, and phone cannot be empty at the same time',
'car_type_not_null' => ' preference_not_null',
'channel_not_null' => ' channel not null',
'email_consistent' => ' Inconsistent email addresses',
'sign_not_null' => ' No affiliated company has been set',
'password_short' => ' Password cannot be less than 6 characters',
'id_empty' => ' ID cannot be empty',
'customer_id' => ' customer ID',
'tag_group_id' => ' tag group ID',
'claim_fail' => ' Cannot claim ownership of customers',
];
+31
View File
@@ -2,4 +2,35 @@
return [
'status_not_modified' => 'Статус не может быть изменен в обратном направлении',
'success' => ' Успех',
'fail' => ' Неудача',
'login_success' => ' Регистрация завершена',
'password_error' => ' Ошибка пароля',
'user_none' => ' Пользователь не существует',
'user_id' => ' Идентификатор пользователя',
'user_login' => ' Пожалуйста, войдите.',
'not_null' => ' Нельзя быть пустым',
'code_error' => ' Ошибка кода проверки',
'format_error' => ' Ошибка формата',
'email_repeat' => ' Почтовый ящик повторяется',
'email_error' => ' Ошибка формата почтового ящика',
'save_success' => ' Сохранить успешно',
'save_fail' => ' Ошибка сохранения',
'register_success' => ' Регистрация успешно',
'register_fail' => ' Ошибка регистрации',
'language_success' => ' Переключить язык успешно',
'language_fail' => ' Ошибка переключения языка',
'param_error' => ' Ошибка параметра',
'required_not_null' => ' Обязательное заполнение не может быть пустым.',
'picture_not_null' => ' Фотографии не могут быть пустыми',
'contacts_not_null' => ' Контакты, почтовый ящик, телефон не может быть одновременно пустым',
'car_type_not_null' => ' Предпочтения не могут быть пустыми',
'channel_not_null' => ' Каналы не могут быть пустыми',
'email_consistent' => ' Почтовый ящик не совпадает',
'sign_not_null' => ' Компания не создана',
'password_short' => ' Пароль не может быть меньше 6.',
'id_empty' => ' ID не может быть пустым',
'customer_id' => ' Идентификатор клиента',
'tag_group_id' => ' Идентификатор группы меток',
'claim_fail' => ' Невозможность получения принадлежащего клиенту',
];
+31
View File
@@ -2,4 +2,35 @@
return [
'status_not_modified' => '状态不能逆向修改',
'success' => ' 成功',
'fail' => ' 失败',
'login_success' => ' 登录成功',
'password_error' => ' 密码错误',
'user_none' => ' 用户不存在',
'user_id' => ' 用户ID',
'user_login' => ' 请先登录',
'not_null' => ' 不能为空',
'code_error' => ' 验证码错误',
'format_error' => ' 格式错误',
'email_repeat' => ' 邮箱重复',
'email_error' => ' 邮箱格式错误',
'save_success' => ' 保存成功',
'save_fail' => ' 保存失败',
'register_success' => ' 注册成功',
'register_fail' => ' 注册失败',
'language_success' => ' 切换语言成功',
'language_fail' => ' 切换语言失败',
'param_error' => ' 参数错误',
'required_not_null' => ' 必填项不能为空',
'picture_not_null' => ' 图片不能为空',
'contacts_not_null' => ' 联系人,邮箱,电话不能同时为空',
'car_type_not_null' => ' 偏好不能为空',
'channel_not_null' => ' 渠道不能为空',
'email_consistent' => ' 邮箱不一致',
'sign_not_null' => ' 未设置所属公司',
'password_short' => ' 密码不能少于6位',
'id_empty' => ' id不能为空',
'customer_id' => ' 客户ID',
'tag_group_id' => ' 标签组ID',
'claim_fail' => ' 不能领取有归属客户',
];