获取信息
获取信息相关接口
获取用户信息,
获取手机端基本信息,
获取网络状态,
获取wifi信息,
获取地理位置信息,
获取app相关信息,
获取浏览器的代理信息,
获取风控信息,
获取风控信息(阿波罗),
获取联系人列表,
选择联系人,
获取城市信息,
获取城市信息,
定位城市信息,
获取城市信息,
调取城市列表选取城市,
获取客户端版本号,
获取requestId,
获取环境信息,
src/doc/doc.js:177
方法
getAppInfo
getAppInfo
(
-
opt
)
Object
Defined in
src/doc/doc.js:309
Available since 0.4.6
获取app相关信息
参数:
opt
Object
参数传递
opt.success
Function
获取成功后执行的回调函数
opt.fail
Function
获取失败后执行的回调函数
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opt
| Object | 参数传递
|
Returns:
{
appVersion: <String>,
appName: <String>,
appScheme: <String>,
bundleId: <String>
}
Example:
<html>
<h1>获取app相关信息</h1>
</html>
<script>
DPZeus.getAppInfo({
success: function(data){
alert(JSON.stringify(data));
},
fail: function (error) {
alert(JSON.stringify(error));
}
});
</script>
getCity
getCity
(
-
opt
)
Object
Defined in
src/doc/doc.js:430
Available since 2.0.0
获取城市信息
参数:
opt
Object
opt.success
Function
成功回调
opt.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opt
| Object |
|
Returns:
{
locCityName: <String>,
locCity: <String>,
cityName: <String>,
}
Example:
<html>
<h1>获取城市信息</h1>
</html>
<script>
DPZeus.getCity({
success:function(e){
/*log(e.cityId); //切换城市
log(e.type); //类型
log(e.locCityId);//定位城市*/
alert(JSON.stringify(e));
},
fail: function(error){
// log('getCity fail', error);
alert(JSON.stringify(error));
}
});
</script>
getCityId
getCityId
(
-
opt
)
Object
Defined in
src/doc/doc.js:452
获取城市信息
参数:
opt
Object
opt.success
Function
参数名 | 类型 | 标识 | 描述 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
opt
| Object |
|
Returns:
{
locCityName: <String>,
locCity: <String>,
cityName: <String>,
}
Example:
<html>
<h1>获取城市信息</h1>
</html>
<script>
DPZeus.getCityId({
success:function(e){
/*log(e.cityId); //切换城市
log(e.locCityId);//定位城市*/
alert(JSON.stringify(e));
},
fail: function (error) {
alert(JSON.stringify(error));
}
});
</script>
getCityInfo
getCityInfo
(
-
opts
)
Object
Defined in
src/doc/doc.js:493
Available since 2.0.0
获取城市信息
参数:
opts
Object
opts.success
Function
成功回调
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
locCityName: <String>,
locCity: <String>,
cityName: <String>,
}
Example:
<html>
<h1>获取城市信息</h1>
</html>
<script>
DPZeus.getCityInfo({
success:function(e){
/*log(e.cityId); //切换城市
log(e.locCityId);//定位城市*/
alert(JSON.stringify(e));
},
fail: function (error) {
alert(JSON.stringify(error));
}
});
</script>
getContactList
getContactList
(
-
opts
)
Object
Defined in
src/doc/doc.js:390
获取联系人列表
参数:
opts
Object
opts.success
Function
参数名 | 类型 | 标识 | 描述 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
contactList: <Array>,// {firstName: <String>, phone: <String>, lastName: <String>}
authorized: <Boolean>,
}
Example:
<html>
<h1>获取联系人列表</h1>
</html>
<script>
DPZeus.getContactList({
success:function(e){
// 2.0.0 之后新加的属性
/*log(result.authorized); // 用户是否授权app读取通讯录,如果为fasle,将无法获取获取联系人
e.contactList.forEach(function(people){
log(e.lastName); // 姓
log(e.firstName); // 名
log(e.phone); // 号码
});*/
// log(e.authorized); // 用户是否授权
alert(JSON.stringify(e));
},
fail: function(error){
// log('getContactList error', error);
alert(JSON.stringify(error));
}
});
</script>
getCX
getCX
(
-
opts
)
Object
Defined in
src/doc/doc.js:375
获取风控信息(阿波罗)
参数:
opts
Object
opts.success
Function
成功回调
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
Base
Example:
<html>
<h1>获取风控信息(阿波罗)</h1>
</html>
<script>
DPZeus.getCX({
success: function(data){
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
})
</script>
getDeviceInfo
getDeviceInfo
(
-
opt
)
Object
Defined in
src/doc/doc.js:223
Available since 0.3.0
获取手机端基本信息
参数:
opt
Object
opt.success
Function
opt.fail
Function
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opt
| Object |
|
Returns:
{
mac: <String>, // mac地址
imei: <String>, // IMEI号
idfa: <String>
}
Example:
<html>
<h1>获取手机端基本信息</h1>
</html>
<script>
DPZeus.getDeviceInfo({
success: function(data){
// log(data);
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
})
</script>
getEnv
getEnv
(
-
opts
)
Null
Defined in
src/doc/doc.js:576
获取环境信息
参数:
opts
Object
opts.success
成功回调
opts.fail
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
TODO
`
Example:
<html>
<h1>获取环境信息</h1>
</html>
<script>
DPZeus.getEnv({
success: function(data){
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
})
</script>
getFingerprint
getFingerprint
(
-
opts
)
Object
Defined in
src/doc/doc.js:355
Available since 2.0.0
获取风控信息
参数:
opts
Object
opts.success
成功回调
opts.fail
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
fingerprint: <String>
}
Example:
<html>
<h1>风控信息</h1>
</html>
<script>
DPZeus.getFingerprint({
success: function(ret){
var fp = ret.fingerprint; //风控信息
// log('getFingerprint success', fp);
alert(JSON.stringify(ret));
},
fail: function(error){
// log('getFingerprint error', error);
alert(JSON.stringify(error));
}
});
</script>
getLocation
getLocation
(
-
opts
)
Object
Defined in
src/doc/doc.js:288
获取地理位置信息
参数:
opts
Object
opts.timeout
Number
定位超时时间
opts.success
Function
获取完毕执行的回调,回调方法中会传入获取到的经度和纬度信息
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
lng: <Number>,
lat: <Number>
}
Example:
<html>
<h1>获取地理位置信息</h1>
</html>
<script>
DPZeus.getLocation({
timeout: 6000,
success: function(result){
/*log(result.lat);
log(result.lng);*/
alert(JSON.stringify(result));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
getLocationCity
getLocationCity
(
-
opts
)
Object
Defined in
src/doc/doc.js:472
Available since 2.0.0
定位城市信息
参数:
opts
Object
opts.success
Function
成功回调
参数名 | 类型 | 标识 | 描述 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
locCityName: <String>,
locCity: <String>,
cityName: <String>,
}
Example:
<html>
<h1>定位城市信息</h1>
</html>
<script>
DPZeus.getLocationCity({
success: function(city){
var cityId = city.cityId; //切换城市id
var type = city.type; //类型'dp','mt'
// log(cityId);
// log(type);
alert(JSON.stringify(city));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
getNetworkType
getNetworkType
(
-
opts
)
Object
Defined in
src/doc/doc.js:269
获取网络状态
参数:
opts
Object
opts.success
Function
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
type: <String>
}
Example:
<html>
<h1>获取网络状态</h1>
</html>
<script>
DPZeus.getNetworkType({
success: function(e){
// log(e.networkType); // 2g, 3g, 4g, wifi
alert(JSON.stringify(e));
},
fail: function(error){
// log('getNetworkType error', error);
alert(JSON.stringify(error));
}
});
</script>
getRequestId
getRequestId
(
-
opts
)
Object
Defined in
src/doc/doc.js:557
获取请求的id
参数:
opts
Object
opts.success
成功回调
opts.fail
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
requestId: <String>
}
Example:
<html>
<h1>获取requestId</h1>
</html>
<script>
DPZeus.getRequestId({
success: function(result){
alert(JSON.stringify(result));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
getUA
getUA
(
-
opts
)
Object
Defined in
src/doc/doc.js:332
获取UA
参数:
opts
Object
opts.success
Function
成功的回调
opts.fail
Function
失败的回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
platform: <String>,
appName: <String>,
osName: <String>,
osVersion: <String>,
appVersion: <String>
}
Example:
<html>
<h1>获取UA</h1>
</html>
<script>
DPZeus.getUA({
success: function(info){
//info.appName
//info.appVersion
//info.osName
//info.osVersion
alert(JSON.stringify(info));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
getUserInfo
getUserInfo
(
-
opt
)
Object
Defined in
src/doc/doc.js:200
获取用户信息
参数:
opt
Object
opt.success
Function
参数名 | 类型 | 标识 | 描述 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
opt
| Object |
|
Returns:
{
shopId: <Number>,
userId: <String>,
edper: <String>,
shopAccountId: <Number>,
userType: <String>,
dpid: <String>
}
edper
属性只在点评管家中存在。
Example:
<html>
<h1>获取用户信息</h1>
</html>
<script>
DPZeus.getUserInfo({
success:function(user){
var type = user.type;//账户类型:‘dp’,'mt'
var userId = user.userId; //用户ID
var uuid = user.uuid; //dp用户为dpid, 美团用户为uuid(mt 7.6后没有该属性)
var token = user.token; //mt 7.6后才支持
alert(JSON.stringify(user));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
getVersion
getVersion
(
-
opts
)
Object
Defined in
src/doc/doc.js:538
获取客户端版本号
参数:
opts
Object
opts.success
Function
成功回调
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
version: <String>
}
Example:
<html>
<h1>获取客户端版本号</h1>
</html>
<script>
DPZeus.getVersion({
success: function(data){
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
})
</script>
getWifiInfo
getWifiInfo
(
-
opt
)
Object
Defined in
src/doc/doc.js:245
Available since 0.3.0
获取wifi信息
参数:
opt
Object
opt.success
Function
opt.fail
Function
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opt
| Object |
|
Returns:
{
mac: <String>,
clientType: <String>,
ssid: <String>,
lng: <Number>,
lat: <Number>
}
Example:
<html>
<h1>获取wifi信息</h1>
</html>
<script>
DPZeus.getWifiInfo({
success: function(data){
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
pickCity
pickCity
(
-
opts
)
Object
Defined in
src/doc/doc.js:515
Available since 2.0.0
调取城市列表选取城市
暂不实现
参数:
opts
Object
opts.type
Number
选择城市列表类型 0为国内城市 1为国外城市 (可选)
opts.success
Function
成功回调
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
cityName: <String>,
cityId: <String>
}
Example:
<html>
<h1>调取城市列表选取城市</h1>
</html>
<script>
DPZeus.pickCity({
success: function(data){
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>
pickContact
pickContact
(
-
opts
)
Object
Defined in
src/doc/doc.js:409
Available since 2.0.0
选择联系人
参数:
opts
Object
opts.success
Function
成功回调
opts.fail
Function
失败回调
参数名 | 类型 | 标识 | 描述 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
| Object |
|
Returns:
{
name: <String>,
phoneNumber: <String>,
}
Example:
<html>
<h1>选择联系人</h1>
</html>
<script>
DPZeus.pickContact({
success: function(data){
alert(JSON.stringify(data));
},
fail: function(error){
alert(JSON.stringify(error));
}
});
</script>