package thyyxxk.webserver.entity.medicine;

import cn.hutool.extra.spring.SpringUtil;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import thyyxxk.webserver.dao.his.medicaladvice.common.DictDataDao;

public enum TaoBaoEnum {

    URL,
    URL_BAK,
    APP_KEY,
    SECRET,
    REF_ENT_ID,
    ENT_ID;

    public String getValue(String key) {
        if(null == key){
            return null;
        }
        DictDataDao dao = SpringUtil.getBean(DictDataDao.class);
        return dao.getDictValueByDictName("tb", key.toLowerCase());
    }

    public static TaobaoClient getClient(){
        return new DefaultTaobaoClient(
                TaoBaoEnum.URL.getValue("url"), TaoBaoEnum.APP_KEY.getValue("app_key"), TaoBaoEnum.SECRET.getValue("secret"));
    }


}
