landofcoder / module-marketplace-graphql
Magento 2 市场GraphQl扩展
1.0.5
2024-04-05 09:20 UTC
Requires
- landofcoder/module-marketplace: *
- dev-master
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-upgrade-refactor-246p4
- dev-add-system
- dev-add-get-product-attribute
- dev-fix-get-rating-seller
- dev-update-review-seller-mutation
- dev-new-queries
- dev-update1.0.2
- dev-update-queries
- dev-fix-graphql-issue
- dev-refactor-graphql-resolver
- dev-update-graphql
This package is auto-updated.
Last update: 2024-09-05 10:14:41 UTC
README
``landofcoder/module-marketplace-graphql
``
主要功能
magento 2 marketplace graphql 扩展
市场插件 GraphQL 扩展
安装
* = 在生产中请使用 --keep-generated
选项
类型 1:Zip 文件
- 在
app/code/Lof
中解压缩 zip 文件 - 通过运行
php bin/magento module:enable Lof_MarketplaceGraphQl
启用模块 - 通过运行
php bin/magento setup:upgrade
应用数据库更新* - 通过运行
php bin/magento cache:flush
清除缓存
类型 2:Composer
- 使模块在 composer 仓库中可用,例如
- 私有仓库
repo.magento.com
- 公共仓库
packagist.org
- 公共 GitHub 仓库作为 vcs
- 私有仓库
- 通过运行
composer config repositories.repo.magento.com composer https://repo.magento.com/
将 composer 仓库添加到配置 - 通过运行
composer require landofcoder/module-marketplace-graphql
安装模块 - 通过运行
php bin/magento module:enable Lof_MarketplaceGraphQl
启用模块 - 通过运行
php bin/magento setup:upgrade
应用数据库更新* - 通过运行
php bin/magento cache:flush
清除缓存
TODO
- 重构 Graphql 查询
- 重构解析器
- 为 Graphql 查询添加文档
查询
- 通过 URL 获取卖家配置信息
{
sellerByUrl(
seller_url: String! @doc(description: "Seller Url Key")
get_other_info: Boolean = false @doc(description: "Get other info: reviews, ratings, total sales, vacation")
get_products: Boolean = false @doc(description: "Get Latest Products")
) {
address
banner_pic
city
company_description
company_locality
contact_number
country
customer_id
email
gplus_active
gplus_id
group
image
name
page_layout
region
return_policy
sale
seller_id
shipping_policy
shop_title
status
store_id
thumbnail
seller_rates {
items {
created_at
customer_id
detail
email
nickname
rate1
rate2
rate3
rating_id
seller_id
status
title
}
total_count
}
}
}
示例
{
sellerByUrl(seller_url: "seller1") {
shop_title
thumbnail
logo_pic
banner_pic
url_key
telephone
product_count
total_sold
offers
benefits
product_shipping_info
prepare_time
response_ratio
response_time
creation_time
}
}
- 通过 ID 获取卖家配置
{
sellerById(
seller_id: Int! @doc(description: "Seller id")
get_other_info: Boolean = false @doc(description: "Get other info: reviews, ratings, total sales, vacation")
get_products: Boolean = false @doc(description: "Get Latest Products")
) {
address
banner_pic
city
company_description
company_locality
contact_number
country
customer_id
email
gplus_active
gplus_id
group
image
name
page_layout
region
return_policy
sale
seller_id
shipping_policy
shop_title
status
store_id
thumbnail
seller_rates {
items {
created_at
customer_id
detail
email
nickname
rate1
rate2
rate3
rating_id
seller_id
status
title
}
total_count
}
}
}
示例
{
sellerById(seller_id: 1) {
shop_title
thumbnail
logo_pic
banner_pic
url_key
telephone
product_count
total_sold
offers
benefits
product_shipping_info
prepare_time
response_ratio
response_time
creation_time
}
}
- 通过过滤选项获取卖家列表
{
sellers (
filter: SellerFilterInput,
pageSize: Int = 20,
currentPage: Int = 1,
sort: SellerSortInput
) {
total_count
items {
seller_rates {
items {
created_at
customer_id
detail
email
nickname
rate1
rate2
rate3
rating_id
seller_id
status
title
}
total_count
}
sale
seller_id
name
thumbnail
country
address
group
products {
items {
sale
id
name
url_key
rating_summary
sku
image {
url
label
}
description {
html
}
short_description {
html
}
product_brand
price_range {
maximum_price {
discount {
amount_off
percent_off
}
final_price {
currency
value
}
regular_price {
currency
value
}
}
minimum_price {
discount {
amount_off
percent_off
}
final_price {
currency
value
}
regular_price {
currency
value
}
}
}
price {
regularPrice {
amount {
currency
}
}
}
}
total_count
}
}
}
}
- 获取卖家集合(分组)
{
sellerCollection(
filter: SellerGroupFilterInput,
pageSize: Int = 5,
currentPage: Int = 1,
sort: SellerGroupSortInput
) {
total_count
items {
group_id
name
url_key
position
}
}
}
- 按卖家 ID 过滤产品
fragment ShopProduct on ProductInterface {
id
rating_summary
description {
html
}
name
image {
url
}
url_key
price_range {
minimum_price {
regular_price {
value
currency
}
}
maximum_price {
discount {
percent_off
}
final_price {
value
currency
}
regular_price {
value
}
}
}
}
fragment PageInfo on SearchResultPageInfo {
current_page
page_size
total_pages
}
productsBySellerId(
seller_id: Int!
search: String = ""
filter: ProductAttributeFilterInput
pageSize: Int = 20
currentPage: Int = 1
sort: ProductAttributeSortInput
) {
items {
...ShopProduct
}
page_info {
...PageInfo
}
total_count
}
- 通过卖家 URL 获取卖家产品
示例:获取卖家 "seller1" 的产品
{
productsBySellerUrl(
seller_url: "seller1"
search: ""
filter: {}
pageSize: 1
currentPage: 1
) {
items {
id
name
url_key
rating_summary
sku
stock_status
image {
url
label
}
description {
html
}
short_description {
html
}
price {
regularPrice {
amount {
currency
}
}
}
}
page_info {
page_size
current_page
total_pages
}
total_count
}
}
- 在产品查询中获取卖家信息
示例
{
products(filter: { sku: { eq: "AAAU_B2C-W713327" } }) {
items {
name
sku
url_key
stock_status
price_range {
minimum_price {
regular_price {
value
currency
}
}
}
seller {
shop_title
thumbnail
url_key
telephone
product_count
total_sold
offers
benefits
product_shipping_info
prepare_time
response_ratio
response_time
creation_time
}
}
total_count
page_info {
page_size
}
}
}
- 注册卖家 - 需要登录客户
mutation {
registerSeller(
input: {
seller: {
group_id: String
url_key: String!
},
customer: {
firstname: String!
lastname: String!
email: String!
address: {
region_id: String
country_id: String!
city: String!
street: String!
company: String
telephone: String!
postcode: String!
}
},
password: String!
}
) {
code
message
}
}
- 成为卖家 - 需要登录客户
mutation {
becomeSeller(
input: {
group_id: String
url_key: String!
}
) {
code
message
}
}
- 评论卖家 - 需要登录客户
mutation {
reviewSeller(
input: {
seller_url : String!
rate1 : Int!
rate2 : Int!
rate3 : Int!
nickname : String!
email : String!
title : String!
detail : String!
}
) {
code
message
}
}
- 客户向卖家发送联系信息 - 需要登录客户
mutation {
customerSendMessage(
input: {
seller_url : String!
subject : String
content : String!
}
) {
code
message
}
}
- 客户回复消息 - 需要登录客户
mutation {
customerReplyMessage(
input: {
message_id : Int!
content : String!
}
) {
code
message
}
}
- 查询登录客户的消息 - 需要登录客户
{
sellerMessages(
filter: SellerMessageFilterInput
pageSize: Int = 20
currentPage: Int = 1
sort: SellerMessageSortInput
) {
total_count
items {
message_id
description
subject
sender_email
sender_name
created_at
status
is_read
sender_id
owner_id
receiver_id
seller_send
details (
pageSize: Int = 20
currentPage: Int = 1
) {
items {
content
sender_name
sender_email
receiver_name
is_read
created_at
}
total_count
page_info {
...PageInfo
}
}
}
page_info {
...PageInfo
}
}
}
- 查询登录客户的卖家信息 - 需要登录客户
{
customer {
firstname
lastname
suffix
email
addresses {
firstname
lastname
street
city
region {
region_code
region
}
postcode
country_code
telephone
}
seller {
shop_title
thumbnail
logo_pic
banner_pic
url_key
telephone
product_count
total_sold
offers
benefits
product_shipping_info
prepare_time
response_ratio
response_time
creation_time
}
}
}
- 通过卖家 URL 键获取卖家评分列表
查询
{
sellerRatings(
seller_url: "seller1"
filter: {}
pageSize: 5
currentPage: 1
sort: { created_at: DESC }
) {
items {
rating_id
rate1
rate2
rate3
rate4
rate5
rating
title
status
detail
nickname
created_at
verified_buyer
is_recommended
is_hidden
answer
admin_note
like_about
not_like_about
guest_email
plus_review
minus_review
report_abuse
country
}
total_count
page_info {
page_size
current_page
total_pages
}
}
}