$row['item_id'], 'season_id' =>$row['season'], ); array_push($ringList, $list); }); return $ringList; } public static function getRingList($targetId,$cb) { SqlHelper::ormSelect( myself()->_getSelfMysql(), 't_user_season_ring', array( 'account_id' => $targetId ), function ($row) use($cb) { $cb($row); } ); foreach (NftService::getRing(phpcommon\extractOpenId($targetId)) as $nftDb) { if (! $nftDb['deleted']){ $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_user_season_ring', array( 'token_id' => $nftDb['token_id'], ) ); // if (!$row) { // $itemMeta = mt\Item::get($nftDb['item_id']); // if ($itemMeta) { // self::addNftRing($itemMeta, $nftDb['token_id'],$targetId,$nftDb['param1']); // $row = SqlHelper::ormSelectOne( // myself()->_getSelfMysql(), // 't_user_season_ring', // array( // 'token_id' => $nftDb['token_id'], // ) // ); // } // if ($row) { // $cb($row); // } // } } } } public static function addNftRing($itemMeta, $tokenId,$accountId,$param1) { return self::internalAddHero( myself()->_getMysql($tokenId), $itemMeta, $accountId, $tokenId, $param1); } public static function internalAddHero($conn, $itemMeta, $accountId, $tokenId,$param1) { $fieldsKv = array( 'season' => $param1, 'item_id' => $itemMeta['id'], 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime() ); if ($accountId) { $fieldsKv['account_id'] = $accountId; } if ($tokenId) { $fieldsKv['token_id'] = $tokenId; } SqlHelper::insert( $conn, 't_user_season_ring', $fieldsKv ); } }