/**
  * 添加工人
  */
 public function addgr()
 {
     parent::_initalize();
     $this->assign("systemConfig", $this->systemConfig);
     $is_qx = $this->getqx($_SESSION['my_info']['role']);
     $cmod = new CityModel();
     if ($is_qx == 1) {
         #地区管理员
         $c_id = $_SESSION['my_info']['cityid'];
         $p_id = $_SESSION['my_info']['proid'];
         $qlist = $cmod->getcity($c_id);
         $this->assign("qlist", $qlist);
         $this->assign("c_id", $c_id);
         $this->assign("p_id", $p_id);
     } else {
         #省
         $plist = $cmod->getprovince(1);
         $this->assign("plist", $plist);
     }
     $this->assign("is_qx", $is_qx);
     if (IS_POST) {
         $a_name = trim($_POST['a_name']);
         //用户登录信息
         $status = $_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 ($confirm_pwd != $pwd) {
             $this->error("两次输入的密码不一致!");
             exit;
         }
         #检测用户名是否存在
         $memMod = M("Member");
         $res = $memMod->where("a_type=2 and a_name='" . $a_name . "'")->count();
         if ($res > 0) {
             $this->error("登录名已经存在!");
             exit;
         }
         //登录信息接受结束
         $picName = trim($_POST['picName']);
         //logo
         $truename = trim($_POST['truename']);
         $ruzhitime = trim($_POST['ruzhitime']);
         #身份证
         if (!empty($_FILES['sfz_img']['name'])) {
             $path = "/Uploads/shangjia/";
             $sfzimg = $this->upload("." . $path);
             if (!empty($sfzimg[0]['savename'])) {
                 $sfz_img = $path . $sfzimg[0]['savename'];
             }
         }
         $content = trim($_POST['content']);
         $movphone = trim($_POST['movphone']);
         $sex = $_POST['sex'];
         $email = trim($_POST['email']);
         $gongling = trim($_POST['gongling']);
         $qq = trim($_POST['qq']);
         $orders = trim($_POST['orders']);
         $is_tj = $_POST['is_tj'];
         $p_id = $_POST['p_id'];
         $c_id = $_POST['c_id'];
         $q_id = $_POST['q_id'];
         $address = trim($_POST['address']);
         $jingdu = $_POST['jingdu'];
         $weidu = $_POST['weidu'];
         $aid = $_POST['aid'];
         $maindata = array("a_name" => $a_name, "a_pwd" => encrypt($pwd), "a_type" => 5, "status" => $status);
         $fjdata1 = array("truename" => $truename, "ruzhitime" => $ruzhitime, "logo" => $picName, "sfz_img" => $sfz_img, "content" => $content, "movphone" => $movphone, "sex" => $sex, "email" => $email, "gongling" => $gongling, "address" => $address, "qq" => $qq, "orders" => $orders, "is_tj" => $is_tj, "p_id" => $p_id, "c_id" => $c_id, "q_id" => $q_id, "jingdu" => $jingdu, "weidu" => $weidu);
         $memmod = new MemberModel();
         $res1 = $memmod->add_member($maindata, $fjdata1);
         if ($res1) {
             $this->success("操作成功!", U("Member/grlist"));
             exit;
         } else {
             $this->error("操作失败!");
             exit;
         }
     }
     $this->display();
 }