当前位置: 首页>>代码示例>>PHP>>正文


PHP UserModel::commit方法代码示例

本文整理汇总了PHP中UserModel::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::commit方法的具体用法?PHP UserModel::commit怎么用?PHP UserModel::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserModel的用法示例。


在下文中一共展示了UserModel::commit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editAction

 public function editAction()
 {
     $p = $_REQUEST;
     $pWeight = empty($p['weight']) ? Tool_Fnc::ajaxMsg('干体重不能为空') : floatval($p['weight']);
     $tTime = time();
     $tDWLMO = new DryweightlogModel();
     $tDWLRow = $tDWLMO->field('id')->where('uid = ' . $this->tUid . ' and date = \'' . date('Y-m-d', $tTime) . '\'')->fRow();
     $tUMO = new UserModel();
     $tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
     if ($tURow['user_type'] == 1) {
         Tool_Fnc::ajaxMsg('操作异常');
     }
     $tData = array('weight' => $pWeight);
     if (empty($tDWLRow['id'])) {
         $tData = array_merge($tData, array('created' => $tTime, 'uid' => $this->tUid, 'date' => date('Y-m-d', $tTime), 'year' => date('Y', $tTime), 'month' => date('Y-m', $tTime)));
     } else {
         $tData = array_merge($tData, array('updated' => $tTime, 'id' => $tDWLRow['id']));
     }
     $tUMO->begin();
     if (!$tDWLMO->save($tData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('修改失败 001');
     }
     $tUData = array('id' => $this->tUid, 'dry_weight' => $pWeight, 'updated' => $tTime);
     if (!$tUMO->update($tUData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('修改失败 002');
     }
     $tUMO->commit();
     Tool_Fnc::ajaxMsg('操作成功', 1);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:31,代码来源:Dryweight.php

示例2: indexAction


//.........这里部分代码省略.........
     }
     //did入库
     $tUDMO = new UserdidModel();
     $tUDRow = $tUDMO->field('count(0) c')->where('uid = ' . $tID . ' and did = \'' . $pDid . '\'')->fRow();
     if (empty($tUDRow['c'])) {
         $tData = array('uid' => $tID, 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip());
         if (!$tUDMO->insert($tData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 002');
         }
     }
     $tTokenarr = $this->creattoken($tID);
     //获取数据
     $tSex = $tBUserInfo['SEX'] == '男' ? 1 : 0;
     $tPatientId = $tBUserInfo['PATIENT_ID'];
     //提取干体重
     $tDryWeight = Oci_User::getDryWeight($tPatientId);
     $tDatas = array('id' => $tID, 'nickname' => $tBUserInfo['NAME'], 'sex' => $tSex, 'dry_weight' => $tDryWeight['BODY_WEIGHT'], 'date_of_birth' => $tBUserInfo['DATE_OF_BIRTH'], 'headimg' => $tBUserInfo['PHOTO']);
     if (!$tUMO->update($tDatas)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 003');
     }
     //新建健康档案
     $tUserAssessment = Oci_User::getAssessment($tPatientId);
     $tUserAssessment['uid'] = $tID;
     $tUserAssessment['name'] = $tBUserInfo['NAME'];
     //his系统数据更新
     $tCMO = new CenterModel();
     $tCRow = $tCMO->field('id,name')->where(' center_id = \'' . $tBUserInfo['CENTER_ID'] . '\'')->fRow();
     if (!empty($tCRow['id'])) {
         $tUserAssessment['medical_id'] = $tCRow['id'];
         //用户透析中心字段更新
         $tUMedicalData = array('id' => $tID, 'center_id' => $tCRow['id'], 'medical_addr' => $tCRow['name']);
         if (!$tUMO->update($tUMedicalData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 003');
         }
     } else {
         $tCenterdict = Oci_User::getCenterdict($tBUserInfo['CENTER_ID']);
         $tCData = array('center_id' => $tCenterdict['CENTER_ID'], 'center_code' => $tCenterdict['CENTER_CODE'], 'name' => $tCenterdict['CENTER_NAME'], 'position' => $tCenterdict['POSITION'], 'created' => $tTime);
         if (!($tUserAssessment['medical_id'] = $tCMO->insert($tCData))) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 008');
         }
         //用户透析中心字段更新
         $tUMedicalData = array('id' => $tID, 'center_id' => $tUserAssessment['medical_id'], 'medical_addr' => $tCenterdict['CENTER_NAME']);
         if (!$tUMO->update($tUMedicalData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 003');
         }
     }
     //健康档案
     $tUA = new UserassessmentModel();
     foreach ($tUserAssessment as $k => $v) {
         $tUserAssessmentData[strtolower($k)] = $v;
     }
     $tUserAssessmentData['created'] = $tTime;
     //添加透析方式默认值
     $tUserAssessmentData['method'] = 1;
     if (!$tUA->insert($tUserAssessmentData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 004');
     }
     //干重记录表数据更新
     $tDWMO = new DryweightlogModel();
     /*$tDryWeightLog = array(
           'uid' => $tID,
           'weight' => $tDryWeight['BODY_WEIGHT'],
           'date' => $tDryWeight['TREATE_DATE'],
           'month' => date('Y-m',strtotime($tDryWeight['TREATE_DATE'])),
           'year' => date('Y',strtotime($tDryWeight['TREATE_DATE'])),
           'patient_id' => $tPatientId,
           'created' => time(),
       );*/
     $tSql = 'update ' . $tDWMO->table . ' set uid=' . $tID . ' where patient_id = \'' . $tPatientId . '\'';
     if (!$tDWMO->exec($tSql)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 005');
     }
     #更新白求恩排班表
     $tSDMO = new BqeschedulingdetailModel();
     $tSql = 'update ' . $tSDMO->table . ' set uid = ' . $tID . ' where patient_id = \'' . $tPatientId . '\'';
     if (!$tSDMO->exec($tSql)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 006');
     }
     #透析 - 治疗单主记录
     $tTRMO = new BqetreatmentrecordModel();
     $tSql = 'update ' . $tTRMO->table . ' set uid = ' . $tID . ' where patient_id = \'' . $tPatientId . '\'';
     if (!$tTRMO->exec($tSql)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 007');
     }
     $tUMO->commit();
     //匿名转实名
     $tUMO->incognito_real($pDid, $tID);
     $tTokenarr = array_merge($tTokenarr, array('user_type' => 1));
     Tool_Fnc::ajaxMsg("注册成功,白求恩用户", 1, $tTokenarr);
     //注册成功返回token
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:101,代码来源:Reg.php

示例3: moneysave

 public function moneysave()
 {
     if (!IS_POST) {
         $this->message2('非法操作!', __APP__ . '/Admin');
     }
     $user_model = new UserModel();
     $user_account = new Model('account_log');
     $id = I('id', 0);
     if ($id <= 0) {
         $this->message('未指定会员信息!', __URL__ . '/index');
     }
     $user = $user_model->where('id=' . $id)->find();
     if (empty($user)) {
         $this->message('未找到指定会员信息!', __URL__ . '/index');
     }
     $account_type = I('account_type', 1);
     $bg_type = I('bg_type', 1);
     $addmoney = I('addmoney', 0);
     $reason = I('reason', '');
     if ($addmoney <= 0) {
         $this->message('请填写变动金额!', __URL__ . '/addmoney/id/' . $id);
     }
     if ($reason == '') {
         $this->message('请填写变更原因!', __URL__ . '/addmoney/id/' . $id);
     }
     if ($account_type == 1) {
         if ($bg_type == 1) {
             $money = $user['money'] + $addmoney;
             $content = '增加账户余额' . $addmoney;
         } else {
             $money = $user['money'] - $addmoney;
             $content = '减少账户余额' . $addmoney;
             $addmoney = 0 - $addmoney;
         }
         if ($money < 0) {
             $this->message('该人账户可用余额已不足以冲减!', __URL__ . '/addmoney/id/' . $id);
         }
         $data['money'] = $money;
     } else {
         if ($account_type == 2) {
             if ($bg_type == 1) {
                 $money = $user['refer_money'] + $addmoney;
                 $content = '增加可用佣金' . $addmoney;
             } else {
                 $money = $user['refer_money'] - $addmoney;
                 $content = '减少可用佣金' . $addmoney;
                 $addmoney = 0 - $addmoney;
             }
             $data['refer_money'] = $money;
             if ($money < 0) {
                 $this->message('该人账户可用佣金已不足以冲减!', __URL__ . '/addmoney/id/' . $id);
             }
         }
     }
     $user_model->startTrans();
     if (false !== $user_model->where('id=\'' . $id . '\'')->data($data)->save()) {
         $account_log['user_id'] = $id;
         $account_log['stage'] = 'admin';
         $account_log['money'] = $addmoney;
         $account_log['comm'] = $reason;
         $account_log['addtime'] = $this->getDate();
         if ($account_type == 1) {
             $account_log['remain_money'] = $money;
             $account_log['remain_refer_money'] = $user['refer_money'];
         } else {
             if ($account_type == 2) {
                 $account_log['remain_money'] = $user['money'];
                 $account_log['remain_refer_money'] = $money;
             }
         }
         if (false !== $user_account->data($account_log)->add()) {
             $user_model->commit();
             $content = '对会员' . $user['username'] . $content . ',若为本人操作,请忽略该条提醒!';
             send_fetion($content);
             $this->message('操作成功', __URL__ . '/index');
         } else {
             $user_model->rollback();
             $this->message('操作失败1:' . $user_account->getError(), __URL__ . '/addmoney/id/' . $id);
         }
     } else {
         $user_model->rollback();
         $this->message('操作失败2:' . $user_account->getDbError());
     }
 }
开发者ID:kwdwkiss,项目名称:kongbao8,代码行数:84,代码来源:UserAction.class.php

示例4: editAction

 public function editAction()
 {
     $p = $_REQUEST;
     $tUMO = new UserModel();
     $tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
     if ($tURow['user_type'] == 1) {
         Tool_Fnc::ajaxMsg('操作异常');
     }
     $tData = array();
     if (isset($p['name'])) {
         $tData = array_merge($tData, array('nickname' => Tool_Fnc::safe_string($p['name'])));
     }
     if (isset($p['date_of_birth'])) {
         $tData = array_merge($tData, array('date_of_birth' => date('Y-m-d', strtotime($p['date_of_birth']))));
     }
     if (isset($p['sex'])) {
         $tData = array_merge($tData, array('sex' => intval($p['sex'])));
     }
     $tTime = time();
     //存在干体重修改,则更新干体重记录
     $pDryWeight = !isset($p['dry_weight']) ? '' : floatval($p['dry_weight']);
     $tUMO->begin();
     if (!empty($pDryWeight)) {
         $tData = array_merge($tData, array('dry_weight' => $pDryWeight));
         $tDWLMO = new DryweightlogModel();
         $tDWLRow = $tDWLMO->field('id')->where('uid = ' . $this->tUid . ' and date = \'' . date('Y-m-d', $tTime) . '\'')->fRow();
         if (empty($tDWLRow['id'])) {
             $tDWLData = array('weight' => $pDryWeight, 'uid' => $this->tUid, 'created' => $tTime, 'date' => date('Y-m-d', $tTime), 'month' => date('Y-m', $tTime), 'year' => date('Y', $tTime));
         } else {
             $tDWLData = array('weight' => $pDryWeight, 'updated' => $tTime, 'id' => $tDWLRow['id']);
         }
         if (!$tDWLMO->save($tDWLData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('修改失败 001');
         }
     }
     //存在名字修改,则更新健康档案中的名字字段
     if (isset($p['name']) && !empty($p['name'])) {
         $tUAMO = new UserassessmentModel();
         $tUARow = $tUAMO->field('id,name')->where('uid = ' . $this->tUid)->fRow();
         if (!empty($tUARow['id'])) {
             $tUADatas = array('id' => $tUARow['id'], 'name' => Tool_Fnc::safe_string($p['name']), 'updated' => $tTime);
             if (!$tUAMO->update($tUADatas)) {
                 $tUMO->back();
                 Tool_Fnc::ajaxMsg('修改失败 002');
             }
         } else {
             $tUADatas = array('uid' => $this->tUid, 'name' => Tool_Fnc::safe_string($p['name']), 'created' => $tTime);
             if (!$tUAMO->insert($tUADatas)) {
                 $tUMO->back();
                 Tool_Fnc::ajaxMsg('修改失败 002');
             }
         }
     }
     $tData = array_merge($tData, array('id' => $this->tUid, 'updated' => $tTime));
     if (!$tUMO->update($tData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('修改失败 003');
     }
     $tUMO->commit();
     Tool_Fnc::ajaxMsg('操作成功', 1);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:62,代码来源:User.php


注:本文中的UserModel::commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。