SaveController.class.php 1016 Bytes
<?php
/**
 * 【销售活动-后台】更新企业配置接口
 *
 * User: daijun
 * Date: 2018-01-30
 */

namespace Apicp\Controller\RedSetting;

use Com\PackageValidate;
use VcySDK\Enterprise;
use VcySDK\Service;

class SaveController extends \Apicp\Controller\AbstractController
{

    public function Index_post()
    {
        // 验证规则
        $rules = [
            'wxMchid' => 'require',
            'wxMchkey' => 'require',
            'wxMchSecret' => 'require'
        ];

        // 验证数据
        $validate = new PackageValidate($rules, [], array_keys($rules));
        $postData = $validate->postData;

        $data = [
            'wxMchid' => $postData['wxMchid'],
            'wxMchkey' => $postData['wxMchkey'],
            'wxMchSecret' => $postData['wxMchSecret'],
        ];

        // 实例化企业信息类
        $enterprise = new Enterprise(Service::instance());

        // 更新企业配置信息
        $enterprise->modifySetting($data);

        return true;
    }
}