@@ -19,7 +19,14 @@ class Agent extends Common
|
||||
];
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'pending_reward'
|
||||
'pending_reward',
|
||||
'identity_text',
|
||||
'identities',
|
||||
'is_partner',
|
||||
'maker_level_name',
|
||||
'voucher_available',
|
||||
'active_30d',
|
||||
'madow_value',
|
||||
];
|
||||
|
||||
// 分销商状态 AGENT_STATUS
|
||||
@@ -71,6 +78,44 @@ class Agent extends Common
|
||||
return number_format($amount, 2, '.', '');
|
||||
}
|
||||
|
||||
public function getIdentityTextAttr($value, $data)
|
||||
{
|
||||
return \addons\shopro\service\partner\IdentityService::build($data)['identity_text'];
|
||||
}
|
||||
|
||||
public function getIdentitiesAttr($value, $data)
|
||||
{
|
||||
return \addons\shopro\service\partner\IdentityService::build($data)['identities'];
|
||||
}
|
||||
|
||||
public function getIsPartnerAttr($value, $data)
|
||||
{
|
||||
return \addons\shopro\service\partner\IdentityService::build($data)['is_partner'];
|
||||
}
|
||||
|
||||
public function getMakerLevelNameAttr($value, $data)
|
||||
{
|
||||
return \addons\shopro\service\partner\IdentityService::build($data)['maker_level_name'];
|
||||
}
|
||||
|
||||
public function getVoucherAvailableAttr($value, $data)
|
||||
{
|
||||
$released = (float) ($data['voucher_released'] ?? 0);
|
||||
$used = (float) ($data['voucher_used'] ?? 0);
|
||||
return number_format(max(0, $released - $used), 2, '.', '');
|
||||
}
|
||||
|
||||
public function getActive_30dAttr($value, $data)
|
||||
{
|
||||
return (new \addons\shopro\service\partner\ActiveService())->isActive($data);
|
||||
}
|
||||
|
||||
public function getMadowValueAttr($value, $data)
|
||||
{
|
||||
$rate = (new \addons\shopro\service\partner\RateService())->currentRate();
|
||||
return \addons\shopro\service\partner\IdentityService::formatMoney((float) ($data['madow'] ?? 0) * (float) $rate);
|
||||
}
|
||||
|
||||
public function levelStatusInfo()
|
||||
{
|
||||
return $this->belongsTo(Level::class, 'level_status', 'level');
|
||||
|
||||
@@ -91,6 +91,11 @@ class Log extends Common
|
||||
case 'apply_info':
|
||||
$remark = '您的分销商资料信息已更新';
|
||||
break;
|
||||
case 'identity':
|
||||
$fieldMap = ['is_venue' => '酒道馆', 'is_county' => '区县代理', 'county_code' => '区县编码'];
|
||||
$name = $fieldMap[$ext['field'] ?? ''] ?? ($ext['field'] ?? '身份');
|
||||
$remark = "您的{$name}已更新";
|
||||
break;
|
||||
}
|
||||
return $remark ?? "";
|
||||
}
|
||||
@@ -180,6 +185,7 @@ class Log extends Common
|
||||
'reward' => '佣金',
|
||||
'share' => '推荐',
|
||||
'bind' => '绑定',
|
||||
'identity' => '身份',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\partner;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
|
||||
class DailyReport extends Common
|
||||
{
|
||||
protected $name = 'shopro_partner_daily_report';
|
||||
|
||||
protected $append = [
|
||||
'status_text',
|
||||
];
|
||||
|
||||
public function statusList()
|
||||
{
|
||||
return [
|
||||
0 => '失败',
|
||||
1 => '成功',
|
||||
2 => '重跑中',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\partner;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
|
||||
class RateLog extends Common
|
||||
{
|
||||
protected $name = 'shopro_partner_rate_log';
|
||||
|
||||
protected $updateTime = false;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\partner;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
use app\admin\model\shopro\user\User as UserModel;
|
||||
use app\admin\model\shopro\order\Order as OrderModel;
|
||||
use addons\shopro\service\partner\PartnerConfig;
|
||||
|
||||
class Reward extends Common
|
||||
{
|
||||
protected $name = 'shopro_partner_reward';
|
||||
|
||||
protected $type = [
|
||||
'ext' => 'json',
|
||||
];
|
||||
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'reward_type_text',
|
||||
'role_text',
|
||||
'skip_reason',
|
||||
'skip_reason_text',
|
||||
'formula',
|
||||
];
|
||||
|
||||
public function statusList()
|
||||
{
|
||||
return [
|
||||
-2 => '已退回',
|
||||
-1 => '已取消',
|
||||
0 => '待入账',
|
||||
1 => '已入账',
|
||||
];
|
||||
}
|
||||
|
||||
public function rewardTypeList()
|
||||
{
|
||||
return PartnerConfig::rewardTypeMap();
|
||||
}
|
||||
|
||||
public function roleList()
|
||||
{
|
||||
return [
|
||||
'taster' => '品酒师',
|
||||
'maker' => '创客',
|
||||
'venue' => '酒道馆',
|
||||
'county' => '区县',
|
||||
'system' => '平台',
|
||||
];
|
||||
}
|
||||
|
||||
public function getRewardTypeTextAttr($value, $data)
|
||||
{
|
||||
return PartnerConfig::rewardTypeText($data['reward_type'] ?? '');
|
||||
}
|
||||
|
||||
public function getRoleTextAttr($value, $data)
|
||||
{
|
||||
$role = $data['role'] ?? '';
|
||||
$list = $this->roleList();
|
||||
return $list[$role] ?? $role;
|
||||
}
|
||||
|
||||
public function getSkipReasonAttr($value, $data)
|
||||
{
|
||||
$ext = $data['ext'] ?? [];
|
||||
if (is_string($ext)) {
|
||||
$ext = json_decode($ext, true) ?: [];
|
||||
}
|
||||
return $ext['skip_reason'] ?? '';
|
||||
}
|
||||
|
||||
public function getSkipReasonTextAttr($value, $data)
|
||||
{
|
||||
$reason = $this->getSkipReasonAttr(null, $data);
|
||||
return $reason ? PartnerConfig::skipReasonText($reason) : '';
|
||||
}
|
||||
|
||||
public function getFormulaAttr($value, $data)
|
||||
{
|
||||
$ext = $data['ext'] ?? [];
|
||||
if (is_string($ext)) {
|
||||
$ext = json_decode($ext, true) ?: [];
|
||||
}
|
||||
return $ext['formula'] ?? '';
|
||||
}
|
||||
|
||||
public function buyer()
|
||||
{
|
||||
return $this->belongsTo(UserModel::class, 'buyer_id', 'id')->field('id, nickname, avatar, mobile');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(UserModel::class, 'user_id', 'id')->field('id, nickname, avatar, mobile');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(OrderModel::class, 'order_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\partner;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
use app\admin\model\shopro\user\User as UserModel;
|
||||
use app\admin\model\shopro\order\Order as OrderModel;
|
||||
|
||||
class VoucherPlan extends Common
|
||||
{
|
||||
protected $name = 'shopro_partner_voucher_plan';
|
||||
|
||||
protected $updateTime = false;
|
||||
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'available',
|
||||
];
|
||||
|
||||
public function statusList()
|
||||
{
|
||||
return [
|
||||
0 => '已关闭',
|
||||
1 => '释放中',
|
||||
2 => '已完成',
|
||||
];
|
||||
}
|
||||
|
||||
public function getAvailableAttr($value, $data)
|
||||
{
|
||||
$released = (float) ($data['released_amount'] ?? 0);
|
||||
return number_format($released, 2, '.', '');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(UserModel::class, 'user_id', 'id')->field('id, nickname, avatar, mobile');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(OrderModel::class, 'order_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,17 @@ class WalletLog extends Common
|
||||
'withdraw_error' => '提现失败-返还佣金',
|
||||
'reward_income' => '佣金-收益',
|
||||
'reward_back' => '佣金-退还',
|
||||
'transfer_to_money' => '佣金-转出到余额'
|
||||
'transfer_to_money' => '佣金-转出到余额',
|
||||
'push3' => '推三返一',
|
||||
'maker_diff' => '创客极差奖',
|
||||
'maker_peer' => '创客平级奖',
|
||||
'maker_overtaken' => '创客超越奖',
|
||||
'team_venue' => '酒道馆团队奖',
|
||||
'team_county' => '区县团队奖',
|
||||
'venue_peer' => '酒道馆平级奖',
|
||||
'county_peer' => '区县平级奖',
|
||||
'venue_share' => '酒道馆平台均分',
|
||||
'county_share' => '区县平台均分'
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户