|
@@ -109,7 +109,7 @@ pub async fn auth(
|
|
|
// 已注册时绑定设备
|
|
// 已注册时绑定设备
|
|
|
if let Some(sn)= q.state.strip_prefix("did="){
|
|
if let Some(sn)= q.state.strip_prefix("did="){
|
|
|
log(Debuging, format!("got did: {}",sn));
|
|
log(Debuging, format!("got did: {}",sn));
|
|
|
- match state.db_lite.execute("update device set belongto=? where sn=? and belongto=0", (id,sn)).await{
|
|
|
|
|
|
|
+ match state.db_lite.execute("update device set belongto=?,name=sn where sn=? and belongto=0", (id,sn)).await{
|
|
|
Err(e) => {println!("{e}");bindfail=Some("&bindfail=true");}
|
|
Err(e) => {println!("{e}");bindfail=Some("&bindfail=true");}
|
|
|
Ok(n)=>{
|
|
Ok(n)=>{
|
|
|
if n!=0{
|
|
if n!=0{
|
|
@@ -186,7 +186,7 @@ pub async fn auth(
|
|
|
// 未注册时绑定设备
|
|
// 未注册时绑定设备
|
|
|
if let Some(sn)= q.state.strip_prefix("did="){
|
|
if let Some(sn)= q.state.strip_prefix("did="){
|
|
|
log(Debuging, format!("got did: {}",sn));
|
|
log(Debuging, format!("got did: {}",sn));
|
|
|
- match state.db_lite.execute("update device set belongto=? where sn=? and belongto=0", (uid,sn)).await{
|
|
|
|
|
|
|
+ match state.db_lite.execute("update device set belongto=?,name=sn where sn=? and belongto=0", (uid,sn)).await{
|
|
|
Err(e)=>{println!("{e}");bindfail=Some("&bindfail=true");},
|
|
Err(e)=>{println!("{e}");bindfail=Some("&bindfail=true");},
|
|
|
Ok(n ) => {
|
|
Ok(n ) => {
|
|
|
if n!=0{ // 设备绑定成功,update至少一条则记录并订阅
|
|
if n!=0{ // 设备绑定成功,update至少一条则记录并订阅
|