30 lines
		
	
	
		
			811 B
		
	
	
	
		
			PHP
		
	
	
		
		
			
		
	
	
			30 lines
		
	
	
		
			811 B
		
	
	
	
		
			PHP
		
	
	
|  | <?php | ||
|  | 
 | ||
|  | namespace app\traits; | ||
|  | 
 | ||
|  | use think\Model; | ||
|  | use app\model\Comment; | ||
|  | use think\db\exception\DbException; | ||
|  | use think\db\exception\DataNotFoundException; | ||
|  | use think\db\exception\ModelNotFoundException; | ||
|  | 
 | ||
|  | trait CommentTrait | ||
|  | { | ||
|  |     /**消费者评论总数 | ||
|  |      * @param string $userCode | ||
|  |      * | ||
|  |     **/ | ||
|  |     public function consumerTotalComment($userCode){ | ||
|  |         return Comment::where("user_code",$userCode)->where("is_delete",Comment::COMMON_OFF)->count("id"); | ||
|  |     } | ||
|  |     /**消费者评论本月总数 | ||
|  |      * @param string $userCode | ||
|  |      * | ||
|  |     **/ | ||
|  |     public function consumerTheMonthTotalComment($userCode){ | ||
|  |         return Comment::where("user_code",$userCode) | ||
|  |             ->where("is_delete",Comment::COMMON_OFF) | ||
|  |             ->whereTime("create_time",">=",date("Y-m-1 00:00:00")) | ||
|  |             ->count("id"); | ||
|  |     } | ||
|  | } |