Exemple #1
0
                </tbody>
            </table>
        </article>
        <div class="block-header">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody>
                <td width="33%" align="center"><a href="/account/node" class="small"><strong><?php 
    echo \common\models\Follow::find()->where(['user_id' => Yii::$app->user->id, 'type' => 2])->count();
    ?>
</strong><div class="mt3"></div><small>节点收藏</small></a></td>
                <td width="34%" align="center"><a href="/account/topic" class="small"><strong><?php 
    echo \common\models\Follow::find()->where(['user_id' => Yii::$app->user->id, 'type' => 3])->count();
    ?>
</strong><div class="mt3"></div><small>主题收藏</small></a></td>
                <td width="33%" align="center"><a href="/account/follow" class="small"><strong><?php 
    echo \common\models\Follow::find()->where(['user_id' => Yii::$app->user->id, 'type' => 1])->count();
    ?>
</strong><div class="mt3"></div><small>关注的人</small></a></td>
                </tbody>
            </table>
        </div>
        <?php 
    if (Yii::$app->user->identity->email_status == 1) {
        ?>
        <div class="block-content">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody><tr>
                    <td width="15"></td>
                    <td width="auto" valign="middle" align="left"><a href="/create"><i class="glyphicon glyphicon-pencil"></i> 创作新主题</a></td></tr>
                </tbody>
            </table>
Exemple #2
0
 /**
  * 获取我收藏的建议id
  * @return array|\yii\db\ActiveRecord[]
  */
 static function Topic()
 {
     if (!($FollowTopic = Yii::$app->cache->get('FollowTopic' . Yii::$app->user->id))) {
         $FollowTopic = ArrayHelper::map(Follow::find()->select('follow_id')->where(['user_id' => Yii::$app->user->id, 'type' => 3])->asArray()->all(), 'follow_id', 'follow_id');
         Yii::$app->cache->set('FollowTopic' . Yii::$app->user->id, $FollowTopic, 0);
     }
     return $FollowTopic;
 }