예제 #1
0
파일: service2.php 프로젝트: wuya1986/php
 public function ztest2($inp)
 {
     $obj = new weixin();
     $obj->send_msg($inp);
     $b = "return seccess";
     return $b;
 }
예제 #2
0
파일: index2.php 프로젝트: wuya1986/php
 }
 if ($redis->exists('timestamp')) {
     if ((string) $fromUserName . (string) $createTime != $redis->get('timestamp')) {
         $redis->set('timestamp', (string) $fromUserName . (string) $createTime);
         if ($msgType == "text" || $msgType == "image") {
             $content = $res_xmlstr->Content;
             $content = trim($content);
             if ($content == '1' || $content == '2') {
                 $redis->set('type', (string) $fromUserName . (string) $content);
                 $wx->log($redis->get('type'));
             }
             //"#1 开启上传模式"的逻辑
             if (($msgType == "text" || $msgType == "image") && $redis->get('type') == (string) $fromUserName . '1') {
                 //提示用户输入图片名称
                 if ($content == '1') {
                     $wx->send_msg(array('userid' => (string) $fromUserName, 'appid' => (string) $agentID, 'msg' => '请您输入要上传的图片名称'));
                 }
                 //储存供应商号码
                 if ($msgType == "text" && $content != '1') {
                     //服务器缓存$content值
                     $redis->set("content", (string) $content);
                     $wx->send_msg(array('userid' => (string) $fromUserName, 'appid' => (string) $agentID, 'msg' => '请您拍照上传'));
                     //$wx -> log($redis->get('content'));
                 }
                 //接收手机发送图片
                 if ($msgType == "image") {
                     if ($redis->exists("content")) {
                         $content = $redis->get("content");
                     }
                     $picUrl = $res_xmlstr->PicUrl;
                     $mediaId = $res_xmlstr->MediaId;
예제 #3
0
파일: trip.php 프로젝트: wuya1986/php
 $msgType = $res_xmlstr->MsgType;
 $agentID = $res_xmlstr->AgentID;
 if ($msgType == 'text' && $fromUserName == 'plustree' && $agentID == '13') {
     $con = mysql_connect("127.0.0.1", "root", "root");
     mysql_select_db("wx", $con);
     $sql = "SELECT count(1) from customer_tbl WHERE user_id = '{$fromUserName}' AND create_time= '{$createTime}'";
     $sql_rsl = mysql_query($sql, $con);
     $row = mysql_fetch_array($sql_rsl);
     //转发全体
     if ($row[0][0] == '0') {
         $content = $res_xmlstr->Content;
         $sql = "UPDATE customer_tbl SET create_time = '{$createTime}' WHERE user_id = '{$fromUserName}'";
         mysql_query($sql, $con);
         // update
         mysql_close($con);
         $wx->send_msg(array('userid' => '@all', 'appid' => (string) $agentID, 'msg' => (string) $content));
     } else {
         mysql_close($con);
     }
 }
 if ($msgType == 'text' && $fromUserName != 'plustree' && $agentID == '13') {
     $con = mysql_connect("127.0.0.1", "root", "root");
     mysql_select_db("wx", $con);
     $sql = "SELECT count(1) from customer_tbl WHERE user_id = '{$fromUserName}' AND create_time= '{$createTime}'";
     $sql_rsl = mysql_query($sql, $con);
     $row = mysql_fetch_array($sql_rsl);
     //转发plustree
     if ($row[0][0] == '0') {
         $content = $res_xmlstr->Content;
         $sql = "UPDATE customer_tbl SET create_time = '{$createTime}' WHERE user_id = '{$fromUserName}'";
         mysql_query($sql, $con);
예제 #4
0
파일: appUser.php 프로젝트: wuya1986/php
    if ($msgType == "image") {
        $picUrl = $res_xmlstr->PicUrl;
        $mediaId = $res_xmlstr->MediaId;
        //$msgId = $res_xmlstr->MsgId;
        $fp = fopen('log.txt', 'w');
        fwrite($fp, $picUrl);
        fclose($fp);
    }
    //进入应用事件响应并消息去重
    if ($event == 'enter_agent' && $eventKey == '') {
        $con = mysql_connect("127.0.0.1", "root", "root");
        mysql_select_db("wx", $con);
        $sql = "SELECT count(1) from customer_tbl WHERE user_id = '{$fromUserName}' AND create_time= '{$createTime}'";
        $sql_rsl = mysql_query($sql, $con);
        $row = mysql_fetch_array($sql_rsl);
        if ($row[0][0] == '0') {
            $sql = "UPDATE customer_tbl SET create_time = '{$createTime}' WHERE user_id = '{$fromUserName}'";
            mysql_query($sql, $con);
            // update
            mysql_close($con);
            $name = $wx->get_user_name($fromUserName);
            $msg_howToUse = "A1: 申请添加新用户\nA2: 申请修改用户信息\nA3: 申请删除用户\nA4: 显示用户\n\nB1: Request for New User\nB2: Request for Changing User\nB3: Request for Deleting User\nB4: Display User Master";
            $msg_welcome = "亲爱的" . $name . "用户:\n(微信号" . $fromUserName . ")\n\n欢迎来到朗姿微妙平台!\n\n在朗姿供应链微妙平台中可以进行很多简便的操作,快速的查询,甚至方便的添加新用户。当然分享信息也是非常easy!\n\n所有便捷的操作都在窗口底下的菜单中。微妙平台也会自动给您发微信告知结果。无论您身在何处,微妙平台都能伴您左右,为您的工作助一臂之力!\n\n祝您有愉快的“微妙”体验!\n\n\t\t\t  朗姿供应链微妙团队";
            $wx->send_msg(array('userid' => (string) $fromUserName, 'appid' => '3', 'msg' => $msg_welcome));
        } else {
            mysql_close($con);
        }
    }
}
//$o = new weixin();
//$o -> create_user("test01", "测试名称", "testid", 1);