fix bug
This commit is contained in:
@@ -46,6 +46,74 @@ class Donation
|
||||
return show("获取成功",SUCCESS_CODE,$result);
|
||||
}
|
||||
|
||||
public function detail(){
|
||||
$userid = $GLOBALS['data']['userid'];
|
||||
if(empty($userid)){
|
||||
return show("请登录后再查看!",NEED_LOGIN);
|
||||
}
|
||||
|
||||
if(empty($GLOBALS['data']['data']['certificate_id'])){
|
||||
return show("请正确上传用户信息!", ERROR_CODE,[]);
|
||||
}
|
||||
$certificate_id =$GLOBALS['data']['data']['certificate_id'];
|
||||
|
||||
$info = Db::name("order")->where("id",$certificate_id)->find();
|
||||
if(empty($info) || $info['user_id']!=$userid || $info['status']!=1){
|
||||
return show("找不到对应证书信息!", ERROR_CODE,[]);
|
||||
}
|
||||
|
||||
$user_info = Db::name("app_user")->where("id",$info['user_id'])->find();
|
||||
if(empty($user_info)){
|
||||
return show("用户信息不存在!", ERROR_CODE,[]);
|
||||
}
|
||||
|
||||
$student_info = Db::name("student")->where("id",$info['student_id'])->find();
|
||||
if(empty($student_info)){
|
||||
return show("找不到学生信息!", ERROR_CODE,[]);
|
||||
}
|
||||
|
||||
$result = [
|
||||
"student_name" => $student_info['nickname'],
|
||||
"app_user"=>$user_info['nickname'],
|
||||
"time"=>explode(" ",$info['create_time'])[0],
|
||||
"address"=> empty($info['app_address_id'])?0:1
|
||||
];
|
||||
return show(SUCCESS_MESSAGE,SUCCESS_CODE,$result);
|
||||
}
|
||||
|
||||
public function setAddress(){
|
||||
$userid = $GLOBALS['data']['userid'];
|
||||
if(empty($userid)){
|
||||
return show("请登录后再查看!",NEED_LOGIN);
|
||||
}
|
||||
|
||||
if(empty($GLOBALS['data']['data']['certificate_id'])){
|
||||
return show("请正确上传用户信息!", ERROR_CODE,[]);
|
||||
}
|
||||
$certificate_id =$GLOBALS['data']['data']['certificate_id'];
|
||||
|
||||
|
||||
if(empty($GLOBALS['data']['data']['address_id'])){
|
||||
return show("请上传地址ID!", ERROR_CODE,[]);
|
||||
}
|
||||
$address_id =$GLOBALS['data']['data']['address_id'];
|
||||
$address_info = Db::name("app_address")->where("id",$address_id)->find();
|
||||
if(empty($address_info ) || $address_info["userid"]!=$userid){
|
||||
return show("找不到用户信息!", ERROR_CODE,[]);
|
||||
}
|
||||
|
||||
|
||||
$info = Db::name("order")->where("id",$certificate_id)->find();
|
||||
if(empty($info) || $info['user_id']!=$userid || $info['status']!=1){
|
||||
return show("找不到对应证书信息!", ERROR_CODE,[]);
|
||||
}
|
||||
|
||||
Db::name("order")->where("id",$certificate_id)->update(
|
||||
["app_address_id"=>$address_info['id']]
|
||||
);
|
||||
|
||||
return show("设置成功!!", SUCCESS_CODE,[]);
|
||||
}
|
||||
|
||||
public function certificate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user