コード例 #1
0
ファイル: TalkController.php プロジェクト: 946493655/culture
 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;
 }
コード例 #2
0
ファイル: TalksModel.php プロジェクト: 946493655/culture
 /**
  * 分享话题
  */
 public function share()
 {
     $datas = TalksShareModel::where('talkid', $this->id)->get();
     return count($datas) ? $datas : 0;
 }