12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- * @Name
- * @Description
- * @Author 刘学玺
- * @Date 2023/11/23 20:57
- */
- namespace App\Http\Services\Admin\Channel;
- use App\Http\Services\BaseService;
- use App\Models\Distributor;
- use App\Models\Menu;
- class DistributorService extends BaseService
- {
- public function index($data)
- {
- $model = $this->queryCondition(Distributor::query(), $data);
- $list = $model->latest('id')
- ->paginate($data['pageSize'])
- ->toArray();
- return $this->apiSuccess('', [
- 'list' => $list['data'],
- 'total' => $list['total']
- ]);
- }
- public function all()
- {
- $model = $this->queryCondition(Distributor::query(), []);
- $list = $model->latest('id')->select('id', 'name')->get()
- ->toArray();
- return $this->apiSuccess('', [
- 'list' => $list,
- ]);
- }
- public function store(array $data)
- {
- return $this->commonCreate(Menu::query(), $data);
- }
- public function detail($id)
- {
- $data = Menu::query()->find($id)->toArray();
- return $this->apiSuccess('', $data);
- }
- public function update(array $data)
- {
- return $this->commonUpdate(Menu::query(), $data['id'], $data);
- }
- }
|