Files
fdesk/app/crm/service/FollowService.php
T

64 lines
1.5 KiB
PHP
Raw Normal View History

2025-07-09 15:10:14 +08:00
<?php
namespace app\crm\service;
2025-07-10 14:27:56 +08:00
use app\common\service\OssService;
2025-07-09 15:10:14 +08:00
use app\crm\model\Follow;
use app\crm\utils\Util;
2025-07-10 14:27:56 +08:00
use config\constants\Constants;
2025-07-09 15:10:14 +08:00
class FollowService
{
2025-07-10 14:27:56 +08:00
public function list($param, $userId)
2025-07-09 15:10:14 +08:00
{
// $page = $request->input('page', 1);
// $perPage = $request->input('per_page', 10);
//客户id
$customer_id =$param['customer_id'];
$where = [];
$where['customer_id'] = $customer_id;
//用户角色
//跟进id
2025-07-10 14:27:56 +08:00
$id = $param['id']??null;
2025-07-09 15:10:14 +08:00
if(!Util::isEmpty($id)){
$where['id'] = $id;
}
// 执行分页查询
$data = Follow::where($where)
->orderBy('id', 'desc')->get();
// ->paginate($perPage, ['*'], 'page', $page);
// $host = $request->host();
2025-07-10 14:27:56 +08:00
// $url = 'http:'.$request->url();
2025-07-09 15:10:14 +08:00
foreach ($data as &$value){
2025-07-10 14:27:56 +08:00
$value = self::getFollow($value);
2025-07-09 15:10:14 +08:00
}
2025-07-10 14:27:56 +08:00
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;
2025-07-09 15:10:14 +08:00
}
}