Browse Source

1.添加修改密码接口

20241218TB223FC(测试jar包)
wangwanlei 9 months ago
parent
commit
8af7645c33

+ 6
- 1
app/src/main/java/com/xhly/manageapp/network/UriAdress.kt View File

12
     const val LOGPUSH_ADD = "/logPush/add"
12
     const val LOGPUSH_ADD = "/logPush/add"
13
 
13
 
14
     /**
14
     /**
15
-     *应用启动日志-添加
15
+     *应用启动日志-添加,用来记录app的使用时长。
16
      */
16
      */
17
     const val LOGAPPSTARTADD = "/logAppStart/add"
17
     const val LOGAPPSTARTADD = "/logAppStart/add"
18
 
18
 
85
      * 解除当前锁屏
85
      * 解除当前锁屏
86
      */
86
      */
87
     const val PWD_DEATIL_USERPAD = "/password/detail_userpad"
87
     const val PWD_DEATIL_USERPAD = "/password/detail_userpad"
88
+
89
+    /**
90
+     * 修改密码
91
+     */
92
+    const val EDITPWD="/user/edit_pwd"
88
 }
93
 }

+ 6
- 0
app/src/main/java/com/xhly/manageapp/ui/login/netservice/LoginService.kt View File

33
      */
33
      */
34
     @POST(UriAdress.PWD_DEATIL_USERPAD)
34
     @POST(UriAdress.PWD_DEATIL_USERPAD)
35
     suspend fun postPwdDetail(@Body map:HashMap<String,Any>):ResponseData<Any>
35
     suspend fun postPwdDetail(@Body map:HashMap<String,Any>):ResponseData<Any>
36
+
37
+    /**
38
+     * 修改密码 userid用户id loginpwd新密码 oldpwd原密码
39
+     */
40
+    @POST(UriAdress.EDITPWD)
41
+    suspend fun postEditPwd(@Body map:HashMap<String,Any>):ResponseData<Any>
36
 }
42
 }

+ 3
- 4
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

323
                             val userBean = spUtils.getFromJson(
323
                             val userBean = spUtils.getFromJson(
324
                                 Const.USERINFO, UserBean().javaClass
324
                                 Const.USERINFO, UserBean().javaClass
325
                             ) as UserBean
325
                             ) as UserBean
326
-
326
+                             viewModel.postEditPwd(userBean.userid,newCode,oldCode)
327
                         } catch (e: Exception) {
327
                         } catch (e: Exception) {
328
 
328
 
329
                         }
329
                         }
508
                 timer?.schedule( object : TimerTask() {
508
                 timer?.schedule( object : TimerTask() {
509
                     override fun run() {
509
                     override fun run() {
510
                         // 在这里编写您的定时任务代码
510
                         // 在这里编写您的定时任务代码
511
-                        Toast(getString(R.string.durationtips))
512
-                        startTimeTask(bean)
511
+                        Toast(getString(R.string.durationtips)+"|||"+bean.duration)
513
                     }
512
                     }
514
-                },0L,bean.duration*60*1000L)
513
+                },bean.duration*60*1000L,bean.duration*60*1000L)
515
             }
514
             }
516
         }
515
         }
517
         //如果设置的有时间则取消所有任务
516
         //如果设置的有时间则取消所有任务

+ 18
- 0
app/src/main/java/com/xhly/manageapp/ui/main/viewmodel/MainViewModel.kt View File

2
 
2
 
3
 import androidx.lifecycle.LiveData
3
 import androidx.lifecycle.LiveData
4
 import androidx.lifecycle.MutableLiveData
4
 import androidx.lifecycle.MutableLiveData
5
+import com.xhly.corelib.Const
6
+import com.xhly.corelib.eventbus.UIEvent
5
 import com.xhly.corelib.network.RetrofitService
7
 import com.xhly.corelib.network.RetrofitService
6
 import com.xhly.manageapp.bean.AppModel
8
 import com.xhly.manageapp.bean.AppModel
7
 import com.xhly.manageapp.bean.ListAppBean
9
 import com.xhly.manageapp.bean.ListAppBean
192
             }
194
             }
193
         }
195
         }
194
     }
196
     }
197
+
198
+    /**
199
+     * 修改密码
200
+     */
201
+    fun postEditPwd(userid:Long, loginpwd:String, oldpwd:String){
202
+        launchUI {
203
+            val map=HashMap<String,Any>()
204
+            map["userid"] = userid
205
+            map["loginpwd"] =loginpwd
206
+            map["oldpwd"] = oldpwd
207
+            val postEditPwd = loginService.postEditPwd(map)
208
+            if (postEditPwd.code==0){
209
+              UIEvent(Const.ACCOUNTLOGINOUT).post()
210
+            }
211
+        }
212
+    }
195
 }
213
 }

Loading…
Cancel
Save