|
|
@@ -49,6 +49,33 @@ class PromotionAdminService
|
|
|
return $this->firstDepositRestriction();
|
|
|
}
|
|
|
|
|
|
+ /** 首充活动详情链接:PC、H5、APP 各一个,全部首充活动共用。前台首充接口按会员的平台返回对应链接。 */
|
|
|
+ public function firstDepositLinks(): array
|
|
|
+ {
|
|
|
+ return ['links' => PromotionRules::detailLinks()];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function saveFirstDepositLinks(array $input): array
|
|
|
+ {
|
|
|
+ $links = [];
|
|
|
+ foreach (PromotionRules::DETAIL_LINK_PLATFORMS as $platform) {
|
|
|
+ $key = strtolower($platform);
|
|
|
+ $value = $input['links'][$platform] ?? $input['links'][$key] ?? $input[$key] ?? '';
|
|
|
+ if (!is_string($value) && $value !== null) throw ValidationException::withMessages([$key => $platform . ' 链接必须是文本']);
|
|
|
+ $value = trim((string) $value);
|
|
|
+ if (mb_strlen($value) > 500) throw ValidationException::withMessages([$key => $platform . ' 链接不能超过 500 个字符']);
|
|
|
+ $links[$platform] = $value;
|
|
|
+ }
|
|
|
+ DB::transaction(function () use ($links) {
|
|
|
+ $before = PromotionRules::detailLinks();
|
|
|
+ DB::table('config')->updateOrInsert(['field' => PromotionRules::DETAIL_LINKS_CONFIG], ['val' => json_encode($links, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
|
|
|
+ if (Schema::hasTable('operation_audits')) {
|
|
|
+ OperationAuditService::record('promotion_first_deposit_links', null, 'update', ['links' => $before], ['links' => $links]);
|
|
|
+ }
|
|
|
+ }, 3);
|
|
|
+ return $this->firstDepositLinks();
|
|
|
+ }
|
|
|
+
|
|
|
private function forbiddenOptions(array $categories): array
|
|
|
{
|
|
|
$options = [];
|