|
@@ -112,7 +112,16 @@ class LoginController extends HomeBaseController |
|
@@ -112,7 +112,16 @@ class LoginController extends HomeBaseController |
112
|
|
112
|
|
113
|
//首页个人中心
|
113
|
//首页个人中心
|
114
|
public function info(){
|
114
|
public function info(){
|
115
|
- return $this->fetch();
|
115
|
+ $login = cmf_is_user_login();
|
|
|
116
|
+ if($login) {
|
|
|
117
|
+ return $this->fetch();
|
|
|
118
|
+ }
|
|
|
119
|
+ }
|
|
|
120
|
+
|
|
|
121
|
+ //退出登录
|
|
|
122
|
+ public function logout(){
|
|
|
123
|
+ cmf_update_current_user(NULL);
|
|
|
124
|
+ $this->apiResponse(1,'退出成功!');
|
116
|
}
|
125
|
}
|
117
|
|
126
|
|
118
|
//首页个人中心修改头像
|
127
|
//首页个人中心修改头像
|
|
@@ -157,7 +166,10 @@ class LoginController extends HomeBaseController |
|
@@ -157,7 +166,10 @@ class LoginController extends HomeBaseController |
157
|
|
166
|
|
158
|
//个人中心编辑页面
|
167
|
//个人中心编辑页面
|
159
|
public function editInfo(){
|
168
|
public function editInfo(){
|
160
|
- return $this->fetch();
|
169
|
+ $login = cmf_is_user_login();
|
|
|
170
|
+ if($login) {
|
|
|
171
|
+ return $this->fetch();
|
|
|
172
|
+ }
|
161
|
}
|
173
|
}
|
162
|
|
174
|
|
163
|
//个人中心编辑提交
|
175
|
//个人中心编辑提交
|
|
@@ -186,23 +198,25 @@ class LoginController extends HomeBaseController |
|
@@ -186,23 +198,25 @@ class LoginController extends HomeBaseController |
186
|
|
198
|
|
187
|
//我的收藏列表
|
199
|
//我的收藏列表
|
188
|
public function myCollection(){
|
200
|
public function myCollection(){
|
189
|
- $limit = $this->limit;
|
|
|
190
|
- $uid = cmf_get_current_user_id();
|
201
|
+ $login = cmf_is_user_login();
|
|
|
202
|
+ if($login) {
|
|
|
203
|
+ $limit = $this->limit;
|
|
|
204
|
+ $uid = cmf_get_current_user_id();
|
191
|
// $collectionModel = new CollectionModel();
|
205
|
// $collectionModel = new CollectionModel();
|
192
|
// $res = $collectionModel
|
206
|
// $res = $collectionModel
|
193
|
// ->where(['uid'=>$uid])
|
207
|
// ->where(['uid'=>$uid])
|
194
|
// ->field('id,post_id,category_name,city_name,post_url')
|
208
|
// ->field('id,post_id,category_name,city_name,post_url')
|
195
|
// ->order('id desc')
|
209
|
// ->order('id desc')
|
196
|
// ->paginate($limit);
|
210
|
// ->paginate($limit);
|
197
|
- $res = Db::name('collection')
|
|
|
198
|
- ->alias('c')
|
|
|
199
|
- ->join('portal_post p','c.post_id = p.id')
|
|
|
200
|
- ->where(['c.uid'=>$uid,'p.delete_time'=>0])
|
|
|
201
|
- ->field('c.id,c.category_name,c.city_name,c.post_url,p.post_title,p.post_excerpt,p.post_favorites')
|
|
|
202
|
- ->order('c.id desc')
|
|
|
203
|
- ->paginate($limit);
|
|
|
204
|
- $data = $res->toArray();
|
|
|
205
|
- $page = $res->render();
|
211
|
+ $res = Db::name('collection')
|
|
|
212
|
+ ->alias('c')
|
|
|
213
|
+ ->join('portal_post p','c.post_id = p.id')
|
|
|
214
|
+ ->where(['c.uid'=>$uid,'p.delete_time'=>0])
|
|
|
215
|
+ ->field('c.id,c.category_name,c.city_name,c.post_url,p.post_title,p.post_excerpt,p.post_favorites')
|
|
|
216
|
+ ->order('c.id desc')
|
|
|
217
|
+ ->paginate($limit);
|
|
|
218
|
+ $data = $res->toArray();
|
|
|
219
|
+ $page = $res->render();
|
206
|
// $post_ids = array_unique(array_column($data['data'],'post_id'));
|
220
|
// $post_ids = array_unique(array_column($data['data'],'post_id'));
|
207
|
// $data1 = Db::name('portal_post')
|
221
|
// $data1 = Db::name('portal_post')
|
208
|
// ->whereIn('id',$post_ids)
|
222
|
// ->whereIn('id',$post_ids)
|
|
@@ -223,9 +237,10 @@ class LoginController extends HomeBaseController |
|
@@ -223,9 +237,10 @@ class LoginController extends HomeBaseController |
223
|
// }
|
237
|
// }
|
224
|
// }
|
238
|
// }
|
225
|
// }
|
239
|
// }
|
226
|
- $this->assign('res',$data['data']);
|
|
|
227
|
- $this->assign('page',$page);
|
|
|
228
|
- return $this->fetch();
|
240
|
+ $this->assign('res',$data['data']);
|
|
|
241
|
+ $this->assign('page',$page);
|
|
|
242
|
+ return $this->fetch();
|
|
|
243
|
+ }
|
229
|
}
|
244
|
}
|
230
|
|
245
|
|
231
|
//搜索列表
|
246
|
//搜索列表
|