Esempio n. 1
0
 public function query($index)
 {
     $uid = $this->userid ? $this->userid : 0;
     //1click,2collect,3follow,4reply,5share,6thank
     if ($index) {
         if ($index == 1) {
             $models = TalksClickModel::where('uid', $uid)->get();
         } elseif ($index == 2) {
             $models = TalksCollectModel::where('uid', $uid)->get();
         } elseif ($index == 3) {
             $models = TalksFollowModel::where('uid', $uid)->get();
         } elseif ($index == 4) {
             $models = TalksReportModel::where('uid', $uid)->get();
         } elseif ($index == 5) {
             $models = TalksShareModel::where('uid', $uid)->get();
         } elseif ($index == 6) {
             $models = TalksThankModel::where('uid', $uid)->get();
         }
         $ids = array();
         if (isset($models) && count($models)) {
             foreach ($models as $model) {
                 $ids[] = $model->talkid;
             }
         }
         $datas = TalksModel::whereIn('id', $ids)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     } else {
         $datas = TalksModel::where('uid', $uid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     }
     $datas->limit = $this->limit;
     return $datas;
 }
Esempio n. 2
0
 public function query($uname)
 {
     if ($uname) {
         $datas = TalksModel::where('uname', 'like', '%' . $uname . '%')->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     } else {
         $datas = TalksModel::orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     }
     $datas->limit = $this->limit;
     return $datas;
 }
Esempio n. 3
0
 /**
  * 获取话题
  */
 public function getTalks($limit)
 {
     $datas = TalksModel::where(['del' => 0, 'isshow' => 1])->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($limit);
     static $number = 1;
     if (count($datas)) {
         foreach ($datas as $data) {
             $data->number = $number++;
         }
     }
     return $datas;
 }
Esempio n. 4
0
 /**
  * 话题数量
  */
 public function talks()
 {
     return TalksModel::where('del', 0)->where('uid', $this->userid)->get();
 }
Esempio n. 5
0
 public function forceDelete($id)
 {
     $this->islogin();
     TalksModel::where('id', $id)->delete();
     return redirect('/talk/follow');
 }