本文整理汇总了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 {