CustomQrcode.php 800 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class CustomQrcode extends Model
  5. {
  6. // 表名
  7. protected $table = 'custom_qrcode';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'int';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. // 追加属性
  14. protected $append = [
  15. 'type_text'
  16. ];
  17. public function getTypeList()
  18. {
  19. return ['0' => __('Type0'),'1' => __('Type1'),'2' => __('Type2'),'3'=>'推广链接'];
  20. }
  21. public function getTypeTextAttr($value, $data)
  22. {
  23. $value = $value ? $value : $data['type'];
  24. $list = $this->getTypeList();
  25. return isset($list[$value]) ? $list[$value] : '';
  26. }
  27. }