/** * addContants * 新增联系人 * @access public * @return void */ public function addContantsAction() { $ret = array("succ" => FALSE, "msg" => array()); $gonghao = $this->input->post('gonghao'); $phone = $this->input->post('phone'); $tel = $this->input->post('tel'); $name = $this->input->post('name'); if (!regexPhone($phone)) { $ret[] = '手机号码格式不正确'; $this->sender($ret); } if (!regexTel($tel)) { $ret[] = '固定电话号码格式不正确'; $this->sender($ret); } $this->contantsService->contantsAddAttr($gonghao, $phone, $tel, $name); $this->sender($ret); }
/** * contantsAddAttr * 单条插入 * @param mixed $gonghao * @param mixed $phone * @param mixed $tel * @param mixed $name * @access public * @return void */ public function contantsAddAttr($gonghao, $phone, $tel, $name) { if (!regexPhone($phone)) { return FALSE; } if (!regexTel($tel)) { return FALSE; } $contantsAddArr = array(); $contantsAddArr['contants_user_gonghao'] = mysqlEscapeStr($gonghao); $contantsAddArr['contants_phone'] = $phone; $contantsAddArr['contants_tel'] = $tel; $contantsAddArr['contants_name'] = mysqlEscapeStr($name); return $this->contants->addContants($contantsAddArr); }