| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- // +----------------------------------------------------------------------
- // | Laravel框架 [ Laravel ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 Laravel研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: wesmiler <12345678@qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services;
- use App\Models\OfferingsModel;
- /**
- * 物品管理-服务类
- * @author wesmiler
- * @since 2020/11/11
- * Class OfferingsService
- * @package App\Services
- */
- class OfferingsService extends BaseService
- {
- /**
- * 构造函数
- * @author wesmiler
- * @since 2020/11/11
- * OfferingsService constructor.
- */
- public function __construct()
- {
- $this->model = new OfferingsModel();
- }
- /**
- * 获取友链列表
- * @return array
- * @since 2020/11/11
- * @author wesmiler
- */
- public function getList()
- {
- $params = request()->all();
- return parent::getList();
- }
- /**
- * 添加或编辑
- * @return array
- * @since 2020/11/11
- * @author wesmiler
- */
- public function edit()
- {
- $data = request()->all();
- // 图片处理
- $image = trim($data['icon']);
- $id = isset($data['id']) ? $data['id'] : 0;
- if (!$id && !$image) {
- return message('请上传商品图片', false);
- }
- if (strpos($image, "temp")) {
- $data['icon'] = save_image($image, 'item');
- } else {
- $data['icon'] = str_replace(IMG_URL, "", $data['icon']);
- }
- // 图标
- if(isset($data['icon_real'])){
- $data['icon_real'] = str_replace(IMG_URL, "", $data['icon_real']);
- }
- $data['update_time'] = time();
- return parent::edit($data); // TODO: Change the autogenerated stub
- }
- }
|