用户信息 - wolfcon/NGA-API-Documents GitHub Wiki

7 用户信息

输入地址

/nuke.php

输入参数

__lib //固定取值 ucp
__act //固定取值 get
uid  //用户id  整数
username  //用户名  字符串
__output //输出格式 见1.1

如有用户id则使用用户id 否则使用用户名查询 用户名编码应与论坛一致使用GBK

返回数据格式大致解释如下

window.script_muti_get_var_store={
"data":{
  "0":{
    "uid":58,//用户id
    "username":"zeg",//用户名
    "memberid":3,//用户组id
    "group":"Titan",//用户组名
    "posts":6135,//发帖数
    "fame":465,//威望 除10为威望显示值
    "money":936650,//金钱 铜币数
    "title":" 1310494018 伊藤周 地精动力",//头衔
    "verified":1,//激活状态 0为未激活 1为激活 -1为被nuke禁止发言 小于-1为其他原因禁止发言
    "lastpost":1378953174,//最后发帖时间
    "bit":7,//用户bit
    "regdate":1034682132,//注册日期
    "medal":'2,3,4,5,6',//用户佩戴的徽章id 逗号分隔 取徽章信息见章节17.1和17.3
    "muteTime":0,//禁言到期时间, 到期时间>当前时间 为禁言状态
    "avatar":"{\"l\":1,\"0\":{\"0\":\"http://pic1.178.com/avatars/00/00/00/nga_58.jpg\",\"cX\":0.39,\"cY\":0.52}}",//头像
    "sign":"123 "456" frew",//签名
    "email":"xxooo",//邮箱地址 不会显示完整的地址
    "reputation":{//用户声望
      "0":{"0":"PvE","1":4371,"2":"任务讨论、副本专区、成就讨论、地精商会、公会管理声望"},// {0:声望名, 1:声望值, 3:声望说明}
      "1":{"0":"艾泽拉斯卫士","1":16,"2":"裁判所声望"},
      "2":{"0":"远古守卫","1":600,"2":"DotA区声望"},
      ...
      },
    "adminForums":{//担任版主的版面
      "9":"印记城 Sigil",//版面id : 版面名字
      ...
      },
    "userForum":1,
    "items":2,//为2时表示用户有道具
    "_admin":1,//拥有管理员权限
    "_super":1,//拥有超级版主权限
    "_greater":1,//拥有版主权限
    "_lesser":1//拥有次级版主权限
    }
  },

"encode":"gbk",

"time":1363861131//当前时间
}

7.2 获取用户的头像

输入地址

/nuke.php

输入参数

__act //固定取值 get_avatar
__lib //固定取值 ucp
uid //用户ID
__nodb  
__output //输出格式 见1.1.1

返回的数据大致如下

window.script_muti_get_var_store={
   "data":{
      "0":图像地址
      }
   }

图像地址可能是网址

也可能是json字符串

{
  "l":1,
  "0":{
    "0":"http://pic1.178.com/avatars/00/00/00/nga_58.jpg",//图像地址
    "cX":0.39,//头像中心点位置
    "cY":0.52//头像中心点位置
    }
  ... //可能有多个 随机选一个
  }

多头像选择的js范例

//用户头像选择=================
//{t:(int)type, l:(int)length, 0:{0:(str)avatar,cX:(int)centerX,cY:(int)centerY}, 1:(str)avatar  }
commonui.selectUserPortrait = function(a,buff){
var y='',i
while(!i){
  i = 1
  if(buff){
    if(buff[99] || buff[102] || buff[107]){
      var y = new String(__PORTRAIT_PATH+'/'+(buff[102] ? 'a_sheep_b.png' : (buff[99] ? 'a_sheep.png' : 'a_sheep_c.png')))
      y.noborder=1
      break
      }
    if(buff[111])
      break
    }
  if(!a)
    break
  if (a.constructor==String){
    if(a.substr(0,1)=='{' || a.indexOf('|')!=-1)
      break
    if(a.substr(0,8)=='/*$js$*/')
      eval('var a='+a)
    else{
      y = a.substr(0,7)!='http://' ? __PORTRAIT_PATH+'/'+a : a
      break
      }
    }
  if(a.constructor==Object){
    if (a.t==1 || !a.t)//随机
      i=Math.floor(Math.random()*a.l)//时段
    else if (a.t==2 && window.date){
      i = (date.getHours()+8)/24
      if (i>=1)i = i-1
      i=Math.floor(i*a.l)
      }
    if(a[i].constructor==Object){
      y = new String(a[i][0])
      y.cX = a[i].cX
      y.cY = a[i].cY
      y.id = i
      }
    else{
      y = new String(a[i])
      y.id = i
      }
    if(y.substr(0,7)!='http://')
      y= __PORTRAIT_PATH+'/'+y
    break
    }

  }
return y

}