Mini Program's request failed due to the difference between the encapsulated promise and the direct request parameters.

this is encapsulated

function request(url, params) {
    let promise = new Promise(function (resolve, reject) {
        wx.request({
            url: url,
            data: params,
            header: {
                "X-Token-With": token
            },
            method: "POST",
            success: function (res) {
                console.log(params)
                console.log(res)
                app.globalData.netWorkData = res.data
                resolve();
            }
        })
    });
    return promise
}

request with encapsulation method

  let  data = { keyword: city_name }
                            let url = `${app.globalData.baseUrl}/city/city`
    network.request(url,data).then(() => {
                                _this.setData({
                                    // hot_city: _this.jsonToArray(app.globalData.netWorkData.resultData)
                                    city: {
                                        name: city_name,
                                        id: app.globalData.netWorkData.resultData[0].region_id
                                    }
                                })
                            });

clipboard.png

clipboard.png


clipboard.png

clipboard.png
Why is it different? what"s the problem?

Feb.27,2021

resolve takes no parameters.
resolve (res);

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