Network embedding is an important work as a representation learning method for mapping high-dimensional networks to low-dimensional vector spaces. Some researches have been carried out on dynamic homogeneous network embedding and static network embedding. But there are still fewer studies for embedding on dynamic heterogeneous information networks (DHINs). If we directly apply static network embedding methods or dynamic homogeneous network embedding methods to solve the DHIN embedding problem, it will lead to serious information loss due to ignoring the dynamic or heterogeneous properties of the network. Therefore, we propose a DHIN embedding method called TNDE, which is based on time- and category-constrained random walk. The method adopts category constraints to solve the problem of preserving semantic information in DHINs. Moreover, unlike the temporal random walk in other dynamic network embedding methods, TNDE uses non-decreasing temporal constraints to incrementally perform random walk. It can solve the problem that edges on local structures with strong semantics have the same timestamps due to the simultaneous existence of dynamic and heterogeneous properties in DHIN and avoid being trapped in the same timestamps during walking. TNDE provides an efficient online representation learning algorithm by adopting incremental walking and incremental representation learning for real-time changes. Experimental results on three real datasets show that TNDE has good generality in networks with different characteristics and significantly improves embedding quality, which outperforms state-of-the-art methods by 2.4%~92.7% in downstream link prediction and node classification tasks. Moreover, TNDE reduces the algorithm runtime by 12.5%~99.91% with good embedding quality.