__('审核中'),'1' => __('审核通过'),'-1' => __('审核驳回')]; } public function getIsPayAttr($value, $data) { //查询当前所属类型是否付费 $type = ContentType::get($data['content_type_id']); return $type->is_pay; } public function getMoneyAttr($value, $data) { //查询当前所属类型的费用 $type = ContentType::get($data['content_type_id']); if($type->is_pay){ return $type['money']; }else{ return 0; } } public function getTypeTagAttr($value, $data) { //查询当前所属类型的费用 $type = ContentType::get($data['content_type_id']); if($type->is_pay){ return $type['tag']; }else{ return ''; } } // 查询当前用户是否已经付过费 public function getlist($where, $order, $offset, $limit,$uid=0){ // 热门推荐:is_hot // 事件类型:content_type_id // 当事人姓名:main_realname // 身份证号:main_phone // 手机号:main_cardno // qq号:main_qq // 微信号:main_wechat // 居住地址:main_address // 籍贯:main_jiguan // 公司:main_company // 姓名/公司/手机号/标签:keyword $order = empty($order)?['createtime'=>"desc"]:$order; $list = $this->order($order) ->where(function($query) use ($where,$uid){ if(isset($where['is_hot']) && $where['is_hot']){ $query->where(['is_hot'=>1]); } if(isset($where['user_id']) && $where['user_id']){ $query->where(['user_id'=>$where['user_id']]); } if(isset($where['content_type_id']) && $where['content_type_id']){ $query->where(['content_type_id'=>$where['content_type_id']]); } if(isset($where['main_realname']) && $where['main_realname']){ $query->whereRaw("main_realname like '%{$where['main_realname']}%'"); } if(isset($where['main_phone']) && $where['main_phone']){ $query->whereRaw("main_phone like '%{$where['main_phone']}%'"); } if(isset($where['main_cardno']) && $where['main_cardno']){ $query->whereRaw("main_cardno like '%{$where['main_cardno']}%'"); } if(isset($where['main_qq']) && $where['main_qq']){ $query->whereRaw("main_qq like '%{$where['main_qq']}%'"); } if(isset($where['main_wechat']) && $where['main_wechat']){ $query->whereRaw("main_wechat like '%{$where['main_wechat']}%'"); } if(isset($where['main_address']) && $where['main_address']){ $query->whereRaw("main_address like '%{$where['main_address']}%'"); } if(isset($where['main_jiguan']) && $where['main_jiguan']){ $query->whereRaw("main_jiguan like '%{$where['main_jiguan']}%'"); } if(isset($where['main_company']) && $where['main_company']){ $query->whereRaw("main_company like '%{$where['main_company']}%'"); } if(isset($where['keyword']) && $where['keyword']){ $query->whereRaw("(main_realname like '%{$where['keyword']}%' or main_phone like '%{$where['keyword']}%' or main_company like '%{$where['keyword']}%' or tag like '%{$where['keyword']}%')"); } if(isset($where['id']) && $where['id']){ $query->whereIn('id',$where['id']); } if(isset($where['ids']) && $where['ids']){ $query->whereIn('id', $where['ids']); } if($uid!=0){ }else{ $query->where('status', '1'); } }) ->paginate(['page'=> $offset?? 1,'list_rows' => $limit])->each(function($item,$key) use ($uid) { //查询订单是否存在 $order = Order::where(['content_id'=>$item['id'],'user_id'=>$uid,'status'=>1])->find(); $item['payed'] = $order||$item['user_id']==$uid?1:0; $item['content_tag'] = json_decode($item['content_tag'],true); }); $result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql()); return $result; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } }