Setinfo.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. *------Create thems Model------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2017-06-21 16:01:32------
  7. */
  8. namespace App\Commons\Model;
  9. use \System\Model;
  10. class Setinfo extends Model
  11. {
  12. public $timestamps = false;
  13. protected $table = 'setinfo';
  14. /**
  15. * 得到网站信息
  16. */
  17. public function getSites()
  18. {
  19. $res = $this->where('infotype', 24)->get();
  20. if(!$res){
  21. return;
  22. }
  23. $res = arrayToOptions($res->toArray(), 'remarks', 'infocontent');
  24. return array('site_name'=>$res['netname'],'site_keywords'=>$res['netkeywords'],'site_desc'=>$res['netdesc']);
  25. }
  26. public function setKey()
  27. {
  28. if(defined('REMOTE_KEY')){
  29. return;
  30. }
  31. $res = $this->where('infotype', 1000)->first();
  32. if(!$res){
  33. return;
  34. }
  35. define('REMOTE_KEY',trim($res->infocontent));
  36. return trim($res->infocontent);
  37. }
  38. public function getType($type)
  39. {
  40. $res = $this->where('infotype', $type)->first();
  41. if (!$res) {
  42. return;
  43. }
  44. return trim($res->infocontent);
  45. }
  46. public function getinfo($type){
  47. $res = $this->where('infotype', $type)->get();
  48. return count($res)>0? $res->toarray():[];
  49. }
  50. public function getWhiteList()
  51. {
  52. return self::where('infotype', '2002')->first();
  53. }
  54. public function getSensitive()
  55. {
  56. return self::where('infotype','2003')->first();
  57. }
  58. }