Subscribelog.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\common\model;
  3. use think\Db;
  4. use think\Config;
  5. /**
  6. * 前台用户玩家子账号表
  7. *
  8. */
  9. class Subscribelog extends \think\Model
  10. {
  11. protected $pk = 'id';
  12. protected $table= 'cy_subscribelog';
  13. protected $dateFormat = false; //时间戳格式不自动转换
  14. /**
  15. * 获取通知模板
  16. * @param $type
  17. * @param $id 开服开测、活动的id
  18. * @return string
  19. */
  20. public function getContent($type, $id) {
  21. $content = '';
  22. if(0 == $type) { //活动通知内容
  23. $info = Db::table('cy_activities')->where('id',$id)->find();
  24. $content = '【遨游网】 您关注的'. $info['title'] . '活动即将开始,详情登录遨游官网进行查看!官网地址:'.$info['url'];
  25. } elseif(1 == $type) { //开服通知内容
  26. $info = Db::table('cy_serverinfo')->alias('a')
  27. ->join('cy_game b','b.id = a.gameid')
  28. ->field('a.sertime,a.sername,b.pinyin,b.nickname,a.gameid')
  29. ->where([
  30. 'a.id'=>$id,
  31. ]
  32. )->find();
  33. $url = Config::get('WEILONG_WEBSITE.HOME').'/game'.$info['gameid'].'.html';
  34. $content = '【遨游网】 您关注的《'. $info['nickname'] . '》手游===%TIME%===开启新服“===%SERVERNAME%===”,立即下载:'.$url;
  35. } elseif (2 == $type) { //开测通知内容
  36. $info = Db::table('cy_serverinfo')->alias('a')
  37. ->join('cy_game b','b.id = a.gameid')
  38. ->field('a.sertime,a.sername,a.serstatus,b.pinyin,b.nickname,a.gameid')
  39. ->where([
  40. 'a.id'=>$id,
  41. ]
  42. )->find();
  43. $url = Config::get('WEILONG_WEBSITE.HOME').'/game'.$info['gameid'].'.html';
  44. if($info['serstatus']==1){
  45. $serStatus = '预告';
  46. }
  47. else if($info['serstatus']==2){
  48. $serStatus = '开服';
  49. }
  50. else if($info['serstatus']==3){
  51. $serStatus = '删档内测';
  52. }
  53. else if($info['serstatus']==4){
  54. $serStatus = '不删档内测';
  55. }
  56. else{
  57. $serStatus = '公测';
  58. }
  59. $content = '【遨游网】 您关注的《'.$info['nickname'].'》手游===%TIME%===开启===%SERVERSTATUS%===,立即下载:'.$url;
  60. }
  61. return $content;
  62. }
  63. }