64 lines
1.5 KiB
PHP
64 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'];
|
|
|
|
$where = [];
|
|
$where['customer_id'] = $customer_id;
|
|
|
|
//用户角色
|
|
|
|
//跟进id
|
|
$id = $param['id']??null;
|
|
if(!Util::isEmpty($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,$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;
|
|
}
|
|
} |