package com.zj365.mime.vm

import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.common.util.CommonUtils
import com.xty.network.model.RespBody
import org.json.JSONObject

class DebugVm: BaseVm() {
    val uploadLive by lazy{MutableLiveData<RespBody<Any>>()}
    val live by lazy{MutableLiveData<RespBody<Any>>()}

    //静默上传测试日志
    fun upload(str: String){
        startHttp(false) {
            var json= JSONObject()
            // json.put("pageNum",page)
            //json.put("pageSize",Const.PAGE_SIZE)
            json.put("userId",  CommonUtils.getMyUserId())
            json.put("content",str)
            var response= apiInterface().saveLog(retrofits.getRequestBody(json.toString()))
            response.getCodeStatus(live,nowData)
        }
    }

    //上传测试文件
    fun uploadLog(str: String){
        startHttp {
            var json= JSONObject()
            // json.put("pageNum",page)
            //json.put("pageSize",Const.PAGE_SIZE)
            json.put("userId", CommonUtils.getMyUserId())
            json.put("content",str)
           var response= apiInterface().saveLog(retrofits.getRequestBody(json.toString()))
            response.getCodeStatus(uploadLive,nowData)
        }
    }
}