Files
fdesk/app/crm/service/FollowService.php
T
2025-07-29 09:00:04 +08:00

65 lines
1.5 KiB
PHP

<?php
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, $userId)
{
// $page = $request->input('page', 1);
// $perPage = $request->input('per_page', 10);
//客户id
$customer_id = $param['customer_id'];
$corp_abbr = $param['corp_abbr'];
$where = [];
$where['customer_id'] = $customer_id;
// $where['corp_abbr'] = $corp_abbr;
//用户角色
//跟进id
$id = $param['id'] ?? null;
if (!empty($id)) {
$where['id'] = $id;
}
// 执行分页查询
$data = Follow::where($where)
->orderBy('id', 'desc')->get();
// ->paginate($perPage, ['*'], 'page', $page);
// $host = $request->host();
// $url = 'http:'.$request->url();
foreach ($data as &$value) {
$value = self::getFollow($value);
}
return $data;
}
public static function getFollow($follow)
{
$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['picture_full'] = $oss_picture;
// $follow = Util::formatDate($follow);
return $follow;
}
}