38 lines
		
	
	
		
			895 B
		
	
	
	
		
			PHP
		
	
	
		
		
			
		
	
	
			38 lines
		
	
	
		
			895 B
		
	
	
	
		
			PHP
		
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace app\repository;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use app\exception\RepositoryException;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use app\model\Recharge;
							 | 
						||
| 
								 | 
							
								use app\service\Repository;
							 | 
						||
| 
								 | 
							
								use think\db\exception\DataNotFoundException;
							 | 
						||
| 
								 | 
							
								use think\db\exception\DbException;
							 | 
						||
| 
								 | 
							
								use think\db\exception\ModelNotFoundException;
							 | 
						||
| 
								 | 
							
								use think\Model;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 充值户域 相关操作
							 | 
						||
| 
								 | 
							
								 * Class RechargeRepository
							 | 
						||
| 
								 | 
							
								 * @package app\repository
							 | 
						||
| 
								 | 
							
								 * @method self getInstance(Model $model = null) static
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class RechargeRepository extends Repository
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 创建一个支付订单
							 | 
						||
| 
								 | 
							
								     * */
							 | 
						||
| 
								 | 
							
								    public function createOrder($businessCode, $money)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $data = [
							 | 
						||
| 
								 | 
							
								            "order_num" => createUuid(),
							 | 
						||
| 
								 | 
							
								            "business_code" => $businessCode,
							 | 
						||
| 
								 | 
							
								            "money" => $money,
							 | 
						||
| 
								 | 
							
								            "state" => Recharge::state_off,
							 | 
						||
| 
								 | 
							
								            "create_time" => date("Y-m-d H:i:s"),
							 | 
						||
| 
								 | 
							
								            "balance" => 0,
							 | 
						||
| 
								 | 
							
								        ];
							 | 
						||
| 
								 | 
							
								        return Recharge::create($data);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |