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'],
];
}