打酱油来了,论坛中,如何在分数变化的时候,显示不同等级的等级图片

martin_zou 2009-12-10 05:57:19
打酱油来了,论坛中,如何在分数变化的时候,显示不同等级的等级图片

有一张分数表(score)和 一张图片路径表(level_image)

Score表
score_id score username
40021 2400 vincent
40022 3600 eric
40023 3000 tomy
... ... ...

level_image表
level_image_id level_image_path level
1 BBS/level_image/列兵.gif 列兵
2 BBS/level_image/上等兵.gif 上等兵
3 BBS/level_image/下士.gif 下士
4 BBS/level_image/中士.gif 中士
5 BBS/level_image/上士.gif 上士
6 BBS/level_image/少尉.gif 少尉
7 BBS/level_image/中尉.gif 中尉
8 BBS/level_image/上尉.gif 上尉
9 BBS/level_image/少校.gif 少校
10 BBS/level_image/中校.gif 中校
11 BBS/level_image/上校.gif 上校
12 BBS/level_image/大校.gif 大校
13 BBS/level_image/少将.gif 少将
14 BBS/level_image/中将.gif 中将
15 BBS/level_image/上将.gif 上将

怎么样让score为多少的时候就显示什么等级的图片,
例如:


select case when score<=100 then '列兵'
when score>100 and score<=500 then '上等兵'
when score>501 and score<=1000 then '下士'
when score>1001 and score<=1500 then '中士'
when score>1501 and score<=2000 then '上士'
when score>2001 and score<=2500 then '少尉'
when score>2501 and score<=3000 then '中尉'
when score>3001 and score<=3500 then '上尉'
when score>3501 and score<=4000 then '少校'
when score>4001 and score<=4500 then '中校'
when score>4501 and score<=5000 then '上校'
when score>5001 and score<=5500 then '大校'
when score>5501 and score<=6000 then '少将'
when score>6001 and score<=6500 then '中将'
when score>6501 and score<=7000 then '上将'
else '其他' end
from score

其中分数表中的分数是随发帖的增多而增加的,就是说是动态变化着的,
所显示的图片也是随分数的增加而显示出来的


问:要在分数慢慢的增加的时候显示出来的(leve)等级图片所对应的图片地址(level_image_path)







...全文
101 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿非 2009-12-11
  • 打赏
  • 举报
回复
先自己弄下,有问题再来问
martin_zou 2009-12-11
  • 打赏
  • 举报
回复
我看看,
小_虎 2009-12-10
  • 打赏
  • 举报
回复
丿
Joetao 2009-12-10
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 xyyz150 的回复:]
引用 3 楼 sandy945 的回复:
写个方法

在绑定的时候 传一个 score 进来 返回一个 string  内容就是对应的 level_image_path               

方法内容 用if 判断 score  是属于哪个区间的 然后赋给相应的值 即可

这个方法就可以
或者
select case when score <=100 then '列兵'.......
改为:select case when score <=100 then 'image/列兵.jpg'
直接转成img的url。
[/Quote]
这个方法不错!
fonvey 2009-12-10
  • 打赏
  • 举报
回复
up
chen_ya_ping 2009-12-10
  • 打赏
  • 举报
回复
这个我想是不是在修改用户分数的时候,进行的操作。
我家有奥特曼 2009-12-10
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 sandy945 的回复:]
写个方法

在绑定的时候 传一个 score 进来 返回一个 string  内容就是对应的 level_image_path               

方法内容 用if 判断 score  是属于哪个区间的 然后赋给相应的值 即可
[/Quote]
这个方法就可以
或者
select case when score <=100 then '列兵'.......
改为:select case when score <=100 then 'image/列兵.jpg'
直接转成img的url。
chengkouda 2009-12-10
  • 打赏
  • 举报
回复
这个很简单嘛,你把图片的名称改一下就可以了三,不要什么“上等兵啊,这些东西”,直接改成“500,1000”这些,到时候获取图拍名字就知道是啥等级了三
阿非 2009-12-10
  • 打赏
  • 举报
回复
写个方法

在绑定的时候 传一个 score 进来 返回一个 string 内容就是对应的 level_image_path

方法内容 用if 判断 score 是属于哪个区间的 然后赋给相应的值 即可
martin_zou 2009-12-10
  • 打赏
  • 举报
回复
我不知道怎么在查询出分数为2600分显示的图片为BBS/level_image/中尉.gif图片
阿非 2009-12-10
  • 打赏
  • 举报
回复
...

根据你现在的不就可以改了么

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧