人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁      樂道系統(tǒng)FAQ      PHP+Mysql+Ajax實現(xiàn)淘寶客服或阿里旺旺聊天功能(前臺頁面)

PHP+Mysql+Ajax實現(xiàn)淘寶客服或阿里旺旺聊天功能(前臺頁面)

標簽: 發(fā)布日期:2017-06-16 00:00:00 270
【CLI】利用Curl下載文件實時進度條顯示的實現(xiàn)

首先來看一下我已經(jīng)實現(xiàn)的效果圖:

消費者頁面:(本篇隨筆)

(1)會顯示店主的頭像

(2)當前用戶發(fā)送信息顯示在右側(cè),接受的信息,顯示在左側(cè)

店主或客服頁面:(下一篇隨筆)

(1)在左側(cè)有一個列表 ,會顯示所有與店主對話的顧客;該列表可以移動;有新消息時會提示;也可以清空該聊天記錄

(2)點擊列表里的顧客進入右邊的對話框界面,顯示與該顧客的聊天信息

 在實現(xiàn)功能之前,來說一下我用到的兩張表:

 解釋一下:bkid在此處沒有用到;isok列是用來判斷消息是否已讀,未讀為0;

現(xiàn)在,來說一下步驟:(分前臺和后臺兩部分)

在這篇隨筆中我們首先來說一下前臺頁面是如何實現(xiàn)的:(李四登錄)

用session存取一下lisi;便于后面從user表中取數(shù)據(jù)

1、布局頁面代碼以及讀取數(shù)據(jù)代碼:

<!--中間內(nèi)容-->
 <div id="zhongjian">
  <div id="kuangjia" style="height: 550px;width: 620px; margin: 0px auto;border: 1px solid gainsboro;background-color: white;">
   <div id="neirong" style="height: 400px;width: 600px;">
    <div style="height: 100px;width: 620px;background-image: url(../img/bj4.jpg);">
  //取店主用戶名,顯示店主的頭像和姓名<br>        <?php
   $uid = $_SESSION["uid"];  
   $sql = "select * from users where uid='zhangsan'";
   $arr = $db->query($sql);
   foreach($arr as $v)
   {    
   echo "
   <div style='height:100px;float:left;width:100px;float:left;'>
    <div style='border:2px solid grey;height:84px;width:84px;margin:7px auto; border-radius:10px;overflow:hidden'>
    <img src='{$v[6]}' height='80px' width='80px'/>
    </div>
    </div>
    <div style='height:100px;width:500px;float:left;'>
    <div style='height:50px;width:500px;text-align:left;line-height:50px'>
     親愛的店主
    </div>   
     <div style='height:50px;width:500px;text-align:left;'>個性簽名:
     <input type='text' placeholder='不讀書怎么對得起今天!' style='width:280px'>        
    </div>
    </div>
    "; 
   }   
   ?>
   </div>
   <div style="height: 300px;width: 620px;overflow: auto;overflow-x:hidden ;"><br>         //獲取session里存取的uid;
    <?php
     $uid = $_SESSION["uid"];     
     $sql3 = "select * from users where uid='{$uid}'";
         $arr3 = $db->query($sql3);<br>                    //從對話表里讀取店主張三和李四所有的對話信息,并按對話時間順序排序
     $sql2="select * from duihua where uid='{$uid}' or jsid='{$uid}' order by dhtime";     
     $arr2= $db->query($sql2);
     foreach($arr2 as $n)
     {<br>        //如果是店主,則信息要顯示在左側(cè)
     if($n[2]=='zhangsan')
     {
     echo "<div style='height:100px;width:600px;'>
     <div style='height:100px;width:250px;float:left'>
      <div style='height:20px;width:250px;font-size:13px;padding-left:20px'>
        {$n[6]}</div>
      <div style='height:80px;width:50px;float:left'>
       <div style='height:50px;width:50px;margin:0px auto; border-radius:90px;overflow:hidden;'>
        <img src='{$v[6]}' height='50px' width='50px'/>
       </div>
      </div>
      <div style='min-height:40px;width:200px;float:left;background-color:cornflowerblue; border-bottom-right-radius: 10px;border-top-right-radius: 10px;border-top-left-radius: 40px;border-bottom-left-radius: 40px;'>
       <p style='padding-left:20px; line-height:40px'>
        {$n[4]}</p>        
      </div>     
     </div></div>";
     } <br>//如果是李四,則顯示在右側(cè)    
     if($n[2]==$uid)
     {            
     echo "<div style='height:100px;width:600px;margin-right:20px'>
     <div style='height:100px;width:250px; float:right'>
      <div style='height:20px;width:250px;font-size:13px;padding-right:20px'>
        {$n[6]}</div>
      <div style='height:80px;width:50px;float:right'>
       <div style='height:50px;width:50px;margin:0px auto; border-radius:90px;overflow:hidden;'>
        <img src='{$arr3[0][6]}' height='50px' width='50px'/>
       </div>
      </div>
      <div style='min-height:40px;width:200px;float:right;background-color:pink; border-bottom-left-radius: 10px;border-top-left-radius: 10px;border-top-right-radius: 40px;border-bottom-right-radius: 40px;'>
       <p style='padding-left:20px; line-height:40px'>
        {$n[4]}</p>        
      </div>     
     </div></div>"; 
     }          
     }  
     ?>   
   </div>  
   </div> <!--id="neirong"--><br>
  <form role="form">
   <div class="form-group">
   <textarea class="form-control" rows="3" id="words"></textarea> //輸入發(fā)送內(nèi)容
   </div>
  </form>
  <div id="fs" style="height: 50px; width: 600px;text-align: right; padding-right: 50px;">
  <button type="button" class="btn btn-success fasong">發(fā)送</button>  //點擊按鈕發(fā)送
  </div>
  </div>   
  </div> <!--id=zhongjian-->