80 lines
1.6 KiB
Go
80 lines
1.6 KiB
Go
package handlers
|
|
|
|
import (
|
|
"errors"
|
|
"lone-services/services/wecom/internal/dao"
|
|
)
|
|
|
|
func GetHandler(job dao.WeComJob) (Handler, error) {
|
|
|
|
switch job.BizType {
|
|
|
|
// 产品
|
|
case dao.EditLogTypeProduct:
|
|
|
|
switch job.Type {
|
|
|
|
case dao.ProductApplyReview:
|
|
return ProductReviewHandler{}, nil
|
|
|
|
case dao.ProductNeedReview:
|
|
return ProductNotifyApplyHandler{}, nil
|
|
|
|
case dao.ProductSubmitReview:
|
|
return ProductNotifySubmitHandler{}, nil
|
|
|
|
case dao.ProductFirstReview:
|
|
return ProductNotifyFirstHandler{}, nil
|
|
|
|
case dao.ProductSecondReview:
|
|
return ProductNotifySecondHandler{}, nil
|
|
|
|
case dao.ProductOrdinaryReview:
|
|
return ProductNotifyOrdinaryHandler{}, nil
|
|
}
|
|
// 门店
|
|
case dao.EditLogTypeStore:
|
|
switch job.Type {
|
|
|
|
case dao.StoreApplyReview:
|
|
return StoreReviewHandler{}, nil
|
|
|
|
case dao.StoreNeedReview:
|
|
return StoreNotifyApplyHandler{}, nil
|
|
|
|
case dao.StoreSubmitReview:
|
|
return StoreNotifySubmitHandler{}, nil
|
|
|
|
case dao.StoreFirstReview:
|
|
return StoreNotifyFirstHandler{}, nil
|
|
|
|
case dao.StoreSecondReview:
|
|
return StoreNotifySecondHandler{}, nil
|
|
}
|
|
// 地址
|
|
case dao.EditLogTypeAddress:
|
|
switch job.Type {
|
|
|
|
case dao.AddressApplyReview:
|
|
return AddressReviewHandler{}, nil
|
|
|
|
case dao.AddressSubmitReview:
|
|
return AddressNotifySubmitHandler{}, nil
|
|
|
|
case dao.AddressFirstReview:
|
|
return AddressNotifyFirstHandler{}, nil
|
|
|
|
case dao.AddressSecondReview:
|
|
return AddressNotifySecondHandler{}, nil
|
|
}
|
|
case dao.EditLogTypeSales:
|
|
switch job.Type {
|
|
|
|
case dao.SalesApplyReview:
|
|
return SalesNotifyApplyHandler{}, nil
|
|
}
|
|
}
|
|
|
|
return nil, errors.New("wecom handler not found")
|
|
}
|