66 lines
2.1 KiB
Kotlin
66 lines
2.1 KiB
Kotlin
package com.pomelotea.hoperun.sign.config
|
|
|
|
/**
|
|
*
|
|
* @version 0.0.1
|
|
* @author jimlee
|
|
* date 2022-07-18 09:56
|
|
* 用户配置
|
|
**/
|
|
object HoperunUserConfig {
|
|
|
|
val deviceMap = mapOf<String, String>(
|
|
"16638" to "Android 12;Redmi;M2007J3SC;deviceId:OAIDe7fa6084205e9a22d8f6f71bc91893ff;deviceName:Android",
|
|
"9119" to "iOS 16.4.1;Apple;iPhone13,2;deviceId:a8baf66f-fdeb-4f4d-b1e5-9fafcd5045b6;deviceName:iOS;clientId:10200;os:iOS 16.3.1;brand:Apple;model:iPhone13,2;lang:zh-CN;fontNum:0;fontScale:1.0;ver:10.7.14;Mozilla/5.0 (iPhone; CPU iPhone OS 16_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
)
|
|
|
|
val userConfigMap: MutableMap<String, UserConfig> = HashMap()
|
|
var address: String = "浙江省杭州市西湖区转塘街道凌家桥路飞天园区"
|
|
var longitueHead: String = "120.085"
|
|
var latitudeHead: String = "30.138"
|
|
var longitueShort: String = "120.0845715522375"
|
|
var latitudeShort: String = "30.140219809955912"
|
|
var qingUa: String = "Qing/0.9.113"
|
|
|
|
fun getUserConfig(employeeNo: String): UserConfig? {
|
|
return userConfigMap.get(employeeNo)
|
|
}
|
|
|
|
fun getUA(emplotyeeNo: String): String {
|
|
return address +
|
|
"$longitueHead${random(11)}," +
|
|
"$latitudeHead${random(12)};" +
|
|
"$longitueShort," +
|
|
"$latitudeShort;" +
|
|
"$qingUa;" +
|
|
(deviceMap.get(emplotyeeNo) ?: "")
|
|
}
|
|
|
|
fun addUserConfig(emplotyeeNo: String, userConfig: UserConfig) {
|
|
userConfigMap.put(emplotyeeNo, userConfig)
|
|
}
|
|
|
|
|
|
fun random(place: Int): Long {
|
|
var random = 0L
|
|
var index = 1
|
|
var divisor = 1
|
|
while (index <= place) {
|
|
random += (Math.random() * 10).toInt() * divisor
|
|
divisor *= 10
|
|
index++
|
|
}
|
|
return if (random < 0) -random else random
|
|
}
|
|
|
|
}
|
|
|
|
data class UserConfig(
|
|
var username: String? = null,
|
|
var employeeNo: String? = null,
|
|
var device: String? = null,
|
|
var project_id: String? = null,
|
|
var projectname: String? = null,
|
|
var projectcode: String? = null,
|
|
var autoDaka: Boolean = false
|
|
) |