看了一下,网上流传的那些个小米运动刷步数源码全是JS调用别人的源码,把自己的帐号密码交给别人家,博主个人心理是不太舒服的,下面是博主参照 Github上 niushuai233 大佬的 mi-sport-change JAVA 项目,写了一个PHP版的纯接口。
直接上代码
代码语言:javascript复制代码请自行理解,调用,有小BUG请自行修复,代码只供参考,勿做非法之事!
<?php
// error_reporting(0);
header("Access-Control-Allow-Origin:*");
header('Content-type:text/json; charset=utf-8');
$user = '小米运动帐号';
$pwd = '小米运动密码';
$steps = 66666; // 要刷的步数
$code = access_code($user, $pwd);
if (strlen($code) > 3) {
$tokenjson = login_token($code);
$login_token = $tokenjson['token_info']['login_token'];
$user_id = $tokenjson['token_info']['user_id'];
$appjson = get_app_token($login_token);
$user_id = $appjson['token_info']['user_id'];
$app_token = $appjson['token_info']['app_token'];
$t = get_time();
$time = date("Y-m-d", time());
$data_json = data_json($time, $steps);
$res = change_steps($t, $user_id, $app_token, $data_json);
echo $res;
} else {
exit("登录失败");
}
exit();
function access_code($user, $pwd)
{
$url = "https://api-user.huami.com/registrations/ 86{$user}/tokens";
$header = ["Content-Type " => "application/x-www-form-urlencoded;charset=UTF-8"];
$post_data = array(
"client_id" => "HuaMi",
"password" => $pwd,
"redirect_uri" => "https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html",
"token" => "access"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_HEADER, true);
$output = curl_exec($ch);
preg_match_all('/access=(.*?)&country_code/i', $output, $out);
curl_close($ch);
return $out[1][0];
}
function login_token($code)
{
$url = "https://account.huami.com/v2/client/login";
$header = ["Content-Type " => "application/x-www-form-urlencoded;charset=UTF-8"];
$post_data = array(
"app_name" => "com.xiaomi.hm.health",
"app_version" => "4.6.0",
"code" => $code,
"country_code" => "CN",
"device_id" => "2C8B4939-0CCD-4E94-8CBA-CB8EA6E613A1",
"device_model" => "phone",
"grant_type" => "access_token",
"third_name" => "huami_phone"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
$output = curl_exec($ch);
curl_close($ch);
return json_decode($output, true);
}
function get_time()
{
$url = "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$output = curl_exec($ch);
curl_close($ch);
return json_decode($output, true)['data']['t'];
}
function get_app_token($login_token)
{
$url = "https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com,api-mifit.huami.com,app-analytics.huami.com&login_token={$login_token}&os_version=4.1.0";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$output = curl_exec($ch);
curl_close($ch);
return json_decode($output, true);
}
function data_json($time, $steps)
{
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
* $datas = '[{"summary":"{"slp":{"ss":73,"lt":304,"dt":0,"st":1589920140,"lb":36,"dp":92,"is":208,"rhr":0,"stage":[{"start":269,"stop":357,"mode":2},{"start":358,"stop":380,"mode":3},{"start":381,"stop":407,"mode":2},{"start":408,"stop":423,"mode":3},{"start":424,"stop":488,"mode":2},{"start":489,"stop":502,"mode":3},{"start":503,"stop":512,"mode":2},{"start":513,"stop":522,"mode":3},{"start":523,"stop":568,"mode":2},{"start":569,"stop":581,"mode":3},{"start":582,"stop":638,"mode":2},{"start":639,"stop":654,"mode":3},{"start":655,"stop":665,"mode":2}],"ed":1589943900,"wk":0,"wc":0},"tz":"28800","stp":{"runCal":1,"cal":6,"conAct":0,"stage":[],"ttl":' . $steps . ',"dis":144,"rn":0,"wk":5,"runDist":4,"ncal":0},"v":5,"goal":8000}","data":[{"stop":1439,"value":"WhQAUA0AUAAAUAAAUAAAUAAAUAAAWhQAUAYAcBEAUAYAUA8AUAsAUAYAUDIAUCQAUDkAUCkAUD4AUC0AUFcAUD8AUCkAUCEAUCwAUCsAUB4AUCQAUBsAUCcAUBQAUDcAUBoAUCYAUFcAUCAAUDkAUCEAWhQAWhQAWhQA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fgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAA","did":"DA932FFFFE8816E7","tz":32,"src":17,"start":0}],"data_hr":"/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 /v7 ","summary_hr":"{"ct":0,"id":[]}","date":"' . $time . '"}]';
*/
return $datas;
}
function change_steps($t, $user_id, $app_token, $data_json)
{
$url = "https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={$t}";
// $header = ["Content-Type " => "application/x-www-form-urlencoded;charset=UTF-8"];
$header = ["apptoken" => $app_token];
$post_data = array(
"data_json" => $data_json,
"userid" => $user_id,
"device_type" => "0",
"last_sync_data_time" => "1589917081",
"last_deviceid" => "DA932FFFFE8816E7"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.12(0x17000c2d) NetType/WIFI Language/zh_CN");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
// return json_decode($output, true);
return $output;
}
?>