diff --git a/digital_doctor/application/api/logic/TyuserLogic.php b/digital_doctor/application/api/logic/TyuserLogic.php index 5dc3a48..7a91a95 100644 --- a/digital_doctor/application/api/logic/TyuserLogic.php +++ b/digital_doctor/application/api/logic/TyuserLogic.php @@ -53,14 +53,15 @@ class TyuserLogic extends BaseLogic - /** * desc:听译-绑定医患关系,医患客户端初始化后绑定关系 + * 请求类型:wss *请求参数: * json消息格式:[ 'action'=>'Tyuser/bindRelation', 'items'=>[ 'username'=>'13333322323', + 'type'=>'doc',//用户类型:user=用户,doc=医生 ] ] * author:wh @@ -76,15 +77,20 @@ class TyuserLogic extends BaseLogic $json = Tools::wss_json($action,'username参数错误'); return Gateway::sendToClient($clientid, $json); } - Db::table('fa_ty_users') - ->data([ - 'clientid'=>$clientid, - ]) - ->where('username',$items['username']) - ->update(); - - //$json = Tools::wss_json('ok','username参数错误'); - //return Gateway::sendToClient($clientid, $json); + if(empty($items['type'])){ + $json = Tools::wss_json($action,'type参数错误'); + return Gateway::sendToClient($clientid, $json); + } + //绑定设备 + $devidata = [ + 'username'=>$items['username'], + 'clientid'=>$clientid, + 'type'=>$items['type'], + ]; + Mmodel::existsUpdateInsert('fa_device',[ + 'username'=>$items['username'], + 'clientid'=>$clientid, + ],$devidata); return null; } } \ No newline at end of file