function followedAction() { $MUID = $_GET['UID']; //传被访问者的信息 $user = new user(); $info = $user->getAllbyUID($MUID); $answer = new answer(); $likeQ = new likeQ(); $likeA = new likeA(); $followu = new followU(); $ffnum = $followu->getFollownumbyUID($MUID); //$this->view->followednum=$ffnum; //关注你的人的人数 $uids = $followu->getUIDsbyFUID($MUID); //关注你的人的uid数组 $this->view->pinfo = array('UID' => $MUID, 'nickname' => $info['nickname'], 'sex' => $info['sex'], 'image' => $info['image'], 'institute' => $info['institute'], 'grade' => $info['grade'], 'answernum' => $answer->getAnswernumbyUID($MUID), 'likenum' => $likeA->getLikenumbyUID($MUID) + $likeQ->getLikenumbyUID($MUID), 'follownum' => $ffnum, 'followednum' => count($uids)); $FFPI = array(); for ($i = 0; $i < count($uids); $i++) { $info = $user->getAllbyUID($uids[$i]); $FFPI[$i] = array("MUID" => $uids[$i], "Mnickname" => $info['nickname'], "Mimage" => $info['image'], 'Minstitute' => $info['institute'], "Mgrade" => $info['grade']); } $this->view->FPI = $FFPI; $this->render("homepage-follower"); }
function likeAaction() { $likea = new likeA(); if ($_GET) { $set = array($UID = $this->getRequest()->getparam("UID", ""), $AID = $this->getRequest()->getparam("AID", ""), $data = date('Y-m-d h-m-s')); $likea->insertLikeA($set); } }
public function likeAction() { // if($_GET){ $set = array("UID" => $_POST["UID"], "AID" => $_POST["AID"], "time" => date('Y-m-d h:i:s')); //print_r($set); $likeA = new likeA(); $arr = $likeA->getAIDsbyUID($set["UID"]); for ($i = 0; $i < count($arr); $i++) { if ($arr[$i] == $set["AID"]) { exit(0); } //return -1; //can't like the same answer twice } $likeA->insertLikeA($set); $likeANum = $likeA->getLikenumbyAID($set['AID']); $result = "{\"AID\":\"" . $set["AID"] . "\"" . ",\"likenum\":\"" . $likeANum . "\"}"; //echo $arr; $this->view->result = $result; $this->render("like"); }
public function getLikedNumByUID($UID) { $likea = new likeA(); $answer = new answer(); $AIDS = $answer->getAIDsbyUID($UID); $sum = 0; for ($i = 0; $i < count($AIDS); $i++) { $sum += $likea->getLikenumbyAID($AIDS[$i]); } return $sum; }