Discuz iOS应用开发 (bigApp iOS源码分析 - 应用配置获取流程)

iOS应用如何获取BigApp插件里定义的配置?

在LoadingVC中请求数据

- (void)requestAppBaseDatas
{
    WEAKSELF
    [_configViewModel getAppBaseConfigWithBlock:^(BOOL result) {
       /*
        * 1、请求插件后面的配置信息
        * 2、请求首页的indexcfg配置信息
        * 3、请求所有的版块儿信息
        */
        [weakSelf requestAppPlugcfg];
        [weakSelf requestHomeIndexcfg];
        [weakSelf requestForumsDatas];
    }];
}
  • 请求插件后面的配置信息
 - (void)request_AppInfoWithBlock:(void(^)(id data, NSError *error))block
{
    NSDictionary *dic = @{
                          @"module" : @"plugcfg",
                          @"iyzmobile" : @"1",
                          @"iyzversion": kiyzversion
                          };
    
    [[ClanNetAPI sharedJsonClient] requestCustomStyleWithPath:_kurl_base_path withParams:dic withMethodType:Get andBlock:^(id data, NSError *error) {
        if (error) {
            block(nil,error);
        }else{
            block(data,nil);
        }
    }];
}
  • basePath:api/mobile/iyz_index.php
  • Params:
    NSDictionary *dic = @{
                          @"module" : @"plugcfg",
                          @"iyzmobile" : @"1",
                          @"iyzversion": kiyzversion
                          };
  • returnValue:
{
    config =     {
        appdesc = "";
        appinfo =         {
            "app_id" = 0;
        };
        "checkin_enabled" = 1;
        "display_style" = 0;
        iyzversion = 2;
        "login_info" =         {
            "allow_avatar_change" = 1;
            "login_mod" = 0;
            "login_url" = "";
            "reg_mod" = 0;
            "reg_switch" = 1;
            "reg_url" = "";
        };
        "platform_login" =         {
            qqlogin = "";
            "qqlogin_end" = "";
            "wechat_login" = 1;
            "weibo_login" = 0;
        };
        portalconfig =         (
                        {
                enable = 1;
                id = 0;
                module = "\U95e8\U6237\U9996\U9875";
                sort = 1;
                title = "\U9996\U9875";
                type = 4;
            }
        );
        "push_enabled" = 0;
        qqlogin = "";
        "qqlogin_end" = "";
        "reply_button_type" = 0;
        searchsetting =         {
            enable = 1;
            enablesphinxon = 0;
            setting =             (
                                {
                    key = portal;
                    maxsearchresults = 500;
                    maxspm = 10;
                    searchctrl = 10;
                    status = 1;
                },
                                {
                    key = forum;
                    maxsearchresults = 500;
                    maxspm = 10;
                    searchctrl = 10;
                    status = 1;
                },
                                {
                    key = blog;
                    maxsearchresults = 500;
                    maxspm = 10;
                    searchctrl = 10;
                    status = 1;
                },
                                {
                    key = album;
                    maxsearchresults = 500;
                    maxspm = 10;
                    searchctrl = 10;
                    status = 1;
                },
                                {
                    key = group;
                    maxsearchresults = 500;
                    maxspm = 10;
                    searchctrl = 10;
                    status = 1;
                },
                                {
                    key = collection;
                    maxsearchresults = 500;
                    maxspm = 10;
                    searchctrl = 10;
                    status = 1;
                }
            );
        };
        "smiley_info" =         {
            code = 1;
            md5 = cd6ce2f9cb75d8f41dc96d3c0b8952b9;
            message = success;
            "zip_info" =             (
                                {
                    "pic_directory" = comcom;
                    "pic_schema" =                     (
                                                {
                            "pic_name" = "1.gif";
                            "pic_size" = 1359;
                        },
                                                {
                            "pic_name" = "10.gif";
                            "pic_size" = 1514;
                        },
                                                {
                            "pic_name" = "11.gif";
                            "pic_size" = 2759;
                        },
                                                {
                            "pic_name" = "12.gif";
                            "pic_size" = 2540;
                        },
                                                {
                            "pic_name" = "13.gif";
                            "pic_size" = 1326;
                        },
                                                {
                            "pic_name" = "14.gif";
                            "pic_size" = 1400;
                        },
                                                {
                            "pic_name" = "15.gif";
                            "pic_size" = 1087;
                        },
                                                {
                            "pic_name" = "16.gif";
                            "pic_size" = 1463;
                        },
                                                {
                            "pic_name" = "17.gif";
                            "pic_size" = 1593;
                        },
                                                {
                            "pic_name" = "18.gif";
                            "pic_size" = 1344;
                        },
                                                {
                            "pic_name" = "19.gif";
                            "pic_size" = 250;
                        },
                                                {
                            "pic_name" = "2.gif";
                            "pic_size" = 1631;
                        },
                                                {
                            "pic_name" = "20.gif";
                            "pic_size" = 1175;
                        },
                                                {
                            "pic_name" = "21.gif";
                            "pic_size" = 1110;
                        },
                                                {
                            "pic_name" = "22.gif";
                            "pic_size" = 1359;
                        },
                                                {
                            "pic_name" = "23.gif";
                            "pic_size" = 1295;
                        },
                                                {
                            "pic_name" = "24.gif";
                            "pic_size" = 2351;
                        },
                                                {
                            "pic_name" = "25.gif";
                            "pic_size" = 1619;
                        },
                                                {
                            "pic_name" = "26.gif";
                            "pic_size" = 753;
                        },
                                                {
                            "pic_name" = "27.gif";
                            "pic_size" = 833;
                        },
                                                {
                            "pic_name" = "28.gif";
                            "pic_size" = 1398;
                        },
                                                {
                            "pic_name" = "29.gif";
                            "pic_size" = 1126;
                        },
                                                {
                            "pic_name" = "3.gif";
                            "pic_size" = 1389;
                        },
                                                {
                            "pic_name" = "30.gif";
                            "pic_size" = 501;
                        },
                                                {
                            "pic_name" = "4.gif";
                            "pic_size" = 1359;
                        },
                                                {
                            "pic_name" = "5.gif";
                            "pic_size" = 2462;
                        },
                                                {
                            "pic_name" = "6.gif";
                            "pic_size" = 1851;
                        },
                                                {
                            "pic_name" = "7.gif";
                            "pic_size" = 1623;
                        },
                                                {
                            "pic_name" = "8.gif";
                            "pic_size" = 1356;
                        },
                                                {
                            "pic_name" = "9.gif";
                            "pic_size" = 1251;
                        }
                    );
                },
                                {
                    "pic_directory" = coolmonkey;
                    "pic_schema" =                     (
                                                {
                            "pic_name" = "01.gif";
                            "pic_size" = 2549;
                        },
                                                {
                            "pic_name" = "02.gif";
                            "pic_size" = 2448;
                        },
                                                {
                            "pic_name" = "03.gif";
                            "pic_size" = 2550;
                        },
                                                {
                            "pic_name" = "04.gif";
                            "pic_size" = 2586;
                        },
                                                {
                            "pic_name" = "05.gif";
                            "pic_size" = 2609;
                        },
                                                {
                            "pic_name" = "06.gif";
                            "pic_size" = 2603;
                        },
                                                {
                            "pic_name" = "07.gif";
                            "pic_size" = 2553;
                        },
                                                {
                            "pic_name" = "08.gif";
                            "pic_size" = 2573;
                        },
                                                {
                            "pic_name" = "09.gif";
                            "pic_size" = 2545;
                        },
                                                {
                            "pic_name" = "10.gif";
                            "pic_size" = 2543;
                        },
                                                {
                            "pic_name" = "11.gif";
                            "pic_size" = 2568;
                        },
                                                {
                            "pic_name" = "12.gif";
                            "pic_size" = 2485;
                        },
                                                {
                            "pic_name" = "13.gif";
                            "pic_size" = 2561;
                        },
                                                {
                            "pic_name" = "14.gif";
                            "pic_size" = 2547;
                        },
                                                {
                            "pic_name" = "15.gif";
                            "pic_size" = 2623;
                        },
                                                {
                            "pic_name" = "16.gif";
                            "pic_size" = 2476;
                        }
                    );
                },
                                {
                    "pic_directory" = default;
                    "pic_schema" =                     (
                                                {
                            "pic_name" = "biggrin.gif";
                            "pic_size" = 1345;
                        },
                                                {
                            "pic_name" = "call.gif";
                            "pic_size" = 603;
                        },
                                                {
                            "pic_name" = "cry.gif";
                            "pic_size" = 2866;
                        },
                                                {
                            "pic_name" = "curse.gif";
                            "pic_size" = 1543;
                        },
                                                {
                            "pic_name" = "dizzy.gif";
                            "pic_size" = 1859;
                        },
                                                {
                            "pic_name" = "funk.gif";
                            "pic_size" = 2928;
                        },
                                                {
                            "pic_name" = "handshake.gif";
                            "pic_size" = 1322;
                        },
                                                {
                            "pic_name" = "huffy.gif";
                            "pic_size" = 3809;
                        },
                                                {
                            "pic_name" = "hug.gif";
                            "pic_size" = 1054;
                        },
                                                {
                            "pic_name" = "kiss.gif";
                            "pic_size" = 987;
                        },
                                                {
                            "pic_name" = "lol.gif";
                            "pic_size" = 1443;
                        },
                                                {
                            "pic_name" = "loveliness.gif";
                            "pic_size" = 1579;
                        },
                                                {
                            "pic_name" = "mad.gif";
                            "pic_size" = 2423;
                        },
                                                {
                            "pic_name" = "sad.gif";
                            "pic_size" = 1237;
                        },
                                                {
                            "pic_name" = "shocked.gif";
                            "pic_size" = 1944;
                        },
                                                {
                            "pic_name" = "shutup.gif";
                            "pic_size" = 2500;
                        },
                                                {
                            "pic_name" = "shy.gif";
                            "pic_size" = 2663;
                        },
                                                {
                            "pic_name" = "sleepy.gif";
                            "pic_size" = 2375;
                        },
                                                {
                            "pic_name" = "smile.gif";
                            "pic_size" = 1662;
                        },
                                                {
                            "pic_name" = "sweat.gif";
                            "pic_size" = 1879;
                        },
                                                {
                            "pic_name" = "time.gif";
                            "pic_size" = 687;
                        },
                                                {
                            "pic_name" = "titter.gif";
                            "pic_size" = 1398;
                        },
                                                {
                            "pic_name" = "tongue.gif";
                            "pic_size" = 1841;
                        },
                                                {
                            "pic_name" = "victory.gif";
                            "pic_size" = 1275;
                        }
                    );
                },
                                {
                    "pic_directory" = grapeman;
                    "pic_schema" =                     (
                                                {
                            "pic_name" = "01.gif";
                            "pic_size" = 2373;
                        },
                                                {
                            "pic_name" = "02.gif";
                            "pic_size" = 2454;
                        },
                                                {
                            "pic_name" = "03.gif";
                            "pic_size" = 2485;
                        },
                                                {
                            "pic_name" = "04.gif";
                            "pic_size" = 2481;
                        },
                                                {
                            "pic_name" = "05.gif";
                            "pic_size" = 2441;
                        },
                                                {
                            "pic_name" = "06.gif";
                            "pic_size" = 2480;
                        },
                                                {
                            "pic_name" = "07.gif";
                            "pic_size" = 2488;
                        },
                                                {
                            "pic_name" = "08.gif";
                            "pic_size" = 2332;
                        },
                                                {
                            "pic_name" = "09.gif";
                            "pic_size" = 2546;
                        },
                                                {
                            "pic_name" = "10.gif";
                            "pic_size" = 2436;
                        },
                                                {
                            "pic_name" = "11.gif";
                            "pic_size" = 2542;
                        },
                                                {
                            "pic_name" = "12.gif";
                            "pic_size" = 2363;
                        },
                                                {
                            "pic_name" = "13.gif";
                            "pic_size" = 2513;
                        },
                                                {
                            "pic_name" = "14.gif";
                            "pic_size" = 2477;
                        },
                                                {
                            "pic_name" = "15.gif";
                            "pic_size" = 2421;
                        },
                                                {
                            "pic_name" = "16.gif";
                            "pic_size" = 2612;
                        },
                                                {
                            "pic_name" = "17.gif";
                            "pic_size" = 2621;
                        },
                                                {
                            "pic_name" = "18.gif";
                            "pic_size" = 2469;
                        },
                                                {
                            "pic_name" = "19.gif";
                            "pic_size" = 2535;
                        },
                                                {
                            "pic_name" = "20.gif";
                            "pic_size" = 2557;
                        },
                                                {
                            "pic_name" = "21.gif";
                            "pic_size" = 2550;
                        },
                                                {
                            "pic_name" = "22.gif";
                            "pic_size" = 2461;
                        },
                                                {
                            "pic_name" = "23.gif";
                            "pic_size" = 2502;
                        },
                                                {
                            "pic_name" = "24.gif";
                            "pic_size" = 2512;
                        }
                    );
                }
            );
            "zip_url" = "http://localhost/inspirelifebbs/static/image/smiley_v2.zip";
        };
        threadconfig =         (
                        {
                enable = 1;
                id = 0;
                module = new;
                sort = 1;
                title = "\U6700\U65b0";
                type = 6;
            },
                        {
                enable = 1;
                id = 0;
                module = hot;
                sort = 2;
                title = "\U70ed\U95e8";
                type = 7;
            },
                        {
                enable = 1;
                id = 0;
                module = digest;
                sort = 3;
                title = "\U7cbe\U534e";
                type = 8;
            }
        );
        "wechat_login" = 1;
        "weibo_login" = 0;
    };
    "error_code" = 0;
    "error_msg" = SUCC;
}

各个参数的详细意义可能需要结合具体的功能再深入了解下。

  • 请求首页的indexcfg配置信息
 - (void)request_HomeConfig:(void(^)(id data, NSError *error))block{
    NSDictionary *dic = @{
                          @"version" : ClanVersion,
                          @"iyzversion" : kiyzversion,
                          @"iyzmobile" : @"1",
                          @"module" : @"indexcfg",
                          };
    [[ClanNetAPI sharedJsonClient] requestJsonDataWithPath:_kurl_base_path
                                                withParams:dic
                                            withMethodType:Get
                                                  andBlock:^(id data, NSError *error) {
                                                      block(data, error);
                                                  }];
}
  • basePath: api/mobile/iyz_index.php
  • Params:
    NSDictionary *dic = @{
                          @"version" : ClanVersion,
                          @"iyzversion" : kiyzversion,
                          @"iyzmobile" : @"1",
                          @"module" : @"indexcfg",
                          };
  • returnValue:
{
    Charset = "UTF-8";
    Variables =     {
        auth = "8539QAPzx5Z93M1sqP4Bs1WN3TspQVkKgszLQ2Hzf/577MWaTkq9fUNmHZDRphUmHYbF9yaXX81z4MXw5Ed9";
        "button_configs" =         (
                        {
                "button_name" = "\U9996\U9875";
                "button_type" = 1;
                "icon_type" = "3_24";
                id = 1;
                "tab_cfg" =                 {
                    "home_page" =                     (
                                                {
                            setting =                             (
                                                                {
                                    desc = "";
                                    pic = "http://mobfile.youzu.com/Uploads_image/14/d/4/f/d4fb1a0f9fd0e780694eaa22cbe63e31.jpg?_v=1495364213";
                                    pid = 0;
                                    title = bigapp;
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = "";
                                    pic = "http://mobfile.youzu.com/Uploads_image/18/c/7/9/c7986bba5411c3249dc8d172b6c1dfff.jpg?_v=1495364213";
                                    pid = 0;
                                    title = "\U4e2a\U6027\U5316\U9996\U9875";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = "";
                                    pic = "http://mobfile.youzu.com/Uploads_image/18/7/4/0/740776a3426865e2d97251bbde856b2b.jpg?_v=1495364213";
                                    pid = 0;
                                    title = "\U6e38\U65cf\U7f51\U7edc";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                }
                            );
                            type = banner;
                        },
                                                {
                            setting =                             (
                                                                {
                                    desc = "";
                                    pic = "http://mobfile.youzu.com/Uploads_image/1/a/2/d/a2d48037df9c1dbeacdb3232ca2197b3.png?_v=1495364213";
                                    pid = 0;
                                    title = "\U529f\U80fd\U533a1";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = "";
                                    pic = "http://mobfile.youzu.com/Uploads_image/1/d/2/c/d2c5d626b2e2dbb705b277f92903a767.png?_v=1495364213";
                                    pid = 0;
                                    title = "\U529f\U80fd\U533a2";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = "";
                                    pic = "http://mobfile.youzu.com/Uploads_image/1/c/5/d/c5d514e2ff2a7d4c58ceed840e0253f0.png?_v=1495364213";
                                    pid = 0;
                                    title = "\U529f\U80fd\U533a3";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                }
                            );
                            type = func;
                        },
                                                {
                            setting =                             (
                                                                {
                                    desc = bigapp;
                                    pic = "http://mobfile.youzu.com/Uploads_image/1/d/6/4/d6443b9c58e64aa3d640d269b23d444f.png?_v=1495364213";
                                    pid = 0;
                                    title = "\U70ed\U95e8\U533a1";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = bigapp;
                                    pic = "http://mobfile.youzu.com/Uploads_image/2/2/6/1/2610b00cd55a65d3580037c910f37e06.png?_v=1495364213";
                                    pid = 3;
                                    title = "\U70ed\U95e8\U533a2";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = bigapp;
                                    pic = "http://mobfile.youzu.com/Uploads_image/2/3/2/7/327bef8b10441329007fb9dcc956be9f.png?_v=1495364213";
                                    pid = 3;
                                    title = "\U70ed\U95e8\U533a3";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = bigapp;
                                    pic = "http://mobfile.youzu.com/Uploads_image/2/b/1/8/b184780602b05fd6df357984890b11f2.png?_v=1495364213";
                                    pid = 3;
                                    title = "\U70ed\U95e8\U533a4";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = bigapp;
                                    pic = "http://mobfile.youzu.com/Uploads_image/2/c/a/1/ca107b8c4d6edd90272.1.1148aeb1e7.png?_v=1495364213";
                                    pid = 1;
                                    title = "\U70ed\U95e8\U533a5";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                },
                                                                {
                                    desc = bigapp;
                                    pic = "http://mobfile.youzu.com/Uploads_image/2/7/6/0/76059c5c50fc81dcc32b9c6fbd722577.png?_v=1495364213";
                                    pid = 1;
                                    title = "\U70ed\U95e8\U533a6";
                                    type = 1;
                                    url = "http://bigapp.mob.com/";
                                }
                            );
                            type = hot;
                        },
                                                {
                            recommend =                             {
                                "thread_config" =                                 (
                                                                        {
                                        "data_link" = "http://localhost/inspirelifebbs/api/mobile/iyz_index.php?iyzmobile=1&iyzversion=2&module=indexthread&buttonid=&navid=&style=1&view=new&displayid=&forbiddenid=";
                                        module = "\U6700\U65b0\U5e16\U5b50";
                                        title = "\U6700\U65b0";
                                    },
                                                                        {
                                        "data_link" = "http://localhost/inspirelifebbs/api/mobile/iyz_index.php?iyzmobile=1&iyzversion=2&module=indexthread&buttonid=&navid=&style=1&view=hot&displayid=&forbiddenid=";
                                        module = "\U70ed\U95e8\U5e16\U5b50";
                                        title = "\U70ed\U95e8";
                                    },
                                                                        {
                                        "data_link" = "http://localhost/inspirelifebbs/api/mobile/iyz_index.php?iyzmobile=1&iyzversion=2&module=indexthread&buttonid=&navid=&style=1&view=digest&displayid=&forbiddenid=";
                                        module = "\U7cbe\U534e\U5e16\U5b50";
                                        title = "\U7cbe\U534e";
                                    }
                                );
                                type = 2;
                            };
                            type = recomm;
                        }
                    );
                    "tab_type" = 1;
                    title = "";
                    "title_cfg" =                     (
                    );
                };
            },
                        {
                "button_name" = "\U8bba\U575b";
                "button_type" = 2;
                "icon_type" = "3_25";
                id = 2;
            },
                        {
                "button_name" = "\U53d1\U5e16";
                "button_type" = 3;
                "icon_type" = "3_26";
                id = 3;
            },
                        {
                "button_name" = "\U7ad9\U5185\U4fe1";
                "button_type" = 4;
                "icon_type" = "3_27";
                id = 4;
            },
                        {
                "button_name" = "\U6211\U7684";
                "button_type" = 5;
                "icon_type" = "3_28";
                id = 5;
            }
        );
        cookiepre = "0oza_2132_";
        formhash = 26cca247;
        groupid = 10;
        "member_avatar" = "http://localhost/inspirelifebbs/uc_server/avatar.php?uid=2&size=big";
        "member_uid" = 2;
        "member_username" = Test;
        notice =         {
            newmypost = 0;
            newpm = 0;
            newprompt = 0;
            newpush = 0;
        };
        readaccess = 10;
        saltkey = c2mR68x2;
    };
    Version = 4;
    "request_id" = 0;
}
Discuz iOS应用开发 (bigApp iOS源码分析 - 应用配置获取流程)_第1张图片
首页信息.png

这个首页信息的内容是需要自定义的,否则界面出来就是这个效果。
Tab的文字,图标也是在这边加载的,可以在BigApp配置页面修改。

  • 请求所有的版块儿信息
 - (void)request_BoardBlock:(void(^)(id data, NSError *error))block{
    NSDictionary *dic = @{
                          @"version":ClanVersion,
                          @"module":@"forumnav",
                          @"iyzmobile":@"1"
                          };
    [[ClanNetAPI sharedJsonClient] requestJsonDataWithPath:_kurl_base_path withParams:dic withMethodType:Get andBlock:^(id data, NSError *error) {
        if (error) {
            block(nil,error);
        }else{
            block(data, nil);
        }
    }];
}
  • basePath:api/mobile/iyz_index.php
  • Params:
    NSDictionary *dic = @{
                          @"version":ClanVersion,
                          @"module":@"forumnav",
                          @"iyzmobile":@"1"
                          };
  • returnValue:
{
    Charset = "UTF-8";
    Variables =     {
        "activity_forums" =         (
        );
        auth = "8539QAPzx5Z93M1sqP4Bs1WN3TspQVkKgszLQ2Hzf/577MWaTkq9fUNmHZDRphUmHYbF9yaXX81z4MXw5Ed9";
        cookiepre = "0oza_2132_";
        "display_style" = 0;
        formhash = 26cca247;
        forums =         (
                        {
                allowpostspecial = 0;
                allowspecialonly = 0;
                fid = 1;
                forums =                 (
                                        {
                        allowpostspecial = 1;
                        allowspecialonly = 0;
                        fid = 2;
                        fup = 1;
                        icon = "";
                        name = "\U9ed8\U8ba4\U7248\U5757";
                        posts = 0;
                        status = 1;
                        threads = 0;
                        todayposts = 0;
                        type = forum;
                    }
                );
                fup = 0;
                icon = "";
                name = "Discuz!";
                posts = 0;
                status = 1;
                threads = 0;
                todayposts = 0;
                type = group;
            }
        );
        groupid = 10;
        ismoderator = 0;
        "member_avatar" = "http://localhost/inspirelifebbs/uc_server/avatar.php?uid=2&size=big";
        "member_uid" = 2;
        "member_username" = Test;
        notice =         {
            newmypost = 0;
            newpm = 0;
            newprompt = 0;
            newpush = 0;
        };
        readaccess = 10;
        saltkey = c2mR68x2;
    };
    Version = 4;
    "request_id" = 0;
}

相应的配置修改 (Todo)

  1. 修改首页的内容
  2. 追加额外的论坛板块

工时:

  1. 0.25 day

你可能感兴趣的:(Discuz iOS应用开发 (bigApp iOS源码分析 - 应用配置获取流程))