<?php
$account_id = Dever::input('set')['account_id'] ?? 0;
if (!$account_id) {
    $account_id = Dever::input('field')['account_id'] ?? 0;
}
$account = Dever::db('account', 'api')->find($account_id);
return [
    'list' => [
        'where' => ['account_id' => $account_id],
        'field'      => [
            'id',
            'platform_cert_id' => [
                'show' => 'Dever::call("api/app.getCertName", "{platform_cert_id}")',
            ],
            'number',
            'cdate',
        ],
        'data_button' => [
            '编辑' => ['fastedit', ['account_id' => $account_id]],
        ],
        'button' => [
            '新增' => ['fastadd', ['account_id' => $account_id]],
        ],
        'search' => [
            'account_id' => 'hidden',
            'number',
        ],
    ],
    'update' => [
        'desc' => '有的证书会自动同步,无需手动添加,如微信支付的平台证书',
        'field'    => [
            'account_id' => 'hidden',
            'platform_cert_id' => [
                'rules' => true,
                'type' => 'select',
                'option'     => 'Dever::call("api/app.getCert", '.$account['platform_id'].')',
                //'remote' => 'api/manage.getCertName',
                //'remote_default' => false,
            ],
            'number' => [
                'rules' => true,
            ],
            'public' => [
                //'rules' => true,
                'type' => 'textarea',
            ],
            'private' => [
                //'rules' => true,
                'type' => 'textarea',
            ],
        ],
    ],
];