Skip to content

Commit ee953e0

Browse files
author
Diankun
committed
modify README
1 parent 222dbf5 commit ee953e0

File tree

1 file changed

+233
-2
lines changed

1 file changed

+233
-2
lines changed

README.md

Lines changed: 233 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,233 @@
1-
# JSONToModelShell
2-
自动化python脚本,能轻松实现JSON转model文件,支持json字符串、get请求url两种方式
1+
Description:
2+
===================
3+
4+
通过url或者json数据快速创建OC model文件,可自定义文件名前缀,可随意继承BaseModel,只需修改以下两个参数,例如
5+
```
6+
yourProjectPrefix = 'NS'
7+
yourModelBaseClassName = 'BaseModel'
8+
```
9+
10+
默认是不加前缀,并且继承于NSObject
11+
12+
----------
13+
14+
Usage:
15+
===================
16+
17+
18+
方式一:Get URL方式
19+
-------------
20+
21+
> **主要步骤:**
22+
23+
> - 在终端中进入SKAutoJSONToModelShell.shell所在的文件夹路径下.
24+
> - 执行脚本:python SKAutoJSONToModelShell.py.
25+
> - 选择GET方式: 1
26+
> - 输入URL:http://m.api.zhe800.com/tao800/bannerv2.json?platform=android&channelid=7aaa14&productkey=tao800&cityid=2&url_name=&userType=0&userRole=0&unlock=1
27+
> - 输入Model名称(如果从url获取输入none),例如输入Banner
28+
> - 脚本执行结束,生成需要的.h和.m文件。
29+
30+
> - Clearing your browser's data may **delete all your local documents!** Make sure your documents are synchronized with **Google Drive** or **Dropbox** (check out the [<i class="icon-refresh"></i> Synchronization](#synchronization) section).
31+
32+
33+
**Terminal Steps:**
34+
35+
```
36+
KUNdeMacBook-Pro:JSONToModelShell KUN$ ls
37+
README.md SKAutoJSONToModelShell.py
38+
KUNdeMacBook-Pro:JSONToModelShell KUN$ python SKAutoJSONToModelShell.py
39+
选择输入的内容类型
40+
HTTP GET Url【1】
41+
或者
42+
返回的数据内容【2】
43+
1
44+
输入完整的GET Request Url: http://m.api.zhe800.com/tao800/bannerv2.json?platform=android&channelid=7aaa14&productkey=tao800&cityid=2&url_name=&userType=0&userRole=0&unlock=1
45+
输入Model名称(从url获取输入none): Banner
46+
生成Bannermodel中
47+
生成BannerResponsemodel中
48+
生成ChildTopicsmodel中
49+
生成ChildTopicsmodel中
50+
生成DealParamsmodel中
51+
生成BannerResponsemodel中
52+
生成ChildTopicsmodel中
53+
生成ChildTopicsmodel中
54+
生成DealParamsmodel中
55+
生成BannerResponsemodel中
56+
生成ChildTopicsmodel中
57+
生成DealParamsmodel中
58+
生成ChildTopicsmodel中
59+
生成ChildTopicsmodel中
60+
生成DealParamsmodel中
61+
脚本执行结束,请复制model文件夹到您需要的地方
62+
```
63+
64+
65+
方式二:JSON 字符串方式
66+
-------------
67+
68+
> **主要步骤:**
69+
70+
> - 在终端中进入SKAutoJSONToModelShell.shell所在的文件夹路径下.
71+
> - 执行脚本:python SKAutoJSONToModelShell.py.
72+
> - 选择GET方式: 2
73+
> - 输入JSON字符串
74+
> - 输入Model名称,例如输入TopBanner
75+
> - 脚本执行结束,生成需要的.h和.m文件。
76+
77+
78+
**Terminal Steps:**
79+
80+
```
81+
KUNdeMacBook-Pro:JSONToModelShell KUN$ python SKAutoJSONToModelShell.py
82+
选择输入的内容类型
83+
HTTP GET Url【1】
84+
或者
85+
返回的数据内容【2】
86+
2
87+
输入Model名称: TopBanner
88+
输入Json内容:
89+
完成后以回车结束
90+
[
91+
{
92+
"banner_type": 1,
93+
"category_name": "",
94+
"child_topics": [],
95+
"deal_params": {
96+
"show_saleout": 0
97+
},
98+
"deal_url": "",
99+
"detail": "",
100+
"id": 12989,
101+
"image_big_android_url": "http://z3.tuanimg.com/imagev2/wxyy/720x250.cf73bd928f01c2830766e430ddc4e4d0.jpg",
102+
"image_big_ios_url": "http://z3.tuanimg.com/imagev2/wxyy/640x244.e3407423fdb17a22e665190ad64cd006.jpg",
103+
"image_category_android_url": "",
104+
"image_category_ios_url": "",
105+
"image_largest_android_url": "",
106+
"image_largest_ios_url": "",
107+
"image_little_android_url": "",
108+
"image_little_ios_url": "",
109+
"image_middle_android_url": "",
110+
"image_middle_ios_url": "",
111+
"image_plugin_url": "",
112+
"image_registration_android_url": "",
113+
"image_registration_ios_url": "",
114+
"image_youpinhui_url": "",
115+
"is_plugin": 0,
116+
"parent_url_name": "",
117+
"show_model": 0,
118+
"title": "开学季",
119+
"value": "",
120+
"wap_url": "http://hd.zhe800.com/xindacu/app/kxj0828"
121+
},
122+
{
123+
"banner_type": 1,
124+
"category_name": "",
125+
"child_topics": [],
126+
"deal_params": {
127+
"show_saleout": 0
128+
},
129+
"deal_url": "",
130+
"detail": "",
131+
"id": 12993,
132+
"image_big_android_url": "http://z3.tuanimg.com/imagev2/wxyy/720x250.479aa9a731dc27d86d533e9a4eb88d98.png",
133+
"image_big_ios_url": "http://z3.tuanimg.com/imagev2/wxyy/640x244.6e040e3a8a60c5845c218e78a8f0d7a0.png",
134+
"image_category_android_url": "",
135+
"image_category_ios_url": "",
136+
"image_largest_android_url": "",
137+
"image_largest_ios_url": "",
138+
"image_little_android_url": "",
139+
"image_little_ios_url": "",
140+
"image_middle_android_url": "",
141+
"image_middle_ios_url": "",
142+
"ima "",
143+
"image_registration_android_url": "",
144+
"image_registration_ios_url": "",
145+
"image_youpinhui_url": "",
146+
"is_plugin": 0,
147+
"parent_url_name": "",
148+
"show_model": 0,
149+
"title": "聚专题",
150+
"value": "",
151+
"wap_url": "http://hd.zhe800.com/xindacu/app/jjtwxd"
152+
},
153+
{
154+
"banner_type": 1,
155+
"category_name": "",
156+
"child_topics": [],
157+
"deal_params": {
158+
"show_saleout": 0
159+
},
160+
"deal_url": "",
161+
"detail": "",
162+
"id": 13053,
163+
"image_big_android_url": "http://z3.tuanimg.com/imagev2/wxyy/720x250.f2a031f909d112580efacf2526a3b2a5.jpg",
164+
"image_big_ios_url": "http://z3.tuanimg.com/imagev2/wxyy/640x244.048cfb9088210a4b5d43e5e8444a742f.jpg",
165+
"image_category_android_url": "",
166+
"image_category_ios_url": "",
167+
"image_largest_android_url": "",
168+
"image_largest_ios_url": "",
169+
"image_little_android_url": "",
170+
"image_little_ios_url": "",
171+
"image_middle_android_url": "",
172+
"image_middle_ios_url": "",
173+
"image_plugin_url": "",
174+
"image_registration_android_url": "",
175+
"image_registration_ios_url": "",
176+
"image_youpinhui_url": "",
177+
"is_plugin": 0,
178+
"parent_url_name": "",
179+
"show_model": 0,
180+
"title": "省薪说 家装好物",
181+
"value": "",
182+
"wap_url": "http://hd.zhe800.com/xindacu/app/xrcd0621"
183+
},
184+
{
185+
"banner_type": 1,
186+
"category_name": "",
187+
"child_topics": [],
188+
"deal_params": {
189+
"show_saleout": 0
190+
},
191+
"deal_url": "",
192+
"detail": "",
193+
"id": 13015,
194+
"image_big_android_url": "http://z3.tuanimg.com/imagev2/wxyy/720x250.b28239939c38010efcf6f1ab30e0a521.jpg",
195+
"image_big_ios_url": "http://z3.tuanimg.com/imagev2/wxyy/640x244.bb39fc052f4612e5da73db6394956f84.jpg",
196+
"image_category_android_url": "",
197+
"image_category_ios_url": "",
198+
age_largest_android_url": "",
199+
"image_largest_ios_url": "",
200+
"image_little_android_url": "",
201+
"image_little_ios_url": "",
202+
"image_middle_android_url": "",
203+
"image_middle_ios_url": "",
204+
"image_plugin_url": "",
205+
"image_registration_android_url": "",
206+
"image_registration_ios_url": "",
207+
"image_youpinhui_url": "",
208+
"is_plugin": 0,
209+
"parent_url_name": "",
210+
"show_model": 0,
211+
"title": "翩翩鞋尖",
212+
"value": "",
213+
"wap_url": "http://hd.zhe800.com/xindacu/app/dppysq0828"
214+
}
215+
]
216+
217+
生成TopBannermodel中
218+
生成TopBannerResponsemodel中
219+
生成ChildTopicsmodel中
220+
生成ChildTopicsmodel中
221+
生成DealParamsmodel中
222+
生成TopBannerResponsemodel中
223+
生成ChildTopicsmodel中
224+
生成ChildTopicsmodel中
225+
生成DealParamsmodel中
226+
生成TopBannerResponsemodel中
227+
生成ChildTopicsmodel中
228+
生成DealParamsmodel中
229+
生成ChildTopicsmodel中
230+
生成ChildTopicsmodel中
231+
生成DealParamsmodel中
232+
脚本执行结束,请复制model文件夹到您需要的地方
233+
```

0 commit comments

Comments
 (0)