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


PHP Reply::transmitText方法代碼示例

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


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

示例1: responseMsg


//.........這裏部分代碼省略.........
                                                                                         if ($keyword == "搭訕" || $keyword == "搭訕漢紙" || $keyword == "搭訕妹紙" || $keyword == "搭訕漢子" || $keyword == "搭訕妹子") {
                                                                                             $sql_state11 = "select fakeid from tb_studentdashan where openid='{$fromUsername}'";
                                                                                             $fromUserFakeidArr = $class_mysqlObj->query_array($sql_state11);
                                                                                             $fromUserFakeid = $fromUserFakeidArr[0]['fakeid'];
                                                                                             $nowTime = time();
                                                                                             // 取出現在的時間
                                                                                             if ($keyword == "搭訕") {
                                                                                                 $sql_state = "select fakeid,nick_name,place,sex,lastTime from tb_studentdashan where '{$nowTime}'-lastTime<172800 and openid is not null and fakeid !='{$fromUserFakeid}' order by lastTime desc";
                                                                                             } else {
                                                                                                 if ($keyword == "搭訕漢紙" || $keyword == "搭訕漢子") {
                                                                                                     $sql_state = "select fakeid,nick_name,place,sex,lastTime from tb_studentdashan where '{$nowTime}'-lastTime<172800 and openid is not null and fakeid !='{$fromUserFakeid}' and sex='漢紙' order by lastTime desc";
                                                                                                 } else {
                                                                                                     if ($keyword == "搭訕妹紙" || $keyword == "搭訕妹子") {
                                                                                                         $sql_state = "select fakeid,nick_name,place,sex,lastTime from tb_studentdashan where '{$nowTime}'-lastTime<172800 and openid is not null and fakeid !='{$fromUserFakeid}' and sex='妹紙' order by lastTime desc";
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                             $studentDaShanInfoArr = $class_mysqlObj->query_array($sql_state);
                                                                                             // 隨機取出一位搭訕者
                                                                                             $daShanNum = rand(0, count($studentDaShanInfoArr) - 1);
                                                                                             $toFakeid = $studentDaShanInfoArr[$daShanNum]['fakeid'];
                                                                                             $nick_name = $studentDaShanInfoArr[$daShanNum]['nick_name'];
                                                                                             $place = $studentDaShanInfoArr[$daShanNum]['place'] != null ? "來自" . $studentDaShanInfoArr[$daShanNum]['place'] . "的" : "";
                                                                                             $sex = $studentDaShanInfoArr[$daShanNum]['sex'] == "漢紙" ? $studentDaShanInfoArr[$daShanNum]['sex'] . "👦" : "妹紙👧";
                                                                                             $lastTime = $studentDaShanInfoArr[$daShanNum]['lastTime'];
                                                                                             $lastTime = date("Y-m-d H:i:s", $lastTime);
                                                                                             $content = "成功匹配到" . $place . $nick_name . $sex . "\n\n";
                                                                                             $content .= "ta最後一次會話時間:\n" . $lastTime . "\n\n";
                                                                                             $content .= "<a href=\"http://ifreeweixin.sinaapp.com/daShan/index.php?toUserFakeid={$toFakeid}&fromUserFakeid={$fromUserFakeid}\">點擊聊天</a>\n---------------\n";
                                                                                             $content .= "發送“@+你想說的話”迅速搭訕ta吧[色]\n---------------\n";
                                                                                             $content .= "[玫瑰]多與平台互動可以提高被搭訕的機率哦";
                                                                                             $content .= "<a href=\"loginView.php?openid={$fromUsername}&&flag=0\"> </a>";
                                                                                             // 提前發送消息
                                                                                             echo $replyObj->transmitText($object, $content);
                                                                                             // 設置搭訕對象緩存
                                                                                             memcache_set($mmc, $fromUsername . "dashan", $toFakeid);
                                                                                             // memcache_set ( $mmc, $fromUsername . "dashan", "1495366437",0,36000 );
                                                                                             // 睡1秒後執行綁定openid操作
                                                                                             sleep(2);
                                                                                             // 如果為空,綁定openid
                                                                                             if (empty($fromUserFakeidArr)) {
                                                                                                 require_once 'daShan/DaShan.class.php';
                                                                                                 $daShan = new DaShan();
                                                                                                 $fakeid2openidArr = $daShan->fakeid2openid();
                                                                                                 $fakeid = $fakeid2openidArr['fakeid'];
                                                                                                 $openid = $fakeid2openidArr['openid'];
                                                                                                 $lastTime2 = $fakeid2openidArr['lastTime'];
                                                                                                 $sql_state3 = "update tb_studentdashan set openid='{$openid}',lastTime='{$lastTime2}' where fakeid='{$fakeid}'";
                                                                                                 $class_mysqlObj->query($sql_state3);
                                                                                             }
                                                                                             return;
                                                                                         } else {
                                                                                             if (preg_match('/@((.*?))/', $keyword)) {
                                                                                                 // ============== 提高綁定效率 ====================
                                                                                                 $sql_state = "select fakeid,nick_name,place,sex from tb_studentdashan where openid='{$fromUsername}'";
                                                                                                 $fromUserInfoArr = $class_mysqlObj->query_array($sql_state);
                                                                                                 $fromUserFakeid = $fromUserInfoArr[0]['fakeid'];
                                                                                                 /*
                                                                                                  * 如果為空,綁定openid if (empty ( $fromFakeid )) { require_once 'daShan/DaShan.class.php'; $daShan = new DaShan (); $fakeid2openidArr = $daShan->fakeid2openid (); $fakeid = $fakeid2openidArr ['fakeid']; $openid = $fakeid2openidArr ['openid']; $lastTime2 = $fakeid2openidArr ['lastTime']; $sql_state3 = "update tb_studentDaShan set openid='{$openid}',lastTime='{$lastTime2}' where fakeid='{$fakeid}'"; $class_mysqlObj->query ( $sql_state3 ); }
                                                                                                  */
                                                                                                 // ================ 綁定結束 ========================
                                                                                                 // 消息發送給誰
                                                                                                 $toUserFakeid = memcache_get($mmc, $fromUsername . "dashan");
                                                                                                 if (empty($toUserFakeid)) {
                                                                                                     $content = "你還未匹配到搭訕對象,請回複【搭訕】進行匹配";
                                                                                                 } else {
開發者ID:mesfreeman,項目名稱:ifreeweixin,代碼行數:67,代碼來源:replyIndex.php


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