MemberCardBatch.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\user;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. class MemberCardBatch extends BaseModel
  15. {
  16. use ModelTrait;
  17. /**
  18. * 数据表主键
  19. * @var string
  20. */
  21. protected $pk = 'id';
  22. /**
  23. * 模型名称
  24. * @var string
  25. */
  26. protected $name = 'member_card_batch';
  27. protected $insert = ['add_time'];
  28. protected $hidden = ['update_time'];
  29. protected $updateTime = false;
  30. /**
  31. * 卡批次名称搜索器
  32. * @param Model $query
  33. * @param $value
  34. */
  35. public function searchTitleAttr($query, $value)
  36. {
  37. if ($value !== '') {
  38. $query->where('title', 'like', '%' . $value . '%');
  39. }
  40. }
  41. /**
  42. * 格式化数据
  43. * @param $value
  44. * @return array|mixed
  45. */
  46. public function getQrcodeAttr($value)
  47. {
  48. $value = $value ? json_decode($value, true) : [];
  49. return is_array($value) ? $value : [];
  50. }
  51. }