Exemple #1
0
function db_response_news($postObj, $newsid)
{
    /*
     * note:
     * 1 text
     * dfault and 2 :news
     *
     * */
    $params = array(array($newsid, SQLSRV_PARAM_IN));
    $sp = "{call app_get_news(?)}";
    $rs = sp_execute($sp, $params);
    if (count($rs) == 1) {
        $msgtype = $rs[0]["kind"];
        //is_numeric($rs[0]["type"])?intval($rs[0]["type"]):0;
        //
        if ($msgtype == 1) {
            //text mode
            response_text($postObj, $rs[0]["describle"]);
        } else {
            //2
            $newsContent = array("title" => $rs[0]["title"], "description" => $rs[0]["describle"], "picUrl" => $rs[0]["picurl"], "url" => $rs[0]["url"]);
            response_news($postObj, $newsContent);
        }
    } elseif (count($rs) > 1) {
        //多行新闻的方式
        $arr = array();
        foreach ($rs as $row) {
            $newsContent = array("title" => $row["title"], "description" => $row["describle"], "picUrl" => $row["picurl"], "url" => $row["url"]);
            array_push($arr, $newsContent);
        }
        response_multiNews($postObj, $arr);
    } else {
        response_text($postObj, "未定义的newsid[{$newsid}]");
    }
}
Exemple #2
0
function click($postObj)
{
    if ($postObj->EventKey == "c45fed65e9873ee368625b73ef7d5760") {
        $params = array(array("" . $postObj->FromUserName, SQLSRV_PARAM_IN));
        $sp = "{call wxp_user_qiando(?)}";
        sp_execute($sp, $params);
        //
        $newsContent = array("title" => "微转赚每日签到板 海量经验等你拿", "description" => "签到成功,点击查看详情\n    每日签到的小伙伴将获得超值经验\n    连续签到1天获得10点经验\n    连续签到2天-4天获得30点经验\n    连续签到5天-9天获得50点经验\n    连续签到10天及以上获得100点经验", "picUrl" => "https://mmbiz.qlogo.cn/mmbiz/KV9KGmD9ic3kMrL9NV0PdcOP7IUsgXBR5dUWWEFxAJ1JHFibI6Ao9EyCoYlpbegezF6MFl3ic5R0X52RgyA0aOQkw/0", "url" => CFG_HTTP . "/apps/mobile/m_checkinfo.php?fromUserName=" . $postObj->FromUserName);
        $resultStr = response_news($postObj, $newsContent);
        echo $resultStr;
    } else {
    }
}
Exemple #3
0
function response_canteen_welcome($postObj, $cids, $canteenname, $canteenpic, $newsid)
{
    if (strlen($cids) > 0) {
        $newsid = is_numeric($newsid) ? intval($newsid) : 0;
        if ($newsid > 0) {
            db_response_news($postObj, $newsid);
        } else {
            $newsContent = array("title" => "欢迎关注" . CFG_APPNAME . "【" . $canteenname . "】", "description" => "点击链接", "picUrl" => CFG_HTTP . CFG_SHOP_PATH . $canteenpic, "url" => CFG_HTTP . "mobile/mycanteen.php?cids={$cids}");
            response_news($postObj, $newsContent);
        }
    } else {
        $newsContent = array("title" => "欢迎关注" . CFG_APPNAME, "description" => "点击链接", "picUrl" => CFG_HTTP . CFG_SHOP_DEFAULT, "url" => CFG_HTTP . "mobile/mycanteen.php");
        response_news($postObj, $newsContent);
    }
}
Exemple #4
0
 private function handleText($postObj)
 {
     $keyword = trim($postObj->Content);
     if (!empty($keyword)) {
         $keyword = trim($keyword);
         switch ($keyword) {
             case "a":
             case "A":
             case "info":
             case "Info":
                 $contentStr = "Current Time : " . date("h:i:sa", time()) . "\n\n";
                 for ($i = 0; $i < 3; $i++) {
                     $contentStr .= $this->getStoreInfo($i) . "\n";
                 }
                 $resultStr = response_text($postObj, $contentStr);
                 break;
             case "b":
             case "B":
             case "menu":
             case "Menu":
                 $record[0] = array('title' => 'A Selectioon of Gourmet Delicates', 'description' => 'null', 'picUrl' => Server_Address . '/menu/menu-title.jpg', 'url' => '');
                 $record[1] = array('title' => 'B1. DESSERTS', 'description' => '', 'picUrl' => Server_Address . '/menu/desserts.bmp', 'url' => '');
                 $record[2] = array('title' => 'B2. APPETISERS & STARTERS', 'description' => '', 'picUrl' => Server_Address . '/menu/A&S.bmp', 'url' => '');
                 $record[3] = array('title' => 'B3. PASTA', 'description' => '', 'picUrl' => Server_Address . '/menu/pasta.bmp', 'url' => '');
                 $resultStr = response_Multiplenews($postObj, $record);
                 break;
             case "b1":
             case "B1":
                 $record[0] = array('title' => 'DESSERTS', 'description' => 'null', 'picUrl' => Server_Address . '/desserts/desserts.bmp', 'url' => '');
                 $record[1] = array('title' => 'TIRAMISU', 'description' => '', 'picUrl' => Server_Address . '/desserts/tiramisu.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296610&idx=2&sn=f8e95cae08a827951dbe59d2b6b13f23#rd');
                 $record[2] = array('title' => 'ADAGIO', 'description' => '', 'picUrl' => Server_Address . '/desserts/adagio.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296610&idx=3&sn=47fffcec06bffb15b90192ec958e88c6#rd');
                 $record[3] = array('title' => 'OPERA', 'description' => '', 'picUrl' => Server_Address . '/desserts/opera.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296610&idx=4&sn=92c6aef704facf60d6940740283f946d#rd');
                 $resultStr = response_Multiplenews($postObj, $record);
                 break;
             case "b2":
             case "B2":
                 $record[0] = array('title' => 'APPETISERS & STARTERS', 'description' => 'null', 'picUrl' => Server_Address . '/A&S/A&S.bmp', 'url' => '');
                 $record[1] = array('title' => 'BAKED CHICKEN WINGS', 'description' => '', 'picUrl' => Server_Address . '/A&S/BCW.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296670&idx=2&sn=e64df5c94cd5722b5919578350f8e07e#rd');
                 $record[2] = array('title' => 'BAKED PORK SAUSAGES', 'description' => '', 'picUrl' => Server_Address . '/A&S/BPS.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296670&idx=3&sn=c511224e45a9932ceb6c8feffdb954af#rd');
                 $record[3] = array('title' => 'BAKED POTATO WEDGES', 'description' => '', 'picUrl' => Server_Address . '/A&S/BPW.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296670&idx=4&sn=e13f8ae1d644db60d077954adbb58d30#rd');
                 $resultStr = response_Multiplenews($postObj, $record);
                 break;
             case "b3":
             case "B3":
                 $record[0] = array('title' => 'PASTA', 'description' => 'null', 'picUrl' => Server_Address . '/A&S/A&S.bmp', 'url' => '');
                 $record[1] = array('title' => 'CARBONARA', 'description' => '', 'picUrl' => Server_Address . '/pasta/carbonara.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296738&idx=2&sn=c0c646d2a2a2e939f9c250c8b3885784#rd');
                 $record[2] = array('title' => 'CREAM MUSHROOM PENE', 'description' => '', 'picUrl' => Server_Address . '/pasta/CMP.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296738&idx=3&sn=e78e0ae99dc91c00df4af98f598df251#rd');
                 $record[3] = array('title' => 'SEAFOOD PASTA', 'description' => '', 'picUrl' => Server_Address . '/pasta/SP.bmp', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201296738&idx=4&sn=6d990c9460d05cc1697e448e46ea6fc8#rd');
                 $resultStr = response_Multiplenews($postObj, $record);
                 break;
             case "c":
             case "C":
             case "q&a":
             case "Q&A":
             case "Q&a":
                 $record[0] = array('title' => 'Terms & Conditions', 'description' => '', 'picUrl' => Server_Address . '/T&C-title.jpg', 'url' => '');
                 $record[1] = array('title' => 'C1. DELIVERY CHARGES', 'description' => 'DELIVERY CHARGES', 'picUrl' => '', 'url' => '');
                 $record[2] = array('title' => 'C2. AMENDMENTS AND CANCELLATION', 'description' => 'AMENDMENTS AND CANCELLATION', 'picUrl' => '', 'url' => '');
                 $record[3] = array('title' => 'C3. DELIVERY INFORMATION', 'description' => 'DELIVERY INFORMATION', 'picUrl' => '', 'url' => '');
                 $resultStr = response_Multiplenews($postObj, $record);
                 break;
             case "c1":
             case "C1":
                 $contentStr = "1. A delivery surcharge of S\$20 + GST per location applies for all item(s) purchase.\n\n2. Specific Delivery Time is subject to an additional charge of S\$30 + GST. (+/- 30 minutes from required timing acceptable for this surcharge)";
                 $resultStr = response_text($postObj, $contentStr);
                 break;
             case "c2":
             case "C2":
                 $contentStr = "1. Refund only applies to cancellation made with written e-mail with more than 2 working days notice from the date of delivery/collection. And there is an administrative charge of S\$10 + GST.\n\n2. Any amendments to orders require at least 2 working day notice from the date of delivery/collection (subject to availability) and there is an administrative charge of S\$10 + GST.";
                 $resultStr = response_text($postObj, $contentStr);
                 break;
             case "c3":
             case "C3":
                 $contentStr = "1. Delivery not applicable to Jurong Island, restricted airline and cargo area as well as other locations not in mainland Singapore.\n\n2. While Bakerzin endeavors to fulfill all deliveries, Bakerzin Holdings Pte Ltd shall not be liable or responsible for any late delivery or failure to deliver the products ordered due to unforeseen circumstances beyond control.\n\n3. Bakerzin Holdings Pte Ltd is not responsible for undelivered products due to the absence of the recipient or wrong address given.";
                 $resultStr = response_text($postObj, $contentStr);
                 break;
             case "where":
             case "Where":
                 $record = array('title' => 'Stroe Locator', 'description' => 'A : Jurong Point' . "\n" . 'B : Northpoint' . "\n" . 'C : Gardens by the Bay', 'picUrl' => Server_Address . '/staticmap.jpg', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwMzAyOTM0Mg==&mid=201297247&idx=1&sn=0e7a2fa4901c211206b5bceb3e273d1f#rd');
                 $resultStr = response_news($postObj, $record);
                 break;
             case "testing":
             case "Testing":
                 $record = array('title' => 'Testing', 'description' => '' . __ROOT__ . '/main/bakerzin.jpg', 'picUrl' => Server_Address . '/main/bakerzin.jpg', 'url' => '');
                 $resultStr = response_news($postObj, $record);
                 break;
             case "bakerzin":
             case "Bakerzin":
             default:
                 $record[0] = array('title' => 'Welcome to Bakerzin!', 'description' => 'null', 'picUrl' => Server_Address . '/main/bakerzin.jpg', 'url' => '');
                 $record[1] = array('title' => 'A. Basic Info', 'description' => 'Opening Hour, Location', 'picUrl' => Server_Address . '/main/about-us.jpg', 'url' => '');
                 $record[2] = array('title' => 'B. Menu', 'description' => 'A Selectioon of Gourmet Delicates', 'picUrl' => Server_Address . '/main/menu.jpg', 'url' => '');
                 $record[3] = array('title' => 'C. Terms & Conditions', 'description' => 'DELIVERY CHARGES, AMENDMENTS AND CANCELLATION, DELIVERY INFORMATION', 'picUrl' => Server_Address . '/main/T&C.jpg', 'url' => '');
                 $resultStr = response_Multiplenews($postObj, $record);
                 break;
         }
     } else {
         echo "Input something...";
     }
     return $resultStr;
 }