更新若干功能
This commit is contained in:
@@ -6,7 +6,6 @@ use App\BaseApp\BaseWxService;
|
||||
use App\Models\business\CatalogueModel;
|
||||
use App\Models\business\CategoryModel;
|
||||
use App\Models\business\ImageModel;
|
||||
use App\Models\business\WxUserModel;
|
||||
use App\Service\business\PriceService;
|
||||
|
||||
/**
|
||||
@@ -92,34 +91,4 @@ class WxProductService extends BaseWxService
|
||||
$info['is_show_price'] = $applied['is_show_price'];
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 继承分享代理商的倍率
|
||||
*
|
||||
* 只有「还没有上级、自己也不是代理商」的用户会被绑定;已绑定同一个上级时同步最新倍率,
|
||||
* 代理商改了倍率下级要跟着变。
|
||||
*/
|
||||
private function inheritAgentPrice(int $shareUserId): void
|
||||
{
|
||||
$isAgent = (int) ($this->userInfo['is_p'] ?? 0) === 1;
|
||||
$pid = (int) ($this->userInfo['pid'] ?? 0);
|
||||
if ($isAgent) {
|
||||
return;
|
||||
}
|
||||
if ($pid !== 0 && $pid !== $shareUserId) {
|
||||
return;
|
||||
}
|
||||
$agent = WxUserModel::where('id', $shareUserId)->where('deleted_at', 0)->first();
|
||||
if (empty($agent) || (int) $agent['is_p'] !== 1) {
|
||||
return;
|
||||
}
|
||||
$this->userInfo['show_price'] = 1;
|
||||
$this->userInfo['price_number'] = $agent['price_number'];
|
||||
WxUserModel::where('id', $this->userId)->update([
|
||||
'pid' => $shareUserId,
|
||||
'show_price' => 1,
|
||||
'price_number' => $agent['price_number'],
|
||||
'updated_at' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user