Beispiel #1
0
    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);