66 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| syntax = "v1"
 | |
| 
 | |
| info (
 | |
| 	title: "websocket"// TODO: add title
 | |
| 	desc: // TODO: add description
 | |
| 	author: ""
 | |
| 	email: ""
 | |
| )
 | |
| 
 | |
| import "basic.api"
 | |
| service websocket {
 | |
| 	//websocket数据交互
 | |
| 	@handler DataTransferHandler
 | |
| 	get /api/websocket/data_transfer(request) returns (response);
 | |
| 	//云渲染完了通知接口
 | |
| 	@handler RenderNotifyHandler
 | |
| 	post /api/websocket/render_notify(RenderNotifyReq) returns (response);
 | |
| 	//第三方登录通知接口
 | |
| 	@handler ThirdPartyLoginNotifyHandler
 | |
| 	post /api/websocket/third_party_login_notify(ThirdPartyLoginNotifyReq) returns (response);
 | |
| }
 | |
| 
 | |
| //websocket数据交互
 | |
| type DataTransferData {
 | |
| 	T string      `json:"t"` //消息类型
 | |
| 	D interface{} `json:"d"` //传递的消息
 | |
| }
 | |
| type RenderImageReqMsg { //websocket接受要云渲染处理的数据
 | |
| 	ProductIds       []int64 `json:"product_ids"`                //产品 id
 | |
| 	TemplateTagId    int64   `json:"template_tag_id"`            //模板标签id
 | |
| 	LogoId           int64   `json:"logo_id"`                    //logoid
 | |
| 	AlgorithmVersion string  `json:"algorithm_version,optional"` //算法版本
 | |
| }
 | |
| type RenderImageRspMsg { //websocket发送渲染完的数据
 | |
| 	ProductId        int64  `json:"product_id"`                 //产品 id
 | |
| 	TemplateTagId    int64  `json:"template_tag_id"`            //模板标签id
 | |
| 	AlgorithmVersion string `json:"algorithm_version,optional"` //算法版本
 | |
| 	LogoId           int64  `json:"logo_id"`                    //logoid
 | |
| 	Image            string `json:"image"`                      //渲染后的图片
 | |
| }
 | |
| type ThirdPartyLoginRspMsg { //websocket三方登录的通知数据
 | |
| 	Token string `json:"token"`
 | |
| }
 | |
| //渲染完了通知接口
 | |
| type RenderNotifyReq {
 | |
| 	Sign string     `json:"sign"`
 | |
| 	Time int64      `json:"time"`
 | |
| 	Info NotifyInfo `json:"info"`
 | |
| }
 | |
| type NotifyInfo {
 | |
| 	ProductId        int64  `json:"product_id"`                 //产品id
 | |
| 	TemplateTagId    int64  `json:"template_tag_id"`            //模板标签id
 | |
| 	AlgorithmVersion string `json:"algorithm_version,optional"` //算法版本
 | |
| 	LogoId           int64  `json:"logo_id"`                    //logoid
 | |
| 	Image            string `json:"image"`
 | |
| }
 | |
| //第三方登录通知接口
 | |
| type ThirdPartyLoginNotifyReq {
 | |
| 	Sign string                `json:"sign"`
 | |
| 	Time int64                 `json:"time"`
 | |
| 	Info ThirdPartyLoginNotify `json:"info"`
 | |
| }
 | |
| type ThirdPartyLoginNotify {
 | |
| 	WebsocketId uint64 `json:"websocket_id"`
 | |
| 	Token       string `json:"token"`
 | |
| } |