Commit 2f30da06 by 朱建香

增加获取电话号码方法

parent f1b5ce2d
......@@ -192,7 +192,23 @@ uPublic.upDateRead = async function(key, time){
}
}
//获取手机号码
uPublic.getPhoneNumber = function(data){
if(data.relAccounts){
let accounts = data.relAccounts;
let flag = false
for(let i=0; i<accounts.length; i++){
if(data.auid === accounts[i].auid){
return accounts[i].name;
flag = true;
}else if(flag === false){
return false;
}
}
}else{
return false;
}
}
iot.ready(() => {
uPublic.recalc();
......
......@@ -195,8 +195,9 @@ function getInfo(self, lockId, relId, uuid){
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
let name = uPublic.getPhoneNumber(data);
//云端绑定
deviceBind(self, lockId, relId, data.auid);
deviceBind(self, lockId, relId, data.auid, name);
// deviceBind(self, lockId, relId);
}
},
......@@ -209,12 +210,13 @@ function getInfo(self, lockId, relId, uuid){
}
// 云端绑定
function deviceBind(self, lockId, relId, auid){
function deviceBind(self, lockId, relId, auid, name){
iot.business.api.sendCustom('lock/bindUser',{
data: {
device_id: lockId,
rel_id: relId,
auid: auid,
name: name,
// mac: parameters.mac,
nickname: ''
},
......
......@@ -362,8 +362,9 @@ function getInfo(self, deviceId, productId,uuid){
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
let name = uPublic.getPhoneNumber(data);
//云端绑定
bind(self, deviceId, productId, data.auid);
bind(self, deviceId, productId, data.auid, name);
// bind(self, deviceId, productId);
}
},
......@@ -376,12 +377,13 @@ function getInfo(self, deviceId, productId,uuid){
}
//云端绑定
function bind(self, deviceId, productId, auid){
function bind(self, deviceId, productId, auid, name){
iot.business.api.sendCustom('lock/bind',{
data: {
product_id: productId,
device_id: deviceId,
auid: auid,
name: name,
// mac: sn,
nickname: '',
lockUserName: Vue.t('wifiAdd.defaultNickName')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment