当$userlist为0时,竟然会再次重新调用,$userlist再次为0时,才会返回$result,请问有什么错呢?functioncount_user_order($user_list_str, $limit = 4, $times = 1){
static$result = array('users_count'=>array(), 'order_number'=>array(), 'order_amount'=>array());
$sql = 'SELECT user_id FROM '.$GLOBALS['ecs']->table('users')." WHERE parent_id IN (%s)"; // 统计顾客
$user_list = $GLOBALS['db']->getCol(sprintf($sql, $user_list_str));
$sql_order = 'SELECT SUM(order_amount) order_amount,COUNT(*) order_number FROM '
.$GLOBALS['ecs']->table('order_info')." WHERE pay_status=2 AND user_id IN (%s)"; // 统计订单数量及金额
list($result['order_amount'][], $result['order_number'][]) = $GLOBALS['db']->getRow(sprintf($sql_order, $user_list_str));
$result['users_count'][] = count($user_list);
if ((!$limit $times < $limit) && count($user_list)) {
$user_list_str = implode(',', $user_list);
count_user_order($user_list_str, $limit, ++$times);
}
return$result;
}
该贴被xpisme编辑于2015-8-26 10:02:41