Browse Source

ft: IIF改成CASE

master
SisMaker 1 year ago
parent
commit
69fb3740cf
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      include/ranks.hrl
  2. +1
    -1
      src/rank/rankWork.erl

+ 1
- 1
include/ranks.hrl View File

@ -12,7 +12,7 @@
-define(publicInfoPos, #etsRankRecord.publicInfo).
%%
-define(IIF(Cond, Ret1, Ret2), (case Cond of true -> Ret1; _ -> Ret2 end)).
-define(CASE(Cond, Ret1, Ret2), (case Cond of true -> Ret1; _ -> Ret2 end)).
-define(etsRankInfo, etsRankInfo).

+ 1
- 1
src/rank/rankWork.erl View File

@ -110,7 +110,7 @@ mGetRankInfo(RankType, MyKey, Cnt, Page, PageInfo) ->
try ets:lookup_element(?etsRankInfo, MyKey, RankPos) of
CurScore ->
MyIndex = ets:select_count(RankType, [{{'$1', '$2'}, [{'>=', '$1', {const, CurScore}}], [true]}]),
?IIF(MyIndex > RankLimit, -1, MyIndex)
?CASE(MyIndex > RankLimit, -1, MyIndex)
catch _:_ ->
-1
end;

Loading…
Cancel
Save