1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\logic\goods;
-
-
- use app\common\basics\Logic;
- use app\common\model\goods\GoodsUnit;
-
-
- class UnitLogic extends Logic
- {
-
-
-
- public static function lists($get)
- {
- $result = GoodsUnit::where(['del' =>0])
- ->order('sort')
- ->paginate([
- 'list_rows'=> $get['limit'],
- 'page'=> $get['page']
- ]);
-
- return ['count' => $result->total(), 'lists' => $result->getCollection()];
- }
-
-
-
-
- public static function addUnit($post)
- {
- return GoodsUnit::create([
- 'name' => $post['name'],
- 'sort' => $post['sort'] ?? 100,
- ]);
- }
-
-
-
-
- public static function editUnit($post)
- {
- return GoodsUnit::update([
- 'name' => $post['name'],
- 'sort' => $post['sort'] ?? 100
- ], ['id' => $post['id']]);
- }
-
-
-
-
- public static function del($id)
- {
- return GoodsUnit::update(['del' => 1], ['id' => $id]);
- }
-
- }
|