コード例 #1
0
ファイル: Weight.php プロジェクト: tanqinwang/test_own
 public function listAction()
 {
     $p = $_REQUEST;
     $pDid = empty($p['did']) ? Tool_Fnc::ajaxMsg('DID不能为空') : trim($p['did']);
     if (!Tool_Validate::az09($pDid)) {
         Tool_Fnc::ajaxMsg('did格式不正确');
     }
     $tMO = new I_WeightModel();
     $tDatas = $tMO->field('number,type,date')->where('did = \'' . $pDid . '\'')->order('date desc')->limit('2')->fList();
     Tool_Fnc::ajaxMsg('', 1, $tDatas);
 }
コード例 #2
0
ファイル: Incognitoreal.php プロジェクト: tanqinwang/test_own
 private function move()
 {
     $tRedis = Cache_Redis::instance();
     $tKeys = $tRedis->hKeys('dakang_incognito_real');
     if (!count($tKeys)) {
         return;
     }
     $tIBPMO = new I_BloodpressureModel();
     $tRBPMO = new R_BloodpressureModel();
     $tIFAMO = new I_FoodaddModel();
     $tRFAMO = new R_FoodaddModel();
     $tIWMO = new I_WeightModel();
     $tRWMO = new R_WeightModel();
     foreach ($tKeys as $tDid) {
         $tRWMO->begin();
         $tUid = $tRedis->hget('dakang_incognito_real', $tDid);
         if (empty($tUid)) {
             continue;
         }
         $tRedis->hdel('dakang_incognito_real', $tDid);
         #血压
         $tIBPDatas = $tIBPMO->field('*')->where('did = \'' . $tDid . '\'')->fList();
         foreach ($tIBPDatas as $tRow) {
             $tID = $tRow['id'];
             unset($tRow['id']);
             unset($tRow['did']);
             $tRow['uid'] = $tUid;
             if (!$tRBPMO->insert($tRow)) {
                 $tRWMO->back();
                 continue;
             }
             $tSql = 'delete from ' . $tIBPMO->table . ' where id = ' . $tID;
             if (!$tIBPMO->exec($tSql)) {
                 $tRWMO->back();
                 continue;
             }
         }
         #饮食记录
         $tIFADatas = $tIFAMO->field('*')->where('did = \'' . $tDid . '\'')->fList();
         foreach ($tIFADatas as $tRow) {
             $tID = $tRow['id'];
             unset($tRow['id']);
             unset($tRow['did']);
             $tRow['uid'] = $tUid;
             if (!$tRFAMO->insert($tRow)) {
                 $tRWMO->back();
                 continue;
             }
             $tSql = 'delete from ' . $tIFAMO->table . ' where id = ' . $tID;
             if (!$tIFAMO->exec($tSql)) {
                 $tRWMO->back();
                 continue;
             }
         }
         #体重
         $tIWDatas = $tIWMO->field('*')->where('did = \'' . $tDid . '\'')->fList();
         foreach ($tIWDatas as $tRow) {
             $tID = $tRow['id'];
             unset($tRow['id']);
             unset($tRow['did']);
             $tRow['uid'] = $tUid;
             if (!$tRWMO->insert($tRow)) {
                 $tRWMO->back();
                 continue;
             }
             $tSql = 'delete from ' . $tIWMO->table . ' where id = ' . $tID;
             if (!$tIWMO->exec($tSql)) {
                 $tRWMO->back();
                 continue;
             }
         }
         $tRWMO->commit();
     }
 }