# Preface
This tutorial is based on the "apifm-wxapi" module and teaches you how to quickly implement small program development, so you may need to understand the following knowledge points first:
["Creating HelloWorld Project"](https://www.yuque.com/apifm/doc/hezlrm)
["Use "apifm-wxapi" to quickly develop small programs"](https://www.yuque.com/apifm/doc/mdldsd)
["Register for free to open the backend and obtain an exclusive domain name"](https://www.yuque.com/apifm/doc/qr6l4m)
In this case, some functions require the user to log in before they can be operated, which means token authorization is required. Please understand first:
["WeChat Mini Program login to obtain openid and third-party tokens"](https://www.yuque.com/apifm/doc/kaygbw)
# Modules that need to be enabled
Log in to the "First Step" registration background, left menu --> Factory settings --> Module management
Find and enable the following modules, then press F5 to refresh the background interface. You will be able to see all the function menus required for this case:
1. Store management
2. Product classification
3. Product management
# Publish data in the background
Set up and maintain data such as stores, product distribution, products, logistics templates, specifications and sizes according to your actual needs.
**Set member discount**
_If necessary, different discounts can be set for different members, and users will automatically enjoy the discount when purchasing goods_
**Daily Pricing**
_For hotels, room reservations, tickets, and ticket products, prices and inventory will change every day. At this time, you can use this function to price the products on a daily basis_
**Product purchase limit**
_Different membership levels can be set, and only a specified number of goods can be purchased within the agreed time period_
---
## Store Management
### Read all store lists
```plain
WXAPI.fetchShops(Object object)
```
> Please refer to the interface documentation for parameter details.
>
> Supports sorting display from near to far according to the current user's location
>
### Store details
```javascript
WXAPI.shopSubdetail(id)
```
> The id parameter is the id field in the store list return data
>
> This method can read the extended attribute information set in the store backend
>
## Product classification
```plain
WXAPI.goodsCategory()
```
> Read all classification data set in the background. Please use level and pid to manage the superior and subordinate relationships between categories.
>
> level = 1 means level 1 category; 2 means level 2 category, and so on.
>
> pid represents the upper-level category ID of this category (pid = 0 for the first-level category)
>
_The classified directory tree can be implemented locally using js based on the above two fields_
## Product Management
### Get product list
```javascript
WXAPI.goods(Object object)
```
> Read all product data, display it in paging, and support sorting in multiple ways
>
> For descriptions of specific parameters, please refer to the interface documentation.
>
### Get product details information
```javascript
WXAPI.goodsDetail(id)
```
> The id parameter is the id field in the data returned by the above product list method
>
> Accessing this method will increase the number of views of the product
>
> This method obtains basic product information, product graphic and text details, product pictures, optional specifications and sizes, categories, express logistics setting information, and product extended attributes.
>
### Get the purchase limit settings of the product
```javascript
WXAPI.goodsLimitations(goodsId, priceId)
```
> If the **limitation** field in the product (list, details) information is **true**, it means that the product has a purchase limit. Only users with membership levels in the settings can purchase no more than the specified quantity within the agreed time.
>
> This method receives 2 parameters. The **goodsId** parameter is required and represents the product ID; the **priceId** parameter is not required and only needs to be passed when the user selects the specified size when purchasing.
>
> You can perform corresponding interactive display on the product details page based on the membership level of the currently logged in user.
>
### Get the product price "Generally used when you need to display the selling price in real time after selecting different specifications and sizes"
```javascript
WXAPI.goodsPrice(goodsId, propertyChildIds)
```
> goodsId is the product id
>
> **propertyChildIds** The parameter is the specification and size data selected by the user. Multiple specification and size data are separated by commas. The format of this parameter is: specification id: sub-property id, for example: 4:15, 2:10 (corresponding to color: red, memory: 256G respectively)
>
### Get the daily price & daily inventory of the product "Applicable to hotel reservations and ticket reservations"
```javascript
WXAPI.goodsPriceDaily(goodsId, priceId)
```
> goodsId is the product id
>
> priceId is the id of the selected product specification and size record. For products without specifications and sizes, there is no need to pass this parameter.
>
### Calculate logistics/express template cost calculation method
```javascript
WXAPI.goodsPriceFreight(Object object)
```
> Please refer to the interface documentation for specific parameters.
>
> Provide the express delivery address. This method can calculate the billing method for this accounting.
>
_For example: x yuan for a piece (weight), and an additional y yuan for each additional b piece (weight) thereafter_
### Pull the discount information that the current member can display
```javascript
WXAPI.goodsRebate(token, goodsId)
```
> token is the login token of the currently logged in user
>
> goodsId is the product id
>
### Get product reviews
```javascript
WXAPI.goodsReputation(Object object)
```
> Read all evaluation data of current product users
>
> Please refer to the interface documentation for specific parameter descriptions.
>
## Product collection
### Favorite a product
```javascript
WXAPI.goodsFavPut(token, goodsId)
```
### Check whether the current product has been collected
```javascript
WXAPI.goodsFavCheck(token, goodsId)
```
### Get favorited products
```javascript
WXAPI.goodsFavList(Object object)
```
> Please refer to the interface documentation for specific parameter descriptions.
>
> Support paged reading and keyword search for products
>
### Delete a favorited product
```javascript
WXAPI.goodsFavDelete(token, id, goodsId)
```
> The id parameter is the record id in the collection list data
>
> goodsId is the product id
>
> At least one of the above two parameters must be filled in
>
**For more detailed parameter usage and more advanced advanced usage methods, please refer to the API interface documentation: **
["api interface document"](#)
_More usage methods about apifm-wxapi: _
["apifm-wxapi Instructions for Use"](https://github.com/gooking/apifm-wxapi/blob/master/instructions.md)
_Download the Demo code of this case: _
["apifm-wxapi using Demo program"](https://github.com/gooking/apifm-wxapi-demo)
Looking forward to your progress!
grateful!