ToolSettings.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class ToolSettings extends Model
  5. {
  6. /**
  7. * 获取值
  8. */
  9. public function getValueAttr($value, $data)
  10. {
  11. $bindurl = config('app.ali_oss_bindurl');
  12. switch ($data['tool_type']) {
  13. case 'styleTest':
  14. $value = json_decode($value, true);
  15. if (is_array($value)) {
  16. foreach ($value as &$v) {
  17. $v['img'] = 'https://' . $bindurl . '/' . $v['img'];
  18. }
  19. } else {
  20. $value = '';
  21. }
  22. break;
  23. default:
  24. break;
  25. }
  26. return $value;
  27. }
  28. public function getStyleTypeAttr($key = '')
  29. {
  30. $type = [1 => '现代简约', 2 => '新中式', 3 => '北欧', 4 => '简欧', 5 => '地中海', 6 => '美式', 7 => '轻奢', 8 => '田园'];
  31. if ($key) {
  32. return $type[$key];
  33. } else {
  34. return $type;
  35. }
  36. }
  37. }