where(['email' => $email, 'appid' => $appid])->find(); //false if (!$res_user) out(122, $app_res); //账号不存在 if ($res_user['ban'] > time() || $res_user['ban'] == 999999999) out(114, $res_user['ban_notice'], $app_res); //账号被禁用 $res_code = Db::table('captcha')->where(['email' => $email, 'code' => $crc, 'new' => 'y', 'appid' => $appid])->order('id DESC')->find(); //false if (!$res_code) out(124, $app_res); //验证码不正确 Db::table('captcha')->where('id', $res_code['id'])->update(['new' => 'n']); $res = Db::table('user')->where('id', $res_user['id'])->update(['pwd' => md5($newpwd)]); if ($res) { if (defined('USER_LOG') && USER_LOG == 1) { Db::table('log')->add(['uid' => $res_user['id'], 'type' => $act, 'status' => 200, 'time' => time(), 'ip' => getip(), 'appid' => $appid]); } //记录日志 out(200, '找回密码成功', $app_res); } else { if (defined('USER_LOG') && USER_LOG == 1) { Db::table('log')->add(['uid' => $res_user['id'], 'type' => $act, 'status' => 201, 'time' => time(), 'ip' => getip(), 'appid' => $appid]); } //记录日志 out(201, '找回密码失败', $app_res); } ?>