| | |
| | | clickAction(responseString) |
| | | } |
| | | |
| | | override fun onError(e: Throwable) { |
| | | super.onError(e) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | fun getAppId(): String { |
| | | var appid = CacheKey.getKeyStr("appid") |
| | | if (appid.isEmpty()){ |
| | | if (appid.isEmpty()) { |
| | | return "" |
| | | } else{ |
| | | } else { |
| | | return appid |
| | | } |
| | | } |
| | |
| | | |
| | | override fun onError(code: Int, msg: String?, resposeString: String?) { |
| | | super.onError(code, msg, resposeString) |
| | | clickActionError(msg) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | fun MyBaseActivity.callNetAndError( |
| | | b: Boolean, |
| | | api: String, |
| | | map: HashMap<String?, Any?>, |
| | | clickAction: (responseString: String?) -> Unit, |
| | | clickActionError: (errorString: String?) -> Unit |
| | | ) { |
| | | if (b) |
| | | this.showDialog() |
| | | if (api.startsWith("api")) { |
| | | map["appid"] = getAppId() |
| | | var sign = DES.getSign(map) |
| | | map["sign"] = sign |
| | | } |
| | | HttpManager.getInstance().post(api, map, object : MyObserver(this) { |
| | | override fun success(responseString: String?) { |
| | | if (b) |
| | | dismissDialog() |
| | | clickAction(responseString) |
| | | } |
| | | |
| | | override fun onError(code: Int, msg: String?, resposeString: String?) { |
| | | // super.onError(code, msg, resposeString) |
| | | clickActionError(msg) |
| | | } |
| | | }) |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | fun MyBaseFragment.callNet( |
| | | b: Boolean, |
| | | api: String, |
| | | map: HashMap<String?, Any?>, |
| | | clickAction: (responseString: String?) -> Unit, |
| | | clickActionError: (errorString: String?) -> Unit |
| | | ) { |
| | | if (b) { |
| | | this.showDialog() |
| | | } |
| | | if (api.startsWith("api")) { |
| | | map["appid"] = getAppId() |
| | | var sign = DES.getSign(map) |
| | | map["sign"] = sign |
| | | } |
| | | HttpManager.getInstance().post(api, map, object : MyObserver(this) { |
| | | override fun success(responseString: String?) { |
| | | if (b) { |
| | | dismissDialog() |
| | | } |
| | | clickAction(responseString) |
| | | } |
| | | |
| | | override fun onError(code: Int, msg: String?, resposeString: String?) { |
| | | super.onError(code, msg, resposeString) |
| | | |
| | | clickActionError(msg) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | fun callNet( |
| | | context: Context, |
| | | api: String, |
| | |
| | | } |
| | | |
| | | |
| | | fun timeOver(timeDown:Long,click: (mill: Int) -> Unit): CountDownTimer { |
| | | fun timeOver(timeDown: Long, click: (mill: Int) -> Unit): CountDownTimer { |
| | | val timer by lazy { |
| | | object : CountDownTimer(timeDown, 1000) { |
| | | override fun onFinish() { |