mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-11-13 06:03:44 +08:00
1、更新通道统计,可以查看每个通道的收入情况,可以查询指定时间段的通道收入情况
2、账号管理列表交互优化,添加操作下拉框 3、修复二维码图片上传功能可能导致的漏洞
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user