1.修改彩金池配置中的playerDefault时自动修改绑定该配置的用户
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
namespace app\dice\logic\player;
|
||||
|
||||
use app\dice\basic\DiceBaseLogic;
|
||||
use app\dice\model\lottery_pool_config\DiceLotteryPoolConfig;
|
||||
use plugin\saiadmin\exception\ApiException;
|
||||
use plugin\saiadmin\utils\Helper;
|
||||
use app\dice\model\player\DicePlayer;
|
||||
@@ -48,9 +49,30 @@ class DicePlayerLogic extends DiceBaseLogic
|
||||
} else {
|
||||
unset($data['password']);
|
||||
}
|
||||
$data = $this->applyLotteryPoolWeightsToPlayerData($data);
|
||||
return parent::edit($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已绑定彩金池时:玩家 T1–T5 以池配置为准,避免前端提交陈旧权重覆盖同步结果
|
||||
*/
|
||||
private function applyLotteryPoolWeightsToPlayerData(array $data): array
|
||||
{
|
||||
$configId = isset($data['lottery_config_id']) ? (int) $data['lottery_config_id'] : 0;
|
||||
if ($configId <= 0) {
|
||||
return $data;
|
||||
}
|
||||
$config = DiceLotteryPoolConfig::find($configId);
|
||||
if (!$config) {
|
||||
return $data;
|
||||
}
|
||||
$row = $config->getData();
|
||||
foreach (['t1_weight', 't2_weight', 't3_weight', 't4_weight', 't5_weight'] as $field) {
|
||||
$data[$field] = $row[$field] ?? 0;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 密码加密:md5(salt . password)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user