diff --git a/app/admin/controller/system_store_storage/SystemStoreStorageController.php b/app/admin/controller/system_store_storage/SystemStoreStorageController.php new file mode 100644 index 000000000..146f97de0 --- /dev/null +++ b/app/admin/controller/system_store_storage/SystemStoreStorageController.php @@ -0,0 +1,95 @@ +dataLists(new SystemStoreStorageLists()); + } + + + /** + * @notes 添加门店入库记录 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 17:06 + */ + public function add() + { + $params = (new SystemStoreStorageValidate())->post()->goCheck('add'); + $result = SystemStoreStorageLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(SystemStoreStorageLogic::getError()); + } + + + /** + * @notes 编辑门店入库记录 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 17:06 + */ + public function edit() + { + $params = (new SystemStoreStorageValidate())->post()->goCheck('edit'); + $result = SystemStoreStorageLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(SystemStoreStorageLogic::getError()); + } + + + /** + * @notes 删除门店入库记录 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 17:06 + */ + public function delete() + { + $params = (new SystemStoreStorageValidate())->post()->goCheck('delete'); + SystemStoreStorageLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取门店入库记录详情 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 17:06 + */ + public function detail() + { + $params = (new SystemStoreStorageValidate())->goCheck('detail'); + $result = SystemStoreStorageLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/admin/lists/store_order/StoreRefundOrderLists.php b/app/admin/lists/store_order/StoreRefundOrderLists.php index 3516ce817..efa8f82d9 100644 --- a/app/admin/lists/store_order/StoreRefundOrderLists.php +++ b/app/admin/lists/store_order/StoreRefundOrderLists.php @@ -37,7 +37,7 @@ class StoreRefundOrderLists extends BaseAdminDataLists implements ListsSearchInt */ public function lists(): array { - $this->searchWhere['refund_status'] = ['>', 0]; + $this->searchWhere[] = ['refund_status','>', 0]; return StoreOrder::with(['user', 'staff', 'product' => function ($query) { $query->field(['id', 'oid', 'product_id', 'cart_info']); }]) diff --git a/app/admin/lists/system_store_storage/SystemStoreStorageLists.php b/app/admin/lists/system_store_storage/SystemStoreStorageLists.php new file mode 100644 index 000000000..c3a0f24ac --- /dev/null +++ b/app/admin/lists/system_store_storage/SystemStoreStorageLists.php @@ -0,0 +1,65 @@ + ['store_id', 'admin_id', 'operating_id', 'status'], + ]; + } + + + /** + * @notes 获取门店入库记录列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2024/06/06 17:06 + */ + public function lists(): array + { + return SystemStoreStorage::where($this->searchWhere) + ->field(['id', 'store_id', 'admin_id', 'operating_id', 'product_id', 'nums', 'status']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取门店入库记录数量 + * @return int + * @author admin + * @date 2024/06/06 17:06 + */ + public function count(): int + { + return SystemStoreStorage::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/admin/logic/system_store_storage/SystemStoreStorageLogic.php b/app/admin/logic/system_store_storage/SystemStoreStorageLogic.php new file mode 100644 index 000000000..db821548c --- /dev/null +++ b/app/admin/logic/system_store_storage/SystemStoreStorageLogic.php @@ -0,0 +1,104 @@ + $params['store_id'], + 'admin_id' => $params['admin_id'], + 'operating_id' => $params['operating_id'], + 'product_id' => $params['product_id'], + 'nums' => $params['nums'], + 'status' => $params['status'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑门店入库记录 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/06 17:06 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + SystemStoreStorage::where('id', $params['id'])->update([ + 'store_id' => $params['store_id'], + 'admin_id' => $params['admin_id'], + 'operating_id' => $params['operating_id'], + 'product_id' => $params['product_id'], + 'nums' => $params['nums'], + 'status' => $params['status'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除门店入库记录 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/06 17:06 + */ + public static function delete(array $params): bool + { + return SystemStoreStorage::destroy($params['id']); + } + + + /** + * @notes 获取门店入库记录详情 + * @param $params + * @return array + * @author admin + * @date 2024/06/06 17:06 + */ + public static function detail($params): array + { + return SystemStoreStorage::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/admin/validate/system_store_storage/SystemStoreStorageValidate.php b/app/admin/validate/system_store_storage/SystemStoreStorageValidate.php new file mode 100644 index 000000000..b7959cfae --- /dev/null +++ b/app/admin/validate/system_store_storage/SystemStoreStorageValidate.php @@ -0,0 +1,82 @@ + 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return SystemStoreStorageValidate + * @author admin + * @date 2024/06/06 17:06 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return SystemStoreStorageValidate + * @author admin + * @date 2024/06/06 17:06 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return SystemStoreStorageValidate + * @author admin + * @date 2024/06/06 17:06 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return SystemStoreStorageValidate + * @author admin + * @date 2024/06/06 17:06 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file