GongdengFoxiangService.php 1.6 KB

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