UserGuildModel.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. //put your code here
  15. public static function Clear() {
  16. $userGuildinfo = new UserGuildModel();
  17. $userGuildinfo->ts = now();
  18. $userGuildinfo->joints = now(); //玩家公会的创建时间
  19. $userGuildinfo->guildId = 0;
  20. //s$userGuildinfo->guildName;
  21. $userGuildinfo->cupScore = 0;
  22. $userGuildinfo->appliedguildlist = array();
  23. $userGuildinfo->appliedguildRecord = ObjectInit();
  24. $userGuildinfo->contribute = 0; //贡献度
  25. // $userGuildinfo->level;
  26. // $userGuildinfo->name;
  27. //$userGuildinfo->fightPower;
  28. $userGuildinfo->requestCardTs = 0;
  29. $userGuildinfo->donateCount = ObjectInit();
  30. $userGuildinfo->allDonateCount = 0;
  31. //$userGuildinfo->position = 0; //职位
  32. return $userGuildinfo;
  33. }
  34. /**
  35. * 检查玩家每日需要清理的状态
  36. * @param UserGuildModel $userGuildInfo
  37. */
  38. static function checkFirstlog($userGuildInfo) {
  39. #每天清理
  40. if (TimeUtil::tsDay() > TimeUtil::tsDay($userGuildInfo->ts)) {
  41. $userGuildInfo->allDonateCount = 0;
  42. }
  43. #清理过期捐献信息
  44. $donateCount = $userGuildInfo->donateCount;
  45. foreach ($donateCount as $key => $value) {
  46. if (now() - $value->ts >= glc()->Guild_DonateCoolingTime) {//捐献冷却时间到了
  47. unset($donateCount->$key);
  48. }
  49. }
  50. }
  51. /**
  52. * 初始化个人公会信息
  53. * @param type $userGuildInfo
  54. * @param type $uid
  55. * @param type $baseInfo
  56. * @param type $mem
  57. * @param type $guildId
  58. * @param type $zoneid
  59. */
  60. static function userGuildInfoInit($userGuildInfo, $uid, $baseInfo, $mem, $zoneid) {
  61. #self::Clear();
  62. $userGuildInfo->ts = now();
  63. // if ($guildId != 0) {
  64. // $guildInfo = GuildProc::getMemGuildInfo($mem, $guildId, $zoneid);
  65. // $userGuildInfo->guildName = $guildInfo->name;
  66. // }
  67. // $key_cur = MemKey_GameRun::Game_PVPScoreByZone_zset($zoneid); # 总积分榜
  68. // $score = $mem->zscore($key_cur, $uid);
  69. // $cupScore = $score == null ? 0 : $score;
  70. // $userGuildInfo->cupScore = $cupScore;
  71. $userGuildInfo->name = $baseInfo->name;
  72. $userGuildInfo->level = $baseInfo->level;
  73. //$userGuildInfo->fightPower = GuildProc::initFightTeamInfo($mem, $uid, $zoneid); #$game->heroTeamConfig;
  74. $userGuildInfo->uid = $uid;
  75. $userGuildInfo->headImg = $baseInfo->headImg;
  76. $userGuildInfo->imgBorderId = $baseInfo->imgBorderId;
  77. }
  78. }