正在显示
1 个修改的文件
包含
32 行增加
和
22 行删除
@@ -180,31 +180,41 @@ class LoginController extends HomeBaseController | @@ -180,31 +180,41 @@ class LoginController extends HomeBaseController | ||
180 | public function myCollection(){ | 180 | public function myCollection(){ |
181 | $limit = $this->limit; | 181 | $limit = $this->limit; |
182 | $uid = cmf_get_current_user_id(); | 182 | $uid = cmf_get_current_user_id(); |
183 | - $collectionModel = new CollectionModel(); | ||
184 | - $res = $collectionModel | ||
185 | - ->where(['uid'=>$uid]) | ||
186 | - ->field('id,post_id,category_name,city_name,post_url') | ||
187 | - ->order('id desc') | 183 | +// $collectionModel = new CollectionModel(); |
184 | +// $res = $collectionModel | ||
185 | +// ->where(['uid'=>$uid]) | ||
186 | +// ->field('id,post_id,category_name,city_name,post_url') | ||
187 | +// ->order('id desc') | ||
188 | +// ->paginate($limit); | ||
189 | + $res = Db::name('collection') | ||
190 | + ->alias('c') | ||
191 | + ->join('portal_post p','c.post_id = p.id') | ||
192 | + ->where(['c.uid'=>$uid,'p.delete_time'=>0]) | ||
193 | + ->field('c.id,c.category_name,c.city_name,c.post_url,p.post_title,p.post_excerpt,p.post_favorites') | ||
194 | + ->order('c.id desc') | ||
188 | ->paginate($limit); | 195 | ->paginate($limit); |
189 | $data = $res->toArray(); | 196 | $data = $res->toArray(); |
190 | $page = $res->render(); | 197 | $page = $res->render(); |
191 | - $post_ids = array_unique(array_column($data['data'],'post_id')); | ||
192 | - $data1 = Db::name('portal_post') | ||
193 | - ->whereIn('id',$post_ids) | ||
194 | - ->where('delete_time', 0) | ||
195 | - ->field('id,post_title,post_excerpt,post_favorites') | ||
196 | - ->order('weigh desc') | ||
197 | - ->select() | ||
198 | - ->toArray(); | ||
199 | - foreach($data['data'] as &$value){ | ||
200 | - foreach ($data1 as $item) { | ||
201 | - if($value['post_id'] == $item['id']){ | ||
202 | - $value['post_title'] = $item['post_title']; | ||
203 | - $value['post_excerpt'] = $item['post_excerpt']; | ||
204 | - $value['post_favorites'] = $item['post_favorites']; | ||
205 | - } | ||
206 | - } | ||
207 | - } | 198 | +// $post_ids = array_unique(array_column($data['data'],'post_id')); |
199 | +// $data1 = Db::name('portal_post') | ||
200 | +// ->whereIn('id',$post_ids) | ||
201 | +// ->where('delete_time', 0) | ||
202 | +// ->field('id,post_title,post_excerpt,post_favorites') | ||
203 | +// ->order('weigh desc') | ||
204 | +// ->select() | ||
205 | +// ->toArray(); | ||
206 | +// foreach($data['data'] as &$value){ | ||
207 | +// $value['post_title'] = ''; | ||
208 | +// $value['post_excerpt'] = ''; | ||
209 | +// $value['post_favorites'] = ''; | ||
210 | +// foreach ($data1 as $item) { | ||
211 | +// if($value['post_id'] == $item['id']){ | ||
212 | +// $value['post_title'] = $item['post_title']; | ||
213 | +// $value['post_excerpt'] = $item['post_excerpt']; | ||
214 | +// $value['post_favorites'] = $item['post_favorites']; | ||
215 | +// } | ||
216 | +// } | ||
217 | +// } | ||
208 | $this->assign('res',$data['data']); | 218 | $this->assign('res',$data['data']); |
209 | $this->assign('page',$page); | 219 | $this->assign('page',$page); |
210 | return $this->fetch(); | 220 | return $this->fetch(); |
-
请 注册 或 登录 后发表评论