logo

(.NET)JTBC2.0获取当前分类的顶级分类ID

2025-02-19 点击 3

这个功能适用于单一模块 多级分类时 将一级分类作为栏目方式展示

   public static string getClassFid(string argGenre, int argLng, string argId)

    {
      string tGenre = argGenre;
      int tLng = argLng;
      int tId = cls.getNum(argId,0);
      string tmPStr = "";
      string[,] tAry = getCatAry(tGenre, tLng);
      if (tId > 0)
      {
              if (tAry != null)
              {
                for (int tis = 0; tis < tAry.GetLength(0); tis ++)
                {
                  if (cls.getNum(tAry[tis, 0], 0) == tId)
                  {
                    if(cls.getNum(tAry[tis, 2], -1) != 0)
                    {
                      tmpstr = getClassFid(tGenre, tLng, cls.toString(tAry[tis, 2]));
                    }
                    else tmpstr = cls.toString(tAry[tis, 0]);
                  }
                }
              }
      }
      return tmpstr;
    }


函数放置于category.cs中 // 由于是历史功能 请结合当前jtbc。net版本适当调整
使用方法string fclassid = category.getClassFid(config.ngenre, cls.toInt32(config.nlng), cls.toString(tClass));

来源:tuotuo

0%