package com.yidian.shenghuoquan.commodity.service

import com.yidian.common.XEventConfig
import com.yidian.xarc.xevent.XBaseEvent
import com.yidian.xarc.xevent.XEventManager
import com.yidian.xarc.xrouter.ResultResolver
import com.yidian.yac.core.zap.ZapService

/**
 * author: yinjiacheng
 * date: 7/9/21 11:40 PM
 * description: 商品发布服务
 */
class GoodsPublishService : ZapService() {

  companion object {
    const val SERVICE_NAME = "goodsPublishService"

    // 发布成功
    const val ACTION_PUBLISH_SUCCESS = "publishSuccess"
  }

  override fun onAction(path: String, action: String, params: Any, options: Any, resolver: ResultResolver) {
    when (action) {
      ACTION_PUBLISH_SUCCESS -> {
        XEventManager.post(XBaseEvent(XEventConfig.COMMODITY_PUBLISH_SUCCESS, null))
      }
    }
  }

  override fun onExit() {

  }

  override fun onInit() {

  }
}
