Super simple small program likes the function

I also watched the praise function of many students in the development, but the amount of code is too much, so I wrote one, the code is as follows, and I need to take it away.

第一步

bbs_list:function(){
    var page = this;
    app.request({
      url: xxxx,
      success: function (res) {
        if (res.code == 1) {
          wx.setStorageSync("liked_list", res.data.bbs_list) // After successful success cachepage.setData({
            Bbs_list: res.data.bbs_list,
          });
        }
      }
    });
  }

第二部

froum_liked:function(e){
    var page = this;
    app.request({
      url: xxx,
      data:{
        comment_id: e.currentTarget.dataset.commentid, //Get the value of the current operation},
      Success:function(res){
        if(res.code == 1){
          var newdata = wx.getStorageSync("liked_list"); //Get the data of the first step 
          for (var i in newdata){ // Loop out the id of the current operation array (you can also get the subscript to do the processing) 
            if (newdata[i].id == e.currentTarget.dataset.commentid){
              newdata[i]['user_liked'] = parseInt(newdata[i].user_liked)+1;
              wx.setStorageSync("liked_list", newdata) //Cache again first No clicks are cached once in the step data}
          }
          page.setData({//Assign to arraybbs_list: newdata
          });
        }
      }
    });
  }, 

The key part has been annotated