feat: mcc/mnc的*通配,GetAccountBundlePlanInfo()判断套餐类型条件错误

This commit is contained in:
zhangsz
2025-04-17 16:56:02 +08:00
parent 5ce12ea2a3
commit c3d5d876a9

View File

@@ -3139,7 +3139,7 @@ int GetAccountBundlePlanInfo(_account_info *ptr, long ret_value[6], _state_data
ret_value[5] = usr_redis.warning_sms_flag; ret_value[5] = usr_redis.warning_sms_flag;
#else #else
#ifdef HAS_BUNDLE_ROAMING #ifdef HAS_BUNDLE_ROAMING
if((shmp != NULL) || (shmp->process_info.bundle_flag == BUNDLE_OTHER_NETWORK)) if((shmp != NULL) && (shmp->process_info.bundle_flag == BUNDLE_OTHER_NETWORK))
{ {
// see if we have to set bundle to 0=================================== // see if we have to set bundle to 0===================================
if ((sub_ptr->bundle_roam.validity_date > 0) && (sub_ptr->bundle_roam.validity_date < tvnow.tv_sec))// 1) set bundle to 0, if expired when querying. if ((sub_ptr->bundle_roam.validity_date > 0) && (sub_ptr->bundle_roam.validity_date < tvnow.tv_sec))// 1) set bundle to 0, if expired when querying.
@@ -4840,7 +4840,7 @@ static void PureDigitAscii(u_char *string)
char char
GetTariffLacInfo(u_char *cgi) GetTariffLacInfo(u_char *cgi)
{ {
int loc = -1, loop, matchFlag=0,len; int loc = -1, loop, matchFlag=0,len, matchMcc=0, matchMnc=0, mMccLen=0, mMncLen=0, matchTz=-1;
u_short cell, lac; u_short cell, lac;
u_char MCC[32]={0},MNC[32]={0}; u_char MCC[32]={0},MNC[32]={0};
BasicTariffZone *pBTZ; BasicTariffZone *pBTZ;
@@ -4866,14 +4866,81 @@ GetTariffLacInfo(u_char *cgi)
continue; continue;
matchFlag = 0; matchFlag = 0;
len = strlen((char *)pBTZ->mcc); len = strlen((char *)pBTZ->mcc);
if(len == 0) if((len == 0) || (pBTZ->mcc[0] == '*'))
{
if ((matchMnc==0) && (matchMcc==0))
{
matchMcc = 1;
mMccLen = 0;
matchTz = loop;
}
continue; continue;
}
else if ((len>=2)&&(pBTZ->mcc[1]=='*'))
{
if (pBTZ->mcc[0]==MCC[0])
{
if ((matchMnc==0) && (mMccLen<=0))
{
matchMcc = 1;
mMccLen = 1;
matchTz = loop;
}
}
continue;
}
else if ((len>=3)&&(pBTZ->mcc[2]=='*'))
{
if(memcmp(pBTZ->mcc,MCC,2) == 0)
{
if ((matchMnc==0) && (mMccLen<=1))
{
matchMcc = 1;
mMccLen = 2;
matchTz = loop;
}
}
continue;
}
if(memcmp(pBTZ->mcc,MCC,len) == 0) if(memcmp(pBTZ->mcc,MCC,len) == 0)
{ {
len = strlen((char *)pBTZ->mnc); len = strlen((char *)pBTZ->mnc);
if(len == 0 || (pBTZ->mnc[0] == '*')) if((len == 0) || (pBTZ->mnc[0] == '*'))
{ {
matchFlag = 1; //matchFlag = 1;
if (matchMnc==0)
{
matchMnc = 1;
mMncLen = 0;
matchTz = loop;
}
continue;
}
else if ((len>=2)&&(pBTZ->mnc[1]=='*'))
{
if (pBTZ->mnc[0]==MNC[0])
{
if (mMncLen<=0)
{
matchMnc = 1;
mMncLen = 1;
matchTz = loop;
}
}
continue;
}
else if ((len>=3)&&(pBTZ->mnc[2]=='*'))
{
if(memcmp(pBTZ->mnc,MNC,2) == 0)
{
if (mMncLen<=1)
{
matchMnc = 1;
mMncLen = 2;
matchTz = loop;
}
}
continue;
} }
else if(memcmp(pBTZ->mnc,MNC,len) ==0 ) else if(memcmp(pBTZ->mnc,MNC,len) ==0 )
{ {
@@ -4912,6 +4979,10 @@ GetTariffLacInfo(u_char *cgi)
} }
}//if mcc }//if mcc
}/* for */ }/* for */
if ((matchMcc==1) || (matchMnc==1))
{
return matchTz;
}
return loc; return loc;
} }