<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Util; use ModStart\Core\Dao\ModelUtil; class MemberCreditUtil { public static function paginateLog($shbIl, $iXUoW, $VUK_X, $r2pbP = array()) { goto H7we8; QpdAJ: $r2pbP['order'] = array('id', 'desc'); goto ZZ_nv; ZZ_nv: return ModelUtil::paginate('member_credit_log', $iXUoW, $VUK_X, $r2pbP); goto QqgIg; H7we8: $r2pbP['where']['memberUserId'] = $shbIl; goto QpdAJ; QqgIg: } public static function getTotal($shbIl) { goto J_QOl; MSH4w: if (empty($QjHVP)) { return 0; } goto Kjk5x; J_QOl: $QjHVP = ModelUtil::get('member_credit', array('memberUserId' => $shbIl)); goto MSH4w; Kjk5x: return $QjHVP['total']; goto lzwoX; lzwoX: } public static function change($shbIl, $itE5Q, $VPhy3) { goto CRD2E; g1hFr: ModelUtil::insert('member_credit_log', array('memberUserId' => $shbIl, 'change' => $itE5Q, 'remark' => $VPhy3)); goto QbbZo; CPjDp: if ($itE5Q < 0 && $QjHVP['total'] + $itE5Q < 0) { throw new \Exception('MemberCreditUtil -> total change to empty'); } goto g1hFr; wjZ1L: $QjHVP = ModelUtil::getWithLock('member_credit', array('memberUserId' => $shbIl)); goto vJuWi; vJuWi: if (empty($QjHVP)) { $QjHVP = ModelUtil::insert('member_credit', array('memberUserId' => $shbIl, 'total' => 0)); } goto CPjDp; QbbZo: ModelUtil::update('member_credit', array('id' => $QjHVP['id']), array('total' => $QjHVP['total'] + $itE5Q)); goto JwXSI; CRD2E: if (!$itE5Q) { throw new \Exception('MemberCreditUtil -> change empty'); } goto wjZ1L; JwXSI: } }