coupon-admin/app/repository/RechargeRepository.php

62 lines
1.6 KiB
PHP
Raw Normal View History

2021-11-18 09:57:04 +00:00
<?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
{
2021-11-29 05:56:26 +00:00
/**
* 后台创建一个支付订单
* @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);
}
2021-11-18 09:57:04 +00:00
/**
* 创建一个支付订单
2021-11-29 05:56:26 +00:00
* @param $businessCode
2021-12-09 05:36:47 +00:00
* @param $openId
2021-11-29 05:56:26 +00:00
* @param $money
* @return Recharge|Model
*/
2021-12-09 05:36:47 +00:00
public function createOrder($businessCode,$openId,$money)
2021-11-18 09:57:04 +00:00
{
$data = [
2021-12-09 05:36:47 +00:00
"open_id" => $openId,
2021-11-18 09:57:04 +00:00
"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);
}
}