//#import $owl_history_p:services/modelService.jsx

var ProductHistoryUtil = (function () {
    var f = {
        addHistory: function (userId, productId) {
            if(!userId || !productId) {
                $.log("productDetail.jsx...ProductHistoryUtil...addHistory...stop...userId=" + userId + "...productId=" + productId);
                return;
            }
            var jHistory = owl_history_pService.get("owl_history_p_" + userId + "_" + productId);
            if (jHistory) {
                //更新一下访问时间
                owl_history_pService.update(jHistory);
                $.log("productDetail.jsx...ProductHistoryUtil...addHistory...updated...userId=" + userId + "...productId=" + productId);
            } else {
                jHistory = {};
                jHistory.userId = userId;
                jHistory.productId = productId;
                owl_history_pService.add(jHistory);
            }
        }
    };
    return f;
})();