dggjimai/application/admin/controller/AccountLogController.php

54 lines
1.7 KiB
PHP
Executable File

<?php
/**
* 会员账户流水记录表控制器
*/
namespace app\admin\controller;
use think\Request;
use app\common\model\AccountLog;
use app\common\validate\AccountLogValidate;
class AccountLogController extends Controller
{
//积分记录
public function integrallist(Request $request, AccountLog $model)
{
$SOURCE_TYPE=$model->SOURCE_TYPE;
$param = $request->param();
$where = [];
if(isset($param['source_type']) && $param['source_type']){
$source_type = $param['source_type'];
$where[] = ['source_type','in',$source_type];
}
if(isset($param['keyword']) && $param['keyword']){
$where[] = [$param['keyword_type'],'like','%'.$param['keyword'].'%'];
}
if (isset($param['start_time']) && $param['start_time'] && isset($param['end_time']) && $param['end_time']) {
$where[] = ['al.create_time', 'between', [strtotime($param['start_time']), strtotime($param['end_time'])]];
}
$model = $model
->alias('al')
->field('al.*,u.mobile,u.nickname,u.sn as user_sn,u.avatar')
->join('user u', 'u.id = al.user_id')
->where($where)
->scope('where', $param);
$data = $model->paginate($this->admin['per_page'], false, ['query'=>$request->get()]);
//关键词,排序等赋值
$this->assign($request->get());
$this->assign([
'data' => $data,
'page' => $data->render(),
'total' => $data->total(),
'source_type_list'=>$SOURCE_TYPE,
]);
return $this->fetch();
}
}