企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 接口情况 作者:ncgis 时间:20150416 作用:验证填写电话是否注册 提交方法:GET 提交参数:mobile 所在文件:passport 接口地址:http://test.lingsq.com/index.php/api?method=lingsqapi.api.passport.noMobileUse&mobile=[mobile] 正式地址:http://www.lingsq.com/index.php/api?method=lingsqapi.api.passport.noMobileUse&mobile=[mobile] 返回数据样式: ~~~ {"errNo":"1","errMsg":"ok"} 验证无注册 {"errNo":"20005","errMsg":"您提交参数不足,请检查参数后再试"} 您提交参数不足,请检查参数后再试 {"errNo":"20002","errMsg":"您提交参数格式不对,请检查参数格式后再试"}您提交参数格式不对,请检查参数格式后再试 {"errNo":"30002","errMsg":"手机号码已注册"} 手机号码已注册 ~~~ ## 接口实现代码 ~~~ public function noMobileUse() { $obj_member =app::get('b2c')->model('members'); $mobile = trim($_GET['mobile']); $member_id=null; if(empty($mobile)) { $back["errNo"]=20005; $back["errMsg"]=$this->errMsg($back["errNo"]); return $back; } else { if(!preg_match('/^13[0-9]{1}[0-9]{8}$|170[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}|14[0-9]{1}[0-9]{8}$/', $mobile)) { $back["errNo"]=20002; $back["errMsg"]=$this->errMsg($back["errNo"]); return $back; } else { if(!$obj_member->is_exists_mobile($mobile,$member_id)) { $back["errNo"]=1; $back["errMsg"]=$this->errMsg($back["errNo"]); return $back; } else { $back["errNo"]=30002; $back["errMsg"]=$this->errMsg($back["errNo"]); return $back; } } } } ~~~