UserGuildModel.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace loyalsoft;
  3. /*
  4. * To change this license header, choose License Headers in Project Properties.
  5. * To change this template file, choose Tools | Templates
  6. * and open the template in the editor.
  7. */
  8. /**
  9. * Description of UserGuildModel
  10. *
  11. * @author cyzhao
  12. */
  13. class UserGuildModel
  14. {
  15. //put your code here
  16. public static function Clear()
  17. {
  18. $userGuildinfo = new UserGuildModel();
  19. $userGuildinfo->ts = now();
  20. $userGuildinfo->joints = now(); //玩家公会的创建时间
  21. $userGuildinfo->guildId = 0;
  22. //s$userGuildinfo->guildName;
  23. $userGuildinfo->cupScore = 0;
  24. $userGuildinfo->appliedguildlist = array();
  25. $userGuildinfo->appliedguildRecord = ObjectInit();
  26. $userGuildinfo->contribute = 0; //贡献度
  27. // $userGuildinfo->level;
  28. // $userGuildinfo->name;
  29. //$userGuildinfo->fightPower;
  30. $userGuildinfo->requestCardTs = 0;
  31. $userGuildinfo->donateCount = ObjectInit();
  32. $userGuildinfo->allDonateCount = 0;
  33. //$userGuildinfo->position = 0; //职位
  34. return $userGuildinfo;
  35. }
  36. /**
  37. * 检查玩家每日需要清理的状态
  38. * @param UserGuildModel $userGuildInfo
  39. */
  40. static function checkFirstlog($userGuildInfo)
  41. {
  42. #每天清理
  43. if (TimeUtil::tsDay() > TimeUtil::tsDay($userGuildInfo->ts)) {
  44. $userGuildInfo->allDonateCount = 0;
  45. }
  46. #清理过期捐献信息
  47. $donateCount = $userGuildInfo->donateCount;
  48. foreach ($donateCount as $key => $value) {
  49. if (now() - $value->ts >= glc()->Guild_DonateCoolingTime) {//捐献冷却时间到了
  50. unset($donateCount->$key);
  51. }
  52. }
  53. }
  54. /**
  55. * 初始化个人公会信息
  56. * @param type $userGuildInfo
  57. * @param type $uid
  58. * @param type $game
  59. * @param type $mem
  60. * @param type $guildId
  61. * @param type $zoneid
  62. */
  63. static function userGuildInfoInit($userGuildInfo, $uid, $game, $mem, $zoneid)
  64. {
  65. #self::Clear();
  66. $userGuildInfo->ts = now();
  67. // if ($guildId != 0) {
  68. // $guildInfo = GuildProc::getMemGuildInfo($mem, $guildId, $zoneid);
  69. // $userGuildInfo->guildName = $guildInfo->name;
  70. // }
  71. $key_cur = MemKey_GameRun::Game_PVPScoreByZone_zset($zoneid); # 总积分榜
  72. $score = $mem->zscore($key_cur, $uid);
  73. $cupScore = $score == null ? 0 : $score;
  74. $userGuildInfo->cupScore = $cupScore;
  75. $userGuildInfo->name = $game->name;
  76. $userGuildInfo->level = $game->level;
  77. //$userGuildInfo->fightPower = GuildProc::initFightTeamInfo($mem, $uid, $zoneid); #$game->heroTeamConfig;
  78. $userGuildInfo->uid = $uid;
  79. $userGuildInfo->img = $game->img;
  80. $userGuildInfo->imgBorderId = $game->imgBorderId;
  81. }
  82. }