Пример #1
0
<?php

!defined('W_P') && exit('Forbidden');
!$windid && wap_msg('not_login');
InitGP(array('action', 'tid'));
$rts = array();
$result = $db->query("SELECT typeid FROM pw_collection WHERE type = 'postfavor' AND typeid = " . S::sqlEscape($tid) . " AND uid = " . S::sqlEscape($winduid));
while ($rt = $db->fetch_array($result)) {
    $rts[] = $rt['typeid'];
}
$rs['tids'] = implode(',', $rts);
$rs['type'] = '';
if ($rs['tids']) {
    $count = 0;
    $tiddb = getFavor($rs['tids']);
    foreach ($tiddb as $key => $t) {
        if (is_array($t)) {
            if (CkInArray($tid, $t)) {
                favShowMsg('job_favor_error');
            }
            $count += count($t);
        } else {
            unset($tiddb[$key]);
        }
    }
    $count > $_G['maxfavor'] && favShowMsg('job_favor_full');
    InitGP(array('type'), 2);
    $typeid = array('0' => 'default');
    if ($rs['type']) {
        $typeid = array_merge($typeid, explode(',', $rs['type']));
        if (!isset($type)) {
Пример #2
0
 			exit();
 		} */
 $from = ($_GET['page'] - 1) * $count;
 $sql = "select comment_id,username,users.imageurl,content,food_comments.time,favor from food_comments,users \n\t\t\t\twhere food_comments.user_id=users.user_id and canteen_id={$_POST['canteen_id']}\n\t\t\t\t and food_id={$_POST['food_id']} order by food_comments.time desc limit {$from},{$count};";
 $db = Db::getInstance();
 try {
     $db->connect();
     $res = $db->query($sql);
     if ($res !== false) {
         if (empty($res)) {
             $res = null;
         } else {
             foreach ($res as &$value) {
                 $value['user_imageurl'] = $value['imageurl'];
                 getImageUrl($db, $value);
                 getFavor($db, $_POST['user_id'], $value);
             }
         }
         $json = getJsonResponse(0, "success", $res);
         /* if($cache->set($cachename, $json,1200)===false)
         			Log::error_log($cachename.'  '.$cache->error); */
         echo $json;
     } else {
         echo getJsonResponse(1, $db->error, null);
         Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
     }
     $db->close();
 } catch (Exception $e) {
     echo getJsonResponse(1, "数据库连接错误", null);
     Log::error_log("数据库连接错误");
     exit;