<?php
$connect_id = Dever::input('set')['connect_id'] ?? 0;
return array
(
    'source' => 'connect/api',
    'list' => array
    (
        'where' => array('connect_id' => $connect_id),
        'field'      => array
        (
            'id',
            //'name',
            'type',
            'uri',
        ),
        'data_button' => array
        (
            '编辑' => 'edit',
        ),
        'button' => array
        (
            //'新增' => 'add',
        ),
        'search' => array
        (
            //'name',
            'connect_id' => 'hidden',
            'type',
        ),
    ),
    'update' => array
    (
        'tab' => array
        (
            '基本设置' => 'type,sign_col,uri,connect/api_uri',
            '请求参数' => 'method,post_method,connect/api_request_body,connect/api_request_header',
            '响应参数' => 'connect/api_response',
            '回调设置' => 'notify_type,notify_success,notify_error,connect/api_notify_code',
        ),
        'field'    => array
        (
            'name',
            'type' => array
            (
                'type' => 'radio',
                //'control' => true,
            ),
            'sign_col' => array
            (
                'desc' => '按顺序做加密，用+号隔开，为空则所有字段均参与加密，这里填写后，将替换规则中的加密参数',
            ),
            'uri',
            'connect/api_uri' => array
            (
                'name' => '接口地址生成',
                'where'  => array('api_id' => 'id'),
                'desc' => '如果需要动态生成接口地址，这里填写参数即可，同样支持变量',
            ),

            'method' => array
            (
                'type' => 'radio',
                'control' => true,
            ),
            'post_method' => array
            (
                'type' => 'radio',
                'show' => false,
            ),
            'connect/api_request_body' => array
            (
                'name' => '业务请求体',
                'where'  => array('api_id' => 'id'),
                'desc' => '[变量：timestamp毫秒时间戳，nonce随机值，appkey渠道的appkey， notify请求回调地址, order_num当前订单号，account当前账号，cash为当前面值，code渠道商品编码，支持函数，如果函数中需要添加变量，请用{}隔开，如{code}，请求头也支持此变量]',
            ),
            'connect/api_request_header' => array
            (
                'name' => '业务请求头',
                'where'  => array('api_id' => 'id'),
            ),

            'connect/api_response' => array
            (
                'name' => '业务响应参数',
                'desc' => '选填，也可以只填写重要响应参数',
                'where'  => array('api_id' => 'id'),
            ),

            'notify_type' => array
            (
                'type' => 'radio',
                'control' => true,
            ),
            'notify_success' => array
            (
                'desc' => '填写回调成功后，返回给渠道的信息',
            ),
            'notify_error' => array
            (
                'desc' => '填写回调失败后，返回给渠道的信息，如果填写500，则会返回HTTP Status Code 500，默认返回HTTP Status Code 200',
            ),
            'notify_sign_col' => array
            (
                'desc' => '回调签名参数，不填写则使用接口的回调签名参数',
            ),
            'connect/api_notify_code' => array
            (
                'name' => '回调状态码',
                'where'  => array('api_id' => 'id'),
            ),
        ),

        'control' => array
        (
            'post_method' => array
            (
                'method' => 2,
            ),
            'notify_success' => array
            (
                'notify_type' => 1,
            ),
            'connect/api_notify_code' => array
            (
                'notify_type' => 1,
            ),
            /*
            'connect/api_notify' => array
            (
                'notify_type' => 1,
            ),*/
        ),
    ),
);