2 changed files with 57 additions and 0 deletions
@ -0,0 +1,56 @@ |
|||
<?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'] |
|||
]); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue