Пример #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}]");
    }
}
Пример #2
0
function click_new($postObj)
{
    if ($postObj->EventKey == "c45fed65e9873ee368625b73ef7d5760") {
        $sp = "{call vp_get_video_list}";
        $rs = sp_execute($sp, null);
        $arr = array();
        foreach ($rs as $row) {
            $newsContent = array("title" => $row["title"], "description" => $row["content"], "picUrl" => CFG_HTTP . "/apps/mobile/upload/2011111.jpg", "url" => CFG_HTTP . "/apps/mobile/upload/" . $row["media_id"] . ".mp4");
            array_push($arr, $newsContent);
        }
        $resultStr = response_multiNews($postObj, $arr);
        echo $resultStr;
    } else {
    }
}