Rewardurl.php 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class Rewardurl extends Model
  5. {
  6. // 表名
  7. protected $table = 'rewardurl';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'int';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. // 追加属性
  14. protected $append = [
  15. 'contact_type_text'
  16. ];
  17. public $contacttypearr = [
  18. '1' => "微信",
  19. '2' => "QQ"
  20. ];
  21. public function getContactTypeList()
  22. {
  23. return ['1' => __('Contact_type 1'),'2' => __('Contact_type 2')];
  24. }
  25. public function getContactTypeTextAttr($value, $data)
  26. {
  27. $value = $value ? $value : $data['contact_type'];
  28. $list = $this->getContactTypeList();
  29. return isset($list[$value]) ? $list[$value] : '';
  30. }
  31. }