1、更新通道统计,可以查看每个通道的收入情况,可以查询指定时间段的通道收入情况

2、账号管理列表交互优化,添加操作下拉框
3、修复二维码图片上传功能可能导致的漏洞
This commit is contained in:
技术老胡
2025-06-03 11:15:12 +08:00
parent 98c90dffcf
commit 5826a7f6e1
11 changed files with 292 additions and 9 deletions

View File

@@ -210,6 +210,6 @@ class Order extends BaseModel
// 模型多对一关联
public function payAccount()
{
return $this->belongsTo(PayAccount::class, 'aid', 'id');
return $this->belongsTo(PayAccount::class, 'id', 'aid');
}
}

View File

@@ -24,7 +24,25 @@ class PayAccount extends BaseModel
$select[] = [$key, '=', $value];
}
}
return self::withCount(['payChannel' => 'channel'])->where($select);
return self::withCount(['payChannel' => 'channel_num'])->withSum(['order' => function ($query, &$alias) {
$query->whereDay('pay_time')->where('state', 1);
$alias = 'income';
}], 'really_price')->where($select);
}
public static function findAccount($query)
{
$select = [];
$allow_field = ['state', 'platform', 'account', 'pattern'];
foreach ($query as $key => $value) {
if (in_array($key, $allow_field) && isset($value)) {
if ($key === 'account') {
$select[] = [$key, 'like', '%' . $value . '%'];
continue;
}
$select[] = [$key, '=', $value];
}
}
return self::where($select);
}
// 获取账号配置
public static function getAccountConfig($aid, $pid = null): array|bool
@@ -86,4 +104,9 @@ class PayAccount extends BaseModel
{
return $this->hasMany(PayChannel::class, 'account_id', 'id');
}
// 一对多关联
public function order()
{
return $this->hasMany(Order::class, 'aid', 'id');
}
}