This commit is contained in:
knowpia
2022-09-16 13:35:52 +08:00
parent b261ab7a61
commit dad13c505c

View File

@@ -63,10 +63,13 @@ class Donation
$where = " id < ".$lastIndex; $where = " id < ".$lastIndex;
} }
$result['lastIndex'] = 0; $result['lastIndex'] = 0;
$result['total'] = 0;
$result['list'] = []; $result['list'] = [];
$list = Db::name("order")->where(['user_id'=>$userid,'status'=>1])->where($where)->order("id desc")->limit(env("page_count"))->select()->toArray(); $list = Db::name("order")->where(['user_id'=>$userid,'status'=>1])->where($where)->order("id desc")->limit(env("page_count"))->select();
print_r($list);
if(!empty($list)){ if(!empty($list)){
// $result['total'] = $list->total();
$list = $list->toArray();
$appUser = getAllUsersMessage($list,"user_id","id,nickname"); $appUser = getAllUsersMessage($list,"user_id","id,nickname");
$studentUser = $this->getStudents($list); $studentUser = $this->getStudents($list);
foreach ($list as $key => $vo) { foreach ($list as $key => $vo) {
@@ -76,6 +79,9 @@ class Donation
"date"=> explode(" ",$vo['create_time'])[0], "date"=> explode(" ",$vo['create_time'])[0],
"student_nickname"=>$studentUser[$vo['student_id']]['nickname'], "student_nickname"=>$studentUser[$vo['student_id']]['nickname'],
"donation_nickname"=>$appUser[$vo['user_id']]['nickname'], "donation_nickname"=>$appUser[$vo['user_id']]['nickname'],
"avatar"=>$studentUser[$vo['student_id']]['avatar'],
"type"=>$studentUser[$vo['student_id']]['type'],
"is_disabled"=>$studentUser[$vo['student_id']]['is_disabled'],
]; ];
} }
if (count($list) < env("PAGE_COUNT")) { if (count($list) < env("PAGE_COUNT")) {
@@ -95,7 +101,7 @@ class Donation
} }
$StudentIds = array_unique($StudentIds); $StudentIds = array_unique($StudentIds);
$getAllStudentsMessage = []; $getAllStudentsMessage = [];
$UserLists = Db::name("student")->where("id", "IN",$StudentIds)->field("id,nickname")->select()->toArray(); $UserLists = Db::name("student")->where("id", "IN",$StudentIds)->field("id,nickname,avatar,type,disabled as is_disabled")->select()->toArray();
foreach ($UserLists as $vo) { foreach ($UserLists as $vo) {
$getAllStudentsMessage[$vo['id']] = $vo; $getAllStudentsMessage[$vo['id']] = $vo;
} }