62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
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
|
|
{
|
|
/**
|
|
* 后台创建一个支付订单
|
|
* @param $businessCode
|
|
* @param $money
|
|
* @return Recharge|Model
|
|
*/
|
|
public function adminCreateOrder($businessCode, $money)
|
|
{
|
|
|
|
$data = [
|
|
"order_num" => createUuid(),
|
|
"agency_code" => session('auth')['business_code']??'',
|
|
"business_code" => $businessCode,
|
|
"money" => $money,
|
|
"state" => Recharge::state_off,
|
|
"create_time" => date("Y-m-d H:i:s"),
|
|
"balance" => 0,
|
|
];
|
|
return Recharge::create($data);
|
|
}
|
|
/**
|
|
* 创建一个支付订单
|
|
* @param $businessCode
|
|
* @param $openId
|
|
* @param $money
|
|
* @return Recharge|Model
|
|
*/
|
|
public function createOrder($businessCode,$openId,$money)
|
|
{
|
|
$data = [
|
|
"open_id" => $openId,
|
|
"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);
|
|
}
|
|
} |