正在显示
1 个修改的文件
包含
45 行增加
和
39 行删除
@@ -984,45 +984,51 @@ class SecondController extends RestBaseController | @@ -984,45 +984,51 @@ class SecondController extends RestBaseController | ||
984 | */ | 984 | */ |
985 | public function zhengJianPic(){ | 985 | public function zhengJianPic(){ |
986 | $userId=$this->getUserId(); | 986 | $userId=$this->getUserId(); |
987 | - $User=new VolunteerModel(); | ||
988 | - $user=$User->where('user_id',$userId)->find()->toArray(); | ||
989 | - //dump($user); | ||
990 | - $userInfo=$User->getUserInfo($userId); | ||
991 | - | ||
992 | - $path='../upload/zhengjian/'; | ||
993 | - $info['photo']=explode('https://volunteer.cnpu.org',$user['photo']); | ||
994 | - $path1=ROOT_PATH.'public/imgs/font.png'; | ||
995 | - $path2=ROOT_PATH.'public'.DS.$info['photo'][1]; | ||
996 | - $image1 =\think\Image::open($path1); | ||
997 | - $image2 =\think\Image::open($path2) | ||
998 | - ->thumb('225',310,\think\Image::THUMB_CENTER)->save(ROOT_PATH.'public/upload/user/'.$userId.'.png'); | ||
999 | - $photo=''; | ||
1000 | - $photo_local[]=430; | ||
1001 | - $photo_local[]=62; | ||
1002 | - $font='../static/font-awesome/fonts/PingFang Medium.ttf'; | ||
1003 | - $text1='姓名 '.$userInfo['name']; | ||
1004 | - $text2='身份 '.$userInfo['status']; | ||
1005 | - $text3='编号 '.$userInfo['user_num']; | ||
1006 | - $text4='当前学时 '.$userInfo['work_time'].'小时'; | ||
1007 | - $locate1[]='35'; | ||
1008 | - $locate1[]='100'; | ||
1009 | - $locate2[]='35'; | ||
1010 | - $locate2[]='165'; | ||
1011 | - $locate3[]='35'; | ||
1012 | - $locate3[]='235'; | ||
1013 | - $locate4[]='35'; | ||
1014 | - $locate4[]='300'; | ||
1015 | - | ||
1016 | - $image1 | ||
1017 | - ->water(ROOT_PATH.'public/upload/user/'.$userId.'.png',$photo_local) | ||
1018 | - ->text($text1,$font,20,'#FFFFFF',$locate1) | ||
1019 | - ->text($text2,$font,20,'#FFFFFF',$locate2) | ||
1020 | - ->text($text3,$font,20,'#FFFFFF',$locate3) | ||
1021 | - ->text($text4,$font,20,'#FFFFFF',$locate4) | ||
1022 | - ->save($path.$userId.'.png'); | ||
1023 | - //$image2->thumb(430,62); | ||
1024 | - $return['url']=cmf_get_image_url('/upload/zhengjian/'.$userId.'.png'); | ||
1025 | - $this->success('',$return); | 987 | + $type=input('type'); |
988 | + if ($type==1){ | ||
989 | + $User=new VolunteerModel(); | ||
990 | + $user=$User->where('user_id',$userId)->find()->toArray(); | ||
991 | + //dump($user); | ||
992 | + $userInfo=$User->getUserInfo($userId); | ||
993 | + | ||
994 | + $path='../upload/zhengjian/'; | ||
995 | + $info['photo']=explode('https://volunteer.cnpu.org',$user['photo']); | ||
996 | + $path1=ROOT_PATH.'public/imgs/font.png'; | ||
997 | + $path2=ROOT_PATH.'public'.DS.$info['photo'][1]; | ||
998 | + $image1 =\think\Image::open($path1); | ||
999 | + $image2 =\think\Image::open($path2) | ||
1000 | + ->thumb('225',310,\think\Image::THUMB_CENTER)->save(ROOT_PATH.'public/upload/user/'.$userId.'.png'); | ||
1001 | + $photo=''; | ||
1002 | + $photo_local[]=430; | ||
1003 | + $photo_local[]=62; | ||
1004 | + $font='../static/font-awesome/fonts/PingFang Medium.ttf'; | ||
1005 | + $text1='姓名 '.$userInfo['name']; | ||
1006 | + $text2='身份 '.$userInfo['status']; | ||
1007 | + $text3='编号 '.$userInfo['user_num']; | ||
1008 | + $text4='当前学时 '.$userInfo['work_time'].'小时'; | ||
1009 | + $locate1[]='35'; | ||
1010 | + $locate1[]='100'; | ||
1011 | + $locate2[]='35'; | ||
1012 | + $locate2[]='165'; | ||
1013 | + $locate3[]='35'; | ||
1014 | + $locate3[]='235'; | ||
1015 | + $locate4[]='35'; | ||
1016 | + $locate4[]='300'; | ||
1017 | + | ||
1018 | + $image1 | ||
1019 | + ->water(ROOT_PATH.'public/upload/user/'.$userId.'.png',$photo_local) | ||
1020 | + ->text($text1,$font,20,'#FFFFFF',$locate1) | ||
1021 | + ->text($text2,$font,20,'#FFFFFF',$locate2) | ||
1022 | + ->text($text3,$font,20,'#FFFFFF',$locate3) | ||
1023 | + ->text($text4,$font,20,'#FFFFFF',$locate4) | ||
1024 | + ->save($path.$userId.'.png'); | ||
1025 | + //$image2->thumb(430,62); | ||
1026 | + $return['url']=cmf_get_image_url('/upload/zhengjian/'.$userId.'.png'); | ||
1027 | + $this->success('',$return); | ||
1028 | + }else{ | ||
1029 | + $return['url']=cmf_get_image_url('/imgs/back.png'); | ||
1030 | + } | ||
1031 | + | ||
1026 | } | 1032 | } |
1027 | /** | 1033 | /** |
1028 | * @title 他人主页 | 1034 | * @title 他人主页 |
-
请 注册 或 登录 后发表评论