56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
		
		
			
		
	
	
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
|  | <?php | ||
|  | 
 | ||
|  | namespace app\repository; | ||
|  | 
 | ||
|  | use app\exception\RepositoryException; | ||
|  | use app\model\Business; | ||
|  | use app\model\BusinessFlow; | ||
|  | use app\model\CouponBill; | ||
|  | use app\model\CouponMain; | ||
|  | use app\model\Deduction; | ||
|  | use app\model\Recharge; | ||
|  | use app\service\Repository; | ||
|  | use think\Collection; | ||
|  | use think\Model; | ||
|  | 
 | ||
|  | /** | ||
|  |  * 流水相关 | ||
|  |  * | ||
|  |  * Class BusinessRepository | ||
|  |  * @package app\repository | ||
|  |  * @method self getInstance(Model $model = null) static | ||
|  |  */ | ||
|  | class BillRepository extends Repository | ||
|  | 
 | ||
|  | { | ||
|  |     /** | ||
|  |      * 流水列表 | ||
|  |      * @param $keyword | ||
|  |      * @param $page | ||
|  |      * @param $size | ||
|  |      * @param $orders | ||
|  |      */ | ||
|  |     public function billList($keyword, $page, $size, $orders = ["a.id" => "desc"]) | ||
|  |     { | ||
|  |         $failData = [ | ||
|  |             'total' => 0, | ||
|  |             'current' => $page, | ||
|  |             'size' => $size, | ||
|  |             'list' => new Collection(), | ||
|  |         ]; | ||
|  |         $rep = CouponBill::alias("a") | ||
|  |             ->join("business b", "a.business_code = b.code") | ||
|  |             ->wher(!empty($keyword), function ($q) use ($keyword) { | ||
|  |                 $q->where("b.business_name", "like", "%$keyword%"); | ||
|  |             }); | ||
|  | 
 | ||
|  |         $failData ['total'] = $rep->count(); | ||
|  |         $failData ['list'] = $rep->field("a.*,b.business_name") | ||
|  |             ->page($page, $size) | ||
|  |             ->order($orders) | ||
|  |             ->select(); | ||
|  |         return $failData; | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  | } |