From 4ef8bf0097bf7571883de1048086dfa1816620bb Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 6 Jun 2024 09:44:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=A2=E5=8A=A1=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/StoreFinanceFlowLogic.php | 19 +++++++++++++++++ .../controller/finance/FinanceController.php | 21 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php index 7a4c6c607..c1489abb8 100644 --- a/app/common/logic/StoreFinanceFlowLogic.php +++ b/app/common/logic/StoreFinanceFlowLogic.php @@ -88,4 +88,23 @@ class StoreFinanceFlowLogic extends BaseLogic ->find(); } + /** + * 备注 + * @param $id + * @param $remark + * @return void + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function remark($id, $remark) + { + $model = StoreFinanceFlow::where('id', $id)->where('store_id', request()->adminInfo['store_id'])->find(); + if (empty($model)) { + throw new \Exception('记录不存在'); + } + $model->remark = $remark; + $model->save(); + } + } diff --git a/app/store/controller/finance/FinanceController.php b/app/store/controller/finance/FinanceController.php index 3363e460b..acfe87359 100644 --- a/app/store/controller/finance/FinanceController.php +++ b/app/store/controller/finance/FinanceController.php @@ -4,6 +4,7 @@ namespace app\store\controller\finance; use app\admin\lists\store_finance_flow\StoreFinanceFlowLists; use app\common\controller\Definitions; +use app\common\logic\StoreFinanceFlowLogic; use app\store\controller\BaseAdminController; use hg\apidoc\annotation as ApiDoc; @@ -34,6 +35,7 @@ class FinanceController extends BaseAdminController ['name' => 'store_name', 'desc' => '店铺名称', 'type' => 'string'], ['name' => 'pay_type_name', 'desc' => '支付方式', 'type' => 'string'], ['name' => 'financial_type_name', 'desc' => '流水类型', 'type' => 'string'], + ['name' => 'remark', 'desc' => '备注', 'type' => 'string'], ]), ] public function lists() @@ -41,4 +43,23 @@ class FinanceController extends BaseAdminController return $this->dataLists(new StoreFinanceFlowLists()); } + #[ + ApiDoc\Title('备注'), + ApiDoc\url('/store/finance/finance/remark'), + ApiDoc\Method('POST'), + ApiDoc\NotHeaders(), + ApiDoc\Author('中国队长'), + ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + ApiDoc\Param(name: 'remark', type: 'string', require: true, desc: '备注'), + ApiDoc\Header(ref: [Definitions::class, "token"]), + ApiDoc\ResponseSuccess("data", type: "array"), + ] + public function remark(StoreFinanceFlowLogic $logic) + { + $id = $this->request->post('id'); + $remark = $this->request->post('remark'); + $logic->remark($id, $remark); + return $this->success('操作成功'); + } + }