MemberCardBatch.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 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\member;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * Class MemberCardBatch
  16. * @package app\model\user\member
  17. */
  18. class MemberCardBatch extends BaseModel
  19. {
  20. use ModelTrait;
  21. /**
  22. * 数据表主键
  23. * @var string
  24. */
  25. protected $pk = 'id';
  26. /**
  27. * 模型名称
  28. * @var string
  29. */
  30. protected $name = 'member_card_batch';
  31. protected $insert = ['add_time'];
  32. protected $hidden = ['update_time'];
  33. protected $updateTime = false;
  34. /**
  35. * 卡批次名称搜索器
  36. * @param Model $query
  37. * @param $value
  38. */
  39. public function searchTitleAttr($query, $value)
  40. {
  41. if ($value !== '') {
  42. $query->where('title', $value);
  43. }
  44. }
  45. /**
  46. * 格式化数据
  47. * @param $value
  48. * @return array|mixed
  49. */
  50. public function getQrcodeAttr($value)
  51. {
  52. $value = $value ? json_decode($value, true) : [];
  53. return is_array($value) ? $value : [];
  54. }
  55. }