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('操作成功'); + } + }