<?php
// +----------------------------------------------------------------------
// | A3Mall
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: xzncit <158373108@qq.com>
// +----------------------------------------------------------------------

namespace app\adminapi\controller\order;

use app\adminapi\controller\Controller;
use app\adminapi\service\Archives as ArchivesService;
use app\adminapi\service\order\Invoice as InvoiceService;
use think\facade\Request;

/**
 * @package app\adminapi\controller\order
 * @class Invoice
 * @author xzncit 2024-02-27
 */
class Invoice extends Controller {

    /**
     * 列表
     * @return \think\response\Json
     */
    public function index(){
        return returnAjax("msg:ok",1,InvoiceService::getList(Request::param()));
    }

    /**
     * 详情/保存
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function detail(){
        if(Request::isPost()){
            return returnAjax("msg:ok",1,InvoiceService::save(Request::param()));
        }

        return returnAjax("msg:ok",1,InvoiceService::detail(Request::param("id",0,"intval")));
    }

}