當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserModel::getUserId方法代碼示例

本文整理匯總了PHP中UserModel::getUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserModel::getUserId方法的具體用法?PHP UserModel::getUserId怎麽用?PHP UserModel::getUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserModel的用法示例。


在下文中一共展示了UserModel::getUserId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ActionSaveMessage

 public static function ActionSaveMessage($chatId)
 {
     ChatModel::saveMessage($chatId, 1, $_POST['message']);
     exit('ok');
     if (UserModel::isUserLoggedIn() and ChatModel::isUserInChat($chatId, UserModel::getUserId())) {
     }
 }
開發者ID:yasch-kub,項目名稱:auroracing.com,代碼行數:7,代碼來源:ChatController.php

示例2: addMessage

 public static function addMessage($chatId, $message)
 {
     $db = Mdb::GetConnection();
     $collection = $db->selectCollection(Mdb::$dbname, 'chat');
     $message = ['senderId' => UserModel::getUserId(), 'date' => UserModel::getDateString(), 'text' => $message, 'timestamp' => time()];
     $collection->update(['_id' => intval($chatId)], ['$push' => ['messages' => $message]]);
     return $message;
 }
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:8,代碼來源:ChatModel.php

示例3: ActionChangeAvatar

 public static function ActionChangeAvatar()
 {
     $path = root . '/application/data/users/' . UserModel::getUserId() . '/';
     if (file_exists($path . 'avatar.png')) {
         unlink($path . 'avatar.png');
     }
     $image = self::fileUpload($path);
     exit('/application/data/users/' . UserModel::getUserId() . '/' . $image);
 }
開發者ID:yasch-kub,項目名稱:auroracing.com,代碼行數:9,代碼來源:UserController.php

示例4: addComment

 public static function addComment($postId, $text)
 {
     $db = Db::connect();
     $query = "INSERT INTO comments(author, post, text, date) VALUES(:author, :post, :text, :date)";
     $stmt = $db->prepare($query);
     $stmt->bindParam(':author', UserModel::getUserId());
     $stmt->bindParam(':post', $postId);
     $stmt->bindParam(':text', $text);
     $stmt->bindParam(':date', date('jS \\of F Y h:i:s A'));
     $stmt->execute();
 }
開發者ID:yasch-kub,項目名稱:auroracing.com,代碼行數:11,代碼來源:PostModel.php

示例5: ActionRules

 public static function ActionRules()
 {
     $id = UserModel::getUserId();
     $dictionary = UserModel::getLangArray();
     $menuClass = [0 => 'active', 1 => '', 2 => '', 3 => '', 4 => '', 5 => ''];
     $view = 'templates/userProfile.php';
     $profile_content = 'templates/rules.php';
     $links = ['userProfile.css', 'webcam.css', 'rules.css'];
     $scripts = ['dragAndDropDownload.js', 'addPost.js', 'MediaAPI.js'];
     $user = UserModel::getInfo($id);
     include_once view . '/templates/template.php';
 }
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:12,代碼來源:ApplicationController.php

示例6: foreach

<div class="panel-body">
    <ul class="chat">
        <?php 
foreach ($messages as $message) {
    ?>
            <?php 
    if ($message['senderId'] == intval(UserModel::getUserId())) {
        ?>
                <?php 
        include view . 'templates/message/messageRight.php';
        ?>
            <?php 
    } else {
        ?>
                <?php 
        include view . 'templates/message/messageLeft.php';
        ?>
            <?php 
    }
    ?>
        <?php 
}
?>
    </ul>
    <div class="row">
        <form method='post' role="form" id="chatForm" action="/addMessage/<?php 
echo $chatId;
?>
"
              timestamp="<?php 
echo $timestamp;
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:31,代碼來源:dialog.php

示例7: addPostLike

 public static function addPostLike($userId, $postId)
 {
     $db = Mdb::GetConnection();
     $collection = $db->selectCollection(Mdb::$dbname, 'user');
     $result = $collection->findOne(['_id' => intval($userId)], ['wall' => true]);
     $nLikes = 0;
     for ($i = 0; $i < count($result['wall']); $i++) {
         if ($result['wall'][$i]['id'] == $postId) {
             if (in_array(UserModel::getUserId(), $result['wall'][$i]['like'])) {
                 return false;
             } else {
                 $result['wall'][$i]['like'][] = UserModel::getUserId();
                 $nLikes = count($result['wall'][$i]['like']);
                 $collection->update(['_id' => intval($userId)], ['$set' => ['wall' => $result['wall']]]);
             }
         }
     }
     return $nLikes;
 }
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:19,代碼來源:UserModel.php

示例8: foreach

    </div>

    <?php 
foreach ($user['information'] as $item) {
    ?>
        <div class="info profile-property col-md-3">
            <?php 
    echo key($item);
    ?>
        </div>
        <div class="val col-md-9">
            <?php 
    echo current($item);
    ?>
            <?php 
    if ($id == UserModel::getUserId()) {
        ?>
                <i class="pull-right dell-info fa fa-minus-square-o"></i>
            <?php 
    }
    ?>
        </div>
    <?php 
}
?>

    <div class="add-information">
        <div class="col-md-3">
            <input name="info" placeholder="<?php 
echo $dictionary['information'];
?>
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:31,代碼來源:main.php

示例9: ActionDellPhotos

 public static function ActionDellPhotos()
 {
     $data = file_get_contents('php://input');
     $data = json_decode($data, true);
     unlink(root . '/application/data/users/' . UserModel::getUserId() . '/photos/' . $data);
     if (UserModel::delletePhoto($data)) {
         exit('ok');
     }
     exit('failed');
 }
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:10,代碼來源:UserController.php

示例10: UserModel

 */
// /////////////////////////
// CONTROLLER checkin.php //
////////////////////////////
// Page de vérification du login et du mot de passe
/////////////////////////////////////////////////////////////////////////////////////////
// Appel aux classes de Model pour récupérer les données
include_once "account/model/UserModel.php";
session_start();
/////////////////////////////////////////////////////////////////////////////////////////
// Traitement des données et des informations diverses
// Récupération du USER via le login saisi
$login = $_POST['login'];
$password = $_POST['password'];
$crypted_password = md5($password);
$user = new UserModel();
// Renvoi l'utilisateur s'il existe; renvoi null sinon
$usercheck = $user->checkUserByLogin($login);
if (!$usercheck) {
    echo "Aucun utilisateur ne correspond a votre login";
} else {
    // vérification du mot de passe
    $checkpassword = $user->checkUserPassword($login, $crypted_password);
    if (!$checkpassword) {
        echo "Mot de passe incorrect";
    } else {
        $user->init($login, $crypted_password);
        $_SESSION['userid'] = $user->getUserId();
        header('Location: index.php');
    }
}
開發者ID:aramisf,項目名稱:-,代碼行數:31,代碼來源:checkin.php

示例11: searchSchool

 function searchSchool($keyword, $ssotoken)
 {
     $tblLog = new DB_Udo_SearchLog();
     $userModel = new UserModel();
     $uid = $userModel->getUserId($ssotoken);
     //print_r($keyword);
     //先進行結果查詢,將查詢出來的id記錄下來
     $tblEntrance = new DB_Sso_Entrance();
     //記錄結果id的數組
     $result = [];
     $resultIds = [];
     //關鍵字搜索的長度限製
     //獲取輸入的關鍵字的字符串長度
     /* $length = strlen($keyword);
             for($i = $length;$i >=1 ;$i--){
                 //對關鍵詞進行拆分
                 $split_array = str_split($keyword,$i);
                 foreach ($split_array as $k=>$value){
                     //對於每一個截斷後的結果進行搜索
                     $name = $tblEntrance->fetchAll("id","where customer_name like '%{$value}%' or customer_title like '%{$value}%' ");
                     $result = array_merge($result,$name);
                 }
     
             }
             $resultIds = $tblEntrance->columnRow($result,"id");
             print_r(array_unique($resultIds));
             print_r(str_split("外語"));
             print_r(preg_split("/[\s,]+/","外語 教學,研究"));
     
             $tempaddtext="php對UTF8字體串進行單字分割返回數組";
             //$cind代表的是字符位移
             $cind = 0;
             $arr_cont = array();
             for ($i = 0; $i < strlen($tempaddtext); $i++) {
                 if (strlen(substr($tempaddtext, $cind, 1)) > 0) {
                 if (ord(substr($tempaddtext, $cind, 1)) < 192) {
                 if (substr($tempaddtext, $cind, 1) != " ") {
                     array_push($arr_cont, substr($tempaddtext, $cind, 1));}
                 $cind++;}
                 elseif(ord(substr($tempaddtext, $cind, 1)) < 224) {
                 array_push($arr_cont, substr($tempaddtext, $cind, 2));
                     $cind+=2;} else {array_push($arr_cont, substr($tempaddtext, $cind, 3));$cind+=3;}}}
             print_r($arr_cont);*/
     $result = $tblEntrance->fetchAll("id", "where customer_name like '%{$keyword}%' or customer_title like '%{$keyword}%' ");
     $resultIds = $tblEntrance->columnRow($result, 'id');
     if (!$resultIds) {
         $tblLog->insert(array("userId" => $uid, "keyword" => $keyword, "result" => -1, "createTime" => time()));
         return -1;
     }
     //print_r($resultIds);
     $result_array = [];
     //從sso獲取所有頻道
     $url = Common_Config::SSO_SCHOOL_URL;
     $post_data = array("ssotoken" => $ssotoken);
     $cl = new Common_Curl();
     $array = $cl->request($url, $post_data);
     $array['entrances'] = $this->schoolOrder($array);
     //針對搜索結果,返回頻道的基礎信息
     foreach ($resultIds as $l) {
         foreach ($array['entrances'] as $k => $val) {
             if ($val['id'] == $l) {
                 $price = $this->getSchoolPrice($l, $uid);
                 $val = array_merge($val, array("isSubscribed" => $this->getIfSub($val['id'], $uid) ? 1 : 0), $price);
                 $index = 0;
                 //過濾掉apiBaseUrl項目
                 while ($key = key($val)) {
                     if ($key == "apiBaseUrl") {
                         array_splice($val, $index, 1);
                         break;
                     }
                     $index++;
                     next($val);
                 }
                 array_push($result_array, $val);
             }
         }
         if (count($result_array) == count($resultIds)) {
             break;
         }
     }
     if (!$result_array) {
         $tblLog->insert(array("userId" => $uid, "keyword" => $keyword, "result" => -1, "createTime" => time()));
         return -1;
     }
     $tblLog->insert(array("userId" => $uid, "keyword" => $keyword, "result" => count($result_array), "resultString" => implode(',', $resultIds), "createTime" => time()));
     //print_r($result_array);
     return $result_array;
 }
開發者ID:krisrita,項目名稱:udo,代碼行數:88,代碼來源:School.php

示例12: searchSchoolAction

 function searchSchoolAction()
 {
     $request = $this->getRequest();
     if ('POST' == $request->getMethod()) {
         $ssotoken = $this->post()->get("ssotoken");
         $keyword = $this->post()->get("keyword");
     } else {
         $ssotoken = $this->get("ssotoken");
         $keyword = $this->get("keyword");
     }
     if (!$ssotoken || !$keyword) {
         $this->displayJsonUdo(Common_Error::ERROR_PARAM);
     }
     //獲取用戶id
     $userModel = new UserModel();
     $uid = $userModel->getUserId($ssotoken);
     if (is_array($uid)) {
         $this->displayJsonUdo(Common_Error::INVALID_TOKEN, "", $uid['msg']);
     }
     $schoolModel = new SchoolModel();
     $result = $schoolModel->searchSchool($keyword, $ssotoken);
     if ($result == -1) {
         $this->displayJsonUdo(Common_Error::ERROR_NO_SEARCH_RESULT, "", "搜索結果為空");
     }
     $this->displayJsonUdo(Common_Error::ERROR_SUCCESS, $result);
 }
開發者ID:krisrita,項目名稱:udo,代碼行數:26,代碼來源:School.php

示例13: getAdAction

 /**
  * 用戶是否存在
  */
 public function getAdAction()
 {
     //廣告接口首先拿客戶端傳來的ssotoken 在SSO進行驗證獲取用戶信息
     $request = $this->getRequest();
     $userModel = new UserModel();
     $userModel->logout();
     if ('POST' == $request->getMethod()) {
         $token = trim($this->post()->get("ssotoken"));
     } else {
         $token = $this->get("ssotoken");
     }
     //$token = "1";
     if (!$token) {
         $this->displayJsonUdo(Common_Error::ERROR_PARAM);
     }
     //獲取到用戶信息
     $url = Common_Config::SSO_SCHOOL_URL;
     $post_data = array("ssotoken" => $token);
     //print_r($post_data);
     $cl = new Common_Curl();
     $result = $cl->request($url, $post_data);
     /*                $result = array("id"=>8 , "grade"=>11,"province"=>3,"city"=>4,"area"=>5,
                         "entrances"=>array(0=>array("id"=>1,"name"=>"雙十","title"=>"雙十網校","grade"=>11,"baseUrl"=>"1",
             "udoUrl"=>"2","city_id"=>4),
             1=>array("id"=>2,"name"=>"華英","title"=>"華英網校","grade"=>14,"baseUrl"=>"1",
                 "udoUrl"=>"2","city_id"=>6),
             2=>array("id"=>3,"name"=>"三明","title"=>"三明網校","grade"=>15,"baseUrl"=>"1",
                 "udoUrl"=>"2","city_id"=>4)));*/
     //print_r($result);
     if (array_key_exists('code', $result) && $result['code'] == 0) {
         $this->displayJsonUdo(Common_Error::ERROR_FAIL, null, "SSO沒有返回正確的用戶信息哦~");
     }
     //$result = array ("id"=> 2779,"province"=>3,"grade"=>11);
     //$result = array ("id"=> 2779,"province"=> 0,"grade"=>11);
     //sso返回成功,開始進行廣告過濾
     //print_r($result);
     //過濾出和用戶所在地區和年級一致的廣告
     $ad = new AdModel();
     $adlist = $ad->getAd($result);
     $uid = $userModel->getUserId($token);
     /*$kaixin = $ad->filterPrimary($uid);
       if(is_array($kaixin))
           $adlist = $kaixin;*/
     //計算總競價值
     $price_sum = 0;
     $temp_arr = array();
     foreach ($adlist as $i => $val) {
         $price_sum += $val['price'];
     }
     //生成隨機數
     $arr = array();
     $arr[] = rand(1, 100);
     $arr = array_unique($arr);
     $rand = implode(" ", $arr);
     //獲得隨機url
     $url = [];
     $rate = 0;
     foreach ($adlist as $i => $val) {
         $temp_arr[$i] = $val['price'] / $price_sum * 100 + ($i - 1 >= 0 ? $temp_arr[$i - 1] : 0);
         //print_r($i."   ".$temp_arr[$i]);
         if ($rand <= $temp_arr[$i] && $rand >= ($i - 1 >= 0 ? $temp_arr[$i - 1] : 0)) {
             $url = $val;
             $rate = $val['price'] / $price_sum;
         }
     }
     //將推送的廣告寫入廣告推送表
     $ad->adLog($url['id'], 0, $rate);
     $ad->adPushSum($url['id']);
     $ad->adStatistics($url['id']);
     $this->displayJsonUdo(Common_Error::ERROR_SUCCESS, $url);
 }
開發者ID:krisrita,項目名稱:udo,代碼行數:74,代碼來源:Ad.php

示例14: payAction

 function payAction()
 {
     $request = $this->getRequest();
     if ('POST' == $request->getMethod()) {
         $ssotoken = $this->post()->get("ssotoken");
         $payType = $this->post()->get("payType");
         $resource = $this->post()->get("resource");
         $amt = $this->post()->get("amt");
         $coinId = $this->post()->get("coinId");
         $platform = $this->post()->get("channel");
         $schoolId = $this->post()->get("schoolId");
     } else {
         $ssotoken = $this->get("ssotoken");
         $payType = $this->get("payType");
         $resource = $this->get("resource");
         $amt = $this->get("amt");
         $coinId = $this->get("coinId");
         $platform = $this->get("channel");
         $schoolId = $this->get("schoolId");
     }
     //此處為測試數據
     //$resource = [];
     $resource = json_decode($resource, true);
     //接收參數判斷
     if (!$ssotoken || !$payType || !$amt) {
         $this->displayJsonUdo(Common_Error::ERROR_PARAM, "", "缺少必選參數");
     }
     $courseCount = 0;
     $schoolModel = new SchoolModel();
     //餘額支付時,需對resource參數進行判斷
     if ($payType == Common_Config::UDO_PAYTYPE_COIN || $payType == Common_Config::UDO_PAYTYPE_CREDIT) {
         if (!is_array($resource) || !$schoolId) {
             $this->displayJsonUdo(Common_Error::ERROR_PARAM, "", "缺少resource或schoolId參數");
         }
         //從客戶端傳過來的resource是所有選中的資源
         //此處根據resource生成交易的信息
         //$resourceType = 0;
         $resourceInfo = "";
         $courseName = "";
         foreach ($resource as $k => $value) {
             if ($value['resourceType'] == Common_Config::UDO_RESOURCE_COURSE) {
                 $courseCount++;
                 //$resourceType = Common_Config::UDO_RESOURCE_SCHOOL;
                 $resourceInfo = "頻道";
                 $courseName = $courseName ? $courseName : $schoolModel->getSingleCourse($value['resourceId']);
             }
         }
         $resourceInfo = $courseName['name'] . "'等" . $courseCount . "個課程";
     } elseif ($payType == Common_Config::UDO_PAYTYPE_RECHARGE) {
         if (!$coinId || !$platform) {
             $this->displayJsonUdo(Common_Error::ERROR_PARAM, "", "缺少channel或coinId參數");
         }
     }
     $accountModel = new AccountModel();
     $tradeModel = new TradeModel();
     $userModel = new UserModel();
     //在校驗過參數完整性後,生成訂單
     $uid = $userModel->getUserId($ssotoken);
     if (is_array($uid)) {
         $this->displayJsonUdo(Common_Error::INVALID_TOKEN, "", $uid['msg']);
     }
     $order = $accountModel->newOrder($ssotoken, $uid, $schoolId, $courseCount, $payType, $resource, $coinId, $amt, $platform);
     //對生成訂單的結果進行判斷
     if ($order < 0) {
         $this->displayJsonUdo(Common_Error::ERROR_SUCCESS, array("result" => $order));
     }
     //生成訂單後,將支付參數傳向公共雲
     //根據支付類型不同,在調用公共雲的支付服務時,傳相應的值處理
     /*
      * @param payType
      * 1:U幣支付
      * 2:U幣充值
      * 3.學分支付
      */
     switch ($payType) {
         case Common_Config::UDO_PAYTYPE_COIN:
             $type = Common_Config::PUBLIC_PAYTYPE_AMOUNT;
             $subject = "U幣購買'" . $resourceInfo;
             $score = 0;
             $balanceAmt = $amt;
             $channel = 0;
             $chargeAmt = 0;
             break;
         case Common_Config::UDO_PAYTYPE_RECHARGE:
             //客戶端提交的amt均為
             $type = $type = Common_Config::PUBLIC_PAYTYPE_CHANNEL;
             $coinMoney = $tradeModel->getCoinMoney($coinId);
             //實際
             $chargeAmt = $amt;
             $amt = $coinMoney['price'];
             $subject = "U幣充值";
             $score = 0;
             $balanceAmt = 0;
             $channel = $platform;
             break;
         case Common_Config::UDO_PAYTYPE_CREDIT:
             $type = Common_Config::PUBLIC_PAYTYPE_AMOUNT;
             $subject = "學分購買'" . $resourceInfo;
             $score = $amt;
             $amt = 0;
//.........這裏部分代碼省略.........
開發者ID:krisrita,項目名稱:udo,代碼行數:101,代碼來源:Account.php

示例15:

                <div class="profile-usertitle">
                    <div class="profile-usertitle-name">
                        <?php 
echo $user['name'] . ' ' . $user['surname'];
?>
                    </div>
                    <div class="profile-usertitle-job">
                        Developer
                    </div>
                </div>
                <div class="profile-userbuttons">
                    <?php 
if (UserModel::getUserId() != $id) {
    ?>
                        <?php 
    if (!in_array($id, UserModel::getFollowers(UserModel::getUserId()))) {
        ?>
                            <a href="" value="<?php 
        echo $id;
        ?>
" id="follow" type="submit" class="btn btn-success btn-sm"><?php 
        echo $dictionary['follow'];
        ?>
</a>
                        <?php 
    }
    ?>
                        <a href="/createChat/<?php 
    echo $id;
    ?>
" value="<?php 
開發者ID:yasch-kub,項目名稱:social-network.com,代碼行數:31,代碼來源:userProfile.php


注:本文中的UserModel::getUserId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。