提交 87a80e07 authored 作者: wangkr's avatar wangkr

init

上级
/ThinkPHP
/Application/Runtime
<?php
//登录日志记录
function k3cloudlog($text,$status,$type=null) {
$DB_CONFIG1 = array(
'db_type' => 'mysql',
'db_user' => 'gonn',
'db_pwd' => 'gonn.123',
'db_host' => '192.168.1.214',
'db_name' => 'gonn',
'db_port' => '10036',
);
$hlog['content'] = $text;
$hlog['create_time'] = time();
$hlog['update_time'] = time();
$hlog['status'] =$status;
$hlog['type'] =$type;
M('cloudlog','',$DB_CONFIG1)->add($hlog);
}
?>
<?php
return array(
//'配置项'=>'配置值'
'DB_TYPE' => 'sqlsrv', // 数据库类型
// 'DB_TYPE' => 'mssql',
'DB_HOST' => '192.168.1.213', // 数据库连接地址
'DB_NAME' => 'AIS20161230122631', // 数据库名
'DB_USER' => 'sa', // 数据库用户名
'DB_PWD' => 'kd.123', // 数据库密码
'DB_PORT' => 1433, // 数据库端口
'DB_CHARSET'=> 'utf8', // 数据库编码
);
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>pdo_sqlsrv</name>
<channel>pecl.php.net</channel>
<summary>Microsoft Drivers for PHP for SQL Server (PDO_SQLSRV)</summary>
<description>The Microsoft Drivers for PHP for SQL Server are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts. The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension implements PDO for accessing data in all editions of SQL Server 2008 R2 and later (including Azure SQL DB). These drivers rely on the Microsoft ODBC Driver for SQL Server to handle the low-level communication with SQL Server.
*This package contains only the PDO_SQLSRV driver.*
</description>
<lead>
<name>Meet Bhagdev</name>
<user>meetbhagdev</user>
<email>meetb@microsoft.com</email>
<active>no</active>
</lead>
<lead>
<name>Jay Kint</name>
<user>jkint</user>
<email>jaykint@microsoft.com</email>
<active>no</active>
</lead>
<lead>
<name>Marie Barwin</name>
<user>mbar</user>
<email>v-mabarw@microsoft.com</email>
<active>yes</active>
</lead>
<lead>
<name>Jenny Tam</name>
<user>yitam</user>
<email>v-yitam@microsoft.com</email>
<active>yes</active>
</lead>
<date>2018-07-20</date>
<time>01:00:49</time>
<version>
<release>5.3.0</release>
<api>5.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://opensource.org/licenses/mit">The MIT License (MIT)</license>
<notes>
[Added]
- Added support for Azure Key Vault for Always Encrypted functionality. Always Encrypted functionality is supported on Linux and macOS through Azure Key Vault
- Added support for connection resiliency on Linux and macOS (requires version 17.2 or higher of the [ODBC driver](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017))
- Added support for macOS High Sierra (requires version 17 or higher of the [ODBC driver](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017))
- Added support for Ubuntu 18.04 (requires version 17.2 or higher of the [ODBC driver](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017))
[Fixed]
- Issue [#577](https://github.com/Microsoft/msphpsql/issues/577) - Idle Connection Resiliency doesn't work with Column Encryption enabled connections (fixed in MS ODBC Driver 17.1)
- Issue [#678](https://github.com/Microsoft/msphpsql/issues/678) - Idle Connection Resiliency doesn't work with Connection Pooling (fixed in MS ODBC Driver 17.1)
- Issue [#705](https://github.com/Microsoft/msphpsql/issues/705) - Always Encrypted - Retrieving a negative decimal value (edge case) as output parameter causes truncation
- Issue [#706](https://github.com/Microsoft/msphpsql/issues/706) - Always Encrypted - Cannot insert double with precision and scale (38, 38)
- Issue [#707](https://github.com/Microsoft/msphpsql/issues/707) - Always Encrypted - Fetching decimals / numerics as output parameters bound to PDO::PARAM_BOOL or PDO::PARAM_INT returns floats, not integers
- Issue [#735](https://github.com/Microsoft/msphpsql/issues/735) - Extended the buffer size for PDO::lastInsertId so that data types other than integers can be supported
- Pull Request [#759](https://github.com/Microsoft/msphpsql/pull/759) - Removed the limitation of binding a binary as inout param as PDO::PARAM_STR with SQLSRV_ENCODING_BINARY
[Limitations]
- No support for inout / output params when using sql_variant type
- In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connecting will not work
- Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017)
- Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported
- Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted enabled, named parameters in subqueries are not supported
- [Always Encrypted limitations](https://docs.microsoft.com/en-us/sql/connect/php/using-always-encrypted-php-drivers?view=sql-server-2017#limitations-of-the-php-drivers-when-using-always-encrypted)
[Known Issues]
- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) &lt; 2.3.6
- When pooling is enabled in Linux or macOS
- unixODBC &lt;= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages
- due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples [here](https://github.com/Microsoft/msphpsql/wiki/Features#pooling)
- With ColumnEncryption enabled, calling stored procedure with XML parameter does not work (Issue [#674](https://github.com/Microsoft/msphpsql/issues/674))
</notes>
<contents>
<dir name="/">
<file md5sum="6a181700bca88ba92e39638b30dea959" name="config.m4" role="src" />
<file md5sum="f42e9c6a91a0742e1c29b38f8e3775dc" name="config.w32" role="src" />
<file md5sum="12c51672bd54784a06c52f3efc7cf85f" name="CREDITS" role="doc" />
<file md5sum="97bf8b6dabceced396d344ec167dd0f3" name="LICENSE" role="doc" />
<file md5sum="fd39542b60aaf11b0ebb087894747e15" name="pdo_dbh.cpp" role="src" />
<file md5sum="8c95bc0f9ed373a93d803a56d6d9d95a" name="pdo_init.cpp" role="src" />
<file md5sum="755a12b10eb8acc28cb21b3ba680785f" name="pdo_parser.cpp" role="src" />
<file md5sum="1eb2c087c7d30f8f6348a75dd265f99f" name="pdo_stmt.cpp" role="src" />
<file md5sum="00f5c1cad492250fc0896dadfb7a9e44" name="pdo_util.cpp" role="src" />
<file md5sum="6019a6bd8f2563afa8def3944caae037" name="php_pdo_sqlsrv.h" role="src" />
<file md5sum="cd263e1a9e3f57578a0b8aeaa3569382" name="shared/core_conn.cpp" role="src" />
<file md5sum="e235a0819e0de587dd401d6196c4ea3b" name="shared/core_init.cpp" role="src" />
<file md5sum="ff1c2a9193dd1ee8fd16c8522f10fdf9" name="shared/core_results.cpp" role="src" />
<file md5sum="01cbd420bdac3a6af88764f634da38d7" name="shared/core_sqlsrv.h" role="src" />
<file md5sum="bc54b7348fe4b98fced18bf7279b96fe" name="shared/core_stmt.cpp" role="src" />
<file md5sum="f6a965dd2cef3d41a9bb76c0bf93d13d" name="shared/core_stream.cpp" role="src" />
<file md5sum="581467f773842c9ababfccf54793fffd" name="shared/core_util.cpp" role="src" />
<file md5sum="df426ae40bf1e744a316b36b3a1fbd69" name="shared/FormattedPrint.cpp" role="src" />
<file md5sum="e430d0d5d9ca130e1fd348ddb9364d96" name="shared/FormattedPrint.h" role="src" />
<file md5sum="67a2d58462e09e2361ee833fb0a83982" name="shared/globalization.h" role="src" />
<file md5sum="da7540a7770d17ea439f4641c7471007" name="shared/interlockedatomic_gcc.h" role="src" />
<file md5sum="b7e511b38cc5495aa97f8fd080af9324" name="shared/interlockedatomic.h" role="src" />
<file md5sum="546f83bb06f0609dedc81d0b937d835d" name="shared/interlockedslist.h" role="src" />
<file md5sum="de44f228a50d3ae5f6d47aa86ac5194c" name="shared/localization.hpp" role="src" />
<file md5sum="01f6a2f7a8f63f1b487718fc001c97c3" name="shared/localizationimpl.cpp" role="src" />
<file md5sum="a2eb913dc535133e0553cdbc3903d39a" name="shared/msodbcsql.h" role="src" />
<file md5sum="e44577a3daeacb2bb8b0fecebca15c84" name="shared/sal_def.h" role="src" />
<file md5sum="ba14916fbce8a4850dfca4262b4c562a" name="shared/StringFunctions.cpp" role="src" />
<file md5sum="63eae96fb2e5ff4f3ed678a67d9e7abd" name="shared/StringFunctions.h" role="src" />
<file md5sum="9d8e743317a4292ecc2405a2d279eca4" name="shared/typedefs_for_linux.h" role="src" />
<file md5sum="a421efacbefc7fdf73b4c2b966404e32" name="shared/version.h" role="src" />
<file md5sum="c003f8024ac5f44f05d6e6d4e279474a" name="shared/xplat.h" role="src" />
<file md5sum="dd746da3952402b5a06934016842b06e" name="shared/xplat_intsafe.h" role="src" />
<file md5sum="f1e978983ea1250bffe85b2a0366a93a" name="shared/xplat_winerror.h" role="src" />
<file md5sum="f66d6df6c4395d5aba85ea52967c9d2a" name="shared/xplat_winnls.h" role="src" />
<file md5sum="16f2bbf7d1f7dd1292ac71e84a1e08c7" name="template.rc" role="src" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>7.0.0</min>
</php>
<pearinstaller>
<min>1.4.0b1</min>
</pearinstaller>
<arch>
<pattern>linux-*-i?86-*</pattern>
<conflicts/>
</arch>
</required>
</dependencies>
<providesextension>pdo_sqlsrv</providesextension>
<extsrcrelease />
</package>
\ No newline at end of file
\ No newline at end of file
<?php
return array(
//'配置项'=>'配置值'
);
\ No newline at end of file
\ No newline at end of file
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$Number=I("get.number");
if(empty($Number)){
$this->json(404, 'NO_DATA');
}
$Model = M();
$sql = " SELECT a.FBILLNO FROM BasicEntry a, PAEZ_t_Cust_Entry100005 b WHERE
a.F_PROJECTID = b.FID AND b.FNUMBER ='$Number'";
$voList = $Model->query($sql);
if( $voList ){
$this->json("200",$voList);
}else{
$this->json("500",'error');
}
}
//通过项目编号获取项目编号列表编码,ID
public function getProNumber(){
$Number=I("get.number");
if(empty($Number)){
$this->json(20001, 'params invalid');
}
$Model = M();
$sql = " SELECT fid,fnumber FROM PAEZ_t_Cust_Entry100005 WHERE fnumber="."'$Number'";
$voList = $Model->query($sql);
if( $voList ){
$this->jsonreturn("200",'success',$voList);
}else{
$this->jsonreturn("200012",'No data','');
}
}
public function getContractNumber(){
$Number=I("get.number");
if(empty($Number)){
$this->json(20001, 'params invalid');
}
$Model = M();
$sql = " SELECT a.FBILLNO,a.fid FROM BasicEntry a, PAEZ_t_Cust_Entry100005 b WHERE
a.F_PROJECTID = b.FID AND b.FNUMBER ="."'$Number'";
$voList = $Model->query($sql);
if( $voList ){
$this->jsonreturn("200",'success',$voList);
}else{
$this->jsonreturn("200011",'No data','');
}
}
public function getDocumentNumber(){
$Number=I("get.number");
if(empty($Number)){
$this->json(20001, 'params invalid');
}
$Model = M();
$sql = "SELECT FBILLNO FROM T_SAL_OUTSTOCK a,PAEZ_t_Cust_Entry100005 b where a.F_PAEZ_PROJECTNO=b.FID and FNUMBER ="."'$Number'";
$voList = $Model->query($sql);
if( $voList ){
$this->jsonreturn("200",'success',$voList);
}else{
$this->jsonreturn("20002",'No data','');
}
}
static function jsonreturn($code,$mes,$result){
header('Content-Type:application/json;charset=utf-8');
if($result){
$data=[
'code'=>$code,
'message'=>'SUCCESS',
'data'=>$result,
];
echo json_encode($data);
exit;
}else{
$data=[
'code'=>$code,
'message'=>$mes,
];
echo json_encode($data);
exit;
}
}
static function json($code,$result){
header('Content-Type:application/json;charset=utf-8');
$data=[
'code'=>$code,
'message'=>$result,
];
echo json_encode($data);
exit;
}
}
<?php
namespace Home\Controller;
use Think\Controller;
class K3Controller extends Controller {
public function index(){
$cloudUrl = "http://192.168.1.211/k3cloud/";
//登陆参数
$data = array(
'5d64e2f4ecb139',//帐套Id
'Administrator',//用户名
'666666',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
var_dump($cookie_jar);die;
header("Content-type: text/html; charset=utf8");
for ($i=1; $i <=3000 ; $i++) {
$starttime = microtime(true);
$data_model ="{
'Creator': '',
'NeedUpDateFields': [],
'NeedReturnFields': [],
'IsDeleteEntry': 'true',
'SubSystemId': '',
'IsVerifyBaseDataField': 'false',
'IsEntryBatchFill': 'true',
'ValidateFlag': 'true',
'NumberSearch': 'true',
'InterationFlags': '',
'IsAutoSubmitAndAudit': 'false',
'Model': {
'FCUSTID': 0,
'FCreateOrgId': {
'FNumber': '0000'
},
'FUseOrgId': {
'FNumber': '0000'
},
'FName': '测试$i',
'FCOUNTRY': {
'FNumber': 'China'
},
'FINVOICETITLE': 'nnn',
'FIsDefPayer': false,
'FIsGroup': false,
'FCustTypeId': {
'FNumber': 'KHLB001_SYS'
},
'FTRADINGCURRID': {
'FNumber': 'PRE001'
},
'FInvoiceType': '1',
'FTaxType': {
'FNumber': 'SFL02_SYS'
},
'FPriority': 1,
'FTaxRate': {
'FNumber': 'SL02_SYS'
},
'FISCREDITCHECK': true,
'FIsTrade': true,
'FT_BD_CUSTOMEREXT': {
'FEnableSL': false
}
}
}";
$data = array(
'BD_Customer',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$endtime = microtime(true);
$log='客户编号:'.$array['Result']['Number'].'保存接口成功 '.'执行时间:'.($endtime-$starttime).' s'."\r\n";
$file_write = file_put_contents('test.txt',$log,FILE_APPEND);
$this->custmoer_submit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number']);
$this->custmoer_audit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number']);
}else{
$log='客户名称:'."测试$i".'保存接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
$file_write = file_put_contents('test.txt',$log,FILE_APPEND);
}
}
}
public function custmoer_submit($cloudUrl,$cookie_jar,$id,$number){
$start_time = microtime(true);
$data_model ="{
'CreateOrgId': 0,
'Numbers': [],
'Ids': $id,
'SelectedPostId': 0
}";
$data = array(
'BD_Customer',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_submit($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
$end_time = microtime(true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$log='客户编号:'.$number.'提交接口成功 '.' 执行时间:'.($end_time-$start_time).' s'."\r\n";
}else{
$log='客户编号:'.$number.'提交接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
// $log='客户编号:'.$number.'提交接口失败 '.' 执行时间:'.($end_time-$start_time).' s'."\r\n";
}
$file_write = file_put_contents('test.txt',$log,FILE_APPEND);
}
public function custmoer_audit($cloudUrl,$cookie_jar,$id,$number){
$start_time = microtime(true);
$data_model ="{
'CreateOrgId': 0,
'Numbers': [],
'Ids': $id,
'InterationFlags': ''
}";
$data = array(
'BD_Customer',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_audit($cloudUrl,$post_content,$cookie_jar);
$end_time = microtime(true);
$array = json_decode($result,true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$log='客户编号:'.$number.'审核接口成功 '.' 执行时间:'.($end_time-$start_time).' s'."\r\n";
}else{
$log='客户编号:'.$number.'审核接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
// $log='客户编号:'.$number.'审核接口失败 '.' 错误信息:'.($end_time-$start_time).' s'."\r\n";
}
$file_write = file_put_contents('test.txt',$log,FILE_APPEND);
}
//登陆
static function invoke_login($cloudUrl,$post_content,$cookie_jar)
{
$loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
return self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
}
//查询
static function invoke_save($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//添加
static function invoke_add($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//提交
static function invoke_submit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//审核
static function invoke_audit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
static function invoke_post($url,$post_content,$cookie_jar,$isLogin)
{
$ch = curl_init($url);
$this_header = array(
'Content-Type: application/json',
'Content-Length: '.strlen($post_content)
);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($isLogin){
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
}
else{
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
//构造Web API请求格式
static function create_postdata($args) {
$postdata = array(
'format'=>1,
'useragent'=>'ApiClient',
'rid'=>self::create_guid(),
'parameters'=>$args,
'timestamp'=>date('Y-m-d'),
'v'=>'1.0'
);
return json_encode($postdata);
}
//生成guid
static function create_guid() {
$charid = strtoupper(md5(uniqid(mt_rand(), true)));
$hyphen = chr(45);// "-"
$uuid = chr(123)// "{"
.substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen
.substr($charid,20,12)
.chr(125);// "}"
return $uuid;
}
}
<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
public function index(){
$cloudUrl = "http://192.168.1.211/k3cloud/";
//登陆参数
$data = array(
'5865e29cb51ecf',//帐套Id
'administrator',//用户名
'kJyGjIQ5DW0tpd@B',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
$result=json_decode($result,true);
if($result['LoginResultType']==1){
$info=array(
"code" => 200,
"message" => '登陆成功'
);
echo json_encode($info);
}else{
$info=array(
"code" => 500,
"message" => ''
);
header("HTTP/1.1 500 Internal Server Error");
}
}
//登陆
static function invoke_login($cloudUrl,$post_content,$cookie_jar)
{
$loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
return self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
}
//查询
static function invoke_save($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//添加
static function invoke_add($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//提交
static function invoke_submit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//审核
static function invoke_audit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
static function invoke_post($url,$post_content,$cookie_jar,$isLogin)
{
$ch = curl_init($url);
$this_header = array(
'Content-Type: application/json',
'Content-Length: '.strlen($post_content)
);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($isLogin){
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
}
else{
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
static function getbxlx($name)
{
$data = m('c_bxlx')->getone("name='".$name."'", 'name,number');
return $data['number'];
}
//构造Web API请求格式
static function create_postdata($args) {
$postdata = array(
'format'=>1,
'useragent'=>'ApiClient',
'rid'=>self::create_guid(),
'parameters'=>$args,
'timestamp'=>date('Y-m-d'),
'v'=>'1.0'
);
return json_encode($postdata);
}
//生成guid
static function create_guid() {
$charid = strtoupper(md5(uniqid(mt_rand(), true)));
$hyphen = chr(45);// "-"
$uuid = chr(123)// "{"
.substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen
.substr($charid,20,12)
.chr(125);// "}"
return $uuid;
}
}
<?php
namespace Home\Controller;
use Think\Controller;
class MoController extends Controller {
public function index(){
$cloudUrl = "http://192.168.1.211/k3cloud/";
//登陆参数
$data = array(
'5d64e2f4ecb139',//帐套Id
'Administrator',//用户名
'666666',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
header("Content-type: text/html; charset=utf8");
for ($i=1; $i <=3000 ; $i++) {
$starttime = microtime(true);
$data_model ="{
'Creator': '',
'NeedUpDateFields': [],
'NeedReturnFields': [],
'IsDeleteEntry': 'true',
'SubSystemId': '',
'IsVerifyBaseDataField': 'false',
'IsEntryBatchFill': 'true',
'ValidateFlag': 'true',
'NumberSearch': 'true',
'InterationFlags': '',
'IsAutoSubmitAndAudit': 'false',
'Model': {
'FID': 0,
'FBILLTYPEID': {
'FNUMBER': 'FKSQ001_SYS'
},
'FDATE': '2019-12-22 00:00:00',
'FCONTACTUNITTYPE': 'BD_Supplier',
'FCONTACTUNIT': {
'FNumber': 'VEN00001'
},
'FRECTUNITTYPE': 'BD_Supplier',
'FRECTUNIT': {
'FNumber': 'VEN00001'
},
'FCURRENCYID': {
'FNumber': 'PRE001'
},
'FPAYORGID': {
'FNumber': '0000'
},
'FSETTLEORGID': {
'FNumber': '0000'
},
'FPURCHASEORGID': {
'FNumber': '0000'
},
'FDOCUMENTSTATUS': 'Z',
'FCANCELSTATUS': 'A',
'FIsCredit': false,
'FAPPLYORGID': {
'FNumber': '0000'
},
'FSETTLECUR': {
'FNUMBER': 'PRE001'
},
'FISCARRYRATE': false,
'FPAYAPPLYENTRY': [
{
'FCOSTID': {
'FNUMBER': 'CI008'
},
'FSETTLETYPEID': {
'FNumber': 'JSFS02_SYS'
},
'FPAYPURPOSEID': {
'FNumber': 'SFKYT08_SYS'
},
'FENDDATE': '2019-12-22 00:00:00',
'FEXPECTPAYDATE': '2019-12-22 00:00:00',
'FAPPLYAMOUNTFOR': '$i'
}
]
}
}";
$data = array(
'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$endtime = microtime(true);
$log='付款单据编号:'.$array['Result']['Number'].'保存接口成功 '.'执行时间:'.($endtime-$starttime).' s'."\r\n";
$file_write = file_put_contents('payment.txt',$log,FILE_APPEND);
$this->custmoer_submit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number']);
// $this->custmoer_audit($cloudUrl,$cookie_jar,$array['Result']['Id'],$array['Result']['Number']);
}else{
$log='保存接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
$file_write = file_put_contents('payment.txt',$log,FILE_APPEND);
}
}
}
public function custmoer_submit($cloudUrl,$cookie_jar,$id,$number){
$start_time = microtime(true);
$data_model ="{
'CreateOrgId': 0,
'Numbers': [],
'Ids': $id,
'SelectedPostId': 0
}";
$data = array(
'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_submit($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
$end_time = microtime(true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$log='付款单据编号:'.$number.'提交接口成功 '.' 执行时间:'.($end_time-$start_time).' s'."\r\n";
}else{
$log='付款单据编号:'.$number.'提交接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
}
$file_write = file_put_contents('payment.txt',$log,FILE_APPEND);
}
public function custmoer_audit($cloudUrl,$cookie_jar,$id,$number){
$start_time = microtime(true);
$data_model ="{
'CreateOrgId': 0,
'Numbers': [],
'Ids': $id,
'InterationFlags': ''
}";
$data = array(
'CN_PAYAPPLY',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_audit($cloudUrl,$post_content,$cookie_jar);
$end_time = microtime(true);
$array = json_decode($result,true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$log='付款单据编号:'.$number.'审核接口成功 '.' 执行时间:'.($end_time-$start_time).' s'."\r\n";
}else{
$log='付款单据编号:'.$number.'审核接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
}
$file_write = file_put_contents('payment.txt',$log,FILE_APPEND);
}
//登陆
static function invoke_login($cloudUrl,$post_content,$cookie_jar)
{
$loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
return self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
}
//查询
static function invoke_save($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//添加
static function invoke_add($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//提交
static function invoke_submit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//审核
static function invoke_audit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
static function invoke_post($url,$post_content,$cookie_jar,$isLogin)
{
$ch = curl_init($url);
$this_header = array(
'Content-Type: application/json',
'Content-Length: '.strlen($post_content)
);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($isLogin){
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
}
else{
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
//构造Web API请求格式
static function create_postdata($args) {
$postdata = array(
'format'=>1,
'useragent'=>'ApiClient',
'rid'=>self::create_guid(),
'parameters'=>$args,
'timestamp'=>date('Y-m-d'),
'v'=>'1.0'
);
return json_encode($postdata);
}
//生成guid
static function create_guid() {
$charid = strtoupper(md5(uniqid(mt_rand(), true)));
$hyphen = chr(45);// "-"
$uuid = chr(123)// "{"
.substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen
.substr($charid,20,12)
.chr(125);// "}"
return $uuid;
}
}
<?php
namespace Home\Controller;
use Think\Controller;
class SupplierController extends Controller {
public function index(){
for ($i=0; $i <1000 ; $i++) {
$start_time = microtime(true);
$cloudUrl = "http://192.168.1.211/k3cloud/";
//登陆参数
$data = array(
'5d64e2f4ecb139',//帐套Id
'Administrator',//用户名
'666666',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
// $name=$arr['name'];
// $supply_classify=$arr['supply_classify'];
// $settle_type=$arr['settle_type'];
// $pay_currency= $arr['pay_currency'];
// $pay_condition=$arr['pay_condition'];
// $tax_type=$arr['tax_type'];
// $charge=$arr['charge'];
// $tax_rate=$arr['tax_rate'];
$data_model ="{
'Creator': '',
'NeedUpDateFields': [],
'NeedReturnFields': [],
'IsDeleteEntry': 'true',
'SubSystemId': '',
'IsVerifyBaseDataField': 'false',
'IsEntryBatchFill': 'true',
'ValidateFlag': 'true',
'NumberSearch': 'true',
'InterationFlags': '',
'IsAutoSubmitAndAudit': 'false',
'Model': {
'FSupplierId': 0,
'FCreateOrgId': {
'FNumber': '0000'
},
'FUseOrgId': {
'FNumber': '0000'
},
'FName': '$i',
'FBaseInfo': {
'FSupplyClassify': 'CG'
},
'FBusinessInfo': {
'FSettleTypeId': {
'FNumber': 'JSFS02_SYS'
},
'FVmiBusiness': false,
'FEnableSL': false
},
'FFinanceInfo': {
'FPayCurrencyId': {
'FNumber': 'PRE001'
},
'FPayCondition': {
'FNumber': 'FKTJ03_SYS'
},
'FTaxType': {
'FNumber': 'SFL02_SYS'
},
'FInvoiceType': '1',
'FTaxRateId': {
'FNUMBER': 'SL02_SYS'
}
}
}
}";
$data = array(
'BD_Supplier',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
if($array['Result']['ResponseStatus']['IsSuccess']){
$this->supplier_submit($array['Result']['Id']);
$this->supplier_audit($array['Result']['Id']);
$end_time = microtime(true);
}
echo '执行时间:'.($end_time-$start_time).' s';
}
}
public function supplier_submit($id){
$cloudUrl = "http://192.168.1.211/k3cloud/";
//登陆参数
$data = array(
'5d64e2f4ecb139',//帐套Id
'Administrator',//用户名
'666666',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
$data_model ="{
'CreateOrgId': 0,
'Numbers': [],
'Ids': $id,
'SelectedPostId': 0
}";
$data = array(
'BD_Supplier',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_submit($cloudUrl,$post_content,$cookie_jar);
return $result;
}
public function supplier_audit($id){
$cloudUrl = "http://192.168.1.211/k3cloud/";
//登陆参数
$data = array(
'5d64e2f4ecb139',//帐套Id
'Administrator',//用户名
'666666',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
$data_model ="{
'CreateOrgId': 0,
'Numbers': [],
'Ids': $id,
'InterationFlags': ''
}";
$data = array(
'BD_Supplier',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_audit($cloudUrl,$post_content,$cookie_jar);
return $result;
}
//登陆
static function invoke_login($cloudUrl,$post_content,$cookie_jar)
{
$loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
return self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
}
//查询
static function invoke_save($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//添加
static function invoke_add($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//提交
static function invoke_submit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
//审核
static function invoke_audit($cloudUrl,$post_content,$cookie_jar)
{
$invokeurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc';
return self::invoke_post($invokeurl,$post_content,$cookie_jar,FALSE);
}
static function invoke_post($url,$post_content,$cookie_jar,$isLogin)
{
$ch = curl_init($url);
$this_header = array(
'Content-Type: application/json',
'Content-Length: '.strlen($post_content)
);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($isLogin){
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
}
else{
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
//构造Web API请求格式
static function create_postdata($args) {
$postdata = array(
'format'=>1,
'useragent'=>'ApiClient',
'rid'=>self::create_guid(),
'parameters'=>$args,
'timestamp'=>date('Y-m-d'),
'v'=>'1.0'
);
return json_encode($postdata);
}
//生成guid
static function create_guid() {
$charid = strtoupper(md5(uniqid(mt_rand(), true)));
$hyphen = chr(45);// "-"
$uuid = chr(123)// "{"
.substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen
.substr($charid,20,12)
.chr(125);// "}"
return $uuid;
}
}
\ No newline at end of file
\ No newline at end of file
\ No newline at end of file
项目目录
\ No newline at end of file
\ No newline at end of file
资源文件目录
\ No newline at end of file
## 简介
ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。
## 全面的WEB开发特性支持
最新的ThinkPHP为WEB应用开发提供了强有力的支持,这些支持包括:
* MVC支持-基于多层模型(M)、视图(V)、控制器(C)的设计模式
* ORM支持-提供了全功能和高性能的ORM支持,支持大部分数据库
* 模板引擎支持-内置了高性能的基于标签库和XML标签的编译型模板引擎
* RESTFul支持-通过REST控制器扩展提供了RESTFul支持,为你打造全新的URL设计和访问体验
* 云平台支持-提供了对新浪SAE平台和百度BAE平台的强力支持,具备“横跨性”和“平滑性”,支持本地化开发和调试以及部署切换,让你轻松过渡,打造全新的开发体验。
* CLI支持-支持基于命令行的应用开发
* RPC支持-提供包括PHPRpc、HProse、jsonRPC和Yar在内远程调用解决方案
* MongoDb支持-提供NoSQL的支持
* 缓存支持-提供了包括文件、数据库、Memcache、Xcache、Redis等多种类型的缓存支持
## 大道至简的开发理念
ThinkPHP从诞生以来一直秉承大道至简的开发理念,无论从底层实现还是应用开发,我们都倡导用最少的代码完成相同的功能,正是由于对简单的执着和代码的修炼,让我们长期保持出色的性能和极速的开发体验。在主流PHP开发框架的评测数据中表现卓越,简单和快速开发是我们不变的宗旨。
## 安全性
框架在系统层面提供了众多的安全特性,确保你的网站和产品安全无忧。这些特性包括:
* XSS安全防护
* 表单自动验证
* 强制数据类型转换
* 输入数据过滤
* 表单令牌验证
* 防SQL注入
* 图像上传检测
## 商业友好的开源协议
ThinkPHP遵循Apache2开源协议发布。Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再作为开源或商业软件发布。
\ No newline at end of file
{
"name": "topthink/thinkphp",
"description": "the ThinkPHP Framework",
"type": "framework",
"keywords": ["framework","thinkphp","ORM"],
"homepage": "http://thinkphp.cn/",
"license": "Apache2",
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"require": {
"php": ">=5.3.0"
},
"minimum-stability": "dev"
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用入口文件
// 检测PHP环境
if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !');
// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
define('APP_DEBUG',True);
// 定义应用目录
define('APP_PATH','./Application/');
// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';
// 亲^_^ 后面不需要任何代码了 就是如此简单
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论