insert($data); return $res; } /** * @author chenniang * @DataTime: 2020-09-29 11:05 * @功能说明:编辑 */ public function dataUpdate($dis,$data){ $res = $this->where($dis)->update($data); return $res; } /** * @author chenniang * @DataTime: 2020-09-29 11:06 * @功能说明:列表 */ public function dataList($dis,$page=10){ $data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray(); return $data; } /** * @author chenniang * @DataTime: 2020-09-29 11:43 * @功能说明: */ public function dataInfo($dis){ $data = $this->where($dis)->find(); return !empty($data)?$data->toArray():[]; } /** * @author chenniang * @DataTime: 2023-01-29 14:11 * @功能说明: */ public function coachDataList($dis,$alh,$page=10){ $data = $this->alias('a') ->join('massage_service_coach_list b','a.coach_id = b.id','left') ->where($dis) ->field(['a.*',$alh,'b.coach_name,b.work_img']) ->order('a.top desc,a.create_time desc,distance asc,a.id desc') ->paginate($page) ->toArray(); if(!empty($data['data'])){ foreach ($data['data'] as &$v){ $v['distance'] = distance_text($v['distance']); } } return $data; } /** * @author chenniang * @DataTime: 2023-01-29 14:11 * @功能说明: */ public function adminDataList($dis,$page=10){ $data = $this->alias('a') ->join('massage_service_coach_list b','a.coach_id = b.id','left') ->where($dis) ->field('a.*,b.coach_name,b.work_img') ->order('a.top desc,a.create_time desc,a.id desc') ->paginate($page) ->toArray(); return $data; } /** * @author chenniang * @DataTime: 2023-01-29 14:11 * @功能说明: */ public function coachFollowDataList($dis,$alh,$page=10){ $data = $this->alias('a') ->join('massage_service_coach_list b','a.coach_id = b.id','left') ->join('massage_dynamic_follow c','a.coach_id = c.coach_id AND a.create_time >= c.create_time') ->where($dis) ->field(['a.*',$alh,'b.coach_name,b.work_img']) ->group('a.id') ->order('a.top desc,a.create_time desc,distance asc,a.id desc') ->paginate($page) ->toArray(); if(!empty($data['data'])){ foreach ($data['data'] as &$v){ $v['distance'] = distance_text($v['distance']); } } return $data; } /** * @author chenniang * @DataTime: 2023-01-29 11:12 * @功能说明:获取动态评论数量 */ public function getCommentNum($dis){ $num = $this->alias('a') ->join('massage_dynamic_comment b','a.id = b.dynamic_id') ->where($dis) ->where('b.status','=',2) ->group('b.id') ->count(); return $num; } /** * @author chenniang * @DataTime: 2023-01-29 11:12 * @功能说明:获取动态点赞数量 */ public function getThumbsNum($dis){ $num = $this->alias('a') ->join('massage_dynamic_thumbs b','a.id = b.dynamic_id') ->where($dis) ->where('b.status','=',1) ->group('b.id') ->count(); return $num; } }