123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\logic\goods;
-
-
- use app\common\basics\Logic;
- use app\common\model\goods\Goods;
- use app\common\model\goods\GoodsColumn;
-
-
- class ColumnLogic extends Logic
- {
-
-
-
- public static function lists($get)
- {
- $result = GoodsColumn::where(['del' =>0])
- ->order('sort')
- ->paginate([
- 'list_rows'=> $get['limit'],
- 'page'=> $get['page']
- ]);
-
- return ['count' => $result->total(), 'lists' => $result->getCollection()];
- }
-
-
-
-
- public static function add($post)
- {
- return GoodsColumn::create([
- 'name' => $post['name'],
- 'remark' => $post['remark'] ?? '',
- 'status' => isset($post['status']) && $post['status'] == 'on' ? 1 : 0,
- ]);
- }
-
-
-
-
- public static function edit($post)
- {
- return GoodsColumn::update([
- 'name' => $post['name'],
- 'remark' => $post['remark'] ?? '',
- 'status' => isset($post['status']) && $post['status'] == 'on' ? 1 : 0,
- ], ['id' => $post['id']]);
- }
-
-
-
-
- public static function del($id)
- {
-
- GoodsColumn::update(['del' => 1], ['id' => $id]);
- Goods::whereFindInSet('column_ids', $id)->update(['column_ids' => '']);
- return true;
- }
-
-
-
- public static function getList()
- {
- return GoodsColumn::where(['del' => 0])->order('sort', 'desc')->column('id,name');
- }
- }
|