mirror of
				https://gitee.com/BDWare/contract-java-example.git
				synced 2025-10-29 20:02:18 +00:00 
			
		
		
		
	add readme
This commit is contained in:
		
							parent
							
								
									e28d52aba0
								
							
						
					
					
						commit
						a536e8e11f
					
				
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							| @ -6,6 +6,11 @@ idea开发合约的示例。 | |||||||
| #### 软件架构 | #### 软件架构 | ||||||
| 软件架构说明 | 软件架构说明 | ||||||
| 
 | 
 | ||||||
|  | #### 配置cp 的lib | ||||||
|  | 做一个软链接,将cp-bundle的build/output 软链接到 | ||||||
|  | backend/cplibs。 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| #### 前端sdk说明 | #### 前端sdk说明 | ||||||
| 1.  如何使用javascript sdk | 1.  如何使用javascript sdk | ||||||
| @ -19,11 +24,9 @@ idea开发合约的示例。 | |||||||
| 
 | 
 | ||||||
| #### 后端常用方法说明 | #### 后端常用方法说明 | ||||||
| 
 | 
 | ||||||
| ##### 配置cp 的lib |  | ||||||
| 
 |  | ||||||
| ##### 调用相同CP的yjs代码 | ##### 调用相同CP的yjs代码 | ||||||
| 
 | 参考: | ||||||
|  | Hello.callYJSInSameCP | ||||||
| ##### 调用其他CP的yjs代码 | ##### 调用其他CP的yjs代码 | ||||||
| 
 | 参考: | ||||||
| ##### 分片 | Hello.callYJSInOtherCP | ||||||
| 
 |  | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								backend/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								backend/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,5 +1,7 @@ | |||||||
| /.DS_Store/ | /.DS_Store/ | ||||||
| /build/ | /build/ | ||||||
|  | /cplibs/ | ||||||
|  | cplibs | ||||||
| # Compiled class file | # Compiled class file | ||||||
| *.class | *.class | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -36,6 +36,8 @@ sourceSets { | |||||||
| dependencies { | dependencies { | ||||||
|     api 'org.apache.logging.log4j:log4j-core:2.14.1' |     api 'org.apache.logging.log4j:log4j-core:2.14.1' | ||||||
|     api 'org.apache.logging.log4j:log4j-api:2.14.1' |     api 'org.apache.logging.log4j:log4j-api:2.14.1' | ||||||
|  |     implementation fileTree(dir: 'cplibs', include: '*.jar') | ||||||
|  |     implementation fileTree(dir: 'cplibs/lib/', include: '*.jar') | ||||||
|     testImplementation 'junit:junit:4.13.2' |     testImplementation 'junit:junit:4.13.2' | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -68,7 +70,7 @@ task mergeJar(dependsOn: ["sourcesJar", "jar"]){ | |||||||
| task copyJar(type: Copy, dependsOn: ["mergeJar", ":backend:copyLibs"]) { | task copyJar(type: Copy, dependsOn: ["mergeJar", ":backend:copyLibs"]) { | ||||||
|     from "./build/libs/$project.name-${project.version}-all.jar" |     from "./build/libs/$project.name-${project.version}-all.jar" | ||||||
|     into "./build/output" |     into "./build/output" | ||||||
|     rename { String fileName -> "gateway.jar" } |     rename { String fileName -> "sc-example.jar" } | ||||||
|     doFirst { |     doFirst { | ||||||
|         println "copyJar start" |         println "copyJar start" | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,6 +1,9 @@ | |||||||
| package org.bdware.sc.contractexample; | package org.bdware.sc.contractexample; | ||||||
|  | 
 | ||||||
| import org.apache.logging.log4j.LogManager; | import org.apache.logging.log4j.LogManager; | ||||||
| import org.apache.logging.log4j.Logger; | import org.apache.logging.log4j.Logger; | ||||||
|  | import org.bdware.sc.ContractProcess; | ||||||
|  | import org.bdware.sc.boundry.JavaScriptEntry; | ||||||
| 
 | 
 | ||||||
| public class Hello { | public class Hello { | ||||||
|     private static final Logger LOGGER = LogManager.getLogger(Hello.class); |     private static final Logger LOGGER = LogManager.getLogger(Hello.class); | ||||||
| @ -8,5 +11,16 @@ public class Hello{ | |||||||
|     public static void main(String[] args) { |     public static void main(String[] args) { | ||||||
|         LOGGER.info("abc"); |         LOGGER.info("abc"); | ||||||
|     } |     } | ||||||
|     public static String call(){return "hello..dafdskf";} | 
 | ||||||
|  |     public static String call() { | ||||||
|  |         return "hello..dafdskf"; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static String callYJSInSameCP() { | ||||||
|  |         return ContractProcess.instance.executeContract("{\"action\":\"getOwner\"\",\"arg\":\"\"}"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static Object callYJSInOtherCP() { | ||||||
|  |         return JavaScriptEntry.executeContract("cid", "action", "arg"); | ||||||
|  |     } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user