Exemplo n.º 1
0
    /**
     * Ta与我私信
     * 我和某人的消息
     */
    public function actionList()
    {
        $id = Yii::$app->request->get('id', 0);
        $ta_uid = Yii::$app->request->get('uid', 0);
        $login_uid = ZCommonSessionFun::get_user_id();
        $model_Message = new Message();
        $data = $model_Message->getTaList($ta_uid, $login_uid, '', ZCommonFun::getPageSize(), null);
        isset($data['models'][0]) ?: ($data['models'] = []);
        //         ZCommonFun::print_r_debug($data);
        //         exit;
        if (count($data['models']) < 1) {
            //echo $page,$pageCount;
            //超过最后一页
            echo '';
            exit;
        }
        $User = User::findOne($login_uid);
        $login_head_image = $User ? $User->getTaShowHead_image() : User::getDefaultHead_image();
        $ta_User = User::findOne($ta_uid);
        $ta_head_image = $ta_User ? $ta_User->getTaShowHead_image() : User::getDefaultHead_image();
        //         $this->title = $ta_user_showNickname.'与'.$login_user_showNickname;
        foreach ($data['models'] as $key => $model_Message) {
            //我发出的
            if ($model_Message->from_uid == $login_uid) {
                $head_image = $login_head_image;
                $class0 = 'imgright';
                $class = 'spanright';
            } else {
                $head_image = $ta_head_image;
                $class0 = 'imgleft';
                $class = 'spanleft';
            }
            echo <<<str
             <li page="{$data['pagination']->page}" pageCount="{$data['pagination']->pageCount}"><img src="{$head_image}"
\t\t\t\tclass="{$class0}"><span class="{$class}">{$model_Message->content}</span></li>


str;
        }
        exit;
    }