fix bug
This commit is contained in:
37
app/controller/Donation.php
Normal file
37
app/controller/Donation.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace app\controller;
|
||||
|
||||
use app\facade\Db;
|
||||
|
||||
class Donation
|
||||
{
|
||||
public function lists(){
|
||||
if(empty($GLOBALS['data']['data']['student_id'])){
|
||||
return show("请正确上传用户信息!", ERROR_CODE,[]);
|
||||
}
|
||||
$student_id = $GLOBALS['data']['data']['student_id'];
|
||||
|
||||
$result = [];
|
||||
//查询用户信息
|
||||
$result['userinfo'] = [];
|
||||
$userinfo = \think\facade\Db::name("student")->where("id",$student_id)->field("nickname,identifier,avatar,age,type,disabled as is_disabled,city,school,hot,hot_count")->find();
|
||||
if(!empty($userinfo)){
|
||||
$result['userinfo'] = $userinfo;
|
||||
}
|
||||
$result['donation_list'] = [];
|
||||
$list = Db::name("order")->where(['student_id' => $student_id,"status"=>1])->select()->toArray();
|
||||
$users = getAllUsersMessage($list,"user_id","nickname,avatar,shiyou_id");
|
||||
|
||||
foreach($list as $vo){
|
||||
$result['donation_list'][] = [
|
||||
"nickname"=>$users[$vo["user_id"]]['nickname'],
|
||||
"identity"=>empty($users[$vo["user_id"]]['shiyou_id'])?1:0,
|
||||
"amount"=>$vo['amount'],
|
||||
];
|
||||
}
|
||||
return show("获取成功",SUCCESS_CODE,$result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user