Device.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * Device.php UTF-8
  4. *
  5. *
  6. * @date : 2018/5/31 20:03
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\controller\common;
  13. use huolib\constant\CommonConst;
  14. class Device {
  15. public static function ins() {
  16. return new static();
  17. }
  18. /**
  19. * 判断是否是黑名单列表
  20. *
  21. * @param string $device
  22. *
  23. * @return bool true 为黑名单 false 为不在黑名单中
  24. */
  25. public static function isBlackList($device = '') {
  26. if (empty($device)) {
  27. return false;
  28. }
  29. return false;
  30. }
  31. /**
  32. * 判断在某个时间段内设备是否存在
  33. *
  34. * @param string $device
  35. * @param string $date
  36. *
  37. * @return bool
  38. */
  39. public static function isRepeat($device, $date = '') {
  40. if (empty($device)) {
  41. return false;
  42. }
  43. $_date = $date;
  44. if (empty($date)) {
  45. $_map['create_time'] = ['gt', 0];
  46. } else {
  47. $_start_time = strtotime($_date);
  48. if (empty($_start_time)) {
  49. return false;
  50. }
  51. $_end_time = $_start_time + CommonConst::CONST_DAY_SECONDS;
  52. $_map['create_time'] = ['between', $_start_time, $_end_time];
  53. }
  54. // $_map['device'] = $device;
  55. // // TODO: wuyonghong 2018/5/31 添加设备每日 与设备总表
  56. // $_model = new CommonModel();
  57. // $_cnt = $_model->where($_map)->count();
  58. // if (empty($_cnt)) {
  59. // return false;
  60. // }
  61. return true;
  62. }
  63. }