コード例 #1
0
 public function actionMomentsshow()
 {
     $rightNowUserId = Yii::$app->user->identity->XH_ID;
     $rightNowUserName = Yii::$app->user->identity->Name;
     $moments = new Moments();
     $result = $moments->getPageMomentWithOrder(1, 20);
     $msg = '';
     foreach ($result as $key => $value) {
         if ($key != 0) {
             $msg .= '<div class=\\"moment_Sty\\"><div class=\\"moment_Owner\\"><p class=\\"centerMomentName\\">' . $value['username'] . '</p></div><div class=\\"moment_Content\\"><p class=\\"centerMomentName\\">' . $value['Content'] . '</p></div><div class=\\"moment_Date\\"><p class=\\"centerMomentName\\">' . $value['Mdate'] . '</p></div></div>';
         }
     }
     if ($msg) {
         echo '{"success" :true , "msg":"' . $msg . '","userIdNow":"' . $rightNowUserId . '","userName":"******"}';
     } else {
         echo '{"success" :false , "msg":"没有动态","userIdNow":"' . $rightNowUserId . '","userName":"******"}';
     }
 }
コード例 #2
0
 public function actionGettopmoment()
 {
     $moments = new Moments();
     $usertb = new UserTb();
     $result = $moments->getAllTopMoment();
     $msg = '';
     $name = '';
     foreach ($result as $value) {
         $name = $usertb->getName($value['XH_ID']);
         $msg .= '<div class=\\"moment_Sty\\"><div class=\\"moment_Owner\\"><p class=\\"centerMomentName\\">' . $name . '</p></div><div class=\\"moment_Content\\"><p class=\\"centerMomentName\\">' . $value['Content'] . '</p></div><div class=\\"moment_Date\\"><p class=\\"centerMomentName\\">' . $value['Mdate'] . '</p></div></div>';
     }
     if ($msg) {
         echo '{"success" :true , "msg":"' . $msg . '"}';
     } else {
         echo '{"success" :false , "msg":"没有置顶动态"}';
     }
 }
コード例 #3
0
 public function actionAdminupdatemoment_1()
 {
     //判断信息是否填写完全
     if (empty($_POST["moment_content"]) || !isset($_POST["moment_content"])) {
         echo '{"success":false,"msg":"内容填写错误"}';
         return;
         //			exit();
     }
     $newmoment = new Moments();
     $newmoment->Content = \yii\helpers\Html::encode($_POST['moment_content']);
     $newmoment->XH_ID = \Yii::$app->user->identity->XH_ID;
     $newmoment->Mdate = date('y-m-d');
     $newmoment->Time = date('H:i:s');
     $newmoment->like_Num = 0;
     $newmoment->save(false);
     echo '{"success":true,"msg":"添加成功!"}';
 }