コード例 #1
0
ファイル: send.php プロジェクト: keyidadi/wxbridge
function get_access_token()
{
    $token = QMC::read("token");
    if (!$token) {
        $authurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxee6c914fca02f4dd&secret=1d0fe2e4f06a42caf289ab817a56d331";
        $html = file_get_contents($authurl);
        $obj = json_decode($html);
        $token = $obj->access_token;
        $time = $obj->expires_in;
        QMC::store("token", $token, $time - 60);
    }
    return $token;
}
コード例 #2
0
ファイル: recv.php プロジェクト: keyidadi/wxbridge
<?php

$devid = $_GET["devid"];
$msg = $_GET["max"];
if (empty($devid)) {
    $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
    $obj = json_decode($postStr);
    $devid = $obj->devid;
    $max = $obj->max;
}
if (empty($devid)) {
    die(json_encode(array("ret" => -1, "msg" => "no devid")));
}
include "qmc.php";
$out = QMC::output($devid, $max);
echo json_encode(array("ret" => 0, "result" => $out));
コード例 #3
0
ファイル: login.php プロジェクト: Huangzefeng/zaina
$headurl = $_GET['headurl'];
//$age  =  $_GET['age'];
$province = $_GET['province'];
$city = $_GET['city'];
$meida_type = $_GET['meida_type'];
$meida_uid = $_GET['meida_uid'];
$access_token = $_GET['access_token'];
$uid = $_GET['uid'];
//获取设备唯一id
//用户版本号,加故事版本后才有(1.5)
$v = $_GET['v'];
$os = $_GET['os'];
$mem = new Memcache();
$mem->connect("172.18.1.23", 12000);
$mem->set($tel_email . $meida_uid . 'uid', $uid, 0, 60000);
QMC::input("login_uid", $tel_email . $meida_uid . '#' . $uid);
//写入队列
if (!empty($action)) {
    if ($action == 'p') {
        //普通登录
        //echo $tel_email."|".$pwd;
        //判断是否为email
        if (is_email($tel_email)) {
            $user_login_info = $db->row_select_one("user", "email = '{$tel_email}' AND pwd = '{$pwd}' ");
            //邮箱登录
        } else {
            $user_login_info = $db->row_select_one("user", "tel = '{$tel_email}' AND pwd = '{$pwd}' ");
            //手机号登录
        }
        if (!empty($user_login_info)) {
            $jsonres = array('headurl' => "" . $user_login_info['headurl'], 'name' => "" . $user_login_info['name'], 'sex' => $user_login_info['sex'] == 1 ? '男' : '女', 'age' => "" . $user_login_info['age'], 'province' => "" . $user_login_info['province'], 'city' => "" . $user_login_info['city'], 'umd5' => md5($user_login_info['uid']), 'pwd' => "" . $user_login_info['pwd'], 'zaina' => "" . $user_login_info['zaina'], 'zhiye' => "" . $user_login_info['zhiye'], 'qianming' => "" . $user_login_info['qianming']);
コード例 #4
0
ファイル: testduilie.php プロジェクト: Huangzefeng/zaina
<?php

include 'duilie.php';
$key = "duilie";
$value = "duilie_value";
for ($i = 0; $i < 100; $i++) {
    //QMC::input($key, $i);//写入队列
}
for ($i = 0; $i < 100; $i++) {
    $list = QMC::output($key, 1);
    //读取队列
    print_r($list);
}
コード例 #5
0
ファイル: gushi.php プロジェクト: Huangzefeng/zaina
$uid_get = $_GET['uid'];
//设备唯一id
$gu_id = $_GET['gu_id'];
//要删除的故事id
//判断是否被黑名单
is_black($user, $uid);
is_black($f_user, $uid_get);
$upzan = $_GET['upzan'];
if (!empty($upzan)) {
    $mem = new Memcache();
    $mem->connect("127.0.0.1", 11211);
    $zanlog = $mem->get($f_user . $upzan);
    if ($zanlog == 1) {
    } else {
        $userjiedao = $mem->set($f_user . $upzan, 1, 0, 10000);
        QMC::input("upzan", $f_user . '#' . $upzan);
        //写入队列
        $insert = array("user" => $f_user, "zan" => $upzan);
        $db->row_insert('zan', $insert);
    }
}
//$content = str_replace('\n','',$content);
$content = str_replace(PHP_EOL, ' ', $content);
//待做需要吧连续的换行符替换为一个
//echo "1231321";
//--$mgcfile = trie_filter_load('./temp/mgc.dic');
//var_dump($mgcfile);
//--$mgcints = trie_filter_search_all($mgcfile, $content);  // 一次把所有的敏感词都检测出来
//$res2 = trie_filter_search($mgcfile, $content);// 每次只检测一个敏感词
//print_r($res1);
//foreach($mgcints as $mgcint){
コード例 #6
0
ファイル: wx.php プロジェクト: keyidadi/wxbridge
 private function unregHandler($user, $devid)
 {
     # code...
     include './qmc.php';
     QMC::remove($devid, $user);
 }
コード例 #7
0
ファイル: login.php プロジェクト: Huangzefeng/zaina
function zan_send()
{
    global $db;
    // echo 'empty--->11list';
    $list = QMC::output("upzan", 1);
    //读取队列
    echo '<br>zan_send--->list<br>';
    // $list = array('ff9e537dbea1b731de24c85116a2fff8#["128"]');
    print_r($list);
    if (!empty($list)) {
        $value = $list[0];
        $valuearr = explode("#", $value);
        if (!empty($valuearr[0]) || !empty($valuearr[1])) {
            $from = trim($valuearr[0]);
            $res_from = $db->row_select_one("user", "umd5 = '{$from}' ", " name , headurl , sex, age");
            $from_name = $res_from['name'];
            $from_sex = $res_from['sex'] == 1 ? '男' : '女';
            $from_age = $res_from['age'];
            $headurl = $res_from['headurl'];
            $gushi_id_json = trim($valuearr[1]);
            $itemzanarr = json_decode($gushi_id_json);
            foreach ($itemzanarr as $item) {
                $res = $db->row_select_one("gushi", " id = '{$item}'  ", " umd5 , content");
                //
                $to = $res['umd5'];
                echo $to . "--->send<br>";
                $content_gushi = $res['content'];
                $slstr = strCut($content_gushi, 31);
                $content['headurl'] = $headurl;
                $content['username'] = $from_name;
                $ext = array("attr" => "card", "content" => $from_sex . "  " . $from_age . "岁  \n\n ta  赞了您的相册 \n" . $slstr, "user" => $from);
                //echo $from_name;
                $sendlog = send_card($to, $content, $ext);
                //print_r($sendlog);
            }
        }
    } else {
        echo 'zan_send--->empty';
    }
}
コード例 #8
0
ファイル: memcache_mq.php プロジェクト: breezelife0/mycode
<?php

$key = "aaa";
$value = 'sunshine:' . time();
QMC::input($key, $value);
//写入队列
QMC::input($key, $value);
//写入队列
QMC::input($key, $value);
//写入队列
$list = QMC::output($key);
//读取队列
var_dump($list);
/** 
* Memcache 消息队列类 
*/
class QMC
{
    const PREFIX = 'ASDFASDFFWQKE';
    /** 
    * 初始化mc 
    * @staticvar string $mc 
    * @return Memcache 
    */
    private static function mc_init()
    {
        static $mc = null;
        if (is_null($mc)) {
            $mc = new Memcache();
            $mc->connect('127.0.0.1', 11211);
        }