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


PHP Model_Base::rollback方法代码示例

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


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

示例1: updMoney

 /**
  * 更新用户余额
  * 
  * @param unknown $aUser            
  * @param unknown $aParam            
  */
 public static function updMoney($aUser, $aParam, $iPayID = 0)
 {
     if (Db_Orm::getCommitCnt() == 0) {
         throw new Exception('处理钱一定要用事务处理!');
         return false;
     }
     if ($aParam['iMoney'] == 0) {
         return 1;
     }
     if (is_array($aUser)) {
         $iUserID = $aUser['iUserID'];
     } else {
         $iUserID = (int) $aUser;
     }
     $aUser = Model_User::getDetail($iUserID);
     // 增加之前余额判断
     $iRet = Model_User::query('UPDATE t_user SET iMoney=iMoney+' . $aParam['iMoney'] . ' WHERE iUserID=' . $iUserID . ' AND iMoney=' . $aUser['iMoney']);
     if ($iRet != 1) {
         Model_Base::rollback();
         throw new Exception('处理钱一定要用事务处理!');
         return false;
     }
     if ($iPayID == 0) {
         $aRow = array('iUserID' => $iUserID, 'iPayment' => $aParam['iPayment'], 'iSource' => $aParam['iSource'], 'sReaName' => isset($aParam['sReaName']) ? $aParam['sReaName'] : '', 'iPayType' => isset($aParam['iPayType']) ? $aParam['iPayType'] : 0, 'iPayMoney' => $aParam['iMoney'], 'iUserMoney' => $aUser['iMoney'] + $aParam['iMoney'], 'sOpenName' => isset($aParam['sOpenName']) ? $aParam['sOpenName'] : '', 'sBankName' => isset($aParam['sBankName']) ? $aParam['sBankName'] : '', 'sPayAccount' => isset($aParam['sPayAccount']) ? $aParam['sPayAccount'] : '', 'iPayStatus' => isset($aParam['iPayStatus']) ? $aParam['iPayStatus'] : 1, 'sPayOrder' => isset($aParam['sPayOrder']) ? $aParam['sPayOrder'] : '', 'sMyOrder' => isset($aParam['sMyOrder']) ? $aParam['sMyOrder'] : '', 'sRemark' => isset($aParam['sRemark']) ? $aParam['sRemark'] : '');
         $iPayID = self::addData($aRow);
     } else {
         $aRow = array('iAutoID' => $iPayID, 'iUserMoney' => $aUser['iMoney'] + $aParam['iMoney'], 'iPayStatus' => isset($aParam['iPayStatus']) ? $aParam['iPayStatus'] : 1, 'sPayOrder' => isset($aParam['sPayOrder']) ? $aParam['sPayOrder'] : '', 'sMyOrder' => isset($aParam['sMyOrder']) ? $aParam['sMyOrder'] : '', 'sRemark' => isset($aParam['sRemark']) ? $aParam['sRemark'] : '');
         self::updData($aRow);
     }
     return $iPayID;
 }
开发者ID:pancke,项目名称:yyaf,代码行数:37,代码来源:Finance.php


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