左晓为主开发手持机充值管理机
zuoxiao
2025-03-14 75f59fa9a615e3584694e820ff83503e8b72ea16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.dayu.general.activity
 
import android.content.Context
import com.dayu.baselibrary.net.subscribers.SubscriberListener
import com.dayu.baselibrary.utils.ToastUtil
import com.dayu.general.bean.net.SearchUserResult
import com.dayu.general.net.ApiManager
import com.dayu.general.net.BaseResponse
 
/**
 * Description:
 * Author: zuo
 * Date: 2025/3/13
 */
class LoginActivity {
 
    companion object {
        @JvmStatic
        fun login(phone: String, password: String, myContext: Context) {
            val map = mutableMapOf<String, Any>()
 
            if (phone.isNotEmpty()) {
                map["phone"] = phone
            }
 
            if (password.isNotEmpty()) {
                map["password"] = password
            }
 
            map["orgTag"] = "ym"
 
            // 使用正确的类型参数
            ApiManager.getInstance().requestPostLoading(
                myContext,
                "sso/sso/loginJson",
                SearchUserResult::class.java,
                map,
                object : SubscriberListener<BaseResponse<SearchUserResult>>() {
                    override fun onNext(t: BaseResponse<SearchUserResult>) {
                        if (t.success) {
 
                        } else {
                            // 处理搜索失败的情况
                            ToastUtil.show(t.msg)
                        }
                    }
 
                    override fun onError(e: Throwable?) {
                        super.onError(e)
                        ToastUtil.show("搜索失败: ${e?.message ?: "未知错误"}")
                    }
                }
            )
        }
    }
 
 
}