直播平台源代码,bmob_gudongStpeAdd
直播平台源代码,bmob_gudongStpeAdd
function onRequest(request, response, modules) {
var access_token;
var stpe=0;
if(request.body.stpe){
access_token = request.body.access_token;
stpe = request.body.stpe;
}
if(request.query.stpe){
access_token = request.query.access_token;
stpe = request.query.stpe;
}
if(!stpe || !access_token ){
response.send('there is an error:TypeError: Cannot read property "cloudcode" of null or 404');
}
GetAccoun(access_token);
function addStpeTemp(){
var url = 'http://api.codoon.com/api/mobile_steps_upload_detail';
// var data_string = '{"date":' + thisdate () + ',"content":' + getSpetContect(10000) + '}';
// var data_string = {"date":thisdate (),"content":[getSpetContect(10000)]};
var data_string = {"date":thisdate(),"content":[getSpetContect(stpe)]};
var ada = JSON.stringify(data_string);
ada = ada.replace('["[','[[');
ada = ada.replace(']"]',']]');
for(var yy=0;yy<30;yy++){
ada = ada.replace('\\','');
}
data_string = JSON.parse(ada);
var header = {
'Accept':' */*',
'Gaea':' 9f1a0eae65432a7ec2f4dd9d98075aa9',
'Timestamp':' 1471771801',
'did':' 23-e3ef00b233ce7b93efa5b30cf4862ab6',
'Authorization':' Bearer '+access_token,
'Proxy-Connection':' keep-alive',
'Cookie':' sessionid=xmsid310348803336061416868533',
'Uranus':' 6jGUpdKAlalJqhTWK3TMHE0Cq0ifFHcjvNV1tSjKpPqBf07ZLMNSSExmhY1rSwrs',
'User-Agent':' CodoonSport(6.11.0 1190;iOS 8.1.3;iPhone)',
'Content-Type':' application/json'
// 'Content-Type':'text/html; charset=utf-8'
};
var http_options = {};
http_options['headers'] = header;
http_options['method'] = 'POST'; //GET POST
http_options['timeout'] = 50000;
http_options['url'] = url;
http_options['body'] = JSON.stringify(data_string);
// http_options['body'] = JSON.stringify(JSON.parse(ada));
// http_options['body'] = data_string;
fetch_url(http_options, function(err, body){
// var dattttt = '{"data":{"calories":0.6477391482330859,"date":"2016-08-20","meters":1,"steps":301,"total_time":1200,"user_id":"f117fab7-37d8-4335-8233-063bc9aa651b"},"description":"","status":"OK"}';
// body = dattttt;
// response.send(dattttt +"");
try{
var pe = JSON.parse(body);
if(pe.status == 'OK'){
}
else if(pe.error == 'invalid_token'){
response.send('您的账号已经在其设备登陆,重新登陆,请回复:登陆');
return;
}
else if(pe.error == 'invalid_request'){
response.send('无效的请求');
return;
}
else if(pe.description == 'update too frequent'){
response.send('刷步频率过快,请稍后再试');
return;
}
else if(pe.error){
response.send(pe.error);
return;
}
else{
response.send(body+'{ null StpeAdd');
return;
}
var per = pe.data;
if(per.length > 0){
var perm = per[0];
var steps = perm.steps;
// response.send(JSON.parse(perm).steps);
// response.send(steps +"");
// response.send(perm + "per" + per.length);
response.send(
'' + '刷' + stpe + '步成功!'//steps
+ '\n\n当前步数:'+steps
+ '\n\n到期时间:' + '&&&&&&'
// + '\n\n*刷步注意事项<a href="http://mp.weixin.qq.com/s?__biz=MzA4NDU3NDQzNQ==&mid=504711586&idx=1&sn=966964e7b66bbee2c41f6ddc45c00e1e">点击查看*</a>'
// + '\n\n *使用教程<a href="http://keji58.github.io/yue#about">请戳我*</a>'
+ '\n\n*最近微信同步严格,总步数超过5w,会有一定几率同步失败* 晚上11点到凌晨1点请不要刷!'
);
// [0].steps
}else if(per.steps){
var steps = per.steps;
// response.send(steps +"");
response.send(
'' + '刷' + stpe + '步成功!'//steps
+ '\n\n当前步数:'+steps
+ '\n\n到期时间:' + '&&&&&'
// + '\n\n*刷步注意事项<a href="http://mp.weixin.qq.com/s?__biz=MzA4NDU3NDQzNQ==&mid=504711586&idx=1&sn=966964e7b66bbee2c41f6ddc45c00e1e">点击查看*</a>'
// + '\n\n *使用教程<a href="http://keji58.github.io/yue#about">请戳我*</a>'
+ '\n\n*最近微信同步严格,总步数超过5w,会有一定几率同步失败* 晚上11点到凌晨1点请不要刷!'
);
}
else{
body = body + '[ ON JSON 请发给管理员';
}
}catch(e){
body = body + '[ ON catch 请发给管理员';
}
response.send(body);
}
);
}
以上就是直播平台源代码,bmob_gudongStpeAdd, 更多内容欢迎关注之后的文章