├── .gitignore ├── README.md ├── backend ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── app │ ├── agent │ │ ├── .env │ │ ├── .gitignore │ │ ├── README.md │ │ ├── cmd │ │ │ ├── einoagent │ │ │ │ └── agent │ │ │ │ │ ├── agent.go │ │ │ │ │ └── web │ │ │ │ │ └── script.js │ │ │ ├── einoagentcli │ │ │ │ └── main.go │ │ │ └── knowledgeindexing │ │ │ │ ├── eino-docs │ │ │ │ ├── _index.md │ │ │ │ └── agent_llm_with_tools.md │ │ │ │ └── main.go │ │ ├── docker-compose.yml │ │ ├── eino │ │ │ ├── eino_agent.json │ │ │ ├── einoagent │ │ │ │ ├── embedding.go │ │ │ │ ├── flow.go │ │ │ │ ├── lambda_func.go │ │ │ │ ├── model.go │ │ │ │ ├── orchestration.go │ │ │ │ ├── prompt.go │ │ │ │ ├── retriever.go │ │ │ │ ├── tool.go │ │ │ │ └── types.go │ │ │ ├── knowledge_indexing.json │ │ │ └── knowledgeindexing │ │ │ │ ├── embedding.go │ │ │ │ ├── indexer.go │ │ │ │ ├── loader.go │ │ │ │ ├── orchestration.go │ │ │ │ └── transformer.go │ │ ├── go.mod │ │ ├── go.sum │ │ └── pkg │ │ │ ├── mem │ │ │ └── simple.go │ │ │ ├── redis │ │ │ └── redis.go │ │ │ └── tool │ │ │ ├── cart │ │ │ └── cart.go │ │ │ ├── einotool │ │ │ ├── einotool.go │ │ │ └── templates │ │ │ │ ├── http_agent │ │ │ │ ├── README.md │ │ │ │ ├── client │ │ │ │ │ └── main.go │ │ │ │ └── main.go │ │ │ │ ├── react_agent │ │ │ │ └── main.go │ │ │ │ └── simple_llm │ │ │ │ └── main.go │ │ │ ├── gitclone │ │ │ └── gitclone.go │ │ │ ├── open │ │ │ └── open.go │ │ │ ├── orderlookup │ │ │ └── orderlookup.go │ │ │ ├── payment │ │ │ └── payment.go │ │ │ ├── productlist │ │ │ └── productlist.go │ │ │ └── task │ │ │ ├── README.md │ │ │ ├── storage.go │ │ │ └── task.go │ ├── cart │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ ├── model │ │ │ │ ├── base.go │ │ │ │ └── cart.go │ │ │ └── service │ │ │ │ ├── add_item.go │ │ │ │ ├── add_item_test.go │ │ │ │ ├── change_qty.go │ │ │ │ ├── change_qty_test.go │ │ │ │ ├── empty_cart.go │ │ │ │ ├── empty_cart_test.go │ │ │ │ ├── get_cart.go │ │ │ │ └── get_cart_test.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ │ └── rpc │ │ │ │ └── client.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ ├── script │ │ │ └── bootstrap.sh │ │ └── utils │ │ │ ├── constant.go │ │ │ ├── errors.go │ │ │ └── function.go │ ├── checkout │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ └── service │ │ │ │ ├── checkout.go │ │ │ │ └── checkout_test.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ │ ├── mq │ │ │ │ └── nats.go │ │ │ └── rpc │ │ │ │ └── client.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ ├── script │ │ │ └── bootstrap.sh │ │ └── utils │ │ │ └── errors.go │ ├── email │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── consumer │ │ │ │ ├── consumer.go │ │ │ │ └── email │ │ │ │ │ ├── email.go │ │ │ │ │ └── email_test.go │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ └── service │ │ │ │ ├── send.go │ │ │ │ └── send_test.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ │ ├── mq │ │ │ │ └── nats.go │ │ │ └── notify │ │ │ │ └── email.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ └── script │ │ │ └── bootstrap.sh │ ├── frontend │ │ ├── .env │ │ ├── .gitignore │ │ ├── .hz │ │ ├── biz │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ ├── handler │ │ │ │ ├── about │ │ │ │ │ ├── about_service.go │ │ │ │ │ └── about_service_test.go │ │ │ │ ├── agent │ │ │ │ │ ├── agent_service.go │ │ │ │ │ └── agent_service_test.go │ │ │ │ ├── auth │ │ │ │ │ ├── auth_service.go │ │ │ │ │ └── auth_service_test.go │ │ │ │ ├── cart │ │ │ │ │ ├── cart_service.go │ │ │ │ │ └── cart_service_test.go │ │ │ │ ├── category │ │ │ │ │ ├── category_service.go │ │ │ │ │ └── category_service_test.go │ │ │ │ ├── checkout │ │ │ │ │ ├── checkout_service.go │ │ │ │ │ └── checkout_service_test.go │ │ │ │ ├── home │ │ │ │ │ ├── hello_service.go │ │ │ │ │ └── hello_service_test.go │ │ │ │ ├── merchant │ │ │ │ │ ├── merchant_service.go │ │ │ │ │ └── merchant_service_test.go │ │ │ │ ├── order │ │ │ │ │ ├── order_service.go │ │ │ │ │ └── order_service_test.go │ │ │ │ ├── oss │ │ │ │ │ ├── oss_service.go │ │ │ │ │ └── oss_service_test.go │ │ │ │ ├── payment │ │ │ │ │ ├── payment_service.go │ │ │ │ │ └── payment_service_test.go │ │ │ │ ├── product │ │ │ │ │ ├── product_service.go │ │ │ │ │ └── product_service_test.go │ │ │ │ └── user │ │ │ │ │ ├── user_service.go │ │ │ │ │ └── user_service_test.go │ │ │ ├── router │ │ │ │ ├── about │ │ │ │ │ ├── about.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── agent │ │ │ │ │ ├── agent.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── auth │ │ │ │ │ ├── auth_page.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── cart │ │ │ │ │ ├── cart_page.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── category │ │ │ │ │ ├── category_page.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── checkout │ │ │ │ │ ├── checkout_page.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── home │ │ │ │ │ ├── home.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── merchant │ │ │ │ │ ├── merchant_gateway.go │ │ │ │ │ └── middleware.go │ │ │ │ ├── order │ │ │ │ │ ├── middleware.go │ │ │ │ │ └── order_page.go │ │ │ │ ├── oss │ │ │ │ │ ├── middleware.go │ │ │ │ │ └── oss.go │ │ │ │ ├── payment │ │ │ │ │ ├── middleware.go │ │ │ │ │ └── payment_page.go │ │ │ │ ├── product │ │ │ │ │ ├── middleware.go │ │ │ │ │ └── product_page.go │ │ │ │ ├── register.go │ │ │ │ └── user │ │ │ │ │ ├── middleware.go │ │ │ │ │ └── user_page.go │ │ │ ├── service │ │ │ │ ├── about.go │ │ │ │ ├── add_cart_item.go │ │ │ │ ├── alipay.go │ │ │ │ ├── category.go │ │ │ │ ├── change_qty.go │ │ │ │ ├── checkout.go │ │ │ │ ├── checkout_result.go │ │ │ │ ├── checkout_waiting.go │ │ │ │ ├── delete_user.go │ │ │ │ ├── empty_cart.go │ │ │ │ ├── get_cart.go │ │ │ │ ├── get_product.go │ │ │ │ ├── handle_chat.go │ │ │ │ ├── home.go │ │ │ │ ├── login.go │ │ │ │ ├── logout.go │ │ │ │ ├── merchant_add_product.go │ │ │ │ ├── merchant_auth.go │ │ │ │ ├── merchant_delete_product.go │ │ │ │ ├── merchant_get_product_detail.go │ │ │ │ ├── merchant_get_product_list.go │ │ │ │ ├── merchant_ping.go │ │ │ │ ├── merchant_register.go │ │ │ │ ├── merchant_update_product.go │ │ │ │ ├── order_list.go │ │ │ │ ├── payresult.go │ │ │ │ ├── paysuccess.go │ │ │ │ ├── query_user.go │ │ │ │ ├── register.go │ │ │ │ ├── search_products.go │ │ │ │ ├── update.go │ │ │ │ ├── upload_image.go │ │ │ │ └── upload_video.go │ │ │ └── utils │ │ │ │ ├── jwt.go │ │ │ │ ├── oss.go │ │ │ │ ├── resp.go │ │ │ │ └── type.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── data │ │ │ └── task │ │ │ │ └── tasks.jsonl │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── hertz_gen │ │ │ ├── api │ │ │ │ └── api.pb.go │ │ │ ├── frontend │ │ │ │ ├── about │ │ │ │ │ └── about.pb.go │ │ │ │ ├── agent │ │ │ │ │ └── agent.pb.go │ │ │ │ ├── auth │ │ │ │ │ └── auth_page.pb.go │ │ │ │ ├── cart │ │ │ │ │ └── cart_page.pb.go │ │ │ │ ├── category │ │ │ │ │ └── category_page.pb.go │ │ │ │ ├── checkout │ │ │ │ │ └── checkout_page.pb.go │ │ │ │ ├── common │ │ │ │ │ └── common.pb.go │ │ │ │ ├── home │ │ │ │ │ └── home.pb.go │ │ │ │ ├── merchant │ │ │ │ │ └── merchant_gateway.pb.go │ │ │ │ ├── order │ │ │ │ │ └── order_page.pb.go │ │ │ │ ├── oss │ │ │ │ │ └── oss.pb.go │ │ │ │ ├── payment │ │ │ │ │ └── payment_page.pb.go │ │ │ │ ├── product │ │ │ │ │ └── product_page.pb.go │ │ │ │ └── user │ │ │ │ │ └── user_page.pb.go │ │ │ └── frontend_oss │ │ │ │ └── oss.pb.go │ │ ├── infra │ │ │ └── rpc │ │ │ │ └── client.go │ │ ├── main.go │ │ ├── middleware │ │ │ ├── auth.go │ │ │ ├── jwt.go │ │ │ └── middleware.go │ │ ├── readme.md │ │ ├── script │ │ │ └── bootstrap.sh │ │ ├── static │ │ │ ├── css │ │ │ │ ├── bootstrap-grid.css │ │ │ │ ├── bootstrap-grid.css.map │ │ │ │ ├── bootstrap-grid.min.css │ │ │ │ ├── bootstrap-grid.min.css.map │ │ │ │ ├── bootstrap-grid.rtl.css │ │ │ │ ├── bootstrap-grid.rtl.css.map │ │ │ │ ├── bootstrap-grid.rtl.min.css │ │ │ │ ├── bootstrap-grid.rtl.min.css.map │ │ │ │ ├── bootstrap-reboot.css │ │ │ │ ├── bootstrap-reboot.css.map │ │ │ │ ├── bootstrap-reboot.min.css │ │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ │ ├── bootstrap-reboot.rtl.css │ │ │ │ ├── bootstrap-reboot.rtl.css.map │ │ │ │ ├── bootstrap-reboot.rtl.min.css │ │ │ │ ├── bootstrap-reboot.rtl.min.css.map │ │ │ │ ├── bootstrap-utilities.css │ │ │ │ ├── bootstrap-utilities.css.map │ │ │ │ ├── bootstrap-utilities.min.css │ │ │ │ ├── bootstrap-utilities.min.css.map │ │ │ │ ├── bootstrap-utilities.rtl.css │ │ │ │ ├── bootstrap-utilities.rtl.css.map │ │ │ │ ├── bootstrap-utilities.rtl.min.css │ │ │ │ ├── bootstrap-utilities.rtl.min.css.map │ │ │ │ ├── bootstrap.css │ │ │ │ ├── bootstrap.css.map │ │ │ │ ├── bootstrap.min.css │ │ │ │ ├── bootstrap.min.css.map │ │ │ │ ├── bootstrap.rtl.css │ │ │ │ ├── bootstrap.rtl.css.map │ │ │ │ ├── bootstrap.rtl.min.css │ │ │ │ └── bootstrap.rtl.min.css.map │ │ │ ├── image │ │ │ │ ├── logo.jpg │ │ │ │ ├── mouse-pad.jpeg │ │ │ │ ├── notebook.jpeg │ │ │ │ ├── sweatshirt.jpeg │ │ │ │ ├── t-shirt-1.jpeg │ │ │ │ ├── t-shirt-2.jpeg │ │ │ │ ├── t-shirt.jpeg │ │ │ │ ├── toiletry-bag.jpg │ │ │ │ └── toothbrush-cup.jpg │ │ │ ├── img │ │ │ │ ├── logo.png │ │ │ │ ├── t-shirt-1.jpg │ │ │ │ ├── t-shirt-2.jpg │ │ │ │ ├── t-shirt-3.jpg │ │ │ │ ├── t-shirt-4.jpg │ │ │ │ ├── t-shirt-5.jpg │ │ │ │ └── t-shirt-6.jpg │ │ │ └── js │ │ │ │ ├── bootstrap.bundle.js │ │ │ │ ├── bootstrap.bundle.js.map │ │ │ │ ├── bootstrap.bundle.min.js │ │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ │ ├── bootstrap.esm.js │ │ │ │ ├── bootstrap.esm.js.map │ │ │ │ ├── bootstrap.esm.min.js │ │ │ │ ├── bootstrap.esm.min.js.map │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.js.map │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── bootstrap.min.js.map │ │ ├── template │ │ │ ├── about.tmpl │ │ │ ├── cart-num.tmpl │ │ │ ├── cart.tmpl │ │ │ ├── category.tmpl │ │ │ ├── checkout.tmpl │ │ │ ├── footer.tmpl │ │ │ ├── header.tmpl │ │ │ ├── header1.tmpl │ │ │ ├── home.tmpl │ │ │ ├── order.tmpl │ │ │ ├── product.tmpl │ │ │ ├── required.tmpl │ │ │ ├── result.tmpl │ │ │ ├── search.tmpl │ │ │ ├── sign-in.tmpl │ │ │ ├── sign-up.tmpl │ │ │ └── waiting.tmpl │ │ ├── types │ │ │ └── order.go │ │ └── utils │ │ │ ├── constant.go │ │ │ ├── corn.go │ │ │ ├── corn_test.go │ │ │ ├── errors.go │ │ │ ├── function.go │ │ │ └── type.go │ ├── merchant │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ ├── model │ │ │ │ ├── base.go │ │ │ │ ├── cache_utils.go │ │ │ │ ├── category.go │ │ │ │ ├── merchant.go │ │ │ │ ├── product.go │ │ │ │ └── product_cache_dao.go │ │ │ ├── service │ │ │ │ ├── add_merchant.go │ │ │ │ ├── add_merchant_test.go │ │ │ │ ├── add_product.go │ │ │ │ ├── add_product_test.go │ │ │ │ ├── delete_product.go │ │ │ │ ├── delete_product_test.go │ │ │ │ ├── get_merchant.go │ │ │ │ ├── get_merchant_test.go │ │ │ │ ├── main_test.go │ │ │ │ ├── product_detail.go │ │ │ │ ├── product_detail_test.go │ │ │ │ ├── search_products.go │ │ │ │ ├── search_products_test.go │ │ │ │ ├── update_product.go │ │ │ │ └── update_product_test.go │ │ │ └── util │ │ │ │ └── random.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ │ └── mq │ │ │ │ ├── nats.go │ │ │ │ ├── nats_processor.go │ │ │ │ └── nats_test.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ └── script │ │ │ └── bootstrap.sh │ ├── order │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── consumer │ │ │ │ ├── consumer.go │ │ │ │ └── order │ │ │ │ │ ├── order.go │ │ │ │ │ └── order_test.go │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ ├── model │ │ │ │ ├── order.go │ │ │ │ └── order_item.go │ │ │ └── service │ │ │ │ ├── change_order_status.go │ │ │ │ ├── change_order_status_test.go │ │ │ │ ├── list_oder.go │ │ │ │ ├── list_oder_test.go │ │ │ │ ├── place_order.go │ │ │ │ └── place_order_test.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ │ └── mq │ │ │ │ └── nats.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ ├── script │ │ │ └── bootstrap.sh │ │ └── utils │ │ │ ├── corn.go │ │ │ └── corn_test.go │ ├── payment │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ ├── model │ │ │ │ ├── base.go │ │ │ │ └── payment.go │ │ │ └── service │ │ │ │ ├── alipay.go │ │ │ │ ├── alipay_test.go │ │ │ │ ├── charge.go │ │ │ │ └── charge_test.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ └── script │ │ │ └── bootstrap.sh │ ├── product │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ │ ├── dal │ │ │ │ ├── init.go │ │ │ │ ├── mysql │ │ │ │ │ └── init.go │ │ │ │ └── redis │ │ │ │ │ └── init.go │ │ │ ├── model │ │ │ │ ├── base.go │ │ │ │ ├── cache_utils.go │ │ │ │ ├── category.go │ │ │ │ ├── database_test.go │ │ │ │ ├── main_test.go │ │ │ │ ├── merchant.go │ │ │ │ ├── product.go │ │ │ │ ├── product_cache_dao.go │ │ │ │ ├── product_test.go │ │ │ │ └── redis_test.go │ │ │ ├── service │ │ │ │ ├── get_product.go │ │ │ │ ├── get_product_test.go │ │ │ │ ├── list_products.go │ │ │ │ ├── list_products_test.go │ │ │ │ ├── search_products.go │ │ │ │ └── search_products_test.go │ │ │ └── util │ │ │ │ └── random.go │ │ ├── build.sh │ │ ├── conf │ │ │ ├── conf.go │ │ │ ├── dev │ │ │ │ └── conf.yaml │ │ │ ├── online │ │ │ │ └── conf.yaml │ │ │ └── test │ │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ │ └── mq │ │ │ │ ├── nats.go │ │ │ │ ├── nats_processor.go │ │ │ │ └── nats_test.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ └── script │ │ │ └── bootstrap.sh │ └── user │ │ ├── .env │ │ ├── .gitignore │ │ ├── biz │ │ ├── dal │ │ │ ├── init.go │ │ │ ├── mysql │ │ │ │ └── init.go │ │ │ └── redis │ │ │ │ └── init.go │ │ ├── model │ │ │ ├── cache_utils.go │ │ │ ├── user.go │ │ │ ├── userCache_unused.go │ │ │ └── user_cache_dao.go │ │ └── service │ │ │ ├── delete.go │ │ │ ├── delete_test.go │ │ │ ├── login.go │ │ │ ├── login_test.go │ │ │ ├── main_test.go │ │ │ ├── query.go │ │ │ ├── query_test.go │ │ │ ├── register.go │ │ │ ├── register_test.go │ │ │ ├── update.go │ │ │ └── update_test.go │ │ ├── build.sh │ │ ├── conf │ │ ├── conf.go │ │ ├── dev │ │ │ └── conf.yaml │ │ ├── online │ │ │ └── conf.yaml │ │ └── test │ │ │ └── conf.yaml │ │ ├── docker-compose.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── handler.go │ │ ├── infra │ │ └── mq │ │ │ ├── nats.go │ │ │ ├── nats_processor.go │ │ │ └── nats_test.go │ │ ├── kitex_info.yaml │ │ ├── main.go │ │ ├── readme.md │ │ └── script │ │ └── bootstrap.sh ├── common │ ├── clientsuite │ │ └── clientsuite.go │ ├── go.mod │ ├── go.sum │ ├── mtl │ │ ├── metrics.go │ │ └── tracing.go │ └── serversuite │ │ └── serversuite.go ├── cwgo.help ├── db │ └── sql │ │ └── ini │ │ ├── README.md │ │ └── databases.sql ├── deploy │ ├── .env.example │ ├── Dockerfile.frontend │ ├── Dockerfile.svc │ ├── config │ │ ├── loki.yml │ │ ├── prometheus.yml │ │ └── promtail.yml │ ├── docker-compose-svc.yaml │ ├── gomall-dev-app.yaml │ ├── gomall-dev-base.yaml │ ├── gomall-dev-cluster.yaml │ └── grafana.json ├── docker-compose.yaml ├── go.work ├── go.work.sum ├── idl │ ├── api.proto │ ├── cart.proto │ ├── checkout.proto │ ├── echo.proto │ ├── echo.thrift │ ├── email.proto │ ├── frontend │ │ ├── about.proto │ │ ├── agent.proto │ │ ├── auth_page.proto │ │ ├── cart_page.proto │ │ ├── category_page.proto │ │ ├── checkout_page.proto │ │ ├── common.proto │ │ ├── home.proto │ │ ├── merchant_gateway.proto │ │ ├── order_page.proto │ │ ├── oss.proto │ │ ├── payment_page.proto │ │ ├── product_page.proto │ │ └── user_page.proto │ ├── merchant.proto │ ├── order.proto │ ├── payment.proto │ ├── product.proto │ └── user.proto ├── kill_service.sh ├── load_lib.sh ├── rpc_gen │ ├── go.mod │ ├── go.sum │ ├── kitex_gen │ │ ├── api │ │ │ ├── api.pb.fast.go │ │ │ └── api.pb.go │ │ ├── cart │ │ │ ├── cart.pb.fast.go │ │ │ ├── cart.pb.go │ │ │ └── cartservice │ │ │ │ ├── cartservice.go │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ └── server.go │ │ ├── checkout │ │ │ ├── checkout.pb.fast.go │ │ │ ├── checkout.pb.go │ │ │ └── checkoutservice │ │ │ │ ├── checkoutservice.go │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ └── server.go │ │ ├── email │ │ │ ├── email.pb.fast.go │ │ │ ├── email.pb.go │ │ │ └── emailservice │ │ │ │ ├── client.go │ │ │ │ ├── emailservice.go │ │ │ │ ├── invoker.go │ │ │ │ └── server.go │ │ ├── merchant │ │ │ ├── merchant.pb.fast.go │ │ │ ├── merchant.pb.go │ │ │ └── merchantservice │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ ├── merchantservice.go │ │ │ │ └── server.go │ │ ├── order │ │ │ ├── order.pb.fast.go │ │ │ ├── order.pb.go │ │ │ └── orderservice │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ ├── orderservice.go │ │ │ │ └── server.go │ │ ├── payment │ │ │ ├── payment.pb.fast.go │ │ │ ├── payment.pb.go │ │ │ └── paymentservice │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ ├── paymentservice.go │ │ │ │ └── server.go │ │ ├── product │ │ │ ├── product.pb.fast.go │ │ │ ├── product.pb.go │ │ │ └── productcatalogservice │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ ├── productcatalogservice.go │ │ │ │ └── server.go │ │ └── user │ │ │ ├── user.pb.fast.go │ │ │ ├── user.pb.go │ │ │ └── userservice │ │ │ ├── client.go │ │ │ ├── invoker.go │ │ │ ├── server.go │ │ │ └── userservice.go │ └── rpc │ │ ├── cart │ │ ├── cart_client.go │ │ ├── cart_default.go │ │ └── cart_init.go │ │ ├── checkout │ │ ├── checkout_client.go │ │ ├── checkout_default.go │ │ └── checkout_init.go │ │ ├── email │ │ ├── email_client.go │ │ ├── email_default.go │ │ └── email_init.go │ │ ├── merchant │ │ ├── merchant_client.go │ │ ├── merchant_default.go │ │ └── merchant_init.go │ │ ├── order │ │ ├── order_client.go │ │ ├── order_default.go │ │ └── order_init.go │ │ ├── payment │ │ ├── payment_client.go │ │ ├── payment_default.go │ │ └── payment_init.go │ │ ├── product │ │ ├── product_client.go │ │ ├── product_default.go │ │ └── product_init.go │ │ └── user │ │ ├── user_client.go │ │ ├── user_default.go │ │ └── user_init.go └── start_service.sh └── frontend ├── .gitignore ├── README.md ├── babel.config.js ├── jsconfig.json ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html └── static │ └── image │ ├── logo.jpg │ ├── mouse-pad.jpeg │ ├── notebook.jpeg │ ├── sweatshirt.jpeg │ ├── t-shirt-1.jpeg │ ├── t-shirt-2.jpeg │ ├── t-shirt.jpeg │ ├── toiletry-bag.jpg │ └── toothbrush-cup.jpg ├── src ├── App.vue ├── assets │ └── logo.png ├── components │ ├── ChatDialog.vue │ ├── HelloWorld.vue │ ├── Layout.vue │ ├── ProductCard.vue │ ├── UserDropdown.vue │ └── merchant │ │ ├── Footer.vue │ │ ├── Functions.vue │ │ ├── Header.vue │ │ └── Left.vue ├── main.js ├── router │ └── index.js ├── store │ ├── index.js │ └── modules │ │ ├── auth.js │ │ ├── cart.js │ │ ├── category.js │ │ ├── merchant.js │ │ └── search.js └── views │ ├── AboutView.vue │ ├── CartView.vue │ ├── CategoryView.vue │ ├── HomeView.vue │ ├── LoginView.vue │ ├── MerchantAddProductView.vue │ ├── MerchantProductDetail.vue │ ├── MerchantProductListView.vue │ ├── OrdersView.vue │ ├── PaymentView.vue │ ├── ProductView.vue │ ├── RegisterView.vue │ └── SearchView.vue └── vue.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | .idea/ 3 | .vscode/ 4 | log/ 5 | .DS_Store/ 6 | *.log 7 | *.exe 8 | *.so 9 | /backend/data/redis/ 10 | /backend/data/mysql/ 11 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | .idea/ 3 | .vscode/ 4 | log/ 5 | *.log 6 | *.exe 7 | *.so -------------------------------------------------------------------------------- /backend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23.1 2 | 3 | WORKDIR /usr/src/gomall 4 | 5 | ENV GOPROXY=https://goproxy.io,direct 6 | 7 | COPY app/frontend/go.mod app/frontend/go.sum ./app/frontend/ 8 | COPY rpc_gen rpc_gen 9 | COPY common common 10 | 11 | RUN cd app/frontend && go mod download && go mod verify 12 | 13 | COPY app/frontend app/frontend 14 | 15 | RUN cd app/frontend && go build -v -o /opt/gomall/frontend/server 16 | 17 | COPY app/frontend/conf /opt/gomall/frontend/conf 18 | COPY app/frontend/static /opt/gomall/frontend/static 19 | COPY app/frontend/template /opt/gomall/frontend/template 20 | 21 | 22 | WORKDIR /opt/gomall/frontend 23 | EXPOSE 8080 24 | CMD ["/opt/gomall/frontend/server"] -------------------------------------------------------------------------------- /backend/app/agent/.env: -------------------------------------------------------------------------------- 1 | # ark model: https://console.volcengine.com/ark 2 | # 必填, 3 | # 火山云方舟 ChatModel 的 Endpoint ID 4 | export ARK_CHAT_MODEL="ep-20250218215910-52sr2" 5 | # 火山云方舟 向量化模型的 Endpoint ID 6 | export ARK_EMBEDDING_MODEL="ep-20250218220954-wgqd4" 7 | # 火山云方舟的 API Key 8 | export ARK_API_KEY="67af9008-9918-4535-bfc2-a9d2e6cbc9c8" 9 | 10 | # langfuse: https://cloud.langfuse.com/ 11 | # 下面两个环境变量如果为空,则不开启 langfuse callback 12 | # Langfuse Project 的 Public Key 13 | export LANGFUSE_PUBLIC_KEY="" 14 | # Langfuse Project 的 Secret Key。 注意,Secret Key 仅可在被创建时查看一次 15 | export LANGFUSE_SECRET_KEY="" 16 | 17 | # Redis Server 的地址,不填写时,默认是 localhost:6379 18 | export REDIS_ADDR= 19 | -------------------------------------------------------------------------------- /backend/app/agent/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | redis-stack: 3 | image: redis/redis-stack:latest 4 | container_name: redis-stack 5 | ports: 6 | - "6379:6379" # Redis port 7 | - "8001:8001" # RedisInsight port 8 | volumes: 9 | - ./data/redis:/data 10 | environment: 11 | - REDIS_ARGS=--dir /data --appendonly no --save 1800 1 12 | restart: unless-stopped 13 | healthcheck: 14 | test: [ "CMD", "redis-cli", "ping" ] 15 | interval: 10s 16 | timeout: 5s 17 | retries: 3 18 | -------------------------------------------------------------------------------- /backend/app/agent/eino/einoagent/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 CloudWeGo Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package einoagent 18 | 19 | import "github.com/cloudwego/eino/schema" 20 | 21 | type UserMessage struct { 22 | ID string `json:"id"` 23 | Query string `json:"query"` 24 | History []*schema.Message `json:"history"` 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/agent/pkg/tool/einotool/templates/http_agent/README.md: -------------------------------------------------------------------------------- 1 | # http_agent 2 | 3 | ## 简介 4 | 5 | http_agent 是一个基于 eino 的 http 服务构建的一个简单的 llm 应用。 6 | 7 | ## 使用 8 | 9 | ### 启动 http server 10 | 11 | ```bash 12 | go run main.go -model=ep-xxxx -apikey=xxx 13 | ``` 14 | 15 | ### 使用 curl 访问 http server 16 | 17 | ```bash 18 | curl 'http://127.0.0.1:8888/chat?id=123&msg=hello' 19 | ``` 20 | > 注意,由于采用了 sse 的格式,结果中会有 `data:` 前缀 21 | 22 | ### 使用 client 23 | 24 | client 是一个简单的交互式客户端,可以与 http server 进行交互,并打印结果。 25 | 26 | ```bash 27 | go run client/main.go 28 | ``` 29 | -------------------------------------------------------------------------------- /backend/app/cart/.env: -------------------------------------------------------------------------------- 1 | MYSQL_USER=root 2 | MYSQL_PASSWORD=K8#tP2@y!mL9 3 | MYSQL_HOST=127.0.0.1 4 | SESSION_SECRET="KJLAJKLJLSF" -------------------------------------------------------------------------------- /backend/app/cart/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.so 4 | _obj 5 | _test 6 | *.[568vq] 7 | [568vq].out 8 | *.cgo1.go 9 | *.cgo2.c 10 | _cgo_defun.c 11 | _cgo_gotypes.go 12 | _cgo_export.* 13 | _testmain.go 14 | *.exe 15 | *.exe~ 16 | *.test 17 | *.prof 18 | *.rar 19 | *.zip 20 | *.gz 21 | *.psd 22 | *.bmd 23 | *.cfg 24 | *.pptx 25 | *.log 26 | *nohup.out 27 | *settings.pyc 28 | *.sublime-project 29 | *.sublime-workspace 30 | !.gitkeep 31 | .DS_Store 32 | /.idea 33 | /.vscode 34 | /output 35 | *.local.yml 36 | -------------------------------------------------------------------------------- /backend/app/cart/biz/dal/init.go: -------------------------------------------------------------------------------- 1 | package dal 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/cart/biz/dal/mysql" 5 | "github.com/tiktokmall/backend/app/cart/biz/dal/redis" 6 | ) 7 | 8 | func Init() { 9 | redis.Init() 10 | mysql.Init() 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/cart/biz/dal/mysql/init.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/tiktokmall/backend/app/cart/biz/model" 8 | "github.com/tiktokmall/backend/app/cart/conf" 9 | 10 | "gorm.io/driver/mysql" 11 | "gorm.io/gorm" 12 | "gorm.io/plugin/opentelemetry/tracing" 13 | ) 14 | 15 | var ( 16 | DB *gorm.DB 17 | err error 18 | ) 19 | 20 | func Init() { 21 | dsn := fmt.Sprintf(conf.GetConf().MySQL.DSN, os.Getenv("MYSQL_USER"), os.Getenv("MYSQL_PASSWORD"), os.Getenv("MYSQL_HOST")) 22 | DB, err = gorm.Open(mysql.Open(dsn), 23 | &gorm.Config{ 24 | PrepareStmt: true, 25 | SkipDefaultTransaction: true, 26 | }, 27 | ) 28 | if err != nil { 29 | panic(err) 30 | } 31 | if err := DB.Use(tracing.NewPlugin(tracing.WithoutMetrics())); err != nil { 32 | panic(err) 33 | } 34 | if os.Getenv("GO_ENV") != "online" { 35 | DB.AutoMigrate( 36 | &model.Cart{}, 37 | ) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /backend/app/cart/biz/dal/redis/init.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/redis/go-redis/v9" 7 | "github.com/tiktokmall/backend/app/cart/conf" 8 | ) 9 | 10 | var ( 11 | RedisClient *redis.Client 12 | ) 13 | 14 | func Init() { 15 | RedisClient = redis.NewClient(&redis.Options{ 16 | Addr: conf.GetConf().Redis.Address, 17 | Username: conf.GetConf().Redis.Username, 18 | Password: conf.GetConf().Redis.Password, 19 | DB: conf.GetConf().Redis.DB, 20 | }) 21 | if err := RedisClient.Ping(context.Background()).Err(); err != nil { 22 | panic(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/cart/biz/model/base.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import "time" 4 | 5 | type Base struct { 6 | ID int `gorm:"primarykey"` 7 | CreatedAt time.Time 8 | UpdatedAt time.Time 9 | } 10 | -------------------------------------------------------------------------------- /backend/app/cart/biz/service/add_item_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | cart "github.com/tiktokmall/backend/rpc_gen/kitex_gen/cart" 8 | ) 9 | 10 | func TestAddItem_Run(t *testing.T) { 11 | ctx := context.Background() 12 | s := NewAddItemService(ctx) 13 | // init req and assert value 14 | 15 | req := &cart.AddItemReq{} 16 | resp, err := s.Run(req) 17 | t.Logf("err: %v", err) 18 | t.Logf("resp: %v", resp) 19 | 20 | // todo: edit your unit test 21 | 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/cart/biz/service/change_qty_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | cart "github.com/tiktokmall/backend/rpc_gen/kitex_gen/cart" 7 | ) 8 | 9 | func TestChangeQty_Run(t *testing.T) { 10 | ctx := context.Background() 11 | s := NewChangeQtyService(ctx) 12 | // init req and assert value 13 | 14 | req := &cart.ChangeQtyReq{} 15 | resp, err := s.Run(req) 16 | t.Logf("err: %v", err) 17 | t.Logf("resp: %v", resp) 18 | 19 | // todo: edit your unit test 20 | 21 | } 22 | -------------------------------------------------------------------------------- /backend/app/cart/biz/service/empty_cart.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/tiktokmall/backend/app/cart/biz/dal/mysql" 7 | "github.com/tiktokmall/backend/app/cart/biz/model" 8 | cart "github.com/tiktokmall/backend/rpc_gen/kitex_gen/cart" 9 | 10 | "github.com/cloudwego/kitex/pkg/kerrors" 11 | ) 12 | 13 | type EmptyCartService struct { 14 | ctx context.Context 15 | } // NewEmptyCartService new EmptyCartService 16 | func NewEmptyCartService(ctx context.Context) *EmptyCartService { 17 | return &EmptyCartService{ctx: ctx} 18 | } 19 | 20 | // Run create note info 21 | func (s *EmptyCartService) Run(req *cart.EmptyCartReq) (resp *cart.EmptyCartResp, err error) { 22 | // Finish your business logic. 23 | if req.UserId == 0 { 24 | return nil, kerrors.NewBizStatusError(40004, "user_id is required") 25 | } 26 | err = model.EmptyCart(s.ctx, mysql.DB, req.UserId) 27 | if err != nil { 28 | return nil, kerrors.NewBizStatusError(50000, err.Error()) 29 | } 30 | return &cart.EmptyCartResp{}, nil 31 | } 32 | -------------------------------------------------------------------------------- /backend/app/cart/biz/service/empty_cart_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | cart "github.com/tiktokmall/backend/rpc_gen/kitex_gen/cart" 8 | ) 9 | 10 | func TestEmptyCart_Run(t *testing.T) { 11 | ctx := context.Background() 12 | s := NewEmptyCartService(ctx) 13 | // init req and assert value 14 | 15 | req := &cart.EmptyCartReq{} 16 | resp, err := s.Run(req) 17 | t.Logf("err: %v", err) 18 | t.Logf("resp: %v", resp) 19 | 20 | // todo: edit your unit test 21 | 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/cart/biz/service/get_cart_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | cart "github.com/tiktokmall/backend/rpc_gen/kitex_gen/cart" 8 | ) 9 | 10 | func TestGetCart_Run(t *testing.T) { 11 | ctx := context.Background() 12 | s := NewGetCartService(ctx) 13 | // init req and assert value 14 | 15 | req := &cart.GetCartReq{} 16 | resp, err := s.Run(req) 17 | t.Logf("err: %v", err) 18 | t.Logf("resp: %v", resp) 19 | 20 | // todo: edit your unit test 21 | 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/cart/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | RUN_NAME="cart" 3 | mkdir -p output/bin output/conf 4 | cp script/* output/ 5 | cp -r conf/* output/conf 6 | chmod +x output/bootstrap.sh 7 | go build -o output/bin/${RUN_NAME} 8 | -------------------------------------------------------------------------------- /backend/app/cart/conf/dev/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "cart" 3 | address: ":8883" 4 | metrics_port: ":9993" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - consul:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "%s:%s@tcp(%s:3306)/cart?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "redis:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | -------------------------------------------------------------------------------- /backend/app/cart/conf/online/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "cart" 3 | address: ":8883" 4 | metrics_port: ":9993" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - consul:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "%s:%s@tcp(%s:3306)/cart?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "redis:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | -------------------------------------------------------------------------------- /backend/app/cart/conf/test/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "cart" 3 | address: ":8883" 4 | metrics_port: ":9993" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - 127.0.0.1:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "%s:%s@tcp(%s:3306)/cart?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "127.0.0.1:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | -------------------------------------------------------------------------------- /backend/app/cart/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | mysql: 4 | image: 'mysql:latest' 5 | ports: 6 | - 3306:3306 7 | environment: 8 | - MYSQL_DATABASE=gorm 9 | - MYSQL_USER=gorm 10 | - MYSQL_PASSWORD=gorm 11 | - MYSQL_RANDOM_ROOT_PASSWORD="yes" 12 | redis: 13 | image: 'redis:latest' 14 | ports: 15 | - 6379:6379 16 | -------------------------------------------------------------------------------- /backend/app/cart/infra/rpc/client.go: -------------------------------------------------------------------------------- 1 | package rpc 2 | 3 | import ( 4 | "sync" 5 | 6 | "github.com/tiktokmall/backend/common/clientsuite" 7 | "github.com/tiktokmall/backend/rpc_gen/kitex_gen/product/productcatalogservice" 8 | 9 | "github.com/tiktokmall/backend/app/cart/conf" 10 | cartUtils "github.com/tiktokmall/backend/app/cart/utils" 11 | 12 | "github.com/cloudwego/kitex/client" 13 | ) 14 | 15 | // client 进行服务发现 16 | 17 | var ( 18 | ProductClient productcatalogservice.Client 19 | once sync.Once 20 | err error 21 | registryAddr string 22 | serviceName string 23 | ) 24 | 25 | func Init() { 26 | once.Do(func() { 27 | registryAddr = conf.GetConf().Registry.RegistryAddress[0] 28 | serviceName = conf.GetConf().Kitex.Service 29 | initProductClient() 30 | }) 31 | } 32 | 33 | func initProductClient() { 34 | opts := []client.Option{ 35 | client.WithSuite(clientsuite.CommonServerSuite{ 36 | RegistryAddr: registryAddr, 37 | CurrentServiceName: serviceName, 38 | }), 39 | } 40 | ProductClient, err = productcatalogservice.NewClient("product", opts...) 41 | cartUtils.MustHandleError(err) 42 | } 43 | -------------------------------------------------------------------------------- /backend/app/cart/kitex_info.yaml: -------------------------------------------------------------------------------- 1 | kitexinfo: 2 | ServiceName: 'cart' 3 | ToolVersion: 'v0.9.1' 4 | -------------------------------------------------------------------------------- /backend/app/cart/readme.md: -------------------------------------------------------------------------------- 1 | # *** Project 2 | 3 | ## introduce 4 | 5 | - Use the [Kitex](https://github.com/cloudwego/kitex/) framework 6 | - Generating the base code for unit tests. 7 | - Provides basic config functions 8 | - Provides the most basic MVC code hierarchy. 9 | 10 | ## Directory structure 11 | 12 | | catalog | introduce | 13 | | ---- | ---- | 14 | | conf | Configuration files | 15 | | main.go | Startup file | 16 | | handler.go | Used for request processing return of response. | 17 | | kitex_gen | kitex generated code | 18 | | biz/service | The actual business logic. | 19 | | biz/dal | Logic for operating the storage layer | 20 | 21 | ## How to run 22 | 23 | ```shell 24 | sh build.sh 25 | sh output/bootstrap.sh 26 | ``` 27 | -------------------------------------------------------------------------------- /backend/app/cart/script/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | CURDIR=$(cd $(dirname $0); pwd) 3 | echo "$CURDIR/bin/cart" 4 | exec "$CURDIR/bin/cart" 5 | -------------------------------------------------------------------------------- /backend/app/cart/utils/constant.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | type SessionUserIdKey string 4 | 5 | const SessionUserId SessionUserIdKey = "user_id" 6 | -------------------------------------------------------------------------------- /backend/app/cart/utils/errors.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "github.com/cloudwego/kitex/pkg/klog" 5 | ) 6 | 7 | func MustHandleError(err error) { 8 | if err != nil { 9 | klog.Fatal(err) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/cart/utils/function.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | ) 7 | 8 | func GetUserIdFromCtx(ctx context.Context) int32 { 9 | userId := ctx.Value(SessionUserId) 10 | if userId == nil { 11 | return 0 12 | } 13 | fmt.Println("userId", userId) 14 | 15 | return userId.(int32) 16 | } 17 | -------------------------------------------------------------------------------- /backend/app/checkout/.env: -------------------------------------------------------------------------------- 1 | MYSQL_USER=root 2 | MYSQL_PASSWORD=K8#tP2@y!mL9 3 | MYSQL_HOST=127.0.0.1 4 | SESSION_SECRET="KJLAJKLJLSF" -------------------------------------------------------------------------------- /backend/app/checkout/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.so 4 | _obj 5 | _test 6 | *.[568vq] 7 | [568vq].out 8 | *.cgo1.go 9 | *.cgo2.c 10 | _cgo_defun.c 11 | _cgo_gotypes.go 12 | _cgo_export.* 13 | _testmain.go 14 | *.exe 15 | *.exe~ 16 | *.test 17 | *.prof 18 | *.rar 19 | *.zip 20 | *.gz 21 | *.psd 22 | *.bmd 23 | *.cfg 24 | *.pptx 25 | *.log 26 | *nohup.out 27 | *settings.pyc 28 | *.sublime-project 29 | *.sublime-workspace 30 | !.gitkeep 31 | .DS_Store 32 | /.idea 33 | /.vscode 34 | /output 35 | *.local.yml 36 | -------------------------------------------------------------------------------- /backend/app/checkout/biz/dal/init.go: -------------------------------------------------------------------------------- 1 | package dal 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/checkout/biz/dal/mysql" 5 | "github.com/tiktokmall/backend/app/checkout/biz/dal/redis" 6 | ) 7 | 8 | func Init() { 9 | redis.Init() 10 | mysql.Init() 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/checkout/biz/dal/mysql/init.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/checkout/conf" 5 | 6 | "gorm.io/driver/mysql" 7 | "gorm.io/gorm" 8 | ) 9 | 10 | var ( 11 | DB *gorm.DB 12 | err error 13 | ) 14 | 15 | func Init() { 16 | DB, err = gorm.Open(mysql.Open(conf.GetConf().MySQL.DSN), 17 | &gorm.Config{ 18 | PrepareStmt: true, 19 | SkipDefaultTransaction: true, 20 | }, 21 | ) 22 | if err != nil { 23 | panic(err) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/checkout/biz/dal/redis/init.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/redis/go-redis/v9" 7 | "github.com/tiktokmall/backend/app/checkout/conf" 8 | ) 9 | 10 | var ( 11 | RedisClient *redis.Client 12 | ) 13 | 14 | func Init() { 15 | RedisClient = redis.NewClient(&redis.Options{ 16 | Addr: conf.GetConf().Redis.Address, 17 | Username: conf.GetConf().Redis.Username, 18 | Password: conf.GetConf().Redis.Password, 19 | DB: conf.GetConf().Redis.DB, 20 | }) 21 | if err := RedisClient.Ping(context.Background()).Err(); err != nil { 22 | panic(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/checkout/biz/service/checkout_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | checkout "github.com/tiktokmall/backend/rpc_gen/kitex_gen/checkout" 8 | ) 9 | 10 | func TestCheckout_Run(t *testing.T) { 11 | ctx := context.Background() 12 | s := NewCheckoutService(ctx) 13 | // init req and assert value 14 | 15 | req := &checkout.CheckoutReq{} 16 | resp, err := s.Run(req) 17 | t.Logf("err: %v", err) 18 | t.Logf("resp: %v", resp) 19 | 20 | // todo: edit your unit test 21 | 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/checkout/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | RUN_NAME="checkout" 3 | mkdir -p output/bin output/conf 4 | cp script/* output/ 5 | cp -r conf/* output/conf 6 | chmod +x output/bootstrap.sh 7 | go build -o output/bin/${RUN_NAME} 8 | -------------------------------------------------------------------------------- /backend/app/checkout/conf/dev/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "checkout" 3 | address: ":8885" 4 | metrics_port: ":9995" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - consul:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "redis:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | 26 | nats: 27 | address: "nats://nats:4222" 28 | -------------------------------------------------------------------------------- /backend/app/checkout/conf/online/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "checkout" 3 | address: ":8885" 4 | metrics_port: ":9995" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - consul:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "redis:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | 26 | nats: 27 | address: "nats://nats:4222" 28 | -------------------------------------------------------------------------------- /backend/app/checkout/conf/test/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "checkout" 3 | address: ":8885" 4 | metrics_port: ":9995" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - 127.0.0.1:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "127.0.0.1:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | 26 | nats: 27 | address: "nats://127.0.0.1:4222" -------------------------------------------------------------------------------- /backend/app/checkout/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | mysql: 4 | image: 'mysql:latest' 5 | ports: 6 | - 3306:3306 7 | environment: 8 | - MYSQL_DATABASE=gorm 9 | - MYSQL_USER=gorm 10 | - MYSQL_PASSWORD=gorm 11 | - MYSQL_RANDOM_ROOT_PASSWORD="yes" 12 | redis: 13 | image: 'redis:latest' 14 | ports: 15 | - 6379:6379 16 | -------------------------------------------------------------------------------- /backend/app/checkout/handler.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/tiktokmall/backend/app/checkout/biz/service" 7 | checkout "github.com/tiktokmall/backend/rpc_gen/kitex_gen/checkout" 8 | ) 9 | 10 | // CheckoutServiceImpl implements the last service interface defined in the IDL. 11 | type CheckoutServiceImpl struct{} 12 | 13 | // Checkout implements the CheckoutServiceImpl interface. 14 | func (s *CheckoutServiceImpl) Checkout(ctx context.Context, req *checkout.CheckoutReq) (resp *checkout.CheckoutResp, err error) { 15 | resp, err = service.NewCheckoutService(ctx).Run(req) 16 | 17 | return resp, err 18 | } 19 | -------------------------------------------------------------------------------- /backend/app/checkout/infra/mq/nats.go: -------------------------------------------------------------------------------- 1 | package mq 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/checkout/conf" 5 | 6 | "github.com/nats-io/nats.go" 7 | ) 8 | 9 | var ( 10 | Nc *nats.Conn 11 | err error 12 | ) 13 | 14 | func Init() { 15 | Nc, err = nats.Connect(conf.GetConf().Nats.Address) 16 | if err != nil { 17 | panic(err) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /backend/app/checkout/kitex_info.yaml: -------------------------------------------------------------------------------- 1 | kitexinfo: 2 | ServiceName: 'checkout' 3 | ToolVersion: 'v0.9.1' 4 | -------------------------------------------------------------------------------- /backend/app/checkout/readme.md: -------------------------------------------------------------------------------- 1 | # *** Project 2 | 3 | ## introduce 4 | 5 | - Use the [Kitex](https://github.com/cloudwego/kitex/) framework 6 | - Generating the base code for unit tests. 7 | - Provides basic config functions 8 | - Provides the most basic MVC code hierarchy. 9 | 10 | ## Directory structure 11 | 12 | | catalog | introduce | 13 | | ---- | ---- | 14 | | conf | Configuration files | 15 | | main.go | Startup file | 16 | | handler.go | Used for request processing return of response. | 17 | | kitex_gen | kitex generated code | 18 | | biz/service | The actual business logic. | 19 | | biz/dal | Logic for operating the storage layer | 20 | 21 | ## How to run 22 | 23 | ```shell 24 | sh build.sh 25 | sh output/bootstrap.sh 26 | ``` 27 | -------------------------------------------------------------------------------- /backend/app/checkout/script/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | CURDIR=$(cd $(dirname $0); pwd) 3 | echo "$CURDIR/bin/checkout" 4 | exec "$CURDIR/bin/checkout" 5 | -------------------------------------------------------------------------------- /backend/app/checkout/utils/errors.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "github.com/cloudwego/kitex/pkg/klog" 5 | ) 6 | 7 | func MustHandleError(err error) { 8 | if err != nil { 9 | klog.Fatal(err) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/email/.env: -------------------------------------------------------------------------------- 1 | MYSQL_USER=root 2 | MYSQL_PASSWORD=K8#tP2@y!mL9 3 | MYSQL_HOST=127.0.0.1 4 | SESSION_SECRET="KJLAJKLJLSF" -------------------------------------------------------------------------------- /backend/app/email/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.so 4 | _obj 5 | _test 6 | *.[568vq] 7 | [568vq].out 8 | *.cgo1.go 9 | *.cgo2.c 10 | _cgo_defun.c 11 | _cgo_gotypes.go 12 | _cgo_export.* 13 | _testmain.go 14 | *.exe 15 | *.exe~ 16 | *.test 17 | *.prof 18 | *.rar 19 | *.zip 20 | *.gz 21 | *.psd 22 | *.bmd 23 | *.cfg 24 | *.pptx 25 | *.log 26 | *nohup.out 27 | *settings.pyc 28 | *.sublime-project 29 | *.sublime-workspace 30 | !.gitkeep 31 | .DS_Store 32 | /.idea 33 | /.vscode 34 | /output 35 | *.local.yml 36 | -------------------------------------------------------------------------------- /backend/app/email/biz/consumer/consumer.go: -------------------------------------------------------------------------------- 1 | package consumer 2 | 3 | import "github.com/tiktokmall/backend/app/email/biz/consumer/email" 4 | 5 | func Init() { 6 | email.ConsumerInit() 7 | } 8 | -------------------------------------------------------------------------------- /backend/app/email/biz/consumer/email/email_test.go: -------------------------------------------------------------------------------- 1 | package email 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "os" 7 | "testing" 8 | "time" 9 | 10 | "github.com/tiktokmall/backend/app/email/infra/mq" 11 | "github.com/tiktokmall/backend/rpc_gen/kitex_gen/email" 12 | "google.golang.org/protobuf/proto" 13 | ) 14 | 15 | func TestConsumerInit(t *testing.T) { 16 | os.Chdir("../../../") 17 | mq.Init() 18 | go ConsumerInit() 19 | time.Sleep(time.Second) 20 | go func() { 21 | count := 1 22 | for { 23 | req := email.EmailReq{ 24 | Content: fmt.Sprintf("%v", count), 25 | } 26 | data, err := proto.Marshal(&req) 27 | if err != nil { 28 | log.Printf("marshal err: %v", err) 29 | continue 30 | } 31 | log.Printf("publish msg, %+v", req) 32 | mq.Nc.Publish("email", data) 33 | count++ 34 | time.Sleep(time.Second) 35 | } 36 | }() 37 | time.Sleep(10 * time.Second) 38 | } 39 | -------------------------------------------------------------------------------- /backend/app/email/biz/dal/init.go: -------------------------------------------------------------------------------- 1 | package dal 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/email/biz/dal/mysql" 5 | "github.com/tiktokmall/backend/app/email/biz/dal/redis" 6 | ) 7 | 8 | func Init() { 9 | redis.Init() 10 | mysql.Init() 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/email/biz/dal/mysql/init.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/email/conf" 5 | 6 | "gorm.io/driver/mysql" 7 | "gorm.io/gorm" 8 | ) 9 | 10 | var ( 11 | DB *gorm.DB 12 | err error 13 | ) 14 | 15 | func Init() { 16 | DB, err = gorm.Open(mysql.Open(conf.GetConf().MySQL.DSN), 17 | &gorm.Config{ 18 | PrepareStmt: true, 19 | SkipDefaultTransaction: true, 20 | }, 21 | ) 22 | if err != nil { 23 | panic(err) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/email/biz/dal/redis/init.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/redis/go-redis/v9" 7 | "github.com/tiktokmall/backend/app/email/conf" 8 | ) 9 | 10 | var ( 11 | RedisClient *redis.Client 12 | ) 13 | 14 | func Init() { 15 | RedisClient = redis.NewClient(&redis.Options{ 16 | Addr: conf.GetConf().Redis.Address, 17 | Username: conf.GetConf().Redis.Username, 18 | Password: conf.GetConf().Redis.Password, 19 | DB: conf.GetConf().Redis.DB, 20 | }) 21 | if err := RedisClient.Ping(context.Background()).Err(); err != nil { 22 | panic(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/email/biz/service/send.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | email "github.com/tiktokmall/backend/rpc_gen/kitex_gen/email" 7 | ) 8 | 9 | type SendService struct { 10 | ctx context.Context 11 | } // NewSendService new SendService 12 | func NewSendService(ctx context.Context) *SendService { 13 | return &SendService{ctx: ctx} 14 | } 15 | 16 | // Run create note info 17 | func (s *SendService) Run(req *email.EmailReq) (resp *email.EmailResp, err error) { 18 | // Finish your business logic. 19 | 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /backend/app/email/biz/service/send_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | email "github.com/tiktokmall/backend/rpc_gen/kitex_gen/email" 8 | ) 9 | 10 | func TestSend_Run(t *testing.T) { 11 | ctx := context.Background() 12 | s := NewSendService(ctx) 13 | // init req and assert value 14 | 15 | req := &email.EmailReq{} 16 | resp, err := s.Run(req) 17 | t.Logf("err: %v", err) 18 | t.Logf("resp: %v", resp) 19 | 20 | // todo: edit your unit test 21 | 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/email/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | RUN_NAME="email" 3 | mkdir -p output/bin output/conf 4 | cp script/* output/ 5 | cp -r conf/* output/conf 6 | chmod +x output/bootstrap.sh 7 | go build -o output/bin/${RUN_NAME} 8 | -------------------------------------------------------------------------------- /backend/app/email/conf/dev/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "email" 3 | address: ":8887" 4 | metrics_port: ":9997" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - consul:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "redis:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | 26 | nats: 27 | address: "nats://nats:4222" 28 | -------------------------------------------------------------------------------- /backend/app/email/conf/online/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "email" 3 | address: ":8887" 4 | metrics_port: ":9997" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - consul:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "redis:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | 26 | nats: 27 | address: "nats://nats:4222" -------------------------------------------------------------------------------- /backend/app/email/conf/test/conf.yaml: -------------------------------------------------------------------------------- 1 | kitex: 2 | service: "email" 3 | address: ":8887" 4 | metrics_port: ":9997" 5 | log_level: info 6 | log_file_name: "log/kitex.log" 7 | log_max_size: 10 8 | log_max_age: 3 9 | log_max_backups: 50 10 | 11 | registry: 12 | registry_address: 13 | - 127.0.0.1:8500 14 | username: "" 15 | password: "" 16 | 17 | mysql: 18 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 19 | 20 | redis: 21 | address: "127.0.0.1:6379" 22 | username: "" 23 | password: "" 24 | db: 0 25 | 26 | nats: 27 | address: "nats://127.0.0.1:4222" -------------------------------------------------------------------------------- /backend/app/email/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | mysql: 4 | image: 'mysql:latest' 5 | ports: 6 | - 3306:3306 7 | environment: 8 | - MYSQL_DATABASE=gorm 9 | - MYSQL_USER=gorm 10 | - MYSQL_PASSWORD=gorm 11 | - MYSQL_RANDOM_ROOT_PASSWORD="yes" 12 | redis: 13 | image: 'redis:latest' 14 | ports: 15 | - 6379:6379 16 | 17 | -------------------------------------------------------------------------------- /backend/app/email/handler.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/tiktokmall/backend/app/email/biz/service" 7 | email "github.com/tiktokmall/backend/rpc_gen/kitex_gen/email" 8 | ) 9 | 10 | // EmailServiceImpl implements the last service interface defined in the IDL. 11 | type EmailServiceImpl struct{} 12 | 13 | // Send implements the EmailServiceImpl interface. 14 | func (s *EmailServiceImpl) Send(ctx context.Context, req *email.EmailReq) (resp *email.EmailResp, err error) { 15 | resp, err = service.NewSendService(ctx).Run(req) 16 | 17 | return resp, err 18 | } 19 | -------------------------------------------------------------------------------- /backend/app/email/infra/mq/nats.go: -------------------------------------------------------------------------------- 1 | package mq 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/email/conf" 5 | 6 | "github.com/nats-io/nats.go" 7 | ) 8 | 9 | var ( 10 | Nc *nats.Conn 11 | err error 12 | ) 13 | 14 | func Init() { 15 | Nc, err = nats.Connect(conf.GetConf().Nats.Address) 16 | if err != nil { 17 | panic(err) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /backend/app/email/infra/notify/email.go: -------------------------------------------------------------------------------- 1 | package notify 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/rpc_gen/kitex_gen/email" 5 | 6 | "github.com/kr/pretty" 7 | ) 8 | 9 | type NoopEmail struct{} 10 | 11 | func (e *NoopEmail) Send(req *email.EmailReq) error { 12 | // 处理,只是打印一下 req 13 | pretty.Printf("%v\n", req) 14 | return nil 15 | } 16 | 17 | func NewNoopEmail() NoopEmail { 18 | return NoopEmail{} 19 | } 20 | -------------------------------------------------------------------------------- /backend/app/email/kitex_info.yaml: -------------------------------------------------------------------------------- 1 | kitexinfo: 2 | ServiceName: 'email' 3 | ToolVersion: 'v0.9.1' 4 | -------------------------------------------------------------------------------- /backend/app/email/readme.md: -------------------------------------------------------------------------------- 1 | # *** Project 2 | 3 | ## introduce 4 | 5 | - Use the [Kitex](https://github.com/cloudwego/kitex/) framework 6 | - Generating the base code for unit tests. 7 | - Provides basic config functions 8 | - Provides the most basic MVC code hierarchy. 9 | 10 | ## Directory structure 11 | 12 | | catalog | introduce | 13 | | ---- | ---- | 14 | | conf | Configuration files | 15 | | main.go | Startup file | 16 | | handler.go | Used for request processing return of response. | 17 | | kitex_gen | kitex generated code | 18 | | biz/service | The actual business logic. | 19 | | biz/dal | Logic for operating the storage layer | 20 | 21 | ## How to run 22 | 23 | ```shell 24 | sh build.sh 25 | sh output/bootstrap.sh 26 | ``` 27 | -------------------------------------------------------------------------------- /backend/app/email/script/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | CURDIR=$(cd $(dirname $0); pwd) 3 | echo "$CURDIR/bin/email" 4 | exec "$CURDIR/bin/email" 5 | -------------------------------------------------------------------------------- /backend/app/frontend/.env: -------------------------------------------------------------------------------- 1 | MYSQL_USER=root 2 | MYSQL_PASSWORD=K8#tP2@y!mL9 3 | MYSQL_HOST=127.0.0.1 4 | SESSION_SECRET="KJLAJKLJLSF" 5 | SecretKey="tiktokmall" 6 | IdentityKey = "id" 7 | 8 | OSS_ACCESS_KEY_ID="LTAI5tC3VZ1hcwKsSuA4ZniM" 9 | OSS_ACCESS_KEY_SECRET="tRXb4YVzHr1jIebfxs3i5dGtbJ9LdV" 10 | 11 | # ark model: https://console.volcengine.com/ark 12 | # 必填, 13 | # 火山云方舟 ChatModel 的 Endpoint ID 14 | ARK_CHAT_MODEL="ep-20250218215910-52sr2" 15 | # 火山云方舟 向量化模型的 Endpoint ID 16 | ARK_EMBEDDING_MODEL="ep-20250218220954-wgqd4" 17 | # 火山云方舟的 API Key 18 | ARK_API_KEY="67af9008-9918-4535-bfc2-a9d2e6cbc9c8" 19 | 20 | # langfuse: https://cloud.langfuse.com/ 21 | # 下面两个环境变量如果为空,则不开启 langfuse callback 22 | # Langfuse Project 的 Public Key 23 | LANGFUSE_PUBLIC_KEY="pk-lf-0e8ef1b4-ff48-418e-a51a-ef4083f111ec" 24 | # Langfuse Project 的 Secret Key。 注意,Secret Key 仅可在被创建时查看一次 25 | LANGFUSE_SECRET_KEY="sk-lf-6d61a49e-311b-43fa-8405-5d583c40cfab" 26 | 27 | # Redis Server 的地址,不填写时,默认是 localhost:6379 28 | # export REDIS_ADDR= -------------------------------------------------------------------------------- /backend/app/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.so 4 | _obj 5 | _test 6 | *.[568vq] 7 | [568vq].out 8 | *.cgo1.go 9 | *.cgo2.c 10 | _cgo_defun.c 11 | _cgo_gotypes.go 12 | _cgo_export.* 13 | _testmain.go 14 | *.exe 15 | *.exe~ 16 | *.test 17 | *.prof 18 | *.rar 19 | *.zip 20 | *.gz 21 | *.psd 22 | *.bmd 23 | *.cfg 24 | *.pptx 25 | *.log 26 | *.jsonl 27 | *nohup.out 28 | *settings.pyc 29 | *.sublime-project 30 | *.sublime-workspace 31 | !.gitkeep 32 | .DS_Store 33 | /.idea 34 | /.vscode 35 | /output 36 | *.local.yml -------------------------------------------------------------------------------- /backend/app/frontend/.hz: -------------------------------------------------------------------------------- 1 | // Code generated by hz. DO NOT EDIT. 2 | 3 | hz version: v0.8.1 4 | handlerDir: "" 5 | modelDir: hertz_gen 6 | routerDir: "" 7 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/dal/init.go: -------------------------------------------------------------------------------- 1 | package dal 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/frontend/biz/dal/mysql" 5 | "github.com/tiktokmall/backend/app/frontend/biz/dal/redis" 6 | ) 7 | 8 | func Init() { 9 | redis.Init() 10 | mysql.Init() 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/dal/mysql/init.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/tiktokmall/backend/app/frontend/conf" 5 | "gorm.io/driver/mysql" 6 | "gorm.io/gorm" 7 | ) 8 | 9 | var ( 10 | DB *gorm.DB 11 | err error 12 | ) 13 | 14 | func Init() { 15 | DB, err = gorm.Open(mysql.Open(conf.GetConf().MySQL.DSN), 16 | &gorm.Config{ 17 | PrepareStmt: true, 18 | SkipDefaultTransaction: true, 19 | }, 20 | ) 21 | if err != nil { 22 | panic(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/dal/redis/init.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/redis/go-redis/v9" 7 | "github.com/tiktokmall/backend/app/frontend/conf" 8 | ) 9 | 10 | var RedisClient *redis.Client 11 | 12 | func Init() { 13 | RedisClient = redis.NewClient(&redis.Options{ 14 | Addr: conf.GetConf().Redis.Address, 15 | Username: conf.GetConf().Redis.Username, 16 | Password: conf.GetConf().Redis.Password, 17 | DB: conf.GetConf().Redis.DB, 18 | }) 19 | if err := RedisClient.Ping(context.Background()).Err(); err != nil { 20 | panic(err) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/about/about_service_test.go: -------------------------------------------------------------------------------- 1 | package about 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | //"github.com/cloudwego/hertz/pkg/common/test/assert" 9 | "github.com/cloudwego/hertz/pkg/common/ut" 10 | ) 11 | 12 | func TestAbout(t *testing.T) { 13 | h := server.Default() 14 | h.GET("/about", About) 15 | path := "/about" // todo: you can customize query 16 | body := &ut.Body{Body: bytes.NewBufferString(""), Len: 1} // todo: you can customize body 17 | header := ut.Header{} // todo: you can customize header 18 | w := ut.PerformRequest(h.Engine, "GET", path, body, header) 19 | resp := w.Result() 20 | t.Log(string(resp.Body())) 21 | 22 | // todo edit your unit test. 23 | // assert.DeepEqual(t, 200, resp.StatusCode()) 24 | // assert.DeepEqual(t, "null", string(resp.Body())) 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/agent/agent_service.go: -------------------------------------------------------------------------------- 1 | package agent 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudwego/hertz/pkg/app" 7 | "github.com/cloudwego/hertz/pkg/protocol/consts" 8 | "github.com/tiktokmall/backend/app/frontend/biz/service" 9 | "github.com/tiktokmall/backend/app/frontend/biz/utils" 10 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 11 | ) 12 | 13 | // HandleChat . 14 | // @router api/chat [GET] 15 | func HandleChat(ctx context.Context, c *app.RequestContext) { 16 | var err error 17 | var req common.Empty 18 | err = c.BindAndValidate(&req) 19 | if err != nil { 20 | utils.SendErrResponse(ctx, c, consts.StatusOK, err) 21 | return 22 | } 23 | 24 | // resp := &common.Empty{} 25 | _, err = service.NewHandleChatService(ctx, c).Run(&req) 26 | if err != nil { 27 | utils.SendErrResponse(ctx, c, consts.StatusOK, err) 28 | return 29 | } 30 | 31 | // utils.SendSuccessResponse(ctx, c, consts.StatusOK, resp) 32 | // c.JSON(consts.StatusOK, map[string]any{}) 33 | } 34 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/agent/agent_service_test.go: -------------------------------------------------------------------------------- 1 | package agent 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | //"github.com/cloudwego/hertz/pkg/common/test/assert" 9 | "github.com/cloudwego/hertz/pkg/common/ut" 10 | ) 11 | 12 | func TestHandleChat(t *testing.T) { 13 | h := server.Default() 14 | h.GET("api/chat", HandleChat) 15 | path := "api/chat" // todo: you can customize query 16 | body := &ut.Body{Body: bytes.NewBufferString(""), Len: 1} // todo: you can customize body 17 | header := ut.Header{} // todo: you can customize header 18 | w := ut.PerformRequest(h.Engine, "GET", path, body, header) 19 | resp := w.Result() 20 | t.Log(string(resp.Body())) 21 | 22 | // todo edit your unit test. 23 | // assert.DeepEqual(t, 200, resp.StatusCode()) 24 | // assert.DeepEqual(t, "null", string(resp.Body())) 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/category/category_service_test.go: -------------------------------------------------------------------------------- 1 | package category 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | //"github.com/cloudwego/hertz/pkg/common/test/assert" 9 | "github.com/cloudwego/hertz/pkg/common/ut" 10 | ) 11 | 12 | func TestCategory(t *testing.T) { 13 | h := server.Default() 14 | h.GET("/category/:category", Category) 15 | path := "/category/:category" // todo: you can customize query 16 | body := &ut.Body{Body: bytes.NewBufferString(""), Len: 1} // todo: you can customize body 17 | header := ut.Header{} // todo: you can customize header 18 | w := ut.PerformRequest(h.Engine, "GET", path, body, header) 19 | resp := w.Result() 20 | t.Log(string(resp.Body())) 21 | 22 | // todo edit your unit test. 23 | // assert.DeepEqual(t, 200, resp.StatusCode()) 24 | // assert.DeepEqual(t, "null", string(resp.Body())) 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/home/hello_service_test.go: -------------------------------------------------------------------------------- 1 | package home 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | //"github.com/cloudwego/hertz/pkg/common/test/assert" 9 | "github.com/cloudwego/hertz/pkg/common/ut" 10 | ) 11 | 12 | func TestHome(t *testing.T) { 13 | h := server.Default() 14 | h.GET("/", Home) 15 | path := "/" // todo: you can customize query 16 | body := &ut.Body{Body: bytes.NewBufferString(""), Len: 1} // todo: you can customize body 17 | header := ut.Header{} // todo: you can customize header 18 | w := ut.PerformRequest(h.Engine, "GET", path, body, header) 19 | resp := w.Result() 20 | t.Log(string(resp.Body())) 21 | 22 | // todo edit your unit test. 23 | // assert.DeepEqual(t, 200, resp.StatusCode()) 24 | // assert.DeepEqual(t, "null", string(resp.Body())) 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/order/order_service.go: -------------------------------------------------------------------------------- 1 | package order 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/tiktokmall/backend/app/frontend/biz/service" 7 | "github.com/tiktokmall/backend/app/frontend/biz/utils" 8 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 9 | 10 | "github.com/cloudwego/hertz/pkg/app" 11 | "github.com/cloudwego/hertz/pkg/protocol/consts" 12 | ) 13 | 14 | // OrderList . 15 | // @router /order [GET] 16 | func OrderList(ctx context.Context, c *app.RequestContext) { 17 | var err error 18 | var req common.Empty 19 | err = c.BindAndValidate(&req) 20 | if err != nil { 21 | c.JSON(consts.StatusBadRequest, map[string]any{ 22 | "code": 400, 23 | "message": err.Error(), 24 | }) 25 | return 26 | } 27 | 28 | resp, err := service.NewOrderListService(ctx, c).Run(&req) 29 | if err != nil { 30 | c.JSON(consts.StatusInternalServerError, map[string]any{ 31 | "code": 500, 32 | "message": err.Error(), 33 | }) 34 | return 35 | } 36 | 37 | resp["code"] = 200 38 | resp["message"] = "ok" 39 | c.JSON(consts.StatusOK, utils.WarpResponse(ctx, c, resp)) 40 | } 41 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/handler/order/order_service_test.go: -------------------------------------------------------------------------------- 1 | package order 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | //"github.com/cloudwego/hertz/pkg/common/test/assert" 9 | "github.com/cloudwego/hertz/pkg/common/ut" 10 | ) 11 | 12 | func TestOrderList(t *testing.T) { 13 | h := server.Default() 14 | h.GET("/order", OrderList) 15 | path := "/order" // todo: you can customize query 16 | body := &ut.Body{Body: bytes.NewBufferString(""), Len: 1} // todo: you can customize body 17 | header := ut.Header{} // todo: you can customize header 18 | w := ut.PerformRequest(h.Engine, "GET", path, body, header) 19 | resp := w.Result() 20 | t.Log(string(resp.Body())) 21 | 22 | // todo edit your unit test. 23 | // assert.DeepEqual(t, 200, resp.StatusCode()) 24 | // assert.DeepEqual(t, "null", string(resp.Body())) 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/about/about.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package about 4 | 5 | import ( 6 | about "github.com/tiktokmall/backend/app/frontend/biz/handler/about" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.GET("/about", append(_aboutMw(), about.About)...) 21 | } 22 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/about/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package about 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _aboutMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/agent/agent.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package agent 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app/server" 7 | agent "github.com/tiktokmall/backend/app/frontend/biz/handler/agent" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | { 21 | _agent := root.Group("/agent", _agentMw()...) 22 | { 23 | _api := _agent.Group("/api", _apiMw()...) 24 | _api.POST("/chat", append(_handlechatMw(), agent.HandleChat)...) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/agent/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package agent 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _apiMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | 19 | func _handlechatMw() []app.HandlerFunc { 20 | // your code... 21 | return nil 22 | } 23 | 24 | func _agentMw() []app.HandlerFunc { 25 | // your code... 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/auth/auth_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package auth 4 | 5 | import ( 6 | auth "github.com/tiktokmall/backend/app/frontend/biz/handler/auth" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | { 21 | _auth := root.Group("/auth", _authMw()...) 22 | _auth.POST("/login", append(_loginMw(), auth.Login)...) 23 | _auth.POST("/logout", append(_logoutMw(), auth.Logout)...) 24 | _auth.POST("/register", append(_registerMw(), auth.Register)...) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/auth/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package auth 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _authMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | 19 | func _loginMw() []app.HandlerFunc { 20 | // your code... 21 | return nil 22 | } 23 | 24 | func _registerMw() []app.HandlerFunc { 25 | // your code... 26 | return nil 27 | } 28 | 29 | func _logoutMw() []app.HandlerFunc { 30 | // your code... 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/cart/cart_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package cart 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app/server" 7 | cart "github.com/tiktokmall/backend/app/frontend/biz/handler/cart" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.POST("/cart", append(_addcartitemMw(), cart.AddCartItem)...) 21 | root.GET("/cart", append(_getcartMw(), cart.GetCart)...) 22 | root.POST("/changeqty", append(_changeqtyMw(), cart.ChangeQty)...) 23 | root.GET("/emptycart", append(_emptycartMw(), cart.EmptyCart)...) 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/cart/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package cart 4 | 5 | import ( 6 | "github.com/tiktokmall/backend/app/frontend/middleware" 7 | 8 | "github.com/cloudwego/hertz/pkg/app" 9 | ) 10 | 11 | func rootMw() []app.HandlerFunc { 12 | // your code... 13 | return []app.HandlerFunc{middleware.Jwt()} 14 | } 15 | 16 | func _addcartitemMw() []app.HandlerFunc { 17 | // your code... 18 | return nil 19 | } 20 | 21 | func _getcartMw() []app.HandlerFunc { 22 | // your code... 23 | return nil 24 | } 25 | 26 | func _emptycartMw() []app.HandlerFunc { 27 | // your code... 28 | return nil 29 | } 30 | 31 | func _changeqtyMw() []app.HandlerFunc { 32 | // your code... 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/category/category_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package category 4 | 5 | import ( 6 | category "github.com/tiktokmall/backend/app/frontend/biz/handler/category" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | { 21 | _category := root.Group("/category", _categoryMw()...) 22 | _category.GET("/:category", append(_category0Mw(), category.Category)...) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/category/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package category 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _categoryMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | 19 | func _category0Mw() []app.HandlerFunc { 20 | // your code... 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/checkout/checkout_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package checkout 4 | 5 | import ( 6 | checkout "github.com/tiktokmall/backend/app/frontend/biz/handler/checkout" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.GET("/checkout", append(_checkout0Mw(), checkout.Checkout)...) 21 | _checkout := root.Group("/checkout", _checkoutMw()...) 22 | _checkout.GET("/result", append(_checkoutresultMw(), checkout.CheckoutResult)...) 23 | _checkout.POST("/waiting", append(_checkoutwaitingMw(), checkout.CheckoutWaiting)...) 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/checkout/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package checkout 4 | 5 | import ( 6 | "github.com/tiktokmall/backend/app/frontend/middleware" 7 | 8 | "github.com/cloudwego/hertz/pkg/app" 9 | ) 10 | 11 | func rootMw() []app.HandlerFunc { 12 | // your code... 13 | // 给路由添加中间件 14 | return []app.HandlerFunc{middleware.Jwt()} 15 | } 16 | 17 | func _checkoutMw() []app.HandlerFunc { 18 | // your code... 19 | return nil 20 | } 21 | 22 | func _checkout0Mw() []app.HandlerFunc { 23 | // your code... 24 | return nil 25 | } 26 | 27 | func _checkoutresultMw() []app.HandlerFunc { 28 | // your code... 29 | return nil 30 | } 31 | 32 | func _checkoutwaitingMw() []app.HandlerFunc { 33 | // your code... 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/home/home.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package home 4 | 5 | import ( 6 | home "github.com/tiktokmall/backend/app/frontend/biz/handler/home" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.GET("/", append(_homeMw(), home.Home)...) 21 | } 22 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/home/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package home 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _homeMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/order/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package order 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _orderlistMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/order/order_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package order 4 | 5 | import ( 6 | order "github.com/tiktokmall/backend/app/frontend/biz/handler/order" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.GET("/order", append(_orderlistMw(), order.OrderList)...) 21 | } 22 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/oss/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package oss 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | "github.com/tiktokmall/backend/app/frontend/middleware" 8 | ) 9 | 10 | func rootMw() []app.HandlerFunc { 11 | // your code... 12 | return []app.HandlerFunc{middleware.Jwt()} 13 | } 14 | 15 | func _uploadimageMw() []app.HandlerFunc { 16 | // your code... 17 | return nil 18 | } 19 | 20 | func _uploadvideoMw() []app.HandlerFunc { 21 | // your code... 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/oss/oss.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package oss 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app/server" 7 | oss "github.com/tiktokmall/backend/app/frontend/biz/handler/oss" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.POST("/uploadImage", append(_uploadimageMw(), oss.UploadImage)...) 21 | root.POST("/uploadVideo", append(_uploadvideoMw(), oss.UploadVideo)...) 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/payment/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package payment 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _alipayMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | 19 | func _payresultMw() []app.HandlerFunc { 20 | // your code... 21 | return nil 22 | } 23 | 24 | func _paysuccessMw() []app.HandlerFunc { 25 | // your code... 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/payment/payment_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package payment 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app/server" 7 | payment "github.com/tiktokmall/backend/app/frontend/biz/handler/payment" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.POST("/alipay", append(_alipayMw(), payment.Alipay)...) 21 | root.POST("/payresult", append(_payresultMw(), payment.Payresult)...) 22 | root.GET("/paysuccess", append(_paysuccessMw(), payment.Paysuccess)...) 23 | } 24 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/product/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package product 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | ) 8 | 9 | func rootMw() []app.HandlerFunc { 10 | // your code... 11 | return nil 12 | } 13 | 14 | func _getproductMw() []app.HandlerFunc { 15 | // your code... 16 | return nil 17 | } 18 | 19 | func _searchproductsMw() []app.HandlerFunc { 20 | // your code... 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/product/product_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package product 4 | 5 | import ( 6 | product "github.com/tiktokmall/backend/app/frontend/biz/handler/product" 7 | "github.com/cloudwego/hertz/pkg/app/server" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | root.GET("/product", append(_getproductMw(), product.GetProduct)...) 21 | root.GET("/search", append(_searchproductsMw(), product.SearchProducts)...) 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/user/middleware.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. 2 | 3 | package user 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app" 7 | "github.com/tiktokmall/backend/app/frontend/middleware" 8 | ) 9 | 10 | func rootMw() []app.HandlerFunc { 11 | // your code... 12 | return []app.HandlerFunc{middleware.Jwt()} 13 | } 14 | 15 | func _userMw() []app.HandlerFunc { 16 | // your code... 17 | return nil 18 | } 19 | 20 | func _updateMw() []app.HandlerFunc { 21 | // your code... 22 | return nil 23 | } 24 | 25 | func _deleteMw() []app.HandlerFunc { 26 | // your code... 27 | return nil 28 | } 29 | 30 | func _deleteuserMw() []app.HandlerFunc { 31 | // your code... 32 | return nil 33 | } 34 | 35 | func _queryMw() []app.HandlerFunc { 36 | // your code... 37 | return nil 38 | } 39 | 40 | func _queryuserMw() []app.HandlerFunc { 41 | // your code... 42 | return nil 43 | } 44 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/router/user/user_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by hertz generator. DO NOT EDIT. 2 | 3 | package user 4 | 5 | import ( 6 | "github.com/cloudwego/hertz/pkg/app/server" 7 | user "github.com/tiktokmall/backend/app/frontend/biz/handler/user" 8 | ) 9 | 10 | /* 11 | This file will register all the routes of the services in the master idl. 12 | And it will update automatically when you use the "update" command for the idl. 13 | So don't modify the contents of the file, or your code will be deleted when it is updated. 14 | */ 15 | 16 | // Register register routes based on the IDL 'api.${HTTP Method}' annotation. 17 | func Register(r *server.Hertz) { 18 | 19 | root := r.Group("/", rootMw()...) 20 | { 21 | _user := root.Group("/user", _userMw()...) 22 | _user.GET("/delete", append(_deleteuserMw(), user.DeleteUser)...) 23 | _user.GET("/query", append(_queryuserMw(), user.QueryUser)...) 24 | _user.POST("/update", append(_updateMw(), user.Update)...) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/about.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 7 | 8 | "github.com/cloudwego/hertz/pkg/app" 9 | ) 10 | 11 | type AboutService struct { 12 | RequestContext *app.RequestContext 13 | Context context.Context 14 | } 15 | 16 | func NewAboutService(Context context.Context, RequestContext *app.RequestContext) *AboutService { 17 | return &AboutService{RequestContext: RequestContext, Context: Context} 18 | } 19 | 20 | func (h *AboutService) Run(req *common.Empty) (resp map[string]any, err error) { 21 | return map[string]any{ 22 | "title": "About", 23 | }, nil 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/category.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | category "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/category" 8 | "github.com/tiktokmall/backend/app/frontend/infra/rpc" 9 | "github.com/tiktokmall/backend/rpc_gen/kitex_gen/product" 10 | 11 | "github.com/cloudwego/hertz/pkg/app" 12 | ) 13 | 14 | type CategoryService struct { 15 | RequestContext *app.RequestContext 16 | Context context.Context 17 | } 18 | 19 | func NewCategoryService(Context context.Context, RequestContext *app.RequestContext) *CategoryService { 20 | return &CategoryService{RequestContext: RequestContext, Context: Context} 21 | } 22 | 23 | func (h *CategoryService) Run(req *category.CategoryReq) (resp map[string]any, err error) { 24 | p, err := rpc.ProductClient.ListProducts(h.Context, &product.ListProductsReq{CategoryName: req.Category}) 25 | if err != nil { 26 | return nil, err 27 | } 28 | log.Printf("category=%v, items=%v", req.Category, p.Products) 29 | return map[string]any{ 30 | "title": "Category", 31 | "items": p.Products, 32 | }, nil 33 | } 34 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/checkout_result.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 7 | 8 | "github.com/cloudwego/hertz/pkg/app" 9 | ) 10 | 11 | type CheckoutResultService struct { 12 | RequestContext *app.RequestContext 13 | Context context.Context 14 | } 15 | 16 | func NewCheckoutResultService(Context context.Context, RequestContext *app.RequestContext) *CheckoutResultService { 17 | return &CheckoutResultService{RequestContext: RequestContext, Context: Context} 18 | } 19 | 20 | func (h *CheckoutResultService) Run(req *common.Empty) (resp map[string]any, err error) { 21 | return map[string]any{}, nil 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/empty_cart.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "github.com/tiktokmall/backend/app/frontend/infra/rpc" 6 | frontendUtils "github.com/tiktokmall/backend/app/frontend/utils" 7 | rpccart "github.com/tiktokmall/backend/rpc_gen/kitex_gen/cart" 8 | 9 | "github.com/cloudwego/hertz/pkg/app" 10 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 11 | ) 12 | 13 | type EmptyCartService struct { 14 | RequestContext *app.RequestContext 15 | Context context.Context 16 | } 17 | 18 | func NewEmptyCartService(Context context.Context, RequestContext *app.RequestContext) *EmptyCartService { 19 | return &EmptyCartService{RequestContext: RequestContext, Context: Context} 20 | } 21 | 22 | func (h *EmptyCartService) Run(req *common.Empty) (resp map[string]any, err error) { 23 | _, err = rpc.CartClient.EmptyCart(h.Context, &rpccart.EmptyCartReq{ 24 | UserId: frontendUtils.GetUserIdFromCtx(h.Context), 25 | }) 26 | return map[string]any{ 27 | "message": "success", 28 | }, err 29 | } 30 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/get_product.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | product "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/product" 7 | "github.com/tiktokmall/backend/app/frontend/infra/rpc" 8 | 9 | "github.com/cloudwego/hertz/pkg/common/utils" 10 | 11 | rpcproduct "github.com/tiktokmall/backend/rpc_gen/kitex_gen/product" 12 | 13 | "github.com/cloudwego/hertz/pkg/app" 14 | ) 15 | 16 | type GetProductService struct { 17 | RequestContext *app.RequestContext 18 | Context context.Context 19 | } 20 | 21 | func NewGetProductService(Context context.Context, RequestContext *app.RequestContext) *GetProductService { 22 | return &GetProductService{RequestContext: RequestContext, Context: Context} 23 | } 24 | 25 | func (h *GetProductService) Run(req *product.ProductReq) (resp map[string]any, err error) { 26 | 27 | p, err := rpc.ProductClient.GetProduct(h.Context, &rpcproduct.GetProductReq{Id: req.Id}) 28 | if err != nil { 29 | return nil, err 30 | } 31 | 32 | return utils.H{ 33 | "item": p.Product, 34 | }, nil 35 | } 36 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/home.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 7 | "github.com/tiktokmall/backend/app/frontend/infra/rpc" 8 | "github.com/tiktokmall/backend/rpc_gen/kitex_gen/product" 9 | 10 | "github.com/cloudwego/hertz/pkg/app" 11 | ) 12 | 13 | type HomeService struct { 14 | RequestContext *app.RequestContext 15 | Context context.Context 16 | } 17 | 18 | func NewHomeService(Context context.Context, RequestContext *app.RequestContext) *HomeService { 19 | return &HomeService{RequestContext: RequestContext, Context: Context} 20 | } 21 | 22 | func (h *HomeService) Run(req *common.Empty) (resp map[string]any, err error) { 23 | products, err := rpc.ProductClient.ListProducts(h.Context, &product.ListProductsReq{}) 24 | if err != nil { 25 | return nil, err 26 | } 27 | return map[string]any{ 28 | "title": "Hot Sale", 29 | "items": products.Products, 30 | }, nil 31 | } 32 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/logout.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 7 | 8 | "github.com/cloudwego/hertz/pkg/app" 9 | "github.com/hertz-contrib/sessions" 10 | ) 11 | 12 | type LogoutService struct { 13 | RequestContext *app.RequestContext 14 | Context context.Context 15 | } 16 | 17 | func NewLogoutService(Context context.Context, RequestContext *app.RequestContext) *LogoutService { 18 | return &LogoutService{RequestContext: RequestContext, Context: Context} 19 | } 20 | 21 | func (h *LogoutService) Run(req *common.Empty) (resp *common.Empty, err error) { 22 | //defer func() { 23 | // hlog.CtxInfof(h.Context, "req = %+v", req) 24 | // hlog.CtxInfof(h.Context, "resp = %+v", resp) 25 | //}() 26 | // todo edit your code 27 | session := sessions.Default(h.RequestContext) 28 | session.Clear() 29 | 30 | err = session.Save() 31 | if err != nil { 32 | return nil, err 33 | } 34 | return 35 | } 36 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/merchant_ping.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudwego/hertz/pkg/app" 7 | common "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/common" 8 | "github.com/tiktokmall/backend/app/frontend/utils" 9 | ) 10 | 11 | type MerchantPingService struct { 12 | RequestContext *app.RequestContext 13 | Context context.Context 14 | } 15 | 16 | func NewMerchantPingService(Context context.Context, RequestContext *app.RequestContext) *MerchantPingService { 17 | return &MerchantPingService{RequestContext: RequestContext, Context: Context} 18 | } 19 | 20 | func (h *MerchantPingService) Run(req *common.Empty) (resp utils.H, err error) { 21 | //defer func() { 22 | // hlog.CtxInfof(h.Context, "req = %+v", req) 23 | // hlog.CtxInfof(h.Context, "resp = %+v", resp) 24 | //}() 25 | // todo edit your code 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/service/search_products.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | 6 | product "github.com/tiktokmall/backend/app/frontend/hertz_gen/frontend/product" 7 | "github.com/tiktokmall/backend/app/frontend/infra/rpc" 8 | rpcproduct "github.com/tiktokmall/backend/rpc_gen/kitex_gen/product" 9 | 10 | "github.com/cloudwego/hertz/pkg/app" 11 | ) 12 | 13 | type SearchProductsService struct { 14 | RequestContext *app.RequestContext 15 | Context context.Context 16 | } 17 | 18 | func NewSearchProductsService(Context context.Context, RequestContext *app.RequestContext) *SearchProductsService { 19 | return &SearchProductsService{RequestContext: RequestContext, Context: Context} 20 | } 21 | 22 | func (h *SearchProductsService) Run(req *product.SearchProductsReq) (resp map[string]any, err error) { 23 | products, err := rpc.ProductClient.SearchProducts(h.Context, &rpcproduct.SearchProductsReq{ 24 | Query: req.Q, 25 | }) 26 | if err != nil { 27 | return nil, err 28 | } 29 | return map[string]any{ 30 | "items": products.Results, 31 | "q": req.Q, 32 | }, nil 33 | } 34 | -------------------------------------------------------------------------------- /backend/app/frontend/biz/utils/type.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | type H map[string]any 4 | -------------------------------------------------------------------------------- /backend/app/frontend/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RUN_NAME=frontend 3 | mkdir -p output/bin output/conf 4 | cp script/bootstrap.sh output 2>/dev/null 5 | chmod +x output/bootstrap.sh 6 | cp -r conf/* output/conf 7 | go build -o output/bin/${RUN_NAME} -------------------------------------------------------------------------------- /backend/app/frontend/conf/dev/conf.yaml: -------------------------------------------------------------------------------- 1 | hertz: 2 | service: "frontend" 3 | address: ":8080" 4 | metrics_port: ":8090" 5 | enable_pprof: true 6 | enable_gzip: true 7 | enable_access_log: true 8 | log_level: info 9 | log_file_name: "log/hertz.log" 10 | log_max_size: 10 11 | log_max_age: 3 12 | log_max_backups: 50 13 | registry_addr: "127.0.0.1:8500" 14 | 15 | # mysql 没用 16 | mysql: 17 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 18 | 19 | redis: 20 | address: "127.0.0.1:6379" 21 | username: "" 22 | password: "" 23 | db: 0 -------------------------------------------------------------------------------- /backend/app/frontend/conf/online/conf.yaml: -------------------------------------------------------------------------------- 1 | hertz: 2 | service: "frontend" 3 | address: ":8080" 4 | metrics_port: ":8090" 5 | enable_pprof: true 6 | enable_gzip: true 7 | enable_access_log: true 8 | log_level: info 9 | log_file_name: "log/hertz.log" 10 | log_max_size: 10 11 | log_max_age: 3 12 | log_max_backups: 50 13 | registry_addr: "127.0.0.1:8500" 14 | 15 | # mysql 没用 16 | mysql: 17 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 18 | 19 | redis: 20 | address: "127.0.0.1:6379" 21 | username: "" 22 | password: "" 23 | db: 0 -------------------------------------------------------------------------------- /backend/app/frontend/conf/test/conf.yaml: -------------------------------------------------------------------------------- 1 | hertz: 2 | service: "frontend" 3 | address: ":8080" 4 | metrics_port: ":8090" 5 | enable_pprof: true 6 | enable_gzip: true 7 | enable_access_log: true 8 | log_level: info 9 | log_file_name: "log/hertz.log" 10 | log_max_size: 10 11 | log_max_age: 3 12 | log_max_backups: 50 13 | registry_addr: "127.0.0.1:8500" 14 | 15 | # mysql 没用 16 | mysql: 17 | dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" 18 | 19 | redis: 20 | address: "127.0.0.1:6379" 21 | username: "" 22 | password: "" 23 | db: 0 -------------------------------------------------------------------------------- /backend/app/frontend/data/task/tasks.jsonl: -------------------------------------------------------------------------------- 1 | {"id":"39811745-e74c-4bdc-a36d-77c0fe62eccc","title":"明天下午三点吃饭任务","content":"吃饭","completed":false,"deadline":"2025-02-20 15:00:00","is_deleted":false,"created_at":"2025-02-19T05:30:22+08:00"} 2 | -------------------------------------------------------------------------------- /backend/app/frontend/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | mysql: 4 | image: 'mysql:latest' 5 | ports: 6 | - 3306:3306 7 | environment: 8 | - MYSQL_DATABASE=gorm 9 | - MYSQL_USER=gorm 10 | - MYSQL_PASSWORD=gorm 11 | - MYSQL_RANDOM_ROOT_PASSWORD="yes" 12 | redis: 13 | image: 'redis:latest' 14 | ports: 15 | - 6379:6379 -------------------------------------------------------------------------------- /backend/app/frontend/middleware/middleware.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import "github.com/cloudwego/hertz/pkg/app/server" 4 | 5 | func Register(h *server.Hertz) { 6 | h.Use(GlobalAuth()) 7 | } 8 | -------------------------------------------------------------------------------- /backend/app/frontend/readme.md: -------------------------------------------------------------------------------- 1 | # *** Project 2 | 3 | ## introduce 4 | 5 | - Use the [Hertz](https://github.com/cloudwego/hertz/) framework 6 | - Integration of pprof, cors, recovery, access_log, gzip and other extensions of Hertz. 7 | - Generating the base code for unit tests. 8 | - Provides basic profile functions. 9 | - Provides the most basic MVC code hierarchy. 10 | 11 | ## Directory structure 12 | 13 | | catalog | introduce | 14 | | ---- | ---- | 15 | | conf | Configuration files | 16 | | main.go | Startup file | 17 | | hertz_gen | Hertz generated model | 18 | | biz/handler | Used for request processing, validation and return of response. | 19 | | biz/service | The actual business logic. | 20 | | biz/dal | Logic for operating the storage layer | 21 | | biz/route | Routing and middleware registration | 22 | | biz/utils | Wrapped some common methods | 23 | 24 | ## How to run 25 | 26 | ```shell 27 | sh build.sh 28 | sh output/bootstrap.sh 29 | ``` -------------------------------------------------------------------------------- /backend/app/frontend/script/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CURDIR=$(cd $(dirname $0); pwd) 3 | BinaryName=frontend 4 | echo "$CURDIR/bin/${BinaryName}" 5 | exec $CURDIR/bin/${BinaryName} -------------------------------------------------------------------------------- /backend/app/frontend/static/image/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/logo.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/mouse-pad.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/mouse-pad.jpeg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/notebook.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/notebook.jpeg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/sweatshirt.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/sweatshirt.jpeg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/t-shirt-1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/t-shirt-1.jpeg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/t-shirt-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/t-shirt-2.jpeg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/t-shirt.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/t-shirt.jpeg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/toiletry-bag.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/toiletry-bag.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/image/toothbrush-cup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/image/toothbrush-cup.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/logo.png -------------------------------------------------------------------------------- /backend/app/frontend/static/img/t-shirt-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/t-shirt-1.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/img/t-shirt-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/t-shirt-2.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/img/t-shirt-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/t-shirt-3.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/img/t-shirt-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/t-shirt-4.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/img/t-shirt-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/t-shirt-5.jpg -------------------------------------------------------------------------------- /backend/app/frontend/static/img/t-shirt-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzulihrs/TikTokMall/22bdae6c52c13b4818af407f3cb59f5b8fca506b/backend/app/frontend/static/img/t-shirt-6.jpg -------------------------------------------------------------------------------- /backend/app/frontend/template/about.tmpl: -------------------------------------------------------------------------------- 1 | {{ define "about" }} 2 | {{ template "header" . }} 3 |
This is a community driven project
9 |