public function userMailWeidu()
 {
     //        $userID = Verif::canshu(I('userID'), 'userID', true, 'int');
     $userID = session("userID");
     //方法1 ,只获未读邮件
     $mailList = Db::dbSelect("UserMailList", ['shouxin_user_id' => $userID, 'shouxin_time_int' => 0]);
     $count = count($mailList);
     //获取未读邮件数量
     //获取发信人的用户信息
     foreach ($mailList as $key => $val) {
         //获取发信人信息 ,把用户资料加到新的字段里
         $mailList[$key]['faxin_user'] = Qita::findUser($mailList[$key]['faxin_user_id']);
         $mailList[$key]['mail_neirong'] = strip_tags($mailList[$key]['mail_neirong']);
         //dump($mailAll);
     }
     $this->ajaxReturn(['zhuangtai' => 1, 'tishi' => '获取用户未读邮件成功', 'data' => ['count' => $count, 'mailList' => $mailList]]);
 }
Beispiel #2
0
 public static function userImg()
 {
     $upload = new \Think\Upload();
     // 实例化上传类
     $upload->maxSize = 3145728;
     // 设置附件上传大小
     $upload->exts = array('jpg', 'gif', 'png', 'jpeg');
     // 设置附件上传类型
     $upload->rootPath = './Public/';
     //设置上传主目录
     $upload->savePath = './userImg/';
     // 设置附件上传目录
     $upload->autoSub = false;
     // 上传文件
     $info = $upload->upload();
     if (!$info) {
         // 上传错误提示错误信息
         //dump($upload->getError());
         exit(json_encode(["zhuangtai" => 0, "tishi" => "上传错误", 'data' => $upload]));
     } else {
         // 上传成功
         //            dump($info);
         $userImg = $info['file']['savename'];
         //            echo $userImg;
         //写入用户头像数据库
         Db::dbSave("UserImg", ['user_id' => session('userID'), 'img_name' => $userImg, 'time_int' => time()]);
         //dump($userImg);
         echo json_encode(["zhuangtai" => 1, "tishi" => "修改成功", 'data' => $userImg]);
         //            return ["zhuangtai" => 1, "tishi" => "修改成功", 'data' => $userImg];
     }
 }