发票管理apiadmin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

56 lines
2.1 KiB

<?php
namespace app\controller\admin;
use app\model\InvoiceHead;
use think\Response;
use app\model\InvoiceIssuance as InvoiceIssuanceModel;
class InvoiceIssuance extends Base
{
/**
* 获取微信用户列表
* @return Response
* @throws \think\db\exception\DbException
*/
public function index(): Response
{
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
$start = $this->request->get('page', 1);
$InvoiceIssuanceModel = new InvoiceIssuanceModel();
$InvoiceHead = new InvoiceHead();
$field = 'id,project_id,merge,pucode_id,expire_time,mobile,email,create_time,status,amount,invoice_head_id,cancel_time,issuance_time';
$listObj = $InvoiceIssuanceModel->order('create_time', 'DESC')
->field($field)
->paginate(['page' => $start, 'list_rows' => $limit])->each(function ($item, $key) use ($InvoiceHead) {
$item->project_itle = InvoiceIssuanceModel::$projectArr[$item->project_id] ?? '';
$item->status = InvoiceIssuanceModel::$statusArr[$item->status] ?? '';
$item->merge = $item->merge ? '合并' : '不合并';
$item->expire_time = $item->expire_time ? date("Y-m") : '';
$item->cancel_time = $item->cancel_time ? date("Y-m-d H:i:s") : '';
$item->issuance_time = $item->issuance_time ? date("Y-m-d H:i:s") : '';
$InvoiceHeadRes = $InvoiceHead->where('id', $item->invoice_head_id)->find();
$item->head_type = '';
$item->head_title = '';
if ($InvoiceHeadRes) {
$item->head_type = InvoiceHead::$typeArr[$InvoiceHeadRes['type']];
$item->head_title = $InvoiceHeadRes['title'];
}
unset($item->invoice_head_id,$item->project_id);
})->toArray();
$listInfo = $listObj['data'];
return $this->buildSuccess([
'list' => $listInfo,
'count' => $listObj['total']
]);
}
}