码迷,mamicode.com
首页 > 移动开发 > 详细

五、手机请求共用参数封装

时间:2019-08-19 18:53:54      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:class   import   ken   new   tco   EOS   mod   dev   his   

一、封装公共参数

import java.util.TreeMap;

public class RequestCommonParams {

    public TreeMap<String, Object> staticParams;

    public TreeMap<String, Object> getStaticParams() {
        return staticParams;
    }

    public void setStaticParams(TreeMap<String, Object> staticParams) {
        this.staticParams = staticParams;
    }


    /**
     * 移动端公共参数
     * @return TreeMap
     */
    public RequestCommonParams(){
        TreeMap<String, Object> map = new TreeMap<>();
        map.put("clientMac", "9e:ee:fb:0f:5b:b8");
        map.put("clientDensity", "3.0");
        map.put("latitude", "255");
        map.put("longitude", "255");
        map.put("isJailbroken", "0");
        map.put("JailReason", "NO Jail");
        map.put("clientVersion", "3.1.0");
        map.put("deviceId", "9e:ee:fb:0f:5b:b8");
        map.put("platform", "Android"); //Android
        map.put("deviceInfo", "{\"deviceModel\":\"MI 5\",\"deviceOs\":\"23_6.0.1\"}");
        map.put("network", "wifi");
        map.put("screenSize", "1920*1080");
        map.put("clientIp", "10.0.3.15");
        setStaticParams(map);
    }

}

二、调用公共参数

TreeMap<String, Object> map = (new SalesRequestCommonParams()).getStaticParams();

//新增入参
map.put("username", "chu01");
map.put("password", 123);

 

五、手机请求共用参数封装

标签:class   import   ken   new   tco   EOS   mod   dev   his   

原文地址:https://www.cnblogs.com/chushujin/p/11378778.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!