Exemplo n.º 1
0
        public static ArrayList query_cms_list(CmsForm cmsForm)
        {
            HttpService httpservice = cmsForm.httpService;
            long        user_id     = cmsForm.appBean.user_id;
            String      user_key    = cmsForm.appBean.user_key;
            String      user_name   = cmsForm.appBean.user_name;
            String      cms_url     = Constants.cms_url;
            //LogUtil.log_call(cmsForm, "user_id=" + user_id + "&user_name=" + user_name + "&user_key=" + user_key + "&user_token=");
            String body = httpservice.post_http(cms_url, "user_id=" + user_id + "&user_name=" + user_name + "&user_key=" + user_key + "&user_token=", null);
            //LogUtil.log_call(cmsForm, "query_cms_list:" + body);

            UnicodeEncoding unicodeEncoding = new UnicodeEncoding();

            ArrayList list = new ArrayList();

            for (int i = body.IndexOf("items"); (i = body.IndexOf("\"app_id\"", i)) != -1; i++)
            {
                UserCms userCms = new UserCms();
                userCms.app_id  = StringUtil.subString(body, i, "\"app_id\":\"", "\"");
                userCms.user_id = StringUtil.subString(body, i, "\"user_id\":\"", "\"");
                String cms_title = StringUtil.subString(body, i, "\"title\":\"", "\"");
                cms_title     = UnicodeUtil.Unicode2String(cms_title);
                userCms.title = cms_title;

                list.Add(userCms);
            }
            return(list);
        }
Exemplo n.º 2
0
        public static ArrayList query_taoke_item_list(CmsForm cmsForm)
        {
            ArrayList list = new ArrayList();

            try
            {
                HttpService httpservice    = cmsForm.httpService;
                long        user_id        = cmsForm.appBean.user_id;
                string      app_id         = cmsForm.appBean.cms_app_id;
                String      user_key       = cmsForm.appBean.user_key;
                String      user_name      = cmsForm.appBean.user_name;
                String      user_taoke_url = Constants.user_taoke_url;
                //LogUtil.log_str(cmsForm, "user_id=" + user_id + "&app_id=" + app_id + "&user_key=" + user_key + "&user_token=");
                String body = httpservice.post_http(user_taoke_url, "user_id=" + user_id + "&app_id=" + app_id + "&user_key=" + user_key + "&user_token=", null);
                //LogUtil.log_cms_call(cmsForm, "query_taoke_item_list:" + body);

                for (int i = body.IndexOf("items"); (i = body.IndexOf("\"num_iid\"", i)) != -1; i++)
                {
                    TaokeItem taokeItem = new TaokeItem();
                    taokeItem.num_iid     = StringUtil.subString(body, i, "\"num_iid\":\"", "\"");
                    taokeItem.user_id     = StringUtil.subString(body, i, "\"user_id\":\"", "\"");
                    taokeItem.app_id      = StringUtil.subString(body, i, "\"app_id\":\"", "\"");
                    taokeItem.activity_id = StringUtil.subString(body, i, "\"activity_id\":\"", "\"");
                    taokeItem.user_num_id = StringUtil.subString(body, i, "\"user_num_id\":\"", "\"");
                    taokeItem.pic_url     = StringUtil.subString(body, i, "\"pic_url\":\"", "\"");
                    //taokeItem.title = StringUtil.subString(body, i, "\"title\":\"", "\"");
                    String goods_title = StringUtil.subString(body, i, "\"title\":\"", "\"");
                    goods_title     = UnicodeUtil.Unicode2String(goods_title);
                    taokeItem.title = goods_title;

                    taokeItem.tkRate       = double.Parse(StringUtil.subString(body, i, "\"common_commission_rate\":\"", "\""));
                    taokeItem.taoke_status = int.Parse(StringUtil.subString(body, i, "\"taoke_status\":", ","));
                    //taokeItem.taoke_status_err = StringUtil.subString(body, i, "\"taoke_status_err\":\"", "\"");
                    String taoke_status_err = StringUtil.subString(body, i, "\"taoke_status_err\":\"", "\"");
                    taoke_status_err           = UnicodeUtil.Unicode2String(taoke_status_err);
                    taokeItem.taoke_status_err = taoke_status_err;
                    list.Add(taokeItem);
                }
            }
            catch (Exception)
            {
            }
            return(list);
        }
Exemplo n.º 3
0
        public static GoodsItem query_goods(CmsForm cmsForm, string num_iid, out string out_log)
        {
            try
            {
                //LogUtil.log_cms_call(cmsForm, ".num_iid:" + num_iid);

                HttpService httpservice    = cmsForm.httpService;
                long        user_id        = cmsForm.appBean.user_id;
                String      user_key       = cmsForm.appBean.user_key;
                String      user_name      = cmsForm.appBean.user_name;
                String      user_goods_url = Constants.user_goods_url;
                //LogUtil.log_cms_call(cmsForm, "user_goods_url:" + user_goods_url);
                //LogUtil.log_cms_call(cmsForm, "user_id=" + user_id + "&num_iid=" + num_iid + "&user_key=" + user_key + "&user_token=");
                String body = httpservice.post_http(user_goods_url, "user_id=" + user_id + "&num_iid=" + num_iid + "&user_key=" + user_key + "&user_token=", null);
                //LogUtil.log_cms_call(cmsForm, "query_goods:" + body);
                if (body.Contains("\"num_iid\":"))
                {
                    GoodsItem goodsItem = new GoodsItem();
                    //goodsItem.title = StringUtil.subString(body, 0, "\"title\":\"", "\"");
                    String cms_title = StringUtil.subString(body, 0, "\"title\":\"", "\"");
                    cms_title       = UnicodeUtil.Unicode2String(cms_title);
                    goodsItem.title = cms_title;

                    goodsItem.num_iid = num_iid;
                    out_log           = "";
                    return(goodsItem);
                }
                out_log = body;
                return(null);
            }
            catch (Exception exception)
            {
                //LogUtil.log_cms_call(cmsForm, "query_goods:" + "出错啦!!!" + exception.ToString());
                out_log = "出错啦!!!" + exception.ToString();
                return(null);
            }
        }
Exemplo n.º 4
0
        public static ArrayList query_gengfa_top_item_list(CmsForm cmsForm)
        {
            HttpService httpservice    = cmsForm.httpService;
            long        user_id        = cmsForm.appBean.user_id;
            string      app_id         = cmsForm.appBean.cms_app_id;
            String      user_key       = cmsForm.appBean.user_token;
            String      user_name      = cmsForm.appBean.user_name;
            String      user_qunfa_url = "http://" + Constants.api_url + "/zhushou/goods/top";
            //user_qunfa_url = "http://api2.open.huopinjie.com/top1.html";
            //user_qunfa_url = "http://api.open.huopinjie.com/index.php?action=index&type=top1&appkey=yr57d3jhah&v=utf-8";
            //user_qunfa_url = "http://api.open.huopinjie.com/index.php?action=index&type=top1&appkey=yr57d3jhah&v=utf-8";
            //LogUtil.log_str(cmsForm, "user_id=" + user_id + "&app_id=" + app_id + "&member_token=" + user_key);
            //String body = httpservice.post_http(user_qunfa_url, "user_id=" + user_id + "&app_id=" + app_id + "&member_token=" + user_key , null);
            //LogUtil.log_call(cmsForm, "user_qunfa_url:" + user_qunfa_url);

            String body = httpservice.get(user_qunfa_url, null);

            ArrayList list = new ArrayList();

            for (int i = body.IndexOf("items"); (i = body.IndexOf("\"create_date_str\"", i)) != -1; i++)
            {
                //TaokeItem taokeItem = new TaokeItem();
                //taokeItem.num_iid = StringUtil.subString(body, i, "\"num_iid\":\"", "\"");
                //taokeItem.user_id = StringUtil.subString(body, i, "\"user_id\":\"", "\"");
                //taokeItem.app_id = StringUtil.subString(body, i, "\"app_id\":\"", "\"");
                //taokeItem.activity_id = StringUtil.subString(body, i, "\"activity_id\":\"", "\"");
                //taokeItem.user_num_id = StringUtil.subString(body, i, "\"user_num_id\":\"", "\"");
                //taokeItem.pic_url = StringUtil.subString(body, i, "\"pic_url\":\"", "\"");
                ////taokeItem.title = StringUtil.subString(body, i, "\"title\":\"", "\"");
                //String goods_title = StringUtil.subString(body, i, "\"title\":\"", "\"");
                //goods_title = UnicodeUtil.Unicode2String(goods_title);
                //taokeItem.title = goods_title;

                //taokeItem.tkRate = double.Parse(StringUtil.subString(body, i, "\"common_commission_rate\":\"", "\""));
                //taokeItem.taoke_status = int.Parse(StringUtil.subString(body, i, "\"taoke_status\":", ","));
                ////taokeItem.taoke_status_err = StringUtil.subString(body, i, "\"taoke_status_err\":\"", "\"");
                //String taoke_status_err = StringUtil.subString(body, i, "\"taoke_status_err\":\"", "\"");
                //taoke_status_err = UnicodeUtil.Unicode2String(taoke_status_err);
                //taokeItem.taoke_status_err = taoke_status_err;

                GengfaItem gengfaItem = new GengfaItem();
                gengfaItem.create_date_str = StringUtil.subString(body, i, "\"create_date_str\":\"", "\",");
                gengfaItem.num_iid         = StringUtil.subString(body, i, "\"num_iid\":\"", "\"");
                //gengfaItem.price = StringUtil.subString(body, i, "\"price\":\"", "\"");
                //gengfaItem.money = StringUtil.subString(body, i, "\"money\":\"", "\"");
                //gengfaItem.user_num_id = StringUtil.subString(body, i, "\"user_num_id\":\"", "\"");
                //gengfaItem.title = StringUtil.subString(body, i, "\"title\":\"", "\"");
                //gengfaItem.activity_id = StringUtil.subString(body, i, "\"activity_id\":\"", "\"");
                //gengfaItem.pic_url = StringUtil.subString(body, i, "\"pic_url\":\"", "\"");

                string content = StringUtil.subString(body, i, "\"content\":\"", "\",");
                content            = content.Replace(@"\/", @"/");
                content            = content.Replace("\\\"", "\"");
                content            = UnicodeUtil.Unicode2String(content);
                gengfaItem.content = content;

                string from = StringUtil.subString(body, i, "\"from\":\"", "\",");
                from            = UnicodeUtil.Unicode2String(from);
                gengfaItem.from = from;

                string goods_type = StringUtil.subString(body, i, "\"goods_type\":\"", "\",");
                gengfaItem.goods_type = goods_type;

                int type = int.Parse(StringUtil.subString(body, i, "\"type\":", ","));
                gengfaItem.type = type;

                list.Add(gengfaItem);
            }
            return(list);
        }