From 5d4c0b186cff19aa115ac8c90b5e83c8fd75ef28 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 22 Aug 2023 15:52:12 +0800 Subject: [PATCH] 1 --- webapp/models/DynData.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/webapp/models/DynData.php b/webapp/models/DynData.php index bb449d82..72eb38e1 100644 --- a/webapp/models/DynData.php +++ b/webapp/models/DynData.php @@ -61,6 +61,32 @@ class DynData extends BaseModel { self::internalSetV($x, $y, $oldVal + $val); } + public static function incVEx($accountId, $x, $y, $val) + { + $oldVal = self::getVEx($x, $y); + SqlHelper::upsert + (myself()->_getMysql($accountId), + 't_dyndata', + array( + 'account_id' => $accountId, + 'x' => $x, + 'y' => $y + ), + array( + 'val' => $oldVal + $val, + 'modifytime' => myself()->_getNowTime() + ), + array( + 'account_id' => $accountId, + 'x' => $x, + 'y' => $y, + 'val' => $val, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + public static function decV($x, $y, $val) { self::incV($x, $y, 0 - $val);