是否可以在Django项目中检查用户是在线还是离线?
需要检查用户是否在线。
在我的Django项目中,我有一个售后服务小组,其中有几位员工管理员用户。
我想列出他们的信息,我也想检查他们是否登录。
如何检查?我使用?- puzzle(Who), write(Who), nl, fail.
first(H,[H|_]).
on_the_left(X,Y,[X,Y|_]).
on_the_left(X,Y,[_|Hs]) :- on_the_left(X,Y,Hs).
next_to(X,Y,[X,Y|_]).
next_to(X,Y,[Y,X|_]).
next_to(X,Y,[_|Hs]) :- next_to(X,Y,Hs).
middle(X,[_,_,X,_,_]).
puzzle(Who) :-
Houses = [
house(Nationality, Colour, Music, Hobby, Food),
house(_, _, _, _, _),
house(_, _, _, _, _),
house(_, _, _, _, _),
house(_, _, _, _, _)],
next_to(house(irish, _, _, _, _), house( _, yellow, _, _, _), Houses), % 01) the Irish person lives next to the yellow house
next_to(house(_, _, _, _, donuts), house( _, _, _, embroidery, _), Houses), % 02) the person who likes donuts lives next to the person who enjoys embroidery
next_to(house(_, _, _, trainspotting, _), house( _, _, _, _, pizza), Houses), % 03) the person who enjoys trainspotting lives next to the one who likes pizza
member(house(_, _, _, pachinko, beets), Houses), % 04) the person who enjoys pachinko likes beets
member(house(czech, purple, _, _, _), Houses), % 05) the Czech lives in the purple house
middle(house(_, _, grunge, _, _), Houses), % 06) the person living in the center house listens to grunge
member(house(_, _, hiphop, glassblowing, _), Houses), % 07) the person who enjoys glassblowing listens to hip hop
member(house(american, _, _, _, tofu), Houses), % 08) the American likes tofu
member(house(dutch, _, jpop, _, _), Houses), % 09) the Dutch person listens to J-Pop
member(house(_, pink, country, _, _), Houses), % 10) the pink house's owner listens to country
member(house(_, green, _, embroidery, _), Houses), % 11) the owner of the green house enjoys embroidery
first(house(irish, _, _, _, _), Houses), % 12) the Irish person lives in the first house
on_the_left(house(_, pink, _, _, _), house(_, orange, _, _, _), Houses), % 13) the pink house is on the left of the orange house
member(house(japanese, _, _, gardening, _), Houses), % 14) the Japanese person enjoys gardening
next_to(house(_, _, _, trainspotting, _), house( _, _, jazz, _, _), Houses), % 15) the person who enjoys trainspotting has a neighbor who listens to jazz
member(house(Who, _, _, _, pie), Houses),
write(Houses), nl.
,有一个令牌来验证用户,我不确定这是否有帮助。