File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,19 @@ public function actionIndex()
45
45
*/
46
46
public function actionView ($ id )
47
47
{
48
- $ result = $ this ->findModel ($ id );
48
+ $ select = [
49
+ "id " ,
50
+ "username " ,
51
+ "realname " ,
52
+ "email " ,
53
+ "status " ,
54
+ "created_at " ,
55
+ "updated_at "
56
+ ];
57
+ $ result = $ this ->findModel ($ id , $ select );
49
58
$ result ->created_at = date ('Y年m月d日 ' , $ result ->created_at );
50
- unset($ result ->password_hash );
51
- unset($ result ->auth_key );
52
- unset($ result ->password_reset_token );
53
- unset($ result ->dingId );
54
-
59
+ $ result ->updated_at = date ('Y年m月d日 ' , $ result ->updated_at );
60
+
55
61
return $ result ;
56
62
}
57
63
@@ -224,9 +230,9 @@ public function actionActivate($id)
224
230
* @return User the loaded model
225
231
* @throws NotFoundHttpException if the model cannot be found
226
232
*/
227
- protected function findModel ($ id )
233
+ protected function findModel ($ id, $ select = [ ' * ' ] )
228
234
{
229
- if (($ model = User::findOne ( $ id )) !== null ) {
235
+ if (($ model = User::find ()-> andWhere ([ ' id ' => $ id])-> select ( $ select )-> one ( )) !== null ) {
230
236
return $ model ;
231
237
} else {
232
238
return false ;
You can’t perform that action at this time.
0 commit comments