<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Util; use ModStart\Core\Dao\ModelUtil; class MemberCreditUtil { public static function paginateLog($nlOSA, $WLCMC, $Aqj3Z, $f2U49 = array()) { goto UMn_a; puuak: return ModelUtil::paginate('member_credit_log', $WLCMC, $Aqj3Z, $f2U49); goto rWPb3; UMn_a: $f2U49['where']['memberUserId'] = $nlOSA; goto gzLVN; gzLVN: $f2U49['order'] = array('id', 'desc'); goto puuak; rWPb3: } public static function getTotal($nlOSA) { goto VSAtM; X2RuY: return $a_yFh['total']; goto xQwkS; VSAtM: $a_yFh = ModelUtil::get('member_credit', array('memberUserId' => $nlOSA)); goto NLHp7; NLHp7: if (empty($a_yFh)) { return 0; } goto X2RuY; xQwkS: } public static function change($nlOSA, $Oa6V9, $gGBGD) { goto oBcdW; oBcdW: if (!$Oa6V9) { throw new \Exception('MemberCreditUtil -> change empty'); } goto fn5h5; Kvlru: if ($a_yFh['total'] < 0) { throw new \Exception('MemberCreditUtil -> total empty'); } goto ckg7E; kZGhd: ModelUtil::insert('member_credit_log', array('memberUserId' => $nlOSA, 'change' => $Oa6V9, 'remark' => $gGBGD)); goto Yjrce; fn5h5: $a_yFh = ModelUtil::getWithLock('member_credit', array('memberUserId' => $nlOSA)); goto BNbeI; Yjrce: $a_yFh = ModelUtil::update('member_credit', array('id' => $a_yFh['id']), array('total' => $a_yFh['total'] + $Oa6V9)); goto Kvlru; JHCv4: if ($Oa6V9 < 0 && $a_yFh['total'] + $Oa6V9 < 0) { throw new \Exception('MemberCreditUtil -> total change to empty'); } goto kZGhd; BNbeI: if (empty($a_yFh)) { $a_yFh = ModelUtil::insert('member_credit', array('memberUserId' => $nlOSA, 'total' => 0)); } goto JHCv4; ckg7E: } }