<?php
/**暂时没有用了
 * Created by PhpStorm.
 * User: XiaoMing
 * Date: 2019/12/4
 * Time: 14:40
 */

namespace JinDouYun\Controller\System;

use JinDouYun\Controller\BaseController;
use Mall\Framework\Core\ErrorCode;
use Mall\Framework\Core\StatusCode;

use JinDouYun\Model\System\MEnterpriseBindPayment;

class EnterpriseBindPayment extends BaseController
{
    private $objMEnterpriseBindPayment;

    /**
     * SystemTemplate constructor.
     * @param bool $isCheckAcl
     * @param bool $isMustLogin
     */
    public function __construct($isCheckAcl = true, $isMustLogin = true)
    {
        parent::__construct($isCheckAcl, $isMustLogin);
        $this->objMEnterpriseBindPayment = new MEnterpriseBindPayment($this->onlineUserId, $this->onlineEnterpriseId);
    }

    /**
     * 添加,编辑企业模版模块
     * @return array
     */
    public function commonFieldFilter()
    {
        $params = $this->request->getRawJson();
        if (empty($params)) {
            $this->sendOutput('参数为空', ErrorCode::$paramError);
        }
        $data = [
            'paymentId'     => isset($params['paymentId']) ? $params['paymentId'] : '',
            'paymentData'   => isset($params['paymentData']) ? json_encode($params['paymentData']) : '',
            'title'         => isset($params['title']) ? $params['title'] : '',
            'enableStatus'  => isset($params['enableStatus']) ? $params['enableStatus'] : StatusCode::$delete,
            'defaultStatus' => isset($params['defaultStatus']) ? $params['defaultStatus'] : StatusCode::$delete,
            'enterpriseId'  => $this->onlineEnterpriseId,
        ];
        foreach ($data as $key => $value) {
            if (empty($value) && $value !== 0) {
                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
            }
        }
        $data['logo'] = isset($params['logo']) ? $params['logo'] : '';
        return $data;
    }
}