| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\GoodsCategoryModel;
- use App\Models\GoodsModel;
- use App\Services\BaseService;
- /**
- * 承兑商管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
- class GoodsCategoryService extends BaseService
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- */
- public function __construct()
- {
- $this->model = new GoodsCategoryModel();
- }
- /**
- * 获取列表
- * @param $params 参数
- * @param int $pageSize 分页大小:默认 15
- * @return array
- */
- public function getDataList($params, $pageSize = 10, $field = [])
- {
- $where = ['a.mark' => 1];
- $query = $this->model
- ->from('goods_category as a')
- ->where($where)
- ->select($field ? $field : ['a.*']);
- if (isset($params['status']) && $params['status'] != '') {
- $query->where('a.status',$params['status']);
- }
- if (isset($params['is_recommend']) && $params['is_recommend'] != '') {
- $query->where('a.is_recommend',$params['is_recommend']);
- }
- if (isset($params['name']) && $params['name'] != '') {
- $query->where('a.name','like',"%{$params['name']}%");
- }
- $list = $query->paginate($pageSize > 0 ? $pageSize : 9999999);
- $list = $list ? $list->toArray() : [];
- if ($list) {
- // foreach($list['data'] as &$item){
- //// $item['create_time_text'] = $item['create_time']? datetime($item['create_time']):'';
- // }
- }
- return [
- 'pageSize' => $pageSize,
- 'total' => isset($list['total']) ? $list['total'] : 0,
- 'list' => isset($list['data']) ? $list['data'] : [],
- ];
- }
- /**
- * 添加会编辑会员
- * @return array
- * @since 2020/11/11
- * @author laravel开发员
- */
- public function edit()
- {
- // 请求参数
- $data = request()->all();
- return parent::edit($data); // TODO: Change the autogenerated stub
- }
- }
|