123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\logic\goods;
-
-
- use app\common\basics\Logic;
- use app\common\model\goods\GoodsBrand;
-
-
-
- class BrandLogic extends Logic
- {
-
-
-
- public static function lists($get)
- {
- $where[] = ['del', '=', 0];
- if(isset($get['name']) && $get['name']) {
- $where[] = ['name','like','%'.$get['name'].'%'];
- }
-
- $lists = GoodsBrand::where($where)
- ->order('sort')
- ->paginate([
- 'list_rows'=> $get['limit'],
- 'page'=> $get['page'],
- ]);
- return ['count' => $lists->total(), 'lists' => $lists->getCollection()];
- }
-
-
-
-
- public static function add($post)
- {
- return GoodsBrand::create([
- 'name' => $post['name'],
- 'initial' => $post['initial'],
- 'image' => $post['image'] ?? '',
- 'sort' => $post['sort'] ?? 100,
- 'is_show' => $post['is_show'],
- 'remark' => $post['remark'] ?? '',
- ]);
- }
-
-
-
-
- public static function edit($post)
- {
- return GoodsBrand::update([
- 'name' => $post['name'],
- 'initial' => $post['initial'],
- 'image' => $post['image'] ?? '',
- 'sort' => $post['sort'] ?? 100,
- 'is_show' => $post['is_show'],
- 'remark' => $post['remark'] ?? '',
- ], ['id' => $post['id']]);
- }
-
-
-
-
- public static function del($id)
- {
- return GoodsBrand::update(['del' => 1], ['id' => $id]);
- }
-
- }
|