ExploreSet.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\common\model\store;
  13. use app\common\library\helper;
  14. use app\common\model\BaseModel;
  15. use think\facade\Log;
  16. /**
  17. * 系统设置模型
  18. * Class Setting
  19. * @package app\common\model
  20. */
  21. class ExploreSet extends BaseModel
  22. {
  23. // 定义表名
  24. protected $name = 'explore_experience';
  25. /**
  26. * 获取器: 转义数组格式
  27. * @param $value
  28. * @return mixed
  29. */
  30. public function getContentsAttr($value, $data)
  31. {
  32. if ($data['contents']) {
  33. return htmlspecialchars_decode($data['contents']);
  34. }
  35. return '';
  36. }
  37. /**
  38. * 修改器: 转义成json格式
  39. * @param $value
  40. * @return string
  41. */
  42. public function setContentsAttr($value, $data)
  43. {
  44. if ($data['contents']) {
  45. return $data['contents'] ?? '';
  46. }
  47. return '';
  48. }
  49. public static function getItem($type){
  50. return self::where('types',$type)->find();
  51. }
  52. public static function detail($type){
  53. return self::where('types',$type)->find();
  54. }
  55. }