function money_get_user_money($user_id) { global $tablePreStr; $t_money = $tablePreStr . "money"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); /*select isns_money.*, isns_users.user_point from iwebsns.isns_money, isns_users where isns_users.user_id=isns_money.user_id and isns_money.user_id=1;*/ $sql = "select {$t_money}.* from {$t_money} where {$t_money}.user_id={$user_id}"; $result_rs = $dbo->getALL($sql); return $result_rs; }
function pals_sort($uid = '') { $uid = intval($uid); if ($uid == 0) { $uid = get_sess_userid(); } global $tablePreStr; $t_pals_sort = $tablePreStr . "pals_sort"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $sql = " select * from {$t_pals_sort} where user_id={$uid} "; $result_rs = $dbo->getALL($sql); return $result_rs; }
function message_get_affair_uid($id, $type = '', $num = 20) { $limit = intval($num) ? " limit {$num} " : ""; $type_str = filt_num_array($type); $id_str = filt_num_array($id); $sql_type = ""; if ($type_str != '') { $sql_type = " and mod_type in ({$type_str}) "; } global $tablePreStr; $t_recent_affair = $tablePreStr . "recent_affair"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $sql = "select * from {$t_recent_affair} where user_id in ({$id_str}) {$sql_type} order by id desc {$limit} "; $result_rs = $dbo->getALL($sql); return $result_rs; }
function paper_get_pick_reasons($paper_id, $user_id) { $paper_is_owned_user = paper_get_is_owned_user($user_id, $paper_id); global $tablePreStr; $t_users = $tablePreStr . "users"; $t_comments = $tablePreStr . "comments"; //评论类型 $comment_type = 0; $paper_pick_reason_rs = array(); $dbo = new dbex(); dbplugin('r'); $paper_comments_sql = ""; if (1 == $paper_is_owned_user) { $paper_comments_sql = "select {$t_users}.*, {$t_comments}.* \n\tfrom {$t_comments}, {$t_users} where {$t_users}.user_id = {$t_comments}.commenter_id \n\tand {$t_comments}.paper_id = {$paper_id} and ({$t_comments}.comment_type=1 or {$t_comments}.comment_type=2) order by {$t_comments}.comment_time"; } else { $paper_is_user_picked = paper_get_is_user_picked($paper_id, $user_id); if (1 == $paper_is_user_picked) { /*select isns_users.*, isns_comments.* from isns_comments, isns_users where isns_users.user_id = isns_comments.commenter_id and isns_comments.commenter_id = 2 and isns_comments.paper_id = 111113 and (isns_comments.comment_type=1 or isns_comments.comment_type=2) order by isns_comments.comment_time*/ $paper_comments_sql = "select {$t_users}.*, {$t_comments}.* \n\tfrom {$t_comments}, {$t_users} where {$t_users}.user_id = {$t_comments}.commenter_id and {$t_comments}.commenter_id = {$user_id}\n\tand {$t_comments}.paper_id = {$paper_id} and ({$t_comments}.comment_type=1 or {$t_comments}.comment_type=2) order by {$t_comments}.comment_time"; } else { return null; } } $paper_pick_reason_rs = $dbo->getALL($paper_comments_sql); $re_pick_reasons = array(); foreach ($paper_pick_reason_rs as $_ => $paper_reason) { $commenter_id = $paper_reason['commenter_id']; if (null == $re_pick_reasons[$commenter_id]) { $re_pick_reasons[$commenter_id] = array(); } $re_pick_reasons[$commenter_id][] = $paper_reason; } return $re_pick_reasons; }
<?php require "api/base_support.php"; //引入语言包 $pu_langpackage = new publiclp(); //变量取得 $least_paper_id = get_argg("least_paper_id"); //返回数量 $return_num = 10; $result = array(); if ($least_paper_id <= 0) { echo json_encode($result); } //数据表定义区 $t_papers = $tablePreStr . "papers"; $t_users = $tablePreStr . "users"; $dbo = new dbex(); dbplugin('r'); $get_more_papers_sql = "select {$t_papers}.*, {$t_users}.* from {$t_papers}, {$t_users} where {$t_users}.user_id={$t_papers}.user_id and {$t_papers}.paper_id < {$least_paper_id} limit {$return_num}"; // select isns_papers.*, isns_users.user_name from isns_papers, isns_users where isns_users.user_id=isns_papers.user_id and isns_papers.paper_id < 222239 limit 2; //$get_more_papers_sql = "select * from $t_papers where $t_papers.paper_id < $least_paper_id limit $return_num"; $result = $dbo->getALL($get_more_papers_sql); $result = calc_all_distance($result); echo json_encode($result);
function paper_related_last_paper() { global $tablePreStr; $t_papers = $tablePreStr . "papers"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $sql = "select * from {$t_papers} where picture is not null and picture <> '' order by paper_id desc limit 5"; $result_rs = $dbo->getALL($sql); return $result_rs; }