<?php
/**
 *  ╔═══════════════════════════════════════════════════╗
 *  ║                                                   ║
 *  ║     ██╗  ██╗   █████╗    ██████╗                  ║
 *  ║     ██║  ██║  ██╔══██╗  ██╔═══██╗                 ║
 *  ║     ███████║  ███████║  ██║   ██║                 ║
 *  ║     ██╔══██║  ██╔══██║  ██║   ██║                 ║
 *  ║     ██║  ██║  ██║  ██║  ╚██████╔╝   SNS           ║
 *  ║                                                   ║    
 *  ║                                                   ║    
 *  ║     © 2023 HaoSNS™ All Rights Reserved            ║
 *  ║     官方网站: https://www.haosns.com                *
 *  ║     本代码由赣州乐易网络科技有限公司®提供             *
 *  ║                                                    *
 *  ║   未经授权禁止复制、传播或用于其他商业目的            *
 *  ║                                                   ║
 *  ╚═══════════════════════════════════════════════════╝
 */

namespace app\adminapi\controller;

class ArticleRed extends BaseAdminController 
{ 
    
    /** 
     * 帖子红包配置 
     */ 
    public function list() 
    { 
        $data = [ 
            'red_open' => \app\common\service\ConfigService::get('articlered', 'red_open', 0),
            'red_pay_mode' => \app\common\service\ConfigService::get('articlered', 'red_pay_mode', 0),
            'red_day_ID_limit' => \app\common\service\ConfigService::get('articlered', 'red_day_ID_limit', ''), 
            'red_day_IP_limit' => \app\common\service\ConfigService::get('articlered', 'red_day_IP_limit', ''), 
            'red_day_phone_limit' => \app\common\service\ConfigService::get('articlered', 'red_day_phone_limit', ''), 
            'red_fee' => \app\common\service\ConfigService::get('articlered', 'red_fee', ''), 
            'red_mode' => \app\common\service\ConfigService::get('articlered', 'red_mode', ''), 
            'titlred_opene' => \app\common\service\ConfigService::get('articlered', 'titlred_opene', ''), 
            'red_receive_allow_ip' => \app\common\service\ConfigService::get('articlered', 'red_receive_allow_ip', ''), 
        ]; 

        return show(config('status.success'), '', $data); 
        
    } 

    public function set() 
    { 
        $params = $this->request->post(); 

        \app\common\service\ConfigService::set('articlered', 'red_open', $params['red_open']);
        \app\common\service\ConfigService::set('articlered', 'red_pay_mode', $params['red_pay_mode']);
        \app\common\service\ConfigService::set('articlered', 'red_day_ID_limit', $params['red_day_ID_limit']); 
        \app\common\service\ConfigService::set('articlered', 'red_day_IP_limit', $params['red_day_IP_limit']); 
        \app\common\service\ConfigService::set('articlered', 'red_day_phone_limit', $params['red_day_phone_limit']); 
        \app\common\service\ConfigService::set('articlered', 'red_fee', $params['red_fee']); 
        \app\common\service\ConfigService::set('articlered', 'red_mode', $params['red_mode']); 
        \app\common\service\ConfigService::set('articlered', 'titlred_opene', $params['titlred_opene']); 
        \app\common\service\ConfigService::set('articlered', 'red_receive_allow_ip', $params['red_receive_allow_ip']); 

        return show(config('status.success'), '设置成功'); 
    } 
     
}


