1.
/**
* 查询用户的抵用点消费记录
* @param $member_id
* @return array
*/
function get_point_trade_list( $member_id, $page = '', $page_count = '' ) {
if ( empty($member_id) ) {
return;
}
$sql = "SELECT * FROM " . TBL_PRE . "member_point_trade WHERE member_id = '{$member_id}' ORDER BY trade_time DESC";
if ( !empty($page) && !empty($page_count) ) {
$page_start = (max(1,$page)-1)*$page_count;
$sql .= " LIMIT {$page_start},{$page_count}";
}
$list = $this->db->get_all($sql);
$sql_count = "SELECT COUNT(*) AS count FROM " . TBL_PRE . "member_point_trade WHERE member_id = '{$member_id}'";
$total_count = $this->db->get_row($sql_count);
$my_list['total'] = $total_count['count'];
$my_list['list'] = $list;
return $my_list;
}
/**
* 余额明细
* @param $member_id
* @return array
*/
function get_balance_trade_list( $member_id, $page = '', $page_count = '' ) {
if ( empty($member_id) ) {
return;
}
$sql = "SELECT * FROM " . TBL_PRE . "member_balance_trade WHERE member_id = '{$member_id}' ORDER BY trade_time DESC";
if ( !empty($page) && !empty($page_count) ) {
$page_start = (max(1,$page)-1)*$page_count;
$sql .= " LIMIT {$page_start},{$page_count}";
}
$list = $this->db->get_all($sql);
$sql_count = "SELECT COUNT(*) AS count FROM " . TBL_PRE . "member_balance_trade WHERE member_id = '{$member_id}'";
$total_count = $this->db->get_row($sql_count);
$my_list['total'] = $total_count['count'];
$my_list['list'] = $list;
return $my_list;
}
/**
* 积分明细
* @param $member_id
* @param $page
* @param $page_count
*/
function get_score_trade_list( $member_id ,$page = '', $page_count = '') {
$sql = "SELECT * FROM " . TBL_PRE . "member_score_trade WHERE member_id = '{$member_id}' ORDER BY trade_time DESC";
if ( !empty($page) && !empty($page_count) ) {
$page_start = (max(1,$page)-1)*$page_count;
$sql .= " LIMIT {$page_start},{$page_count}";
}
$list = $this->db->get_all($sql);
$sql_count = "SELECT COUNT(*) AS count FROM " . TBL_PRE . "member_score_trade WHERE member_id = '{$member_id}'";
$total_count = $this->db->get_row($sql_count);
$my_list['total'] = $total_count['count'];
$my_list['list'] = $list;
return $my_list;
}