<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 一、家庭檔案信息顯示 ### 1.調試接口 +++ get:http://www.dakaifa.net/index.php?g=App&m=My&a=familyDoc *int:uid=111#說明文字 limit=2#顯示幾條 <<< success [ { "id": "27", "uid": "111", "cid": "1", "username": "掌門", "avatar": "http://dakaifa.net/data/upload/avatar/57b683ca5e92c.jpg", "age": "50", "diseases_history": "慢性病", "name": "子女" }, { "id": "34", "uid": "111", "cid": "1", "username": "張威 ", "avatar": "http://dakaifa.net/data/upload/avatar/579eb36aad16c.jpg", "age": "30", "diseases_history": "胃病,慢性病", "name": "子女" } ] <<< error +++ ### 2.接口代碼 ``` public function familyDoc(){ $uid=$_GET['uid']; $limit=$_GET['limit']; $join = "".C('DB_PREFIX').'file_classify as b on a.cid =b.cid'; $rs=M('Family_files'); $field="a.id,a.uid,a.cid,a.username,a.avatar,a.age,a.diseases_history,b.name"; if($limit){ $docs=$rs->alias("a")->join($join)->field($field)->where("uid={$uid}")->limit($limit)->select(); }else{ $docs=$rs->alias("a")->join($join)->field($field)->where("uid={$uid}")->select(); } foreach ($docs as &$value) { $value['avatar']="http://".$_SERVER['SERVER_NAME']."/data/upload/avatar/". $value['avatar']; } echo json_encode($docs); } ``` ## 二、家庭檔案信息添加 ### 1.調試接口 +++ post:http://www.dakaifa.net/index.php?g=App&m=My&a=submit_familyDoc *username=111#用戶名 *age=20#年齡 *avatar=qq.jpg#頭像 //不支持 *sex=0#性別 *vaccine_time=1989-09-10#疫苗時間 *health_time=1989-09-10#體檢時間 *health_status=優秀#健康狀況 *diseases_history=胃病#疾病史 *allergic_history=羅紅霉素#過敏史 *yanjiu_survey=不喝酒不吸煙#煙酒史 *health_investment=運動健身,家庭醫生與服務#健康投資 *cid=1#分類id *uid=113#用戶id <<< success { "msg": 1 } <<< error { "msg": 0 } +++ ### 2.接口代碼 ``` public function submit_familyDoc(){ // 家庭檔案id $fid=$_POST['fid']; $familyInfo=$_POST['familyInfo']; // 處理頭像上傳 $upload = new \Think\Upload();// 實例化上傳類 $upload->maxSize = 3145728 ;// 設置附件上傳大小 $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 設置附件上傳類型 $upload->rootPath = './'.C("UPLOADPATH"); // 設置附件上傳根目錄 $upload->savePath = './avatar/'; // 設置附件上傳(子)目錄 $info = $upload->upload(); $rst=json_decode($familyInfo,true); $rst['diseases_history']=implode(',', $rst['diseases_history']); $rst['allergic_history']=implode(',', $rst['allergic_history']); $rst['health_investment']=implode(',', $rst['health_investment']); // 數據寫入 $family_model=M('Family_files'); $data=array( 'username'=>$rst['username']?$rst['username']:$_POST['username'], 'avatar' =>$info["upfile"]['savename'], 'sex' => $rst['sex']?$rst['sex']:$_POST['sex'], 'age' => $rst['age']?$rst['age']:$_POST['age'], 'vaccine_time' =>$rst['vaccine_time']?$rst['vaccine_time']:$_POST['vaccine_time'], 'health_time' =>$rst['health_time']?$rst['health_time']:$_POST['health_time'], 'health_status' => $rst['health_status']?$rst['health_status']:$_POST['health_status'], 'diseases_history' => $rst['diseases_history']?$rst['diseases_history']:$_POST['diseases_history'], 'allergic_history' => $rst['allergic_history']?$rst['allergic_history']:$_POST['allergic_history'], 'yanjiu_survey' => $rst['yanjiu_survey']?$rst['yanjiu_survey']:$_POST['yanjiu_survey'], 'health_investment' => $rst['health_investment']?$rst['health_investment']:$_POST['health_investment'], "cid"=>$rst['cid']?$rst['cid']:$_POST['cid'], "uid" =>$rst['uid']?$rst['uid']:$_POST['uid'], ); // 判斷數據庫中是否存在家庭檔案 if($fid){ $ret=$family_model->find($fid); $old_img=$ret['avatar']; // 刪除原頭像 sp_delete_avatar($old_img); $row= $family_model->where("id={$fid}")->save($data); }else{ $row= $family_model->add($data); } // 判斷是否執行成功 if($row){ $arr=array('msg'=>1); echo json_encode($arr); }else{ $arr=array('msg'=>0); echo json_encode($arr); } } ``` ### 三、顯示要修改的家庭檔案信息 ### 1.調試接口 +++ post:http://www.dakaifa.net/index.php?g=App&m=My&a=updateFamilyDoc *int:fid=26#用戶的家庭檔案id <<< success { "id": "24", "username": "張天", "avatar": "http://dakaifa.net/data/upload/avatar/579819b4b91a1.jpg", "sex": "1", "age": "28", "vaccine_time": "1990/1/1", "health_time": "1990/1/1", "health_status": "優秀", "diseases_history": "胃病,慢性病", "allergic_history": "青霉素,胡蘿卜", "yanjiu_survey": "不吸煙不喝酒", "health_investment": "購買健康刊物,關注健康咨詢和書籍,購買健康保險", "cid": "3", "uid": "111" } <<< error +++ ### 2.調試接口 ``` public function updateFamilyDoc(){ $id=$_GET['fid']; // $id=24; $family_model=M('Family_files'); $rst=$family_model->find($id); $rst['avatar']="http://".$_SERVER['SERVER_NAME']."/data/upload/avatar/". $rst['avatar']; // dump($rst); echo json_encode($rst); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看