<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Model; use Illuminate\Database\Eloquent\Model; class MemberDataStatistic extends Model { protected $table = 'member_data_statistic'; public static function getCreateMemberUser($M3rBS) { goto cz4sc; lPOhH: return $XrUDf->toArray(); goto xdsK3; cz4sc: $XrUDf = self::where('id', $M3rBS)->first(); goto N1F80; N1F80: if (empty($XrUDf)) { goto lNC8b; iMbFX: $nnCtx->sizeLimit = modstart_config('Member_DataStatisticDefaultLimit', 1024); goto tNt2e; LdpBu: $nnCtx->id = $M3rBS; goto iMbFX; DsGG1: self::updateMemberUserUsedSize($M3rBS); goto YL_6i; tNt2e: $nnCtx->save(); goto DsGG1; lNC8b: $nnCtx = new self(); goto LdpBu; YL_6i: return self::getCreateMemberUser($M3rBS); goto ad3sj; ad3sj: } goto lPOhH; xdsK3: } public static function updateMemberUser($M3rBS, $Pg57y) { goto eGXmP; K7BIY: foreach ($Pg57y as $MFVkb => $YxV2x) { $nnCtx->{$MFVkb} = $YxV2x; } goto fGsNv; tlPHG: if ($HKM0o) { self::updateMemberUserUsedSize($M3rBS); } goto iXMvx; D178P: $HKM0o = false; goto Jz3MY; Jz3MY: if (empty($nnCtx)) { goto gVvue; AUDcw: $HKM0o = true; goto lE1z6; wg_9Q: $nnCtx->id = $M3rBS; goto AUDcw; gVvue: $nnCtx = new self(); goto wg_9Q; lE1z6: } goto K7BIY; eGXmP: $nnCtx = self::where('id', $M3rBS)->first(); goto D178P; fGsNv: $nnCtx->save(); goto tlPHG; iXMvx: } public static function calcMemberUserUsedSize($M3rBS) { $EWgvi = MemberUpload::where(array('userId' => $M3rBS))->leftJoin('data', 'data.id', '=', 'member_upload.dataId')->sum('data.size'); return intval($EWgvi); } public static function updateMemberUserUsedSize($M3rBS) { $EUGER = array('sizeUsed' => self::calcMemberUserUsedSize($M3rBS)); self::where('id', $M3rBS)->update($EUGER); } }