Manage.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Push\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. //{source_id} > 0 ? ("{name}" ? "{name}" : Dever::load("sad/supply-one#name", {source_id})) : "{name}"
  7. public function name($id)
  8. {
  9. $info = Dever::db('push/data')->one($id);
  10. if ($info['name']) {
  11. return $info['name'];
  12. }
  13. if ($info['type'] < 10) {
  14. $table = Dever::config('base')->type_table[$info['type']];
  15. $audit = array
  16. (
  17. //'audit' => 2,
  18. //'status' => 2,
  19. 'state' => 1,
  20. );
  21. if ($info['type'] == 1) {
  22. $audit['id'] = $info['article_id'];
  23. $data = Dever::db($table)->one($audit);
  24. } elseif ($info['type'] == 2) {
  25. $audit['id'] = $info['vod_id'];
  26. $data = Dever::db($table)->one($audit);
  27. } elseif ($info['type'] == 3) {
  28. $audit['id'] = $info['live_id'];
  29. $data = Dever::db($table)->one($audit);
  30. } elseif ($info['type'] == 4) {
  31. $audit['id'] = $info['journal_id'];
  32. $data = Dever::db($table)->one($audit);
  33. } elseif ($info['type'] == 6) {
  34. $audit['id'] = $info['feature_id'];
  35. $data = Dever::db($table)->one($audit);
  36. } elseif ($info['type'] == 7) {
  37. $data = Dever::db($table)->one(array('state' => 1, 'id' => $info['applet_id']));
  38. }
  39. if (isset($data) && $data && isset($data['name'])) {
  40. return $data['name'];
  41. }
  42. }
  43. return $info['name'];
  44. }
  45. }