🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
表结构 ~~~ CREATE TABLE `yf_front_forum` ( `forum_id` int(10) NOT NULL AUTO_INCREMENT, `forum_name` varchar(255) NOT NULL COMMENT '板块名称', `forum_order` int(10) NOT NULL COMMENT '首页板块顺序', `forum_state` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态1开启2关闭', `forum_content` varchar(255) NOT NULL COMMENT '板块内容', `forum_style` int(10) NOT NULL DEFAULT 1 COMMENT '1-长方形 2-正方形', PRIMARY KEY (`forum_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='首页板块设置表'; ~~~ 1.获取版块列表 ~~~[api] get:/index.php?crl=Api_Forum&met=front&typ=json <<< success {"cmd_id":-140, "status":200, "msg":"success", "data":{ "page":1, "total":1, "totalsize":"3", "records":"3", "items":[ {"forum_id":"1", //版块id "forum_name":"店铺代金券", //版块名称 "forum_order":"1", //版块排序 "forum_state":"1", /版块状态 1-开启 2-关闭 "forum_content":[ {"title":"店铺代金券", //版块活动名称 "type":"voucher", //版块活动类型 "content":["242","241","240","235"] //版块活动内容 }], "forum_style":"1", //版块样式 1-长方形 2-正方形 "id":"1" }, {"forum_id":"6", "forum_name":"平台红包", "forum_order":"2", "forum_state":"2", "forum_content":[ {"title":"平台红包", "type":"redpacket", "content":["149","114","30","25"] }], "forum_style":"1", "id":"6"}, {"forum_id":"4", "forum_name":"测试2", "forum_order":"3", "forum_state":"2", "forum_content":[ {"title":"团", "type":"grouptype", "content":["293","228","171","141"] }, {"title":"限时折扣", "type":"discount", "content":["297","298","299"] }], "forum_style":"2", "id":"4" } ] } } <<< error ~~~ 2.获取版块内容 ~~~[api] get:/index.php?ctl=Api_Forum&met=getForumContent&typ=json *string:id=默认值#版块id <<< success {"cmd_id":-140, "status":200, "msg":"success", "data":{ "forum_id":"11", //版块id "forum_name":"团购", //版块名称 "forum_order":"7", //版块排序 "forum_state":"1", //版块状态 1-开启 2-关闭 "forum_content":[ //版块内容 {"title":"团购", //版块活动名称 "type":"groupbuy", //版块活动类型 "content":["293","228","171","141","235","304","149"], //版块活动内容 -- 此处为团购 "content_info":[ //版块活动内容详情 -- 此处为团购信息 {"groupbuy_image_rec":"http:\/\/shop.local.yuanfeng021.com\/image.php\/shop\/data\/upload\/media\/d3aabd05be45670d48e2685d1e1f5992\/10104\/51\/image\/20171024\/1508809291346874.jpg!612x318.jpg", //团购图片 "groupbuy_name":"tz虚拟团", //团购名称 "groupbuy_endtime":"2018-10-24 10:00:00", //团购结束时间 "groupbuy_starttime":"2017-10-24 10:00:00", //团购开始时间 "groupbuy_buyer_count":"12", //已团人数 "goods_price":"450.00" //团购价 }, {"groupbuy_image_rec":"https:\/\/shop.local.yuanfeng021.com\/image.php\/shop\/data\/upload\/media\/d3aabd05be45670d48e2685d1e1f5992\/10104\/51\/image\/20171208\/1512725526425266.jpg!612x318.jpg", "groupbuy_name":"tttttttt", "groupbuy_endtime":"2018-11-09 23:00:00", "groupbuy_starttime":"2017-12-08 18:00:00", "groupbuy_buyer_count":"4", "goods_price":"50.00"}, {"groupbuy_image_rec":"https:\/\/shop.local.yuanfeng021.com\/image.php\/shop\/data\/upload\/media\/d3aabd05be45670d48e2685d1e1f5992\/10104\/51\/image\/20180329\/1522303533136936.jpg!612x318.jpg", "groupbuy_name":"团购团购", "groupbuy_endtime":"2018-09-15 18:00:00", "groupbuy_starttime":"2018-03-29 15:00:00", "groupbuy_buyer_count":"29", "goods_price":"90.00"}, {"groupbuy_image_rec":"http:\/\/upload.local.yuanfeng021.com\/image.php\/media\/d3aabd05be45670d48e2685d1e1f5992\/10295\/82\/image\/20180823\/1534991492934718.jpg!612x318.jpg", "groupbuy_name":"供应商也可以发团购?", "groupbuy_endtime":"2018-09-19 16:00:00", "groupbuy_starttime":"2018-08-23 11:00:00", "groupbuy_buyer_count":"0", "goods_price":"12.00"} ] }], "forum_style":"1", "id":"11" } } <<< error ~~~ 3.修改版块内容 ~~~[api] get:/index.php?ctl=Api_Forum&met=editForum&typ=json *string:id#版块id row:forum_connect#版块内容 int:edit_content#修改哪块版块内容 1-左 2-右 forum_name#版块名称 int:forum_state#是否启用 int:forum_style#版块样式 <<< success {"cmd_id":-140,"status":200,"msg":"success","data":{}} <<< error {"cmd_id":-140,"status":250,"msg":"failure","data":{}} ~~~ ``` 当edit_content = 1 时,edit_econtent需要传递键值为0的数组 $edit_econtent[0]['title'] = '团购'; $edit_econtent[0]['type'] = 'groupbuy'; $edit_econtent[0]['content'] = array('293','228'); 当edit_content = 2 时,edit_econtent需要传递键值为1的数组 $edit_econtent[1]['title'] = '团购'; $edit_econtent[1]['type'] = 'groupbuy'; $edit_econtent[1]['content'] = array('293','228'); ``` 4.修改板块顺序 ~~~[api] get:/index.php?ctl=Api_Forum&met=setForumOrder&typ=json row:order_forum1#修改的对应板块 row:order_forum2#修改的对应板块 <<< success {"cmd_id":-140,"status":200,"msg":"success","data":{}} <<< error {"cmd_id":-140,"status":250,"msg":"failure","data":{}} ~~~ 5.添加版块内容 ~~~[api] get:/index.php?ctl=Api_Forum&met=addFrontForum&typ=json forum_name#版块名称 int:forum_order#版块排序 row:forum_content#版块内容 int:forum_style=1#版块样式 1-长方形 2-正方形 <<< success {"cmd_id":-140,"status":200,"msg":"添加成功","data":{}} <<< error {"cmd_id":-140,"status":250,"msg":"最多添加9款商品","data":{}} ~~~ ~~~ 版块内容说明: 当forum_style=1时,表明版块中只有一个活动,forum_content中只有一个活动参数,举例如下: $updata = array(); $updata[0]['title'] = '团购'; //活动名称 $updata[0]['type'] = 'grouptype'; //活动类型 $updata[0]['content'] = array('293','228','171','141'); //活动内容 -- 此处为团购商品 forum_content= $updata; 当forum_style=2时,表明版块中有两个活动,forum_content中有两个活动参数,举例如下: $updata = array(); $updata[0]['title'] = '团购'; //活动名称 $updata[0]['type'] = 'grouptype'; //活动类型 $updata[0]['content'] = array('293','228','171','141'); //活动内容 -- 此处为团购商品 $updata[1]['title'] = '显示折扣'; $updata[1]['type'] = 'discount'; $updata[1]['content'] = array('297','298','299'); //活动内容 -- 此处为显示折扣商品 forum_content= $updata; ~~~ 6.删除首页版块 ~~~[api] get:/index.php?ctl=Api_Forum&met=editForum&typ=json *string:id=默认值#说明文字 name#说明文字 <<< success {"cmd_id":-140,"status":200,"msg":"success","data":{}} <<< error {"cmd_id":-140,"status":250,"msg":"failure","data":{}} ~~~