收藏
回答

用wx.cloud.uploadFile往云存储中上传2.63K的.txt文件,偶尔出错为什么?

如红圈所示,只发了部分长度的文件。遇到这种情况,wx.cloud.uploadFile会返回fail 吗?

回答关注问题邀请回答
收藏

1 个回答

  • nono
    nono
    2020-12-07

    补充:有关程序

    puke:function(){//生成32副随机牌套并发到云存储(名为puke+屋号.txt)

        var i,ii,iii,j,j1,j2,j3,j4,k,aaa='',bbb=15

        var x=[]

        var pk=["","SA","SK","SQ","SJ","ST","S9","S8","S7","S6","S5","S4","S3","S2",

               "HA","HK","HQ","HJ","HT","H9","H8","H7","H6","H5","H4","H3","H2",

               "DA","DK","DQ","DJ","DT","D9","D8","D7","D6","D5","D4","D3","D2",

               "CA","CK","CQ","CJ","CT","C9","C8","C7","C6","C5","C4","C3","C2"]

        var sss=[],hhh=[],ddd=[],ccc=[]

        var text1=["","","","",""]

        var text2=["","","","",""]

        var text3=["","","","",""]

        var text4=["","","","",""]

        var ns=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var nh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var nd=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var nc=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var es=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var eh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var ed=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var ec=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var ws=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var wh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var wd=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var wc=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var ss=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var sh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var sd=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var sc=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

        var fsm = wx.getFileSystemManager()

        

     ........//省略无关语句

        

      fsm.writeFile({ //先建立一个空文件:puke.txt

       filePath: wx.env.USER_DATA_PATH + '/puke.txt',

       data: (""),

       encoding: 'utf-8',

      })

      for( i=1;i<=32;i++){

      fsm.appendFile({

       filePath: wx.env.USER_DATA_PATH + '/puke.txt',

       data: (//和打牌桌面一致,按南西北东顺序排

              '"'+ss[i]+'""'+sh[i]+'""'+sd[i]+'""'+sc[i]+'""'

                 +ws[i]+'""'+wh[i]+'""'+wd[i]+'""'+wc[i]+'""'

                 +ns[i]+'""'+nh[i]+'""'+nd[i]+'""'+nc[i]+'""'

                 +es[i]+'""'+eh[i]+'""'+ed[i]+'""'+ec[i]+'"'

       ),

       encoding: 'utf8',

      }) 

      }

      wx.cloud.uploadFile({

        cloudPath:'puke/puke'+(App.globalData.roomNumber).toString()+'.txt',

        filePath: wx.env.USER_DATA_PATH + '/puke.txt',           

      }) 

         

      },


    txt文件样例:

    "542""J76""T86""JT42""AJT6""AT2""AK2""653""KQ9""KQ84""J753""AK""873""953""Q94""Q987""A43""T""KQJT52""JT3""976""A984""A643""K8""Q852""Q7653""7""Q94""KJT""KJ2""98""A7652""A85""KJ752""K""Q742""T42""Q63""AQ""AT965""93""AT94""T9764""K3""KQJ76""8""J8532""J8""85432""54""K95""AK6""AQ96""KQ983""3""QJ2""K7""A7""AQJT62""953""JT""JT62""874""T874""Q93""953""863""A854""AT765""AJ""K52""T32""J""KQ82""A94""KQJ96""K842""T764""QJT7""7""T32""82""QJ7542""Q4""A75""K9654""T83""K3""KQ6""T3""AK9""A9865""J984""AQJ7""6""JT72""AQJT42""KQ5""QT7""2""953""A43""A65""KJT9""87""J876""982""AQ83""K6""T92""KJ43""7654""K832""T7""K86532""T""AQJ96""J53""T""AK87""74""AKQ8""AQ""QJ642""T5""9642""J974""953""J432""QJ873""J7""J4""9876""62""T532""Q72""AK5""K94""84""KT853""QT""AT5""AKQ96""A96""QJ9642""K5""92""AKT""K85""QJ974""87""842""T7""AT862""K5""QJ73""A3""3""AQJT643""965""64""Q""J864""AQ9763""872""AJ98764""K""J4""KQJ""K53""QT5""KT52""AT953""T2""A9732""8""Q732""QT6""54""9653""K84""A85""AQT76""87""AJT9""KJ942""K9""QJ""65""73""J832""AKT42""K942""T9542""KJ""32""QT5""76""Q832""KJT7""A3""AKQJ""A5""AQ964""J876""83""T9764""85""43""AQT8""Q64""JT96""87""K5""8532""AKQ75""AKQT5""J92""J""8432""J962""7643""AKT97""""A5""K73""AKJT4""Q92""KT93""QJ""Q932""A83""Q62""A652""6""KT654""J874""T984""875""J7""963""KT95""JT3""K84""Q8""Q832""Q96""JT95""K4""AJ4""A874""A732""AJT752""76""K52""Q6""AJ84""K32""QJ7""A65""76""JT65""K985""K97""""984""AT432""QJ832""KQT9532""AQ7""6""T4""32""72""KQT2""J9754""J""9""A98653""AQT62""AKQT87""AJT6""J""83""9654""KQ8543""74""K""A2""JT8652""T""A984""T8""AK943""743""QT6""KJ74""Q""KQJ52""J75""Q9653""7""A986""K32""AJ5""JT82""742""842""KQ432""A6""AK85""Q6""T97""K754""QJ3""J97""86""Q93""T96""AKT53""AJT2""AJT4""87""J84""654""K762""Q93""T96""KQ9873""85""T42""K2""""Q93""AKJ65""AQ753""75""AQ754""T9874""4""AK83""KJT93""""AKT7""Q9""86""AK3""QJ6532""JT642""2""QJ652""98""J75""AKT82""QJ3""K2""QT98""QJ""T7""AQ743""AK43""753""A9""T965""62""964""K86542""J8""AQT5""J743""K5""AJ5""K762""""QJT76""9864""943""A85""A3""KT732""J8""KQT962""9842""Q""T942""6""KJ9642""94""Q85""QJ93""T75""Q65""AK""KT74""AQ""AJT87""J763""A852""83""K32""KQ86""4""KT7652""JT""94""KQJT3""AJ4""764""52""8752""Q983""AK2""AJT73""A96""""Q9853""Q74""T9653""K973""2""9""AKQJ""A52""T8754""A65""872""T4""AKJ96""KJT832""4""QJ86""Q3""T2""AQ2""JT943""K97""Q94""J985""Q8""T643""AK8653""64""K752""5""J7""KT73""A6""AQJ82""J2""KQJ63""QT73""T8""T863""42""J8""76543""AK754""A85""A42""AJ""Q9""T97""K965""KQ92""K8""AT93""KT962""AQ""AQ97""QJ65""Q83""87""J6432""K8742""7""K6""T5""""AJ54""JT95432""JT7""9762""2""AT953""A5""AKT54""AT65""Q2""KQ96432""J""KQ""K86""8""Q83""J98743""J74""Q8742""J7""AK854""T""K96""AT654""J97""A4""AJ53""K32""QT62""82""T""Q98""3""KQJ97653"

    2020-12-07
    有用 1
    回复 3
    • 社区技术运营专员-娇华
      社区技术运营专员-娇华
      2020-12-09
      你好,反馈已收到,我们看看。
      2020-12-09
      回复
    • 社区技术运营专员-娇华
      社区技术运营专员-娇华
      01-29
      这个问题没法复现,请问现在解决了么
      01-29
      回复
    • nono
      nono
      02-12回复社区技术运营专员-娇华
      没解决。而且整个小程序运行的环境似乎不稳定。各种随机错误都出现过。出错时似乎程序乱蹦,胡乱执行某些程序片段。
      02-12
      回复
登录 后发表内容
问题标签