TP3.2 mysql会写入两条一模一样的数据

浏览:1176 发布日期:2016/10/18 分类:求助交流 关键字: 3.2 mysql
1.不明白这是为什么, 我的代码检查不出来毛病 求助大神帮助
2.我的数据库设置了读写分离
//登陆
function login($account,$password)
{
//dump($password);
$strdata['result'] = 'success';
$qoocourl=$this->getCfgUrl();
//dump($qoocourl);
//$account = "'".$account."'";
//$password = "'".$password."'";
$account1=$this->subStr($account);
$password1=$this->subStr($password);
//dump($account1);
//dump($password1);
$account2 = urlencode($account1);
$password2 = urlencode($password1);
$url=$qoocourl."/service/login.jsp?Username=".$account2."&Password=".$password2;
//dump($url);
$html =file_get_contents($url);
$jiexi= json_decode($html,true);
if($jiexi["Result"]=="Fail")
{
$strdata["result"] = 'fail';
$strdata['errorcode'] = '用户名或者密码出错,请重新填写!';
$jsondata = json_encode_ex($strdata);
echo $jsondata;
return $jsondata;
}else if($jiexi["Result"] =="Success"){
$AccountMoldel = new \Home\Model\GameAccountModel();
$selectresult = $AccountMoldel->where("openid='".$jiexi["UserId"]."'")->select();
if($selectresult==false){
$data['openid'] = $jiexi["UserId"];
$data['username'] = $account1;
$data['password'] = $password1;
$data['nickname'] = $account1;
$data['level'] = '1';
$AccountMoldel->add($data);
}
$strdata['result'] = 'success';
$strdata['openid'] = $jiexi['UserId'];
$jsondata = json_encode_ex($strdata);
echo $jsondata;
return $jsondata;
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>