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

68 lines
1.7 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
2025-07-17 09:36:46 +08:00
$customer_id = $param['customer_id'];
$corp_abbr = $param['corp_abbr'];
2025-07-09 15:10:14 +08:00
$where = [];
$where['customer_id'] = $customer_id;
2025-07-25 16:14:09 +08:00
// $where['corp_abbr'] = $corp_abbr;
2025-07-09 15:10:14 +08:00
//用户角色
//跟进id
2025-07-17 09:36:46 +08:00
$id = $param['id'] ?? null;
2025-07-18 15:43:51 +08:00
if (!empty($id)) {
2025-07-09 15:10:14 +08:00
$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-17 09:36:46 +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;
}
2025-07-17 09:36:46 +08:00
public static function getFollow($follow)
2025-07-10 14:27:56 +08:00
{
$follow['type_txt'] = Constants::FOLLOW[$follow['type']];
$follow['firstFollowtime'] = $follow['follow_time'];
$oss_picture = '';
2025-07-17 09:36:46 +08:00
if (!empty($follow['picture'])) {
2025-07-10 14:27:56 +08:00
$ossservice = new OssService();
2025-07-17 09:36:46 +08:00
$oss_picture = $ossservice->generatePrivateUrl($follow['picture'], 86400);
2025-07-10 14:27:56 +08:00
}
2025-07-18 15:43:51 +08:00
$follow['picture_full'] = $oss_picture;
2025-08-22 13:59:39 +08:00
2025-08-22 14:49:10 +08:00
$follow = Util::formatDate($follow,['created_at','updated_at','follow_time']);
$follow['follow_time'] = empty($follow['follow_time'])?'':$follow['follow_time'];
2025-07-10 14:27:56 +08:00
// $follow = Util::formatDate($follow);
return $follow;
2025-07-09 15:10:14 +08:00
}
}