package com.yidian.shenghuoquan.newscontent.service

import android.util.Log
import com.yidian.xarc.xrouter.ResultResolver
import com.yidian.yac.core.zap.ZapService

class CacheService: ZapService(){
    companion object{
        const val serviceName: String = "CacheService"
    }

    private lateinit var resolver: ResultResolver

    override fun onAction(name: String, action: String, params: Any, options: Any, resolver: ResultResolver) {
        this.resolver = resolver
//        params as JSONObject
//        val path = params.optString("path")
//        val body = params.optJSONObject("body")
        Log.e("zhb-yd", "action:$action")
        when(action){
            "clearAllCache" -> clearAllCache()
        }
    }

    override fun onExit() {

    }

    override fun onInit() {

    }

    private fun clearAllCache(){
//        ToastUtil.showToast(YdBaseApplication.context, "清除缓存")
        val jsonObject = "{\"message\":\"清除缓存完成\"}"
        resolver.success(jsonObject)
    }
}