统一USER_HOST
This commit is contained in:
@ -6,7 +6,9 @@ import android.content.SharedPreferences;
|
||||
|
||||
public class Config {
|
||||
|
||||
public static final String HOST = "http://api.ghzhushou.com/";
|
||||
public static final String HOST = "http://api.ghzhushou.com/v2d1";
|
||||
public static final String USER_HOST = "http://user.ghzhushou.com/v1d0";
|
||||
public static final String COMMENT_HOST = "http://comment.ghzhushou.com/v1d0";
|
||||
public static final String PREFERENCE = "ghzhushou";
|
||||
|
||||
public static boolean isShow(Context context) {
|
||||
|
||||
@ -56,11 +56,10 @@ public class TokenUtils {
|
||||
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
|
||||
sp.edit().putBoolean("isUploadMid", false).apply();
|
||||
}
|
||||
String url = "http://user.ghzhushou.com/v1d0/device/register";
|
||||
HttpURLConnection connection = null;
|
||||
String url = Config.USER_HOST + "/device/register";
|
||||
try {
|
||||
JSONObject body = new JSONObject(params);
|
||||
connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
connection.setConnectTimeout(5000);
|
||||
@ -120,7 +119,7 @@ public class TokenUtils {
|
||||
}
|
||||
|
||||
// 重新获取token
|
||||
String url = "http://user.ghzhushou.com/v1d0/login";
|
||||
String url = Config.USER_HOST + "/login";
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("device_id", getDeviceId(context));
|
||||
try {
|
||||
|
||||
@ -12,6 +12,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.FileUtils;
|
||||
@ -70,7 +71,7 @@ public class CropImageActivity extends BaseActivity {
|
||||
+ System.currentTimeMillis() + ".jpg";
|
||||
if (cropimage_custom.savePicture(path)) {
|
||||
// 上传图片
|
||||
JSONObject result = FileUtils.uploadFile("http://user.ghzhushou.com/v1d0/icon",
|
||||
JSONObject result = FileUtils.uploadFile(Config.USER_HOST + "/icon",
|
||||
path, TokenUtils.getToken(CropImageActivity.this));
|
||||
dialog.dismiss();
|
||||
if (result != null) {
|
||||
|
||||
@ -408,7 +408,7 @@ public class PersonalFragment extends Fragment implements View.OnClickListener,
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("name", nickname);
|
||||
StringExtendedRequest request = new StringExtendedRequest(Request.Method.POST,
|
||||
"http://user.ghzhushou.com/v1d0/name", new JSONObject(params).toString(),
|
||||
Config.USER_HOST + "/name", new JSONObject(params).toString(),
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
@ -478,7 +478,7 @@ public class PersonalFragment extends Fragment implements View.OnClickListener,
|
||||
@Override
|
||||
public void run() {
|
||||
StringExtendedRequest request = new StringExtendedRequest(Request.Method.POST,
|
||||
"http://user.ghzhushou.com/v1d0/device/" + TokenUtils.getDeviceId(getActivity()),
|
||||
Config.USER_HOST + "/device/" + TokenUtils.getDeviceId(getActivity()),
|
||||
new JSONObject(params).toString(), null, null);
|
||||
request.addHeader("TOKEN", TokenUtils.getToken(getActivity()));
|
||||
AppController.addToRequestQueue(request, TAG);
|
||||
|
||||
Reference in New Issue
Block a user