Browse Source

新增用户查询,新增发票列表查询及查询数据,

master
wanghongjun 2 years ago
parent
commit
5045a91c4d
  1. 43
      app/controller/admin/InvoiceIssuance.php
  2. 20
      app/controller/admin/WechatUser.php

43
app/controller/admin/InvoiceIssuance.php

@ -17,15 +17,36 @@ class InvoiceIssuance extends Base
public function index(): Response public function index(): Response
{ {
$param = $this->request->get();
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT')); $limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
$start = $this->request->get('page', 1); $start = $this->request->get('page', 1);
$where = [];
if (isset($param['pucode']) && !empty($param['pucode'])) {
$where[] = ['pucode', '=', $param['pucode']];
}
if (isset($param['project_id']) && !empty($param['project_id'])) {
$where[] = ['project_id', '=', $param['project_id']];
}
if (isset($param['mobile']) && !empty($param['mobile'])) {
$where[] = ['mobile', '=', $param['mobile']];
}
if (isset($param['merge']) && !empty($param['merge'])) {
$where[] = ['merge', '=', $param['merge']];
}
$InvoiceIssuanceModel = new InvoiceIssuanceModel(); $InvoiceIssuanceModel = new InvoiceIssuanceModel();
$InvoiceHead = new InvoiceHead(); $InvoiceHead = new InvoiceHead();
$field = 'id,project_id,merge,pucode,expire_time,mobile,email,create_time,status,amount,invoice_head_id,cancel_time,issuance_time'; $field = 'id,project_id,merge,pucode,expire_time,mobile,email,create_time,status,amount,invoice_head_id,cancel_time,issuance_time';
$listObj = $InvoiceIssuanceModel->order('create_time', 'DESC') $listObj = $InvoiceIssuanceModel->where($where)
->order('create_time', 'DESC')
->field($field) ->field($field)
->paginate(['page' => $start, 'list_rows' => $limit])->each(function ($item, $key) use ($InvoiceHead) { ->paginate(['page' => $start, 'list_rows' => $limit])->each(function ($item, $key) use ($InvoiceHead) {
@ -53,4 +74,24 @@ class InvoiceIssuance extends Base
]); ]);
} }
/**
* 获取发票项目选项
* @return Response
*/
public function getIndexData(): Response
{
$projectArr = InvoiceIssuanceModel::$projectArr;
unset($projectArr[0]);
$keyArr = [];
foreach ($projectArr as $key => $value) {
$keyArr[] = [
'value' => $key,
'text' => $value
];
}
return $this->buildSuccess($keyArr);
}
} }

20
app/controller/admin/WechatUser.php

@ -12,18 +12,28 @@ class WechatUser extends Base
* @return Response * @return Response
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
*/ */
public function index(): Response { public function index(): Response
{
$param = $this->request->get();
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT')); $limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
$start = $this->request->get('page', 1); $start = $this->request->get('page', 1);
$where = [];
if (isset($param['key']) && !empty($param['key'])) {
$where[] = ['phone', '=', $param['key']];
}
$obj = new WechatUserModel(); $obj = new WechatUserModel();
$listObj = $obj->order('create_time', 'DESC') $listObj = $obj->order('create_time', 'DESC')
->where($where)
->field('id,openid,headimgurl,phone,create_time,status,last_login_time') ->field('id,openid,headimgurl,phone,create_time,status,last_login_time')
->paginate(['page' => $start, 'list_rows' => $limit])->each(function($item, $key) { ->paginate(['page' => $start, 'list_rows' => $limit])
$item->last_login_time = $item->last_login_time ? date("Y-m-d H:i:s") :''; ->each(function ($item, $key) {
})->toArray(); $item->last_login_time = $item->last_login_time ? date("Y-m-d H:i:s") : '';
})->toArray();
$listInfo = $listObj['data']; $listInfo = $listObj['data'];
return $this->buildSuccess([ return $this->buildSuccess([

Loading…
Cancel
Save