@官方,为授权的小程序帐号上传小程序代码,JSON_STRING怎么都有错误
发布于 5 年前 作者 taoyang 13824 次浏览 来自 问答

{

    “template_id”: 0,

    “ext_json”: "

{

    extAppid:"",

    ext:{

        “attr1”:“value1”,

        “attr2”:“value2”,

    },

    extPages:{

        “index”:{

        },

        “search/index”:{

        },

    },

    pages:[“index”,“search/index”],

    “window”:{

    },

    “networkTimeout”:{

    },

    “tabBar”:{

    },

}

",

    “user_version”: “V1.0”,

    “user_desc”: “test”

}

6 回复

{

“template_id”:1,

“ext_json”:"

{

  \“extEnable\”: true,

  \“extAppid\”: \"  \",

  \“directCommit\”: false,

  \“ext\”: {

    \“name\”: \“wechat\”,

    \“attr\”: {

      \“host\”: \“open.weixin.qq.com\”,

      \“users\”: [

        \“user_1\”,

        \“user_2\”

      ]

    }

  },

  \“extPages\”: {

   \“pages/logs/logs\”: {

    \“navigationBarTitleText\”: \“logs\”

    }

  },

  \“window\”: {

    \“backgroundTextStyle\”: \“light\”,

    \“navigationBarBackgroundColor\”: \"#fff\",

    \“navigationBarTitleText\”: \“Demo\”,

    \“navigationBarTextStyle\”: \“black\”

  },

  \“tabBar\”: {

    \“list\”: [

      {

        \“pagePath\”: \“pages/index/index\”,

       \“text\”: \“首页\”

     }    

    ]

  },

  \“networkTimeout\”: {

    \“request\”: 10000,

    \“downloadFile\”: 10000

  }

}

",

“user_version”:“V1.0”,

“user_desc”:“test”

}

同样的access_token, 前一分钟说已经过期了,后面接着调用又没有问题!!这是怎么回事呀?


前后都是同样的access_token!! 前后相隔30秒,前一个请求失败,后一个请求成功!好诡异!!


2018-04-16 10:31:08.745 ERROR 14501 --- [  XNIO-2 task-9] c.z.wechat.business.service.OpenService  :

【请求地址】: https://api.weixin.qq.com/wxa/commit?access_token=8_Q03Z9P61gQpbZXOD01BBnC7hJYcR7HfQoeS0bitI7fmEHks5k8iZaxWyzF_uQ7dWdMBOhKX6GRutJrn72J1oJwDIfj60r6BYs93MkhzbifMNeXvhChvQOAgRUaw_8DVjIEMa5B-RYgw8m2SBABBhAIDIJJ

【请求参数】:{"template_id":5,"user_version":"test","user_desc":"test","ext_json":"{\"extAppid\":\"wxfe8abcd6b6f66d7e\",\"ext\":{\"appid\":\"wxfe8abcd6b6f66d7e\",\"shopId\":\"5wtQr0lwDuPq8i2pYVN\",\"parentShopId\":\"shp_rZTmLWdQCvPU3xt1kPL\"},\"window\":{\"navigationBarTitleText\":\"海珠店\"}}"}

【错误信息】:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [3t96CA08684525]"}

2018-04-16 10:31:08.748 ERROR 14501 --- [  XNIO-2 task-9] c.z.w.b.c.miniapp.service.CodeService    : [commitCode error:]



2018-04-16 10:31:36.713 DEBUG 14501 --- [ XNIO-2 task-10] c.z.wechat.business.service.OpenService  :

【请求地址】: https://api.weixin.qq.com/wxa/commit?access_token=8_Q03Z9P61gQpbZXOD01BBnC7hJYcR7HfQoeS0bitI7fmEHks5k8iZaxWyzF_uQ7dWdMBOhKX6GRutJrn72J1oJwDIfj60r6BYs93MkhzbifMNeXvhChvQOAgRUaw_8DVjIEMa5B-RYgw8m2SBABBhAIDIJJ

【请求参数】:{"template_id":5,"user_version":"test","user_desc":"test","ext_json":"{\"extAppid\":\"wxfe8abcd6b6f66d7e\",\"ext\":{\"appid\":\"wxfe8abcd6b6f66d7e\",\"shopId\":\"5wtQr0lwDuPq8i2pYVN\",\"parentShopId\":\"shp_rZTmLWdQCvPU3xt1kPL\"},\"window\":{\"navigationBarTitleText\":\"海珠店\"}}"}

【响应数据】:{"errcode":0,"errmsg":"ok"}


https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=0000c444300110bee49667b0856400&highline=ext.json&comment_lvl=6&comment_lvl=7&comment_lvl=8

{

    “template_id”: 0,

    “ext_json”: "{

        \“extAppid\”: \"\"

    }",

    “user_version”: “V1.0”,

    “user_desc”: “test”

}

字符串,必须字符串拼接才行

为了拼接这个字符串,我是操碎了心还不能成功。

POST数据示例:

{
"template_id":0,
"ext_json":"JSON_STRING", //*ext_json需为string类型,请参考下面的格式*
"user_version":"V1.0",
"user_desc":"test",
}

请问你是这样的错:

{

    “template_id”: 0,

    “ext_json”: “{   extAppid:”"}",

    “user_version”: “V1.0”,

    “user_desc”: “test”

}

还是这样的错:

{

    "template_id": 0,

    "ext_json": "{  " extAppid":""}",

    "user_version": "V1.0",

    "user_desc": "test"

}

应该是这样吧

{

    “template_id”: 0,

    “ext_json”: {

        “extAppid”: “”

    },

    “user_version”: “V1.0”,

    “user_desc”: “test”

}

根本不是字符串,ext_json里面是个对象,对吗官方人员

回到顶部