|
|
@@ -48,14 +48,16 @@ class Service extends Base
|
|
|
$param['field'] = "last_at";
|
|
|
$data = $this->service->setModel()->getList($param,['user' => function($query){
|
|
|
$query->field("openid,nickname,avatar,mobile,create_at");
|
|
|
- }],true,['last','avatar'],['last' => function($data,$resp) use($param){
|
|
|
+ }],true,['last','avatar','last_time'],['last' => function($data,$resp) use($param){
|
|
|
$last = (new SaasChatMsg)->where(["poi_id" => $resp['poi_id'],"service_id" => $param['service_id'],"openid" => $resp['openid']])->order("create_at desc")->field("content,create_at,type")->findOrEmpty();
|
|
|
if ($last->isEmpty()) {
|
|
|
return ['type' => "text","content"=>"无",'num' => 0,'time' => time(),"create_at"=> formatTime(date("Y-m-d H:i:s",time()))];
|
|
|
}
|
|
|
- return ["content"=> hide_str($last['content']),'num' => 0,"create_at"=> formatTime($last['create_at']),"time"=> strtotime($last['create_at']),'type' => $last['type']];
|
|
|
+ return ["content"=> str_cut_ellipsis($last['content']),'num' => 0,"create_at"=> formatTime($last['create_at']),"time"=> strtotime($last['create_at']),'type' => $last['type']];
|
|
|
},'avatar' => function(){
|
|
|
return "https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png";
|
|
|
+ },'last_time' => function($data,$resp){
|
|
|
+ return $resp['last_at']?date('Y-m-d',strtotime($resp['last_at'])):'-';
|
|
|
}]);
|
|
|
return successTrans(100010,pageFormat($data),200);
|
|
|
} catch (\Throwable $th) {
|