/** * @brief 比较指定字段的值 * @param $field 字段名 * @param $a UserStatEntry 类型的变量 * @param $b UserStatEntry 类型的变量 * @return -1:$a<$b 0:$a==$b 1:$a>$b */ public static function compare_field($field, $a, $b) { if ('user_name' == $field) { return strcmp($a->user_name, $b->user_name); } else { if ('parent_group' == $field) { return strcmp($a->parent_group, $b->parent_group); } else { if ('user_desc' == $field) { return strcmp($a->user_desc, $b->user_desc); } else { if ('lan_ip' == $field) { return ip2long($a->lan_ip) - ip2long($b->lan_ip); } else { if ('lan_mac' == $field) { return strcmp($a->lan_mac, $b->lan_mac); } else { if ('flow_count' == $field) { return $a->flow_count - $b->flow_count; } else { if ('terminal_type' == $field) { return $a->terminal_type - $b->terminal_type; } else { if ('login_time' == $field) { return strcmp($a->login_time, $b->login_time); } else { if ('update_time' == $field) { return strcmp($a->update_time, $b->update_time); } else { if ('auth_type' == $field) { return $a->auth_type - $b->auth_type; } else { if ('login_type' == $field) { return $a->login_type - $b->login_type; } else { if ('is_disabled_internet_access' == $field) { return $a->is_disabled_internet_access - $b->is_disabled_internet_access; } else { return parent::compare_field($field, $a->stat, $b->stat); } } } } } } } } } } } } }
/** * @brief 比较指定字段的值 * @param $field 字段名 * @param $a ApplicationUserEntry 类型的变量 * @param $b ApplicationUserEntry 类型的变量 * @return -1:$a<$b 0:$a==$b 1:$a>$b */ public static function compare_field($field, $a, $b) { if ('lan_ip' == $field) { return ip2long($a->lan_ip) - ip2long($b->lan_ip); } else { if ('user_name' == $field) { return strcmp($a->user_name, $b->user_name); } else { if ('flow_count' == $field) { return $a->flow_count - $b->flow_count; } else { return parent::compare_field($field, $a->stat, $b->stat); } } } }
/** * @brief 比较指定字段的值 * @param $field 字段名 * @param $a ApplicationStatEntry 类型的变量 * @param $b ApplicationStatEntry 类型的变量 * @return -1:$a<$b 0:$a==$b 1:$a>$b */ public static function compare_field($field, $a, $b) { if ('l7prot' == $field) { return strcmp($a->l7prot, $b->l7prot); } else { if ('l7name' == $field) { return strcmp($a->l7name, $b->l7name); } else { if ('flow_count' == $field) { return $a->flow_count - $b->flow_count; } else { return parent::compare_field($field, $a->stat, $b->stat); } } } }