LayoutService.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | RXThinkCMF框架 [ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 南京RXThinkCMF研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.rxthink.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: 牧羊人 <1175401194@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Services;
  12. use App\Models\LayoutModel;
  13. /**
  14. * 布局管理-服务类
  15. * @author 牧羊人
  16. * @since 2020/11/11
  17. * Class LayoutService
  18. * @package App\Services
  19. */
  20. class LayoutService extends BaseService
  21. {
  22. /**
  23. * 构造函数
  24. * @author 牧羊人
  25. * @since 2020/11/11
  26. * LayoutService constructor.
  27. */
  28. public function __construct()
  29. {
  30. $this->model = new LayoutModel();
  31. }
  32. /**
  33. * 添加或编辑
  34. * @return array
  35. * @since 2020/11/11
  36. * @author 牧羊人
  37. */
  38. public function edit()
  39. {
  40. $data = request()->all();
  41. // 图片处理
  42. $image = trim($data['image']);
  43. if (!$data['id'] && !$image) {
  44. return message('请上传布局图片', false);
  45. }
  46. if (strpos($image, "temp")) {
  47. $data['image'] = save_image($image, 'layout');
  48. } else {
  49. $data['image'] = str_replace(IMG_URL, "", $data['image']);
  50. }
  51. return parent::edit($data); // TODO: Change the autogenerated stub
  52. }
  53. }