This commit is contained in:
技术老胡
2026-04-01 14:30:50 +08:00
parent 0eee3b92c2
commit d34bd386ec
15 changed files with 542 additions and 186 deletions

View File

@@ -21,7 +21,7 @@ class MerchantAppRepository extends BaseRepository
public function findByAppId(string $appId): ?MerchantApp
{
return $this->model->newQuery()
->where('app_id', $appId)
->where('app_code', $appId)
->where('status', 1)
->first();
}
@@ -32,19 +32,30 @@ class MerchantAppRepository extends BaseRepository
public function findByMerchantAndApp(int $merchantId, int $appId): ?MerchantApp
{
return $this->model->newQuery()
->where('merchant_id', $merchantId)
->where('mer_id', $merchantId)
->where('id', $appId)
->where('status', 1)
->first();
}
/**
* 根据商户ID和应用IDapp_id查询
*/
public function findByMerchantAndAppId(int $merchantId, string $appId): ?MerchantApp
{
return $this->model->newQuery()
->where('mer_id', $merchantId)
->where('app_code', $appId)
->first();
}
/**
* 后台按 app_id 查询(不过滤状态)
*/
public function findAnyByAppId(string $appId): ?MerchantApp
{
return $this->model->newQuery()
->where('app_id', $appId)
->where('app_code', $appId)
->first();
}
@@ -56,13 +67,13 @@ class MerchantAppRepository extends BaseRepository
$query = $this->model->newQuery();
if (!empty($filters['merchant_id'])) {
$query->where('merchant_id', (int)$filters['merchant_id']);
$query->where('mer_id', (int)$filters['merchant_id']);
}
if (($filters['status'] ?? '') !== '' && $filters['status'] !== null) {
$query->where('status', (int)$filters['status']);
}
if (!empty($filters['app_id'])) {
$query->where('app_id', 'like', '%' . $filters['app_id'] . '%');
$query->where('app_code', 'like', '%' . $filters['app_id'] . '%');
}
if (!empty($filters['app_name'])) {
$query->where('app_name', 'like', '%' . $filters['app_name'] . '%');
@@ -70,6 +81,15 @@ class MerchantAppRepository extends BaseRepository
if (!empty($filters['api_type'])) {
$query->where('api_type', (string)$filters['api_type']);
}
if (!empty($filters['package_code'])) {
$query->where('package_code', (string)$filters['package_code']);
}
if (($filters['notify_enabled'] ?? '') !== '' && $filters['notify_enabled'] !== null) {
$query->where('notify_enabled', (int)$filters['notify_enabled']);
}
if (!empty($filters['callback_mode'])) {
$query->where('callback_mode', (string)$filters['callback_mode']);
}
$query->orderByDesc('id');

View File

@@ -41,6 +41,12 @@ class MerchantRepository extends BaseRepository
if (!empty($filters['merchant_name'])) {
$query->where('merchant_name', 'like', '%' . $filters['merchant_name'] . '%');
}
if (!empty($filters['email'])) {
$query->where('email', 'like', '%' . $filters['email'] . '%');
}
if (isset($filters['balance']) && $filters['balance'] !== '') {
$query->where('balance', (string)$filters['balance']);
}
$query->orderByDesc('id');

View File

@@ -15,9 +15,9 @@ class PaymentChannelRepository extends BaseRepository
public function findAvailableChannel(int $merchantId, int $merchantAppId, int $methodId): ?PaymentChannel
{
return $this->model->newQuery()
->where('merchant_id', $merchantId)
->where('merchant_app_id', $merchantAppId)
->where('method_id', $methodId)
->where('mer_id', $merchantId)
->where('app_id', $merchantAppId)
->where('pay_type_id', $methodId)
->where('status', 1)
->orderBy('sort', 'asc')
->first();
@@ -51,13 +51,13 @@ class PaymentChannelRepository extends BaseRepository
$query = $this->model->newQuery();
if (!empty($filters['merchant_id'])) {
$query->where('merchant_id', (int)$filters['merchant_id']);
$query->where('mer_id', (int)$filters['merchant_id']);
}
if (!empty($filters['merchant_app_id'])) {
$query->where('merchant_app_id', (int)$filters['merchant_app_id']);
$query->where('app_id', (int)$filters['merchant_app_id']);
}
if (!empty($filters['method_id'])) {
$query->where('method_id', (int)$filters['method_id']);
$query->where('pay_type_id', (int)$filters['method_id']);
}
if (($filters['status'] ?? '') !== '' && $filters['status'] !== null) {
$query->where('status', (int)$filters['status']);

View File

@@ -27,7 +27,7 @@ class PaymentMethodRepository extends BaseRepository
public function findByCode(string $methodCode): ?PaymentMethod
{
return $this->model->newQuery()
->where('method_code', $methodCode)
->where('type', $methodCode)
->where('status', 1)
->first();
}
@@ -38,7 +38,7 @@ class PaymentMethodRepository extends BaseRepository
public function findAnyByCode(string $methodCode): ?PaymentMethod
{
return $this->model->newQuery()
->where('method_code', $methodCode)
->where('type', $methodCode)
->first();
}
@@ -53,10 +53,10 @@ class PaymentMethodRepository extends BaseRepository
$query->where('status', (int)$filters['status']);
}
if (!empty($filters['method_code'])) {
$query->where('method_code', 'like', '%' . $filters['method_code'] . '%');
$query->where('type', 'like', '%' . $filters['method_code'] . '%');
}
if (!empty($filters['method_name'])) {
$query->where('method_name', 'like', '%' . $filters['method_name'] . '%');
$query->where('name', 'like', '%' . $filters['method_name'] . '%');
}
$query->orderBy('sort', 'asc')->orderByDesc('id');