Manuscript.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. namespace app\admin\model\cms\author;
  3. use think\Model;
  4. class Manuscript extends Model
  5. {
  6. // 表名
  7. protected $name = 'cms_author_manuscript';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'integer';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. protected $deleteTime = false;
  14. // 追加属性
  15. protected $append = [
  16. 'is_copyright_text',
  17. 'is_funding_text',
  18. 'is_interest_text',
  19. 'statement_type_text',
  20. 'status_text'
  21. ];
  22. public function getIsCopyrightList()
  23. {
  24. return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
  25. }
  26. public function getIsFundingList()
  27. {
  28. return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
  29. }
  30. public function getIsInterestList()
  31. {
  32. return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
  33. }
  34. public function getStatementTypeList()
  35. {
  36. return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
  37. }
  38. public function getStatusList()
  39. {
  40. return ['100' => __('Status 100')];
  41. }
  42. public function getIsCopyrightTextAttr($value, $data)
  43. {
  44. $value = $value ? $value : (isset($data['is_copyright']) ? $data['is_copyright'] : '');
  45. $list = $this->getIsCopyrightList();
  46. return isset($list[$value]) ? $list[$value] : '';
  47. }
  48. public function getIsFundingTextAttr($value, $data)
  49. {
  50. $value = $value ? $value : (isset($data['is_funding']) ? $data['is_funding'] : '');
  51. $list = $this->getIsFundingList();
  52. return isset($list[$value]) ? $list[$value] : '';
  53. }
  54. public function getIsInterestTextAttr($value, $data)
  55. {
  56. $value = $value ? $value : (isset($data['is_interest']) ? $data['is_interest'] : '');
  57. $list = $this->getIsInterestList();
  58. return isset($list[$value]) ? $list[$value] : '';
  59. }
  60. public function getStatementTypeTextAttr($value, $data)
  61. {
  62. $value = $value ? $value : (isset($data['statement_type']) ? $data['statement_type'] : '');
  63. $list = $this->getStatementTypeList();
  64. return isset($list[$value]) ? $list[$value] : '';
  65. }
  66. public function getStatusTextAttr($value, $data)
  67. {
  68. $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
  69. $list = $this->getStatusList();
  70. return isset($list[$value]) ? $list[$value] : '';
  71. }
  72. }