易语言之超级列表框的使用及json解析

效果图

json数据:

{
    "message": "获取数据信息成功",
    "totalNum": 38,
    "couponList": [
        {
            "position": 0,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 1,
            "ynLabel": "0",
            "remindPeople": "20345",
            "batchId": "46927266",
            "endTime": "2018-01-24 23:59:59",
            "ynPlus": false,
            "todayEnd": null,
            "startTime": "2018-01-24 20:00:00",
            "id": 409018,
            "jumpFlag": 10,
            "quota": "200",
            "rate": 0,
            "todayStart": null,
            "totalBean": null,
            "ruleKey": "f2d8a181cc5797dd240149d1b25743d1b90e9ad46280cee6e6a1e70db9ec73b70edb16d51404e4cbea1f93b702f84ea8",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": null,
            "denomination": "10",
            "key": "6eda272c819d41e1b4041240b842c51e",
            "roleId": "10220357",
            "couponSortId": 0,
            "limitStr": "全品类(除特殊商品)【20点限量抢】",
            "couponImg": "jfs/t16963/353/179390262/21708/c3bd92b9/5a6198b2N083edc38.jpg",
            "leftTime": "5437",
            "extendInfo": {},
            "discount": false,
            "overlying": false,
            "couponTag": 4,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 375000
        },
        {
            "position": 50,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 1,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "55729693",
            "endTime": "2018-01-24 23:58:00",
            "ynPlus": false,
            "todayEnd": "23:59:59",
            "startTime": "2018-01-22 00:00:00",
            "id": 409293,
            "jumpFlag": 1,

            "quota": "199",
            "rate": 59,
            "todayStart": "00:00:00",
            "totalBean": null,
            "ruleKey": "6699964c263c6c7be38448d4a7a10a324236d6ffea02a6b01687a3f747dd0fd3238662d869f6e9648900793eccf36950",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满199减120",
            "denomination": "120",
            "key": "740b5675e1d846cab0219cd50765bc95",
            "roleId": "10228307",
            "couponSortId": 3,
            "limitStr": "【年货节】三只松鼠旗舰店",
            "couponImg": "jfs/t14656/34/1939890355/26079/d1973fd5/5a61d3fbN35b186c7.jpg",
            "leftTime": null,
            "extendInfo": {
                "18": "[6]"
            },
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 3000000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "47096526",
            "endTime": "2018-01-25 23:59:59",
            "ynPlus": false,
            "todayEnd": null,
            "startTime": "2018-01-24 00:00:00",
            "id": 414479,
            "jumpFlag": 9,

            "quota": "4000",
            "rate": 35,
            "todayStart": null,
            "totalBean": null,
            "ruleKey": "dbaac303aa0e1a8f8549f7cf74d75296f226c9cd8bded101f9f76a16bca8ba6704bfcd07f387e54a00cfd797c2086d00",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满4000减600",
            "denomination": "600",
            "key": "8c873cc896e24ad8a1e2205cb546578b",
            "roleId": "10225785",
            "couponSortId": 1,
            "limitStr": "【自营】冰洗冷部分商品",
            "couponImg": "jfs/t2680/300/3085318076/201501/bbee60ec/577dd103N67caec65.jpg",
            "leftTime": null,
            "extendInfo": {},
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 1000000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "46928746",
            "endTime": "2018-01-25 23:59:59",
            "ynPlus": false,
            "todayEnd": null,
            "startTime": "2018-01-24 00:00:00",
            "id": 414480,
            "jumpFlag": 9,

            "quota": "10000",
            "rate": 28,
            "todayStart": null,
            "totalBean": null,
            "ruleKey": "2cf977c744d0e97d0b56b60427e17899e5012c6c952cf437c243ae62df55d0e693c6d477c62344d9bb12c21a68156faa",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满10000减1500",
            "denomination": "1500",
            "key": "8173893e0ded4af4939147d033760fcf",
            "roleId": "10225809",
            "couponSortId": 1,
            "limitStr": "【自营】冰洗冷部分商品",
            "couponImg": "jfs/t2680/300/3085318076/201501/bbee60ec/577dd103N67caec65.jpg",
            "leftTime": null,
            "extendInfo": {},
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 1000000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "55554341",
            "endTime": "2018-01-24 23:58:59",
            "ynPlus": false,
            "todayEnd": "23:59:59",
            "startTime": "2018-01-24 00:00:00",
            "id": 411443,
            "jumpFlag": 1,

            "quota": "100",
            "rate": 14,
            "todayStart": "00:00:00",
            "totalBean": null,
            "ruleKey": "9859e7f6a2f369aa4f25fb532d281c9b69471eece297ee717ed42e5ad7d647f1d80dfa8b9660f21d284eb3c05a106ac3",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满100减50",
            "denomination": "50",
            "key": "997803192d3840449dc71bbae2de86ae",
            "roleId": "10172978",
            "couponSortId": 2,
            "limitStr": "颜域旗舰店",
            "couponImg": "jfs/t8815/33/2101930384/278395/c4d0def/59c32e26N3053670a.jpg",
            "leftTime": null,
            "extendInfo": {
                "18": "[6]"
            },
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 1000000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "55660497",
            "endTime": "2018-01-24 23:59:59",
            "ynPlus": false,
            "todayEnd": "23:59:59",
            "startTime": "2018-01-24 00:00:00",
            "id": 404554,
            "jumpFlag": 1,

            "quota": "39",
            "rate": 74,
            "todayStart": "00:00:00",
            "totalBean": null,
            "ruleKey": "1c7d44978b43a68c063db1eb9653fb38a395383c435902a8db7329608871e285df3a7fad1654b5ae02f2af785ae5f8d5",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满39减30",
            "denomination": "30",
            "key": "120d330a4ee5401e92bf2a0df65b4b6a",
            "roleId": "10170758",
            "couponSortId": 3,
            "limitStr": "顺祥超级神券【多种色土马克杯券后仅需9.9元】",
            "couponImg": "jfs/t16000/362/1742526524/30699/1c41cbbb/5a5dd43aN655492f4.jpg",
            "leftTime": null,
            "extendInfo": {
                "18": "[6]"
            },
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 100000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "46804886",
            "endTime": "2018-01-31 23:59:59",
            "ynPlus": false,
            "todayEnd": null,
            "startTime": "2018-01-13 00:00:00",
            "id": 397650,
            "jumpFlag": 1,

            "rate": 74,
            "todayStart": null,
            "totalBean": null,
            "ruleKey": "2b176b6575491da4fc65735fcc78101a2f3f43936e58d3399b0fd423ed5c57349a664890729cf68d6a7b3722ed62d055",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": null,
            "denomination": "10",
            "key": "1596f75182f34614961426835f2bca1c",
            "roleId": "10082646",
            "couponSortId": 1,
            "limitStr": "火车票",
            "couponImg": "jfs/t15307/25/1709779943/11637/8e046a5b/5a55c9bdNd3a1c67f.png",
            "leftTime": null,
            "extendInfo": {},
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 2100000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "55588379",
            "endTime": "2018-01-24 23:59:59",
            "ynPlus": false,
            "todayEnd": "23:59:59",
            "startTime": "2018-01-24 00:00:00",
            "id": 414297,
            "jumpFlag": 1,

            "rate": 51,
            "todayStart": "00:00:00",
            "totalBean": null,
            "ruleKey": "ae52fd77d5195647fdb57e79d89f178d34fa66925f32e568c624f6fcd5767488e76e80f0d78fc95b8383e55a4f7a0b74",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满40减30",
            "denomination": "30",
            "key": "013ca0111ed4414391994cbd3700e4b4",
            "roleId": "10183498",
            "couponSortId": 3,
            "limitStr": "恒源祥暴力券满40减30",
            "couponImg": "jfs/t14869/42/2032218256/83517/de34d1b0/5a67546eN277006bc.jpg",
            "leftTime": null,
            "extendInfo": {
                "18": "[6]"
            },
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 300000
        },
        {
            "position": 999,
            "riskLevel": "A",

            "labelColor": "-1",
            "ynTop": 0,
            "ynLabel": "0",
            "remindPeople": null,
            "batchId": "46792534",
            "endTime": "2018-01-31 23:59:59",
            "ynPlus": false,
            "todayEnd": null,
            "startTime": "2018-01-13 00:00:00",
            "id": 394853,
            "jumpFlag": 9,

            "quota": "1000",
            "rate": 26,
            "todayStart": null,
            "totalBean": null,
            "ruleKey": "ee65c77a75982a954ef53649c0009de8de69a8e6624d41d78f32e6f007653334476e0faa6e852d22f53c483ce587e439",
            "dongOverlapText": "",
            "shopId": "",
            "operateWord": "",
            "successLabel": "满1000减300",
            "denomination": "300",
            "key": "b318e71ce75949099a6f3ee9420f5515",
            "roleId": "10064540",
            "couponSortId": 1,

            "couponImg": "jfs/t2905/300/3847999660/312900/a9fb3e68/579b201cNed7566f1.jpg",
            "leftTime": null,
            "extendInfo": {},
            "discount": false,
            "overlying": false,
            "couponTag": 3,
            "receiveFlag": 0,
            "labelText": "",
            "discountDetailText": "",
            "sortType": 1,
            "needBean": "",
            "beanGet": 0,
            "batchCount": 11500000
        }
    ],
    "resultCode": "200",
    "success": true
}
.版本 2
.支持库 spec
.支持库 iext

优惠券数据 = #拼接JSON + 优惠券数据 + “}”
' 调试输出 (优惠券数据)
json.解析 (优惠券数据)
.计次循环首 (json.成员数 (“couponList”), i)
    i = i - 1
    ' 开抢时间
    startTime = json.取通用属性 (“couponList[” + 到文本 (i) + “].startTime”)
    调试输出 (startTime)
    ' 结束时间
    endTime = json.取通用属性 (“couponList[” + 到文本 (i) + “].endTime”)
    ' 订阅提醒人数
    remindPeople = json.取通用属性 (“couponList[” + 到文本 (i) + “].remindPeople”)
    ' 优化券名称
    limitStr = json.取通用属性 (“couponList[” + 到文本 (i) + “].limitStr”)
    ' 总量
    batchCount = json.取通用属性 (“couponList[” + 到文本 (i) + “].batchCount”)

    索引 = 超级列表框2.插入表项 (, , , , , )
    超级列表框2.置标题 (索引, 0, 到文本 (i + 1))
    超级列表框2.置标题 (索引, 1, startTime)
    超级列表框2.置标题 (索引, 2, endTime)
    超级列表框2.置标题 (索引, 3, remindPeople)
    超级列表框2.置标题 (索引, 4, limitStr)
    超级列表框2.置标题 (索引, 5, batchCount)

    ' 超级列表框2.置标题 (i, 4, 局_json.四舍五 (jdPrice, miaoShaPrice, ShaPrice) + “%”)
    ' 超级列表框2.置标题 (i, 5, wareId)
    ' 超级列表框2.置标题 (i, 6, “http:” + 子文本替换 (imageurl, “\/”, “/”, , , 真))

.计次循环尾 ()

首先要将超级列表框配置好,然后加入文本数据

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
今天更新一下, 解决之前贴子中提到的一些问题: 1. 封装了几个自定义的函数, 例如 move_to_root, array_get_length, array_move_to_index, 这样可以少调用一些 X64Call; 2. 简单实现了对于类似 [0].A.B[0].C 的路径的解析取值. 接下来说一下遇到的问题和一些体验: 1. 我构造的测试数据大小是大约是 96MB, 在我的机器上可以正常解析, 再大一些(例如 128MB)会崩溃, 崩溃位于 ParsedJson.allocateCapacity , 琢磨了下没琢磨明白 (温馨提示: 真要是这种大小级别了还是建议各位用 SAX 方式); 2. 除了上面这点, 还有个已知的比较隐蔽 BUG, 貌似是 print_ 这个函数的锅: 静态编译之后, 在 demo 中如果 print_ 递归打印了一个 Object 例如 [0], 再点击解析就会在 iterator_free 崩溃. 如果只是取值就不崩溃. 3. 这个库会拷贝数据, 在针对过长的数据的时候这不是好做法, 感觉这个库更像是科研性质, 和那些千锤百炼的老牌库相比, 目前可能只有速度占优势了; 4. 机器或者其它方面的限制, 我用易语言跑不出宣传文章中的千兆字节每秒, 不过几百 MB/s 还是有的; 5. 由于解析的时候它会拷贝数据, 我不清楚有没有可能会产生 64-bit 的内存地址, 暂时就是指针到文本当 32-bit 用, 但心里很没底, 希望 eWOW64Ext 作者有空可以帮忙看一下... @shier2817  谢谢! 6. 库用的是 10.0.17134.0 版本的 SDK /MT 编译的, 但已经无法支持 WindowXP, 低版本的 SDK 编译不过去, 对这些指令不熟悉所以没有去探究原因(也许就是不支持, 详情请翻阅 MSDN); 7. 关于编译模式: 用 MinSizeRel 生成的话, 会导致 double 取值异常, 具体原因未深究, 所以默认使用了 Release . 我将会在附件中附上三种编译模式生成的文件供各位研究: RelWithDebInfo, MinSizeRel, Release; 8. 我对于 WOW64Ext 方面的知识不了解, 所以无法保证代码的稳定性, 抛砖引玉, 所以如果你希望封装完整的模块和工具, 可以进群与我交流.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值