field('U.*')->JOIN('user', 'as U', 'logon.uid=U.id')->where('logon.appid', $appid)->where('U.appid', $appid)->where('logon.token', $token)->find(); //false if (!$res_logon) out(127, $app_res); //TOKEN不存在或已失效 if ($res_logon['ban'] > time() || $res_logon['ban'] == 999999999) out(114, $res_logon['ban_notice'], $app_res); //账号被禁用 Db::table('user_logon')->where('token', $token)->update(['last_t' => time()]); //记录活动时间 if (empty($res_logon['user']) && empty($res_logon['phone'])) out(110, '没有账号不可以解绑邮箱', $app_res); //没有账号不可以解绑 if (empty($res_logon['email'])) out(165, $app_res); //没有绑定 $res_code = Db::table('captcha')->where(['email' => $res_logon['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_logon['id'])->update(['email' => '']); if ($res) { if (defined('USER_LOG') && USER_LOG == 1) { Db::table('log')->add(['uid' => $res_logon['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_logon['id'], 'type' => $act, 'status' => 201, 'time' => time(), 'ip' => getip(), 'appid' => $appid]); } //记录日志 out(201, '解绑失败', $app_res); } ?>