Пример #1
0
 /**
  * 添加设计师
  */
 public function addsjs()
 {
     parent::_initalize();
     $this->assign("systemConfig", $this->systemConfig);
     $citymod = new CityModel();
     $is_qx = $this->getqx($_SESSION['my_info']['role']);
     if ($is_qx == 0) {
         #省
         $pro_list = $citymod->getprovince(1);
         $this->assign("pro_list", $pro_list);
     } else {
         $p_id = $_SESSION['my_info']['proid'];
         $c_id = $_SESSION['my_info']['cityid'];
         #区
         $qulist = $citymod->getcity($c_id);
         $this->assign("qulist", $qulist);
         $this->assign("p_id", $p_id);
         $this->assign("c_id", $c_id);
     }
     $this->assign("is_qx", $is_qx);
     $fgmod = M("Fgcategory");
     $fglist = $fgmod->where("1")->select();
     $this->assign("fglist", $fglist);
     $this->assign("is_add", 1);
     if (IS_POST) {
         $a_name = trim($_POST['a_name']);
         $status = trim($_POST['status']);
         $pwd = trim($_POST['pwd']);
         $confirm_pwd = trim($_POST['confirm_pwd']);
         if (empty($a_name)) {
             $this->error("登录名不能为空!");
             exit;
         }
         if (empty($pwd)) {
             $this->error("密码不能为空!");
             exit;
         }
         if (empty($confirm_pwd)) {
             $this->error("确认密码不能为空!");
             exit;
         }
         if (empty($confirm_pwd)) {
             $this->error("确认密码不能为空!");
             exit;
         }
         if ($pwd != $confirm_pwd) {
             $this->error("两次输入的密码不能为空!");
             exit;
         }
         //登录名称是否存在
         $memmod = new MemberModel();
         if ($memmod->check_name($a_name) > 0) {
             $this->error("登录名已经存在,请重新命名");
             exit;
         }
         $picName = trim($_POST['picName']);
         $truename = trim($_POST['truename']);
         if (empty($truename)) {
             $this->error("真实姓名不能为空!");
             exit;
         }
         $sex = $_POST['sex'];
         $mvophone = trim($_POST['mvophone']);
         $koubei = trim($_POST['koubei']);
         $email = trim($_POST['email']);
         $gongling = trim($_POST['gongling']);
         $qq = trim($_POST['qq']);
         $jiguan = trim($_POST['jiguan']);
         $scfg = $_POST['scfg'];
         $zhicheng = trim($_POST['zhicheng']);
         $sjln = trim($_POST['sjln']);
         $is_tj = $_POST['is_tj'];
         $dhimg = $_FILES['dhimg']['name'];
         if (!empty($dhimg)) {
             $path = "/Uploads/shangjia/";
             $imginf = $this->upload("." . $path);
             if (!empty($imginf[0]['savename'])) {
                 $dhimg_str = $path . $imginf[0]['savename'];
             }
         }
         $p_id = $_POST['p_id'];
         $c_id = $_POST['c_id'];
         $q_id = $_POST['q_id'];
         $address = trim($_POST['address']);
         $jingdu = trim($_POST['jingdu']);
         $weidu = trim($_POST['weidu']);
         $maindata = array("a_name" => $a_name, "a_pwd" => encrypt($pwd), "a_type" => 4, "status" => $status);
         $fjdata = array();
         $fjdata['logo'] = $picName;
         $fjdata['truename'] = $truename;
         $fjdata['sex'] = $sex;
         $fjdata['movphone'] = $mvophone;
         $fjdata['koubei'] = $koubei;
         $fjdata['email'] = $email;
         $fjdata['gongling'] = $gongling;
         $fjdata['qq'] = $qq;
         $fjdata['jiguan'] = $jiguan;
         $fjdata['scfg'] = $scfg;
         $fjdata['zhicheng'] = $zhicheng;
         $fjdata['sjln'] = $sjln;
         $fjdata['is_tj'] = $is_tj;
         $fjdata['dhimg'] = $dhimg_str;
         $fjdata['p_id'] = $p_id;
         $fjdata['c_id'] = $c_id;
         $fjdata['q_id'] = $q_id;
         $fjdata['address'] = $address;
         $fjdata['jingdu'] = $jingdu;
         $fjdata['weidu'] = $weidu;
         $res = $memmod->add_member($maindata, $fjdata);
         if ($res['status']) {
             $this->success($res['info'], U('Member/shejishi'));
         } else {
             $this->error($res['info']);
         }
         exit;
     }
     $this->display();
 }