Files
EasySoft-ZenTaoPMS/test/model/api/update.php
宋辰轩 b21e8bf480 * Modify.
2022-05-10 15:21:06 +08:00

60 lines
1.6 KiB
PHP

#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/api.class.php';
su('admin');
/**
title=测试 apiModel->update();
cid=1
pid=1
*/
$api = new apiTest();
$data = array(
'lib' => 910,
'module' => 0,
'title' => 'testapi',
'protocol' => 'HTTP',
'method' => 'GET',
'path' => '/api/test/id',
'requestType' => 'application/json',
'status' => 'done',
'owner' => 'admin',
'type' => 'formData',
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
'desc' => '',
'paramsExample' => '',
'response' => '[]',
'responseExample' => ''
);
$editData = array(
'lib' => 910,
'module' => 0,
'title' => 'edittestapi',
'protocol' => 'HTTP',
'method' => 'GET',
'path' => '/api/test/id',
'requestType' => 'application/json',
'status' => 'done',
'owner' => 'admin',
'type' => 'formData',
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
'desc' => '',
'paramsExample' => '',
'response' => '[]',
'responseExample' => ''
);
$normalApi = $data;
$editApi = $editData;
$apiInfo = $api->createTest($normalApi, false);
r($api->updateTest($apiInfo->id, $editApi)) && p('0:new') && e('edittestapi'); //修改一个刚创建的api