<?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($gZ39D) { goto l5vh2; SnlWD: if (empty($rBX9E)) { goto nuLR4; edWbg: return self::getCreateMemberUser($gZ39D); goto bbqNQ; BvrCv: $QjHVP->id = $gZ39D; goto ANwy1; ANwy1: $QjHVP->sizeLimit = modstart_config('Member_DataStatisticDefaultLimit', 1024); goto J2Az1; nuLR4: $QjHVP = new self(); goto BvrCv; ACFsE: self::updateMemberUserUsedSize($gZ39D); goto edWbg; J2Az1: $QjHVP->save(); goto ACFsE; bbqNQ: } goto i3L9B; l5vh2: $rBX9E = self::where('id', $gZ39D)->first(); goto SnlWD; i3L9B: return $rBX9E->toArray(); goto tXez9; tXez9: } public static function updateMemberUser($gZ39D, $avcnU) { goto ry6j0; wZ2sK: $QjHVP->save(); goto Azlnu; ry6j0: $QjHVP = self::where('id', $gZ39D)->first(); goto wnhPS; Azlnu: if ($ZjBZH) { self::updateMemberUserUsedSize($gZ39D); } goto kM1q5; LXHcS: if (empty($QjHVP)) { goto DmDfd; CoLmZ: $QjHVP->id = $gZ39D; goto CmcUD; DmDfd: $QjHVP = new self(); goto CoLmZ; CmcUD: $ZjBZH = true; goto zW1xF; zW1xF: } goto tRrmh; tRrmh: foreach ($avcnU as $KAKiA => $Iim2u) { $QjHVP->{$KAKiA} = $Iim2u; } goto wZ2sK; wnhPS: $ZjBZH = false; goto LXHcS; kM1q5: } public static function calcMemberUserUsedSize($gZ39D) { $mAmuv = MemberUpload::where(array('userId' => $gZ39D))->leftJoin('data', 'data.id', '=', 'member_upload.dataId')->sum('data.size'); return intval($mAmuv); } public static function updateMemberUserUsedSize($gZ39D) { $Gszjy = array('sizeUsed' => self::calcMemberUserUsedSize($gZ39D)); self::where('id', $gZ39D)->update($Gszjy); } }