public function checkEventVip($aid, $uin) { $data = array('ret' => 0); $aid = !empty($aid) ? Utils::EscapeDBInput($aid) : ''; $uin = intval($uin); if (!empty($aid)) { sleep(1); $db = DBHelper::GenerateVipClient('slave'); $where = "`source_tag` = '{$aid}'"; $where .= $uin > 0 ? " and `uin` = {$uin}" : ''; $sql = "select count(*) as `times` from tb_vip_transaction where {$where};"; $row = $db->query($sql); if (!empty($row)) { $data['ret'] = intval($row[0]['times']); } } return $data; }
/** * 取活动的vip充值流水记录或者用户的活动充值流水记录 * aid是活动在充值流水表的id,用于分辨活动的充值记录 * 例如:aid=1001|rch=qdqb|44009FBC62994368E2412B1BB6E1FD7624402| */ protected function getVipTransaction($aid, $uin = 0, $num = 0) { $transArr = array(); $uin = intval($uin); $sql = "select * from tb_vip_transaction where remark like '%aid={$aid}%' "; if ($uin > 0) { $sql .= " and uin = {$uin} "; } $sql .= " order by create_time;"; if ($num > 0) { $sql .= " limit 0,{$num}"; } $client = DBHelper::GenerateVipClient(); if (!empty($client)) { $transArr = $client->query($sql); } return $transArr; }