Skip to content

Commit d8fd380

Browse files
committed
大更新:Server:新增session;新增Row级别角色权限校验;QueryConfig改为SQLConfig,QueryHelper改为SQLExecutor;用@MethodAccess和@MethodStructure替代@APIJSONRequest;新增@Schema;JSONResponse新增通用状态码code;新增重置密码接口;其它优化和bug修复。 Client:为新服务端工程改版;完成重置密码;部分细节优化
1 parent a68069e commit d8fd380

74 files changed

Lines changed: 2876 additions & 1674 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/res/layout/user_activity.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@
8484
<View style="@style/divider_horizontal_1px" />
8585

8686
<LinearLayout
87-
android:id="@+id/llUserTag"
87+
android:id="@+id/llUserPhone"
8888
style="@style/content_item_white" >
8989

9090
<TextView
9191
style="@style/content_item_lf_tv_black"
92-
android:text="标签" />
92+
android:text="手机" />
9393

9494
<TextView
95-
android:id="@+id/tvUserTag"
95+
android:id="@+id/tvUserPhone"
9696
style="@style/content_item_rt_tv"
9797
android:layout_weight="1"
98-
android:text="Android" />
98+
android:text="12345678900" />
9999

100100
<ImageView style="@style/content_item_rt_img" />
101101
</LinearLayout>

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/res/layout/user_view.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
android:text="ID:" />
4141

4242
<TextView
43-
android:id="@+id/tvUserViewPhone"
43+
android:id="@+id/tvUserViewTag"
4444
style="@style/text_middle"
45-
android:text="Phone:" />
45+
android:text="Tag:" />
4646
</LinearLayout>
4747

4848
</LinearLayout>

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/LoginActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
import zuo.biao.library.ui.ServerSettingActivity;
2323
import zuo.biao.library.ui.TextClearSuit;
2424
import zuo.biao.library.util.EditTextUtil;
25+
import zuo.biao.library.util.Log;
2526
import zuo.biao.library.util.SettingUtil;
2627
import zuo.biao.library.util.StringUtil;
2728
import android.annotation.SuppressLint;
2829
import android.app.Activity;
2930
import android.content.Context;
3031
import android.content.Intent;
3132
import android.os.Bundle;
32-
import android.util.Log;
3333
import android.view.MotionEvent;
3434
import android.view.View;
3535
import android.view.View.OnClickListener;
@@ -175,15 +175,15 @@ public void onHttpResponse(int requestCode, String resultJson, Exception e) {
175175
User user = response.getObject(User.class);
176176

177177
if (response.isSucceed() == false) {
178-
switch (response.getStatus()) {
179-
case 404:
178+
switch (response.getCode()) {
179+
case JSONResponse.CODE_NOT_FOUND:
180180
showShortToast("账号不存在,请先注册");
181181
onDragBottom(true);
182182
break;
183-
case 406:
183+
case JSONResponse.CODE_ILLEGAL_ARGUMENT:
184184
showShortToast("账号或密码不合法!");
185185
break;
186-
case 412:
186+
case JSONResponse.CODE_CONDITION_ERROR:
187187
showShortToast("账号或密码错误!");
188188
showForget();
189189
break;

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/PasswordActivity.java

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
package apijson.demo.client.activity_fragment;
1616

17+
import static zuo.biao.apijson.JSONResponse.CODE_TIME_OUT;
18+
import zuo.biao.apijson.JSONResponse;
19+
import zuo.biao.library.base.BaseActivity;
20+
import zuo.biao.library.interfaces.OnBottomDragListener;
21+
import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
22+
import zuo.biao.library.ui.TextClearSuit;
23+
import zuo.biao.library.util.EditTextUtil;
24+
import zuo.biao.library.util.StringUtil;
1725
import android.app.Activity;
1826
import android.content.Context;
1927
import android.content.Intent;
@@ -25,19 +33,12 @@
2533
import android.widget.EditText;
2634
import android.widget.TextView;
2735
import android.widget.Toast;
28-
2936
import apijson.demo.client.R;
3037
import apijson.demo.client.application.APIJSONApplication;
3138
import apijson.demo.client.model.User;
3239
import apijson.demo.client.model.Verify;
3340
import apijson.demo.client.util.HttpRequest;
34-
import zuo.biao.apijson.JSONResponse;
35-
import zuo.biao.library.base.BaseActivity;
36-
import zuo.biao.library.interfaces.OnBottomDragListener;
37-
import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
38-
import zuo.biao.library.ui.TextClearSuit;
39-
import zuo.biao.library.util.EditTextUtil;
40-
import zuo.biao.library.util.StringUtil;
41+
import apijson.demo.server.model.UserPrivacy;
4142

4243
/**注册、验证码登录、重置密码等密码相关界面
4344
* @author Lemon
@@ -220,7 +221,7 @@ public void run() {
220221
}
221222
});
222223

223-
HttpRequest.getAuthCode(StringUtil.getTrimedString(etPasswordPhone), HTTP_GET_VERIFY, this);
224+
HttpRequest.getVerify(StringUtil.getTrimedString(etPasswordPhone), HTTP_GET_VERIFY, this);
224225
}
225226

226227
/**下一步
@@ -261,7 +262,7 @@ private boolean checkVerify(boolean fromServer) {
261262

262263
if (fromServer) {
263264
showProgressDialog();
264-
HttpRequest.checkAuthCode(StringUtil.getTrimedString(etPasswordPhone),
265+
HttpRequest.checkVerify(StringUtil.getTrimedString(etPasswordPhone),
265266
StringUtil.getTrimedString(etPasswordVerify), HTTP_CHECK_VERIFY, this);
266267
}
267268

@@ -344,7 +345,7 @@ public void onHttpResponse(int requestCode, String resultJson, Exception e) {
344345
dismissProgressDialog();
345346
switch (requestCode) {
346347
case HTTP_CHECK_REGISTER:
347-
response2 = response.getJSONResponse(User.class.getSimpleName());
348+
response2 = response.getJSONResponse(HttpRequest.USER_PRIVACY_);
348349
Log.i(TAG, "checkPassword result = " + resultJson);
349350
runUiThread(new Runnable() {
350351
@Override
@@ -387,7 +388,7 @@ public void run() {
387388
}
388389
} else {//验证码错误
389390
EditTextUtil.showInputedError(context, etPasswordVerify
390-
, response.getStatus() == 408 ? "验证码已过期" : "验证码错误");
391+
, response.getCode() == CODE_TIME_OUT ? "验证码已过期" : "验证码错误");
391392
}
392393
}
393394
});
@@ -398,12 +399,12 @@ public void run() {
398399
@Override
399400
public void run() {
400401
showVerifyGet(false);
401-
if (verify == null || StringUtil.isNotEmpty(verify.getCode(), true) == false) {
402+
if (verify == null || StringUtil.isNotEmpty(verify.getVerify(), true) == false) {
402403
showShortToast(R.string.get_failed);
403404
} else {
404405
Log.i(TAG, "发送成功");
405406
time.start();
406-
Toast.makeText(context, "验证码是\n" + verify.getCode(), Toast.LENGTH_LONG).show();
407+
Toast.makeText(context, "验证码是\n" + verify.getVerify(), Toast.LENGTH_LONG).show();
407408
}
408409
}
409410
});
@@ -413,9 +414,9 @@ public void run() {
413414
dismissProgressDialog();
414415
if (user == null || user.getId() <= 0 || JSONResponse.isSucceed(
415416
response.getJSONResponse(User.class.getSimpleName())) == false) {
416-
if (response.getStatus() == 408 || response.getStatus() == 412) {
417+
if (response.getCode() == CODE_TIME_OUT || response.getCode() == 412) {
417418
EditTextUtil.showInputedError(context, etPasswordVerify
418-
, response.getStatus() == 408 ? "验证码已过期" : "验证码错误");
419+
, response.getCode() == CODE_TIME_OUT ? "验证码已过期" : "验证码错误");
419420
} else {
420421
showShortToast("注册失败,请检查网络后重试");
421422
}
@@ -427,7 +428,16 @@ public void run() {
427428
}
428429
break;
429430
case HTTP_RESET_PASSWORD:
430-
//TODO
431+
response2 = response.getJSONResponse(UserPrivacy.class.getSimpleName());
432+
dismissProgressDialog();
433+
if (JSONResponse.isSucceed(response2) == false) {
434+
EditTextUtil.showInputedError(context, etPasswordVerify
435+
, response.getCode() == CODE_TIME_OUT ? "验证码已过期" : "验证码错误");
436+
} else {
437+
showShortToast("修改密码成功,请重新登录");
438+
439+
saveAndExit(newResult().putExtra(INTENT_PHONE, phone));
440+
}
431441
break;
432442
default:
433443
break;

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserActivity.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected void onCreate(Bundle savedInstanceState) {
131131
private GridView gvUserMoment;
132132

133133
private TextView tvUserRemark;
134-
private TextView tvUserTag;
134+
private TextView tvUserPhone;
135135

136136
private ViewGroup llUserBottomMenuContainer;
137137
private BottomMenuView bottomMenuView;
@@ -159,7 +159,7 @@ public void initView() {//必须调用
159159
gvUserMoment = (GridView) findViewById(R.id.gvUserMoment);
160160

161161
tvUserRemark = (TextView) findViewById(R.id.tvUserRemark);
162-
tvUserTag = (TextView) findViewById(R.id.tvUserTag);
162+
tvUserPhone = (TextView) findViewById(R.id.tvUserPhone);
163163

164164
llUserMoment.setVisibility(isOnEditMode ? View.GONE : View.VISIBLE);
165165
if (isOnEditMode == false) {
@@ -211,7 +211,7 @@ public void run() {
211211
userView.bindView(user);//方式三
212212

213213
tvUserRemark.setText(StringUtil.getTrimedString(user.getHead()));
214-
tvUserTag.setText(StringUtil.getTrimedString(user.getTag()));
214+
tvUserPhone.setText(StringUtil.getTrimedString(user.getPhone()));
215215

216216
if (adapter == null) {
217217
adapter = new GridAdapter(context);
@@ -343,7 +343,7 @@ public boolean onTouch(View v, MotionEvent event) {
343343

344344
if (isOnEditMode) {
345345
findViewById(R.id.llUserRemark).setOnClickListener(this);
346-
findViewById(R.id.llUserTag).setOnClickListener(this);
346+
findViewById(R.id.llUserPhone).setOnClickListener(this);
347347

348348
userView.setOnDataChangedListener(new OnDataChangedListener() {
349349

@@ -384,12 +384,12 @@ public void onClick(View v) {
384384
user.setSex(user.getSex() == User.SEX_FEMALE ? User.SEX_MAIL : User.SEX_FEMALE);
385385
}
386386
break;
387-
case R.id.tvUserViewPhone:
387+
case R.id.tvUserViewTag:
388388
if (isOnEditMode) {
389-
toActivity(EditTextInfoWindow.createIntent(context, EditTextInfoWindow.TYPE_PHONE
390-
, "手机", user.getPhone()), REQUEST_TO_EDIT_TEXT_INFO_PHONE, false);
389+
toActivity(EditTextInfoActivity.createIntent(context, "标签"
390+
, StringUtil.getTrimedString(tvUserPhone)), REQUEST_TO_EDIT_TEXT_INFO_TAG);
391391
} else {
392-
CommonUtil.copyText(context, user.getPhone());
392+
CommonUtil.copyText(context, user.getTag());
393393
}
394394
break;
395395
default:
@@ -513,9 +513,9 @@ public void onClick(View v) {
513513
toActivity(EditTextInfoActivity.createIntent(context, EditTextInfoActivity.TYPE_WEBSITE, "备注"
514514
, StringUtil.getTrimedString(tvUserRemark)), REQUEST_TO_EDIT_TEXT_INFO_REMARK);
515515
break;
516-
case R.id.llUserTag:
517-
toActivity(EditTextInfoActivity.createIntent(context, "标签"
518-
, StringUtil.getTrimedString(tvUserTag)), REQUEST_TO_EDIT_TEXT_INFO_TAG);
516+
case R.id.llUserPhone:
517+
toActivity(EditTextInfoWindow.createIntent(context, EditTextInfoWindow.TYPE_PHONE
518+
, "手机", user.getPhone()), REQUEST_TO_EDIT_TEXT_INFO_PHONE, false);
519519
break;
520520
default:
521521
break;

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/WalletActivity.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import apijson.demo.client.R;
3232
import apijson.demo.client.model.Wallet;
3333
import apijson.demo.client.util.HttpRequest;
34+
import apijson.demo.server.model.UserPrivacy;
3435

3536
/**钱包界面
3637
* @author Lemon
@@ -83,19 +84,19 @@ public void initView() {//必须调用
8384
}
8485

8586

86-
private Wallet wallet;
87-
public void setWallet(Wallet wallet_) {
88-
this.wallet = wallet_;
87+
private UserPrivacy privacy;
88+
public void setWallet(UserPrivacy privacy_) {
89+
this.privacy = privacy_;
8990
runUiThread(new Runnable() {
9091

9192
@Override
9293
public void run() {
9394
dismissProgressDialog();
9495
tvBaseTitle.setText(getTitleName());
95-
if (wallet == null) {
96-
wallet = new Wallet();
96+
if (privacy == null) {
97+
privacy = new UserPrivacy();
9798
}
98-
tvWalletCount.setText(StringUtil.getPrice(wallet.getBalance(), StringUtil.PRICE_FORMAT_PREFIX));
99+
tvWalletCount.setText(StringUtil.getPrice(privacy.getBalance(), StringUtil.PRICE_FORMAT_PREFIX));
99100
}
100101
});
101102
}
@@ -117,7 +118,7 @@ public void run() {
117118
public void initData() {//必须调用
118119

119120
showProgressDialog(getTitleName());
120-
HttpRequest.getWallet(HTTP_GET, this);
121+
HttpRequest.getUserPrivacy(HTTP_GET, this);
121122
}
122123

123124
public String getTitleName() {
@@ -172,9 +173,9 @@ public void run() {
172173
switch (requestCode) {
173174
case HTTP_RECHARGE:
174175
case HTTP_WITHDRAW:
175-
if (response.getStatus() == 412) {
176+
if (response.getCode() == JSONResponse.CODE_CONDITION_ERROR) {
176177
showShortToast("密码错误!");
177-
} else if (requestCode == HTTP_WITHDRAW && response.getStatus() == 416) {
178+
} else if (requestCode == HTTP_WITHDRAW && response.getCode() == JSONResponse.CODE_OUT_OF_RANGE) {
178179
showShortToast("余额不足!");
179180
} else {
180181
showShortToast((requestCode == HTTP_RECHARGE ? "充值" : "提现")
@@ -186,7 +187,7 @@ public void run() {
186187
break;
187188
case HTTP_GET:
188189
if (isSucceed) {
189-
setWallet(response.getObject(Wallet.class));
190+
setWallet(response.getObject(UserPrivacy.class));
190191
} else {
191192
showShortToast(R.string.get_failed);
192193
}

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/CommentItem.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414

1515
package apijson.demo.client.model;
1616

17-
import android.support.annotation.NonNull;
18-
1917
import java.util.List;
2018

21-
import zuo.biao.apijson.BaseModel;
19+
import android.support.annotation.NonNull;
20+
import apijson.demo.server.model.BaseModel;
2221

2322
public class CommentItem extends BaseModel {
2423
private static final long serialVersionUID = -1011007127735372824L;

APIJSON(Android)/APIJSON(ADT)/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/MomentItem.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
package apijson.demo.client.model;
1616

17-
import android.support.annotation.NonNull;
18-
1917
import java.util.ArrayList;
2018
import java.util.List;
2119

20+
import android.support.annotation.NonNull;
2221
import apijson.demo.client.application.APIJSONApplication;
23-
import zuo.biao.apijson.BaseModel;
22+
import apijson.demo.server.model.BaseModel;
2423

2524
public class MomentItem extends BaseModel {
2625
private static final long serialVersionUID = -7437225320551780084L;

0 commit comments

Comments
 (0)