WechatCard.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\wechat;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * 关键词model
  16. * Class WechatKey
  17. * @package app\model\wechat
  18. */
  19. class WechatCard extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 数据表主键
  24. * @var string
  25. */
  26. protected $pk = 'id';
  27. /**
  28. * 模型名称
  29. * @var string
  30. */
  31. protected $name = 'wechat_card';
  32. /**
  33. * 特别信息修改器
  34. * @param $value
  35. * @return false|string
  36. */
  37. protected function setEspecialAttr($value)
  38. {
  39. if ($value) {
  40. return is_array($value) ? json_encode($value) : $value;
  41. }
  42. return '';
  43. }
  44. /**
  45. * 特别信息获取器
  46. * @param $value
  47. * @param $data
  48. * @return mixed
  49. */
  50. protected function getEspecialAttr($value)
  51. {
  52. return $value ? json_decode($value, true) : [];
  53. }
  54. }