Role.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php namespace Place_benefit\Manage\Lib;
  2. use Dever;
  3. class Role
  4. {
  5. # 获取升级奖励信息
  6. public function getUpgrade($id)
  7. {
  8. $info = Dever::db('role_upgrade', 'place_benefit')->select(['level_id' => $id]);
  9. if (!$info) {
  10. return '无';
  11. }
  12. $body = '';
  13. foreach ($info as $v) {
  14. $type_name = Dever::db('role_upgrade', 'place_benefit')->value('type', $v['type']);
  15. $type_info = Dever::load('item', 'place_benefit')->getTypeData($v['type'], $v['type_id']);
  16. $body .= '<tr>';
  17. $body .= '<td>'.$type_name.'</td>';
  18. $body .= '<td>'.$type_info['name'].'</td>';
  19. $body .= '</tr>';
  20. }
  21. return '<table border="1" cellspacing="0" cellpadding="8" style="border-collapse: collapse; text-align: left;">
  22. <thead style="background-color: #f2f2f2;">
  23. <tr>
  24. <th>类型</th>
  25. <th>权益</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. '.$body.'
  30. </tbody>
  31. </table>
  32. ';
  33. }
  34. public function getPeriod($id)
  35. {
  36. $info = Dever::db('role_period', 'place_benefit')->select(['level_id' => $id]);
  37. if (!$info) {
  38. return '无';
  39. }
  40. $body = '';
  41. foreach ($info as $v) {
  42. $type_name = Dever::db('role_period', 'place_benefit')->value('type', $v['type']);
  43. $type_info = Dever::load('item', 'place_benefit')->getTypeData($v['type'], $v['type_id']);
  44. $body .= '<tr>';
  45. $body .= '<td>'.$type_name.'</td>';
  46. $body .= '<td>'.$type_info['name'].'</td>';
  47. $body .= '<td>'.$v['num'].'</td>';
  48. $body .= '<td>'.$v['day'].'</td>';
  49. $body .= '<td>'.$v['max'].'</td>';
  50. $body .= '</tr>';
  51. }
  52. return '<table border="1" cellspacing="0" cellpadding="8" style="border-collapse: collapse; text-align: left;">
  53. <thead style="background-color: #f2f2f2;">
  54. <tr>
  55. <th>类型</th>
  56. <th>权益</th>
  57. <th>数量</th>
  58. <th>天数</th>
  59. <th>上限</th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. '.$body.'
  64. </tbody>
  65. </table>
  66. ';
  67. }
  68. }