2021-01-28 14:43:37 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\user\controller;
|
|
|
|
|
|
|
|
|
|
use app\user\model\UserScore as UserScoreModel;
|
|
|
|
|
use fastphp\base\Controller;
|
|
|
|
|
|
|
|
|
|
class UserScore extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function export()
|
|
|
|
|
{
|
2024-02-05 18:19:57 +08:00
|
|
|
|
|
|
|
|
$data = $_GET;
|
|
|
|
|
|
|
|
|
|
$where = [];
|
|
|
|
|
$where_str = '';
|
|
|
|
|
if (!empty($data)) {
|
|
|
|
|
if (!empty($data['st'])) {
|
|
|
|
|
$date1 = date('Y-m-d', strtotime($data['st']));
|
|
|
|
|
$date2 = date('Y-m-d', strtotime($data['et']));
|
|
|
|
|
$where_str = " CreateTime>='" . $date1 . "' and CreateTime<='" . $date2 . "' ";
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-28 14:43:37 +08:00
|
|
|
$user_score_model = new UserScoreModel;
|
|
|
|
|
|
2024-02-05 18:19:57 +08:00
|
|
|
$list = $user_score_model->field('UpdateTime,UserName,OperateUserName,ScoreTypeName,RestAmount1,ScoreValue,RestAmount2,Remark')->where($where)->where($where_str)->fetchAll();;
|
2021-01-28 14:43:37 +08:00
|
|
|
|
|
|
|
|
\exportToCsv('test.csv',['创建时间','会员号','操作人员','资金项目','操作前余额','金额','操作后余额','备注'],$list);
|
|
|
|
|
}
|
2022-03-30 17:49:46 +08:00
|
|
|
|
2024-02-06 14:59:56 +08:00
|
|
|
public function get_all_list() {
|
|
|
|
|
$data = $_GET;
|
|
|
|
|
$page = 0;
|
|
|
|
|
if (isset($data['PageIndex'])) {
|
|
|
|
|
$page = ($data['PageIndex'] - 1) * 50;
|
|
|
|
|
}
|
|
|
|
|
$where_str = '';
|
|
|
|
|
if (!empty($data)) {
|
|
|
|
|
if (!empty($data['st'])) {
|
|
|
|
|
$date1 = date('Y-m-d', strtotime($data['st']));
|
|
|
|
|
$date2 = date('Y-m-d', strtotime($data['et']));
|
|
|
|
|
$where_str = " CreateTime>='" . $date1 . "' and CreateTime<='" . $date2 . "' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($data['type'])) {
|
|
|
|
|
if (!empty($where_str)) {
|
|
|
|
|
$where_str .= ' AND ';
|
|
|
|
|
}
|
|
|
|
|
$where_str .= " ScoreType='" . $data['type'] . "' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($data['keyWord'])) {
|
|
|
|
|
if (!empty($where_str)) {
|
|
|
|
|
$where_str .= ' AND ';
|
|
|
|
|
}
|
|
|
|
|
$where_str .= " UserName='" . $data['keyWord'] . "' ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$user_score_model = new UserScoreModel;
|
|
|
|
|
|
|
|
|
|
$list = $user_score_model->field('*')->where($where_str)->order('Id desc')->limit("$page,50")->fetchAll();;
|
|
|
|
|
|
|
|
|
|
echo json_encode([
|
|
|
|
|
'Code' => 10000,
|
|
|
|
|
'Data' => $list,
|
|
|
|
|
'TotalCount' => (int)$user_score_model->getCount($where_str)['count'],
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-30 17:49:46 +08:00
|
|
|
/**
|
|
|
|
|
* @description: 获取资金明细列表
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function getList() {
|
2022-03-31 10:25:49 +08:00
|
|
|
$data = json_decode(file_get_contents("php://input"),true);
|
|
|
|
|
$page = 0;
|
|
|
|
|
if (isset($data['page'])) {
|
|
|
|
|
$page = ($data['page'] - 1) * 50;
|
|
|
|
|
}
|
2022-03-30 17:49:46 +08:00
|
|
|
$user_score_model = new UserScoreModel;
|
2022-03-31 10:25:49 +08:00
|
|
|
$list = $user_score_model->getListPage(['UserId'=>$this->userinfo['UserId']],'*','id desc',"$page,50");
|
2022-03-30 17:49:46 +08:00
|
|
|
echo json_encode($list);
|
|
|
|
|
}
|
2021-01-28 14:43:37 +08:00
|
|
|
}
|