• 多图片上传(证书认证)


        use ThinkUpload;
        /**
         * 上传文件
         */
        public function Img_upload($file = '')
        {
            //配置
            $config = array(
                "exts" => 'jpg,gif,png,jpeg',
            );
            $upload = new Upload($config);
            $add = $upload->upload($file);
            $path = array();
            $http = sp_get_host();
            foreach ($add as $v) {
                $path[] = $http . "/Uploads/" . trim($v['savepath'], '.') . $v['savename'];
            }
            return $path;
        }

    //证书认证
        public function renzheng1(){
            // $post = json_encode($_POST);
            // $file = json_encode($_FILES);
            // $this->json('10001',array("post"=>$post,'file'=>$file));die;
            $uid = I("uid");
            $arrs = M("diploma")->where("uid='$uid'")->find();
            if($arrs){
                $this->json("10003","您已提交过资质证书,等待审核");
            }
            $d_types = I('d_type');
            $d_names = I('d_name');
            $d_mutypes = I('d_mutype');
            $date = array();
            foreach ($d_types as $key => $value) {
                $arr = array();
                $arr['uid'] = $uid;
                $arr['d_type'] = $d_types[$key];
                $arr['d_name'] = $d_names[$key];
                $arr['d_mutype'] = isset($d_mutypes[$key])?$d_mutypes[$key]:0;
                $img = $this->Img_upload(array('img'=>$_FILES['d_url'.$key]));
                $arr['d_url'] = json_encode($img);
                $arr['d_ren'] = 1;
                $arr['d_time'] = time();
                $date[] = $arr;
            }
            $rst = M("diploma")->addAll($date);
            if($rst){
                $this->json("10001","资质证书已提交,等待审核");
            } else {
                $this->json("10002","资质证书提交失败");
            }
        }
        //证书修改
        public function renzheng_save(){
            $uid = I("uid");
            $d_types = I('d_type');
            $d_names = I('d_name');
            $d_mutypes = I('d_mutype');
            $d_rens = I("d_ren");
            $date = array();
            foreach ($d_types as $key => $value) {
                $arr = array();
                $arr['uid'] = $uid;
                $arr['d_type'] = $d_types[$key];
                $arr['d_name'] = $d_names[$key];
                $arr['d_mutype'] = isset($d_mutypes[$key])?$d_mutypes[$key]:0;
                $img = $this->Img_upload(array('img'=>$_FILES['d_url'.$key]));
                $d_url = $_POST['d_url'.$key];
                $d_url = empty($d_url)?array():$d_url;
                $img = empty($img)?array():$img;
                $img = array_merge($d_url,$img);
                $arr['d_url'] = json_encode($img);
                if($d_rens[$key] ==3){
                    $arr['d_ren'] = 1;
                } else {
                    $arr['d_ren'] = $d_rens[$key];
                }
                $arr['d_time'] = time();
                $date[] = $arr;
            }
            M("diploma")->where("uid='$uid'")->delete();
            $rst = M("diploma")->addAll($date);
            if($rst){
                $this->json("10001","提交审核成功");
            } else {
                $this->json("10002","提交审核失败");
            }
        }

  • 相关阅读:
    Xcode的控制台调试命令
    android 分辨率自适应
    android 分辨率自适应
    android屏幕适配
    android屏幕适配
    最新版本的ADT使用问题
    最新版本的ADT使用问题
    UVa 1639 Candy (数学期望+组合数学+高精度存储)
    UVa 12230 && HDU 3232 Crossing Rivers (数学期望水题)
    HDU 1087 Super Jumping! Jumping! Jumping! (DP+LIS)
  • 原文地址:https://www.cnblogs.com/jhy-ocean/p/6202968.html
Copyright © 2020-2023  润新知