multi-store/app/store/controller/finance/FinancialTransfersController.php

75 lines
2.5 KiB
PHP

<?php
namespace app\store\controller\finance;
use app\admin\lists\financial_transfers\FinancialTransfersLists;
use app\admin\logic\financial_transfers\FinancialTransfersLogic;
use app\admin\validate\financial_transfers\FinancialTransfersValidate;
use app\common\controller\Definitions;
use app\store\controller\BaseAdminController;
use hg\apidoc\annotation as ApiDoc;
#[ApiDoc\title('提现列表')]
class FinancialTransfersController extends BaseAdminController
{
// public $notNeedLogin = ['confirmation', 'app_update', 'test'];
#[
ApiDoc\Title('财务流水'),
ApiDoc\url('/store/finance/financialTransfers/lists'),
ApiDoc\Method('GET'),
ApiDoc\NotHeaders(),
ApiDoc\Author('中国队长'),
ApiDoc\Query(name: 'status', type: 'int', require: true, desc: '状态1'),
ApiDoc\Query(name: 'store_id', type: 'int', require: true, desc: '店员id'),
ApiDoc\Header(ref: [Definitions::class, "token"]),
ApiDoc\Query(ref: [Definitions::class, "page"]),
ApiDoc\ResponseSuccess("data", type: "array"),
]
public function lists()
{
return $this->dataLists(new FinancialTransfersLists());
}
#[
ApiDoc\Title('店铺确认'),
ApiDoc\url('/store/finance/financialTransfers/confirmation'),
ApiDoc\Method('POST'),
ApiDoc\NotHeaders(),
ApiDoc\Author('中国队长'),
ApiDoc\Query(name: 'status', type: 'int', require: true, desc: '状态1确认 0不确认'),
ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '数据id'),
ApiDoc\Query(name: 'mark', type: 'string', require: false, desc: '原因/备注'),
ApiDoc\Header(ref: [Definitions::class, "token"]),
ApiDoc\Query(ref: [Definitions::class, "page"]),
ApiDoc\ResponseSuccess("data", type: "array"),
]
public function confirmation()
{
$params = (new FinancialTransfersValidate())->post()->goCheck('confirm');
$staff_id = $this->request->adminInfo['admin_id']??5;
$data = [
'store_staff_id' => $staff_id,
'mark' => $params['mark']??'',
];
$status = -2;
if ($params['status']) {
$status = 2;
$data['confirmation_time'] = time();
}
$data['status'] = $status;
$result = FinancialTransfersLogic::storeConfirmation($data,$params['id']);
if (true === $result) {
return $this->success('操作成功' );
}
return $this->fail(FinancialTransfersLogic::getError());
}
}