Foxtable(狐表)用户栏目专家坐堂 → 创建微信礼品卡货架多层嵌套json


  共有2516人关注过本帖树形打印复制链接

主题:创建微信礼品卡货架多层嵌套json

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/9 16:38:00 [显示全部帖子]

Dim jo As new JObject
Dim ar As New JArray
Dim i As Integer = 0
For Each r1 As DataRow In DataTables("微信礼品卡货架").Select("主题分类名称 = '分类一'")
    Dim ao As New JObject
    ao("theme_pic_url") = r1("主题封面链接").Tostring
    ao("title") = r1("主题名称").Tostring
    ao("title_color") = r1("主题名称颜色").Tostring
    ar.add(ao)
    jo("page")("theme_list") = ar
   
    Dim ar2 As New JArray
    For Each r2 As DataRow In DataTables("微信礼品卡货架").Select("主题名称 = '" & r1("主题名称") & "'")
        Dim ao2 As New JObject
        ao2("card_id") = r2("卡券ID").tostring
        ao2("title") = r2("商品名称").tostring
        ao2("pic_url") = r2("商品缩略图链接").tostring
        ao2("desc") = r2("商品简介").tostring
        ar2.add(ao2)
    Next
    ao("item_list") = ar2
    ao("category_index")= i
    i += 1
Next


Dim ar4 As New JArray
Dim ao4 As New JObject
ao4("title") = "分类一"
ar4.add(ao4)
jo("page")("category_list") = ar4


'hc.Content = jo.ToString()
'jo = JObject.Parse(hc.GetData)
'hc.GetData
output.show(jo.Tostring)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/9 18:11:00 [显示全部帖子]

实例发上来测试。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/9 18:34:00 [显示全部帖子]

做一个foxtable项目发上来测试,导入你【微信礼品卡货架】表数据。


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/9 23:22:00 [显示全部帖子]

Dim jo As New JObject
jo("page") = New JObject
jo("page")("page_title") = "礼品卡标题"
jo("page")("support_multi") = True
jo("page")("support_buy_for_self") = True
jo("page")("banner_pic_url") = "http://mmbiz.qpic.cn/mmbiz_jpg/ahyj0ppmibfrTLNaiaZmqK71SDT5pDPzeCfxdWJL5MibJiahDOmIdytzZicotiaSjm0n0Y9LyuhnIos62KR3GO7rKzpw/0?wx_fmt=jpeg"
jo("page")("support_multi") = True


Dim ar As New JArray
Dim i As Integer = 0
For Each s As String In DataTables("微信礼品卡货架").GetValues("主题分类名称")
    Dim r1 As DataRow = DataTables("微信礼品卡货架").find("主题分类名称 = '" & s & "'")
    Dim ao As New JObject
    ao("theme_pic_url") = r1("主题封面链接").Tostring
    ao("title") = r1("主题名称").Tostring
    ao("title_color") = r1("主题名称颜色").Tostring
    ar.add(ao)
    jo("page")("theme_list") = ar
   
    Dim ar2 As New JArray
    For Each r2 As DataRow In DataTables("微信礼品卡货架").Select("主题名称 = '" & r1("主题名称") & "'")
        Dim ao2 As New JObject
        ao2("card_id") = r2("卡券ID").tostring
        ao2("title") = r2("商品名称").tostring
        ao2("pic_url") = r2("商品缩略图链接").tostring
        ao2("desc") = r2("商品简介").tostring
        ar2.add(ao2)
    Next
    ao("item_list") = ar2
    ao("category_index")= i
    i += 1
Next


Dim ar4 As New JArray
Dim ao4 As New JObject
ao4("title") = "分类一"
ar4.add(ao4)
jo("page")("category_list") = ar4

 


jo("page")("address") = "泉州中山路专卖店"
jo("page")("service_phone") = "13559053751"
jo("page")("biz_description") = "退款指引"
jo("page")("cell_1") = New JObject
jo("page")("cell_1")("title") = "申请fa piao"
jo("page")("cell_1")("url") = "http://baidu.com"
jo("page")("cell_2") = New JObject
jo("page")("cell_2")("title") = "申请退款"
jo("page")("cell_2")("url") = "http://baidu.com"


output.show(jo.Tostring)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/10 10:53:00 [显示全部帖子]

请理清自己的逻辑,然后写条件

 

http://www.foxtable.com/webhelp/scr/2747.htm

 

 

For Each s As String In DataTables("微信礼品卡货架").GetValues("主题分类名称")
    Dim r1 As DataRow = DataTables("微信礼品卡货架").find("主题分类名称 = '" & s & "'")
    Dim ao As New JObject
    ao("theme_pic_url") = r1("主题封面链接").Tostring
    ao("title") = r1("主题名称").Tostring
    ao("title_color") = r1("主题名称颜色").Tostring
    ar.add(ao)
    jo("page")("theme_list") = ar
   
    Dim ar2 As New JArray
    For Each r2 As DataRow In DataTables("微信礼品卡货架").Select("主题名称 = '" & r1("主题名称") & "'")


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/10 12:12:00 [显示全部帖子]

Dim jo As New JObject
jo("page") = New JObject
jo("page")("page_title") = "礼品卡标题"
jo("page")("support_multi") = True
jo("page")("support_buy_for_self") = True
jo("page")("banner_pic_url") = "http://mmbiz.qpic.cn/mmbiz_jpg/ahyj0ppmibfrTLNaiaZmqK71SDT5pDPzeCfxdWJL5MibJiahDOmIdytzZicotiaSjm0n0Y9LyuhnIos62KR3GO7rKzpw/0?wx_fmt=jpeg"
jo("page")("support_multi") = True


Dim ar As New JArray
Dim i As Integer = 0
Dim Arys As List(Of String())
Arys = DataTables("微信礼品卡货架").GetValues("主题分类名称|主题名称")
jo("page")("theme_list") = ar
For Each s As String() In Arys
    Dim r1 As DataRow = DataTables("微信礼品卡货架").find("主题分类名称 = '" & s(0) & "' and 主题名称 = '" & s(1) & "'  ")
    output.show("r1" & r1("主题分类名称") & "|" & r1("主题名称"))
    Dim ao As New JObject
    ao("theme_pic_url") = r1("主题封面链接").Tostring
    ao("title") = r1("主题名称").Tostring
    ao("title_color") = r1("主题名称颜色").Tostring
    ar.add(ao)
    Dim ar2 As New JArray
    For Each r2 As DataRow In DataTables("微信礼品卡货架").Select("主题名称 = '" & r1("主题名称") & "'")
        output.show("r2" & r2("主题分类名称") & "|" & r2("主题名称") & "|" & r2("商品名称"))
        Dim ao2 As New JObject
        ao2("card_id") = r2("卡券ID").tostring
        ao2("title") = r2("商品名称").tostring
        ao2("pic_url") = r2("商品缩略图链接").tostring
        ao2("desc") = r2("商品简介").tostring
        ar2.add(ao2)
    Next
    ao("item_list") = ar2
    ao("category_index")= i
    output.show(i)
    i += 1
Next
output.show(jo.Tostring)


 回到顶部