How to better deal with the problem of assembling multiple service data?

problem description

for example:
merchandise module is a separate service that exposes some rest api interfaces, providing product picture links, basic product information, etc.
shopping cart is a separate module (for example, the module contains a cart table that records product_id,num).
in this case, you have to get the product ID of the user"s shopping cart before you can get the product information. How can we better solve this problem by assembling these two modules and returning the data to
?

the environmental background of the problems and what methods you have tried

personal feeling is very bad solution: first, go to the shopping cart module to get the product_id, under the user"s shopping cart, and then send a http request inside the shopping cart module to request the information of the merchandise module ~

related codes

/ / Please paste the code text below (do not replace the code with pictures)

none

what result do you expect? What is the error message actually seen?

looking forward to a better solution, the solution I think of is too coupled ~


set up a gateway on the first floor.

                   /*  */
User -> Gateway -> getCartProductInfos -> { 
                                            cartService,
                                            productService
                <-        <- }

just doing this means that the outside world will not be aware of cartService and productService , but only know that there is a getCartProductInfos interface. Those services are known only within the system.

the advantage is that you can do a permission verification at the gateway entry ( getCartProductInfos ), which can be considered secure later (if you need secondary / additional verification, you can do it again at the service, with a high degree of flexibility). In addition, when the service is split later, as long as the external interface of the gateway remains unchanged, the front end (including WEB and mobile, if any) does not need to be changed. That is, no matter how much the things behind the gateway are iteratively upgraded, it is insensitive to the front system. The downside of
is that there is one more layer of things. I personally feel that unless we simply do something of the nature of Demo to practice, we should set up a gateway, and the subsequent expansion will be very easy and convenient.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31ebc-e321.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31ebc-e321.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?