添加财务流水备注

This commit is contained in:
luofei 2024-06-06 09:44:53 +08:00
parent 748d9ea085
commit 4ef8bf0097
2 changed files with 40 additions and 0 deletions

View File

@ -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();
}
}

View File

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