From bcff501224635b0df90c3f1165671473dd1fd90d Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 16:20:44 +0800 Subject: [PATCH] 1 --- .../controller/BaseAuthedController.class.php | 2 +- webapp/models/Parachute.php | 7 ++++++- webapp/models/UserSeasonRing.php | 21 +++++++++++-------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 7becadd7..69dfe18e 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -393,7 +393,7 @@ class BaseAuthedController extends BaseController { $headsDb = emptyReplace(json_decode($userInfo['head_list'], true), array()); $headFramesDb = emptyReplace(json_decode($userInfo['head_frame_list'], true), array()); $heads = array_unique(array_merge($heads, $headsDb)); - $headFrames = array_unique(array_merge($headFrames, $headFramesDb)); + $headFrames = array_values(array_unique(array_merge($headFrames, $headFramesDb))); $this->_updateUserInfo(array( 'head_list' => json_encode($heads), 'head_frame_list' => json_encode($headFrames), diff --git a/webapp/models/Parachute.php b/webapp/models/Parachute.php index 2d5f0b29..5c7a97fc 100644 --- a/webapp/models/Parachute.php +++ b/webapp/models/Parachute.php @@ -20,9 +20,14 @@ class Parachute extends BaseModel public static function addParachute($itemMeta){ if ($itemMeta){ if ($itemMeta['type'] == mt\Item::PARACHUTE_TYPE){ - SqlHelper::insert( + SqlHelper::upsert( myself()->_getSelfMysql(), 't_parachute', + array( + 'account_id' => myself()->_getAccountId(), + 'item_id' => $itemMeta['id'], + ), + array(), array( 'account_id' => myself()->_getAccountId(), 'item_id' => $itemMeta['id'], diff --git a/webapp/models/UserSeasonRing.php b/webapp/models/UserSeasonRing.php index bc2d8ea0..625031f4 100644 --- a/webapp/models/UserSeasonRing.php +++ b/webapp/models/UserSeasonRing.php @@ -46,17 +46,20 @@ class UserSeasonRing extends BaseModel public static function internalAddHero($conn, $itemMeta, $accountId) { - $fieldsKv = array( - 'account_id' => $accountId, - 'item_id' => $itemMeta['id'], - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - - SqlHelper::insert( + SqlHelper::upsert( $conn, 't_user_season_ring', - $fieldsKv + array( + 'account_id' => $accountId, + 'item_id' => $itemMeta['id'], + ), + array(), + array( + 'account_id' => $accountId, + 'item_id' => $itemMeta['id'], + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) ); } } \ No newline at end of file