mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-05-09 18:34:26 +08:00
1. 维护代码健壮
2. 更新项目结构文档
This commit is contained in:
@@ -73,6 +73,27 @@ class PaymentChannelRepository extends BaseRepository
|
||||
return $query->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定商户的通道名称是否已存在。
|
||||
*
|
||||
* @param int $merchantId 商户ID
|
||||
* @param string $name 通道名称
|
||||
* @param int $ignoreId 需要排除的记录ID
|
||||
* @return bool 是否存在
|
||||
*/
|
||||
public function existsByMerchantName(int $merchantId, string $name, int $ignoreId = 0): bool
|
||||
{
|
||||
$query = $this->model->newQuery()
|
||||
->where('merchant_id', $merchantId)
|
||||
->where('name', $name);
|
||||
|
||||
if ($ignoreId > 0) {
|
||||
$query->where('id', '<>', $ignoreId);
|
||||
}
|
||||
|
||||
return $query->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计商户名下的支付通道概览。
|
||||
*
|
||||
@@ -104,4 +125,3 @@ class PaymentChannelRepository extends BaseRepository
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,14 +32,30 @@ class PaymentPluginConfRepository extends BaseRepository
|
||||
public function findByPluginCode(string $pluginCode, array $columns = ['*'])
|
||||
{
|
||||
return $this->model->newQuery()
|
||||
->where('merchant_id', 0)
|
||||
->where('plugin_code', $pluginCode)
|
||||
->orderByDesc('id')
|
||||
->first($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前商户可访问的插件配置。
|
||||
*
|
||||
* @param int $merchantId 商户ID
|
||||
* @param int $id 配置ID
|
||||
* @param array $columns 字段列表
|
||||
* @return PaymentPluginConf|null 插件配置记录
|
||||
*/
|
||||
public function findByMerchantAndId(int $merchantId, int $id, array $columns = ['*'])
|
||||
{
|
||||
return $this->model->newQuery()
|
||||
->where('merchant_id', $merchantId)
|
||||
->whereKey($id)
|
||||
->first($columns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,10 +49,40 @@ class PaymentPluginRepository extends BaseRepository
|
||||
->orderBy('code', 'asc')
|
||||
->get($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商户端允许使用的支付插件。
|
||||
*
|
||||
* @param array $columns 字段列表
|
||||
* @return \Illuminate\Database\Eloquent\Collection<int, PaymentPlugin> 插件列表
|
||||
*/
|
||||
public function merchantEnabledList(array $columns = ['*'])
|
||||
{
|
||||
return $this->model->newQuery()
|
||||
->where('status', 1)
|
||||
->where('allow_merchant', 1)
|
||||
->orderBy('code', 'asc')
|
||||
->get($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商户端允许使用的支付插件。
|
||||
*
|
||||
* @param string $code 插件编码
|
||||
* @param array $columns 字段列表
|
||||
* @return PaymentPlugin|null 插件记录
|
||||
*/
|
||||
public function findMerchantAllowed(string $code, array $columns = ['*']): ?PaymentPlugin
|
||||
{
|
||||
return $this->model->newQuery()
|
||||
->whereKey($code)
|
||||
->where('status', 1)
|
||||
->where('allow_merchant', 1)
|
||||
->first($columns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user