├── .buildpath
├── .project
├── .settings
└── org.eclipse.php.core.prefs
├── README.md
├── daonileapi.php
└── index.php
/.buildpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | daonile
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.validation.validationbuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.dltk.core.scriptbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.php.core.PHPNature
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.php.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | include_path=0;/daonile
3 | phpVersion=php5.4
4 | use_asp_tags_as_php=false
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | daonile
2 | =======
3 |
4 | 到你了(daonile)是一个开源的餐饮叫号系统,吃货们不用再在饭店门口无聊地排队等桌了,到饭店排上号以后就可以去周围转转,商家端在快轮到某位吃货时会自动给他发送短信提醒,吃货们也可以通过微信公众平台随时查询排队情况。
--------------------------------------------------------------------------------
/daonileapi.php:
--------------------------------------------------------------------------------
1 | responseMsg();
13 | }else if($_SERVER['REQUEST_METHOD'] == "GET"){
14 | $wechatObj->valid();
15 | }
16 |
17 | class daonileCallbackapi
18 | {
19 | public function valid()
20 | {
21 | $echoStr = $_GET["echostr"];
22 |
23 | //valid signature , option
24 | if($this->checkSignature()){
25 | echo $echoStr;
26 | exit;
27 | }
28 | }
29 |
30 | public function responseMsg()
31 | {
32 | //get post data, May be due to the different environments
33 | $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
34 |
35 | //extract post data
36 | if (!empty($postStr)){
37 |
38 | $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
39 | $fromUsername = $postObj->FromUserName;
40 | $toUsername = $postObj->ToUserName;
41 | $keyword = trim($postObj->Content);
42 | $time = time();
43 | $textTpl = "
44 |
45 |
46 | %s
47 |
48 |
49 | 0
50 | ";
51 | if(!empty( $keyword ))
52 | {
53 | $msgType = "text";
54 | $contentStr = "[到你了]多亏朋友们的支持,目前已经有近400粉丝,当我们的粉丝数到达500时,就可以申请认证了。我们的开发工作现在也在顺利地进行中,您现在收到的这条消息是从我们的后台自动发出的,如果您有什么问题或建议,请发邮件到wenhuaqiang@gmail.com或访问http://113.107.233.169/dokuwiki/,再次感谢您的支持";
55 | $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
56 | echo $resultStr;
57 | }else{
58 | echo "Input something...";
59 | }
60 |
61 | }else {
62 | echo "";
63 | exit;
64 | }
65 | }
66 |
67 | private function checkSignature()
68 | {
69 | $signature = $_GET["signature"];
70 | $timestamp = $_GET["timestamp"];
71 | $nonce = $_GET["nonce"];
72 |
73 | $token = TOKEN;
74 | $tmpArr = array($token, $timestamp, $nonce);
75 | sort($tmpArr);
76 | $tmpStr = implode( $tmpArr );
77 | $tmpStr = sha1( $tmpStr );
78 |
79 | if( $tmpStr == $signature ){
80 | return true;
81 | }else{
82 | return false;
83 | }
84 | }
85 | }
86 |
87 | ?>
88 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------