1.对客服提交数据的ip地址记录。
获取ip地址的方法:
public function getIP() { global $ip; if (getenv("HTTP_X_REAL_IP")) $ip = getenv("HTTP_X_REAL_IP"); else if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "Unknow"; return $ip; }
ajax提交的请求处理function
1 /* 2 * ajax提交商机信息 3 */ 4 public function ajaxPushAction(){ 5 $this->getRequest()->isPost() && $this->post = $this->getRequest()->getPost(); 6 if(!$this->post['t_name'] || !$this->post['t_tel']){ 7 $res = -1; 8 Comm_Tools::renderJson($res); 9 } 10 $getip = $this->getIP(); 11 $this->post['getip'] = $getip; 12 $url = "http://home.demo.cn/web/buss/ajaxPushBusinessToQueue"; 13 $res = Comm_Tools::curl($url, 'POST', $this->post); 14 Comm_Tools::renderJson($res); 15 }