Publishack.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /*
  3. * @Descripttion:
  4. * @version: 1.0.0
  5. * @Author: likang
  6. * @Date: 2022-07-09 16:57:43
  7. * @LastEditors: likang
  8. * @LastEditTime: 2022-08-02 19:58:38
  9. */
  10. namespace catchAdmin\api\model;
  11. use catchAdmin\permissions\model\DataRangScopeTrait;
  12. use catcher\base\CatchModel as Model;
  13. use catcher\traits\db\BaseOptionsTrait;
  14. use catcher\traits\db\ScopeTrait;
  15. class PublishAck extends Model
  16. {
  17. use DataRangScopeTrait;
  18. // 表名
  19. public $name = 'publish_ack';
  20. // 数据库字段映射
  21. public $field = array(
  22. 'id',
  23. // 版本
  24. 'PublishVersion',
  25. // 下发的内容
  26. 'PublishContent',
  27. // 创建时间
  28. 'AddTime',
  29. // 1 成功 -1 失败
  30. 'Succ',
  31. // 回复时间
  32. 'AckTime',
  33. // 回复的内容
  34. 'Extra',
  35. //网关Imei号
  36. 'Imei',
  37. );
  38. public function getList()
  39. {
  40. $res = $this->dataRange()
  41. ->catchSearch()
  42. ->order($this->aliasField('id'), 'desc')
  43. ->paginate();
  44. return $res;
  45. }
  46. public function getAddTimeAttr()
  47. {
  48. $addtime = $this->getData('AddTime');
  49. return date('Y-m-d H:i:s', $time = substr($addtime, 0, 10));
  50. }
  51. public function getAckTimeAttr()
  52. {
  53. $addtime = $this->getData('AckTime');
  54. return date('Y-m-d H:i:s', $time = substr($addtime, 0, 10));
  55. }
  56. }