public function personadd()
 {
     $id = (int) $this->_get("id");
     $pid = (int) $this->_get("pid");
     $t = $this->_get("t");
     //        $parentid = (int) $this->_get("parentid");
     $aname = $t == 'a' ? '增加' : '修改';
     //$param1 = gp($this->_get('param')); //htmlspecialchars
     //$param1 = json_encode(ser($this->_post('param'),1)); //htmlspecialchars
     $pinfo = $this->Cusperson->where(array('per_id' => $pid))->find();
     if ($t == 'a') {
         $_defsex = '女';
         $_defsts = 'Y';
         $param1 = gp($this->_get('param'));
         //htmlspecialchars
     } else {
         $_defsex = $pinfo['sex'];
         $_defsts = $pinfo['sts'];
         $param1 = json_encode(ser($this->_post('param'), 1));
         //htmlspecialchars
     }
     //echo $param1;
     $sel = new stdClass();
     $sel->sex = showMenuParent0('sex', $_defsex, 'class="length_2"', '', 1, '1', 1);
     $sel->sts = nysts('停用', '使用', 'sts', $_defsts, '', 'class="length_2"');
     $this->assign('sel', $sel);
     $info = $this->Cusperson->where(array('customer_id' => $id))->order(array("sts" => "DESC"))->select();
     $this->assign("parentid", $id);
     $this->assign("info", $info);
     $this->assign("pinfo", $pinfo);
     $this->assign("t", $t);
     $this->assign("aname", $aname);
     $this->assign('param', $param1);
     //        $this->display("Dcustomermsg:personadd");
     $this->display();
 }
 public function add()
 {
     if (IS_POST) {
         if ($this->_post("id") == '') {
             if ($this->Custom->create()) {
                 $this->Custom->opr_no = AppframeAction::$Cache['User']['username'];
                 $this->Custom->opr_time = date('Y-m-d H:i:s');
                 if ($this->Custom->add()) {
                     $this->success("新增成功!", U("Dwtfmsg/index", 'param=' . gp($this->_post('param')) . '&menuid=' . $this->_post('menuid')));
                 } else {
                     $this->error("新增失败!");
                 }
             } else {
                 $this->error($this->Custom->getError());
             }
         } else {
             if ($this->Custom->create()) {
                 $this->Custom->opr_no = AppframeAction::$Cache['User']['username'];
                 $this->Custom->opr_time = date('Y-m-d H:i:s');
                 if ($this->Custom->save() !== false) {
                     $this->success("更新成功!", U("Dwtfmsg/index", 'param=' . gp($this->_post('param')) . '&menuid=' . $this->_post('menuid')));
                 } else {
                     $this->error("更新失败!");
                 }
             } else {
                 $this->error($this->Custom->getError());
             }
         }
     } else {
         $id = (int) $this->_get("id");
         $t = $this->_get("t");
         $parentid = (int) $this->_get("parentid");
         $aname = $t == 'a' ? '增加' : '修改';
         $param1 = gp($this->_get('param'));
         //htmlspecialchars
         $sel = new stdClass();
         if (empty($id)) {
             $info = array();
             $sel->type_code = showMenuParent0('type_code', '45', 'class="w90"', '', 1, '', 44);
             $sel->jsstate = showMenuParent0('jsstate', '34', 'class="w90"', '', 1, '', 3);
             $sel->dis_sts = nysts('备用', '常用', 'dis_sts', 'Y', '', 'class="w90"');
         } else {
             $info = $this->Custom->where(array('wtf_id' => $id))->find();
             //echo $this->Custom->getLastSql();
             //$parentid = $info.parentid;
             $sel->type_code = showMenuParent0('type_code', $info['type_code'], 'class="w90"', '', 1, '', 44);
             $sel->jsstate = showMenuParent0('jsstate', $info['jsstate'], 'class="w90"', '', 1, '', 3);
             $sel->dis_sts = nysts('备用', '常用', 'dis_sts', $info['dis_sts'], '', 'class="w90"');
         }
         //$parentid = 0;
         //            dump( $info);
         $this->assign('sel', $sel);
         $this->assign("parentid", $parentid);
         $this->assign("info", $info);
         $this->assign("t", $t);
         $this->assign("aname", $aname);
         $this->assign('param', $param1);
         $this->display();
     }
 }
 public function add()
 {
     if (IS_POST) {
         if ($this->_post("t") == 'a') {
             if ($this->Custom->create()) {
                 $this->Custom->opr_no = AppframeAction::$Cache['User']['username'];
                 $this->Custom->opr_time = date('Y-m-d H:i:s');
                 if ($this->Custom->add()) {
                     $this->success("新增成功!", U("Dcustomermsg/index", 'param=' . gp($this->_post('param')) . '&menuid=' . $this->_post('menuid')));
                 } else {
                     $this->error("新增失败!");
                 }
             } else {
                 $this->error($this->Custom->getError());
             }
         } else {
             if ($this->Custom->create()) {
                 $this->Custom->opr_no = AppframeAction::$Cache['User']['username'];
                 $this->Custom->opr_time = date('Y-m-d H:i:s');
                 if ($this->Custom->save() !== false) {
                     $this->success("更新成功!", U("Dcustomermsg/index", 'param=' . gp($this->_post('param')) . '&menuid=' . $this->_post('menuid')));
                 } else {
                     $this->error("更新失败!");
                 }
             } else {
                 $this->error($this->Custom->getError());
             }
         }
     } else {
         $id = (int) $this->_get("id");
         $t = $this->_get("t");
         $parentid = (int) $this->_get("parentid");
         $aname = $t == 'a' ? '增加' : '修改';
         $param1 = gp($this->_get('param'));
         //htmlspecialchars
         $sel = new stdClass();
         if (empty($id)) {
             $info = array();
             //$info['opr_no'] =  AppframeAction::$Cache['User']['username'];
             // $info['opr_time'] =  date('Y-m-d H:i:s');
             $sel->cus_group = showMenuParent0('cus_group', '25', 'class="length_4"', '', 1, '', 19);
             $sel->hzstate = showMenuParent0('hzstate', '31', 'class="length_4"', '', 1, '', 24);
             $sel->xylevel = showMenuParent0('xylevel', '40', 'class="length_4"', '', 1, '', 39);
             $sel->tzlevel = showMenuParent0('tzlevel', '40', 'class="length_4"', '', 1, '', 39);
             $sel->jsstate = showMenuParent0('jsstate', '34', 'class="length_4"', '', 1, '', 3);
             $sel->cus_type = nysts('传统', '线上', 'cus_type', 'N', '', 'class="length_4"');
         } else {
             $info = $this->Custom->where(array('customer_id' => $id))->find();
             //echo $this->Custom->getLastSql();
             //$parentid = $info.parentid;
             $sel->cus_group = showMenuParent0('cus_group', $info['cus_group'], 'class="length_4"', '', 1, '', 19);
             $sel->hzstate = showMenuParent0('hzstate', $info['hzstate'], 'class="length_4"', '', 1, '', 24);
             $sel->xylevel = showMenuParent0('xylevel', $info['xylevel'], 'class="length_4"', '', 1, '', 39);
             $sel->tzlevel = showMenuParent0('tzlevel', $info['tzlevel'], 'class="length_4"', '', 1, '', 39);
             $sel->jsstate = showMenuParent0('jsstate', $info['jsstate'], 'class="length_4"', '', 1, '', 3);
             $sel->cus_type = nysts('传统', '线上', 'cus_type', $info['cus_type'], '', 'class="length_4"');
         }
         //$parentid = 0;
         //            dump( $info);
         $this->assign('sel', $sel);
         $this->assign("parentid", $parentid);
         $this->assign("info", $info);
         $this->assign("t", $t);
         $this->assign("aname", $aname);
         $this->assign('param', $param1);
         $this->display();
     }
 }
 /**
  *
  * 供应商人员列表
  */
 public function personlist()
 {
     $_defsex = '女';
     $_defsts = 'Y';
     $sel = new stdClass();
     $sel->sex = showMenuParent0('sex', $_defsex, 'class="w80"', '', 1, '1', 1);
     $sel->sts = nysts('停用', '使用', 'sts', $_defsts, '', 'class="w80"');
     $sel->wtf = R('Dwtfmsg/wtfStr', array(2, '', '', 'id', 'class="w80"', ''));
     $this->assign('sel', $sel);
     C('TOKEN_ON', false);
     $this->display();
 }