Commit 72fe8c18 authored by yinjiacheng's avatar yinjiacheng

add mockC端客户端信息服务

parent 72b39c98
...@@ -2,6 +2,10 @@ package com.yidian.bcommon.sdk ...@@ -2,6 +2,10 @@ package com.yidian.bcommon.sdk
import com.yidian.bcommon.app.YdBaseApplication import com.yidian.bcommon.app.YdBaseApplication
import com.yidian.bcommon.constant.AppConfig import com.yidian.bcommon.constant.AppConfig
import com.yidian.bcommon.services.ZapServiceActionConstants
import com.yidian.bcommon.services.ZapServiceNameConstants
import com.yidian.yac.core.zap.ZapTicket
import org.json.JSONObject
/** /**
* author: yinjiacheng * author: yinjiacheng
...@@ -17,20 +21,6 @@ object BCommonManager { ...@@ -17,20 +21,6 @@ object BCommonManager {
*/ */
private lateinit var encryptIml: IEncryptService private lateinit var encryptIml: IEncryptService
/**
* C端 uid
*/
// TODO: 7/27/21 Test
// private var uid: String? = "510227073302"
private var uid: String? = null
/**
* C端同步uid
*/
fun syncUid(uid: String) {
this.uid = uid
}
/** /**
* 获取AppId * 获取AppId
*/ */
...@@ -53,9 +43,14 @@ object BCommonManager { ...@@ -53,9 +43,14 @@ object BCommonManager {
/** /**
* 获取C端uid * 获取C端uid
* todo C端用户信息数据接口待定
*/ */
fun getUid(): String? { fun getUid(): String? {
return uid var userId: String? = null
ZapTicket(ZapServiceNameConstants.ClientInfoService).withAction(ZapServiceActionConstants.ActionGetUserInfo).onResult {
userId = (it.result as JSONObject).optString("userId")
}.ship()
return userId
} }
/** /**
......
...@@ -39,5 +39,8 @@ class ZapServiceActionConstants { ...@@ -39,5 +39,8 @@ class ZapServiceActionConstants {
// AES解密 // AES解密
const val ActionAESDecrypt = "AESDecrypt" const val ActionAESDecrypt = "AESDecrypt"
// 获取用户信息
const val ActionGetUserInfo = "getUserInfo"
} }
} }
...@@ -24,6 +24,9 @@ class ZapServiceNameConstants { ...@@ -24,6 +24,9 @@ class ZapServiceNameConstants {
// BRoot组件中加解密服务 // BRoot组件中加解密服务
const val EncryptService = "EncryptService" const val EncryptService = "EncryptService"
// C端客户端信息服务
const val ClientInfoService = "cClientInfoService"
} }
} }
package com.yidian.shenghuoquan.bdemo.app
import com.yidian.bcommon.app.YdBaseApplication
import com.yidian.bcommon.services.ZapServiceNameConstants
import com.yidian.news.util.ProcessUtil
import com.yidian.shenghuoquan.bdemo.service.ClientInfoService
import com.yidian.yac.core.core.YacModuleSpec
import com.yidian.yac.core.zap.Zap
@YacModuleSpec
class BDemoApplication : YdBaseApplication() {
override fun onCreate() {
super.onCreate()
if (ProcessUtil.isMainProcess(this)) {
initService()
}
}
private fun initService() {
Zap.addService(ZapServiceNameConstants.ClientInfoService, ClientInfoService())
}
}
package com.yidian.shenghuoquan.bdemo.service
import com.yidian.bcommon.services.ZapServiceActionConstants
import com.yidian.xarc.xrouter.ResultResolver
import com.yidian.yac.core.zap.ZapService
import org.json.JSONObject
/**
* author: yinjiacheng
* date: 7/30/21 4:27 PM
* description: C端客户端信息服务
*/
class ClientInfoService : ZapService() {
override fun onAction(path: String, action: String, params: Any, options: Any, resolver: ResultResolver) {
when (action) {
ZapServiceActionConstants.ActionGetUserInfo -> {
// 获取C端userId 调试时可修改为开发者自己的userId
resolver.success(JSONObject().put("userId", "510227073302"))
}
}
}
override fun onExit() {
}
override fun onInit() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment