Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨秀秀
HBHAndroid
Commits
1963544a
Commit
1963544a
authored
Jan 12, 2024
by
小费同学阿
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev1.0' into dev1.0
parents
f2f50925
0f193b53
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
334 additions
and
5 deletions
+334
-5
ApiService.kt
.../src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
+16
-0
BaseRespons.kt
...src/main/java/com/xx/hbhconsumer/data/http/BaseRespons.kt
+37
-0
LoginRequest.kt
.../java/com/xx/hbhconsumer/data/http/requst/LoginRequest.kt
+10
-0
VersionBean.kt
.../java/com/xx/hbhconsumer/data/http/respons/VersionBean.kt
+6
-0
StaticData.kt
...ain/java/com/xx/hbhconsumer/data/staticdata/StaticData.kt
+78
-2
LoginActivity.kt
...rc/main/java/com/xx/hbhconsumer/ui/login/LoginActivity.kt
+18
-0
LoginViewModel.java
...main/java/com/xx/hbhconsumer/ui/login/LoginViewModel.java
+167
-1
StoreServicesActivity.java
...x/hbhconsumer/ui/storeservices/StoreServicesActivity.java
+2
-2
No files found.
consumer/src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
View file @
1963544a
...
@@ -39,6 +39,7 @@ import com.xx.hbhconsumer.data.http.respons.ShopBean
...
@@ -39,6 +39,7 @@ import com.xx.hbhconsumer.data.http.respons.ShopBean
import
com.xx.hbhconsumer.data.http.respons.ShopDetailBean
import
com.xx.hbhconsumer.data.http.respons.ShopDetailBean
import
com.xx.hbhconsumer.data.http.respons.ShopGoodsBean
import
com.xx.hbhconsumer.data.http.respons.ShopGoodsBean
import
com.xx.hbhconsumer.data.http.respons.UserInfoBean
import
com.xx.hbhconsumer.data.http.respons.UserInfoBean
import
com.xx.hbhconsumer.data.http.respons.VersionBean
import
io.reactivex.rxjava3.core.Observable
import
io.reactivex.rxjava3.core.Observable
import
me.goldze.mvvmhabit.http.BasePageResponse
import
me.goldze.mvvmhabit.http.BasePageResponse
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.http.BaseResponse
...
@@ -61,7 +62,22 @@ import retrofit2.http.Url
...
@@ -61,7 +62,22 @@ import retrofit2.http.Url
interface
ApiService
{
interface
ApiService
{
/**
* 获取版本
*/
@Headers
(
"Content-type:application/json"
)
@POST
(
"app/system/version/current"
)
open
fun
getLineVersion
(
@Body
requestBody
:
RequestBody
):
Observable
<
BaseResponse
<
VersionBean
>>
/**
* 下载文件
*
* @param url
* @return
*/
@Streaming
@GET
fun
download
(
@Url
url
:
String
?):
Observable
<
ResponseBody
>
/**
/**
* 根据字典类型查询字典数据信息
* 根据字典类型查询字典数据信息
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/BaseRespons.kt
View file @
1963544a
...
@@ -2,13 +2,18 @@ package com.xx.hbhconsumer.data.http
...
@@ -2,13 +2,18 @@ package com.xx.hbhconsumer.data.http
import
com.xx.hbhconsumer.data.http.respons.Filebean
import
com.xx.hbhconsumer.data.http.respons.Filebean
import
com.xx.hbhconsumer.utils.RetrofitClient
import
com.xx.hbhconsumer.utils.RetrofitClient
import
io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import
io.reactivex.rxjava3.core.Observable
import
io.reactivex.rxjava3.core.Observable
import
io.reactivex.rxjava3.schedulers.Schedulers
import
me.goldze.mvvmhabit.base.BaseModel
import
me.goldze.mvvmhabit.base.BaseModel
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.http.BaseResponse
import
okhttp3.MediaType
import
okhttp3.MediaType
import
okhttp3.MultipartBody
import
okhttp3.MultipartBody
import
okhttp3.RequestBody
import
okhttp3.RequestBody
import
okhttp3.ResponseBody
import
java.io.File
import
java.io.File
import
java.io.FileOutputStream
import
java.io.IOException
open
class
BaseRespons
:
BaseModel
()
{
open
class
BaseRespons
:
BaseModel
()
{
...
@@ -18,6 +23,13 @@ open class BaseRespons : BaseModel() {
...
@@ -18,6 +23,13 @@ open class BaseRespons : BaseModel() {
apiService
=
RetrofitClient
.
getInstance
().
create
(
ApiService
::
class
.
java
)
apiService
=
RetrofitClient
.
getInstance
().
create
(
ApiService
::
class
.
java
)
}
}
fun
downFile
(
url
:
String
,
name
:
String
):
Observable
<
ResponseBody
>
{
return
apiService
.
download
(
url
).
subscribeOn
(
Schedulers
.
io
())
.
unsubscribeOn
(
Schedulers
.
io
()).
doOnNext
{
body
->
saveFile
(
body
,
name
)
}.
observeOn
(
AndroidSchedulers
.
mainThread
())
}
fun
upLoadFile
(
file
:
File
):
Observable
<
BaseResponse
<
List
<
Filebean
>>>
fun
upLoadFile
(
file
:
File
):
Observable
<
BaseResponse
<
List
<
Filebean
>>>
{
{
val
files
:
MutableList
<
File
>
=
ArrayList
()
val
files
:
MutableList
<
File
>
=
ArrayList
()
...
@@ -41,5 +53,30 @@ open class BaseRespons : BaseModel() {
...
@@ -41,5 +53,30 @@ open class BaseRespons : BaseModel() {
return
apiService
.
upLoadFiles
(
parts
)
return
apiService
.
upLoadFiles
(
parts
)
}
}
open
fun
saveFile
(
body
:
ResponseBody
,
writeUrl
:
String
)
{
val
buf
=
ByteArray
(
2048
)
var
len
:
Int
try
{
val
file
=
File
(
writeUrl
)
val
fileBasePath
=
writeUrl
.
substring
(
0
,
writeUrl
.
lastIndexOf
(
"/"
))
val
filePath
=
File
(
fileBasePath
)
//创建目录
if
(!
filePath
.
exists
())
{
filePath
.
mkdirs
()
}
if
(!
file
.
exists
())
{
file
.
createNewFile
()
}
val
fos
=
FileOutputStream
(
file
)
val
secInputstream
=
body
.
byteStream
()
while
(
secInputstream
.
read
(
buf
).
also
{
len
=
it
}
!=
-
1
)
{
fos
.
write
(
buf
,
0
,
len
)
}
secInputstream
.
close
()
fos
.
close
()
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
}
}
}
}
\ No newline at end of file
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/LoginRequest.kt
View file @
1963544a
...
@@ -2,12 +2,22 @@ package com.xx.hbhconsumer.data.http.requst
...
@@ -2,12 +2,22 @@ package com.xx.hbhconsumer.data.http.requst
import
com.xx.hbhconsumer.data.http.respons.UserInfoBean
import
com.xx.hbhconsumer.data.http.respons.UserInfoBean
import
com.xx.hbhconsumer.data.http.BaseRespons
import
com.xx.hbhconsumer.data.http.BaseRespons
import
com.xx.hbhconsumer.data.http.respons.VersionBean
import
com.xx.xxviewlibrary.model.VersionBody
import
io.reactivex.rxjava3.core.Observable
import
io.reactivex.rxjava3.core.Observable
import
me.goldze.mvvmhabit.http.ApiParams
import
me.goldze.mvvmhabit.http.ApiParams
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.http.BaseResponse
class
LoginRequest
:
BaseRespons
()
{
class
LoginRequest
:
BaseRespons
()
{
fun
checkVersion
():
Observable
<
BaseResponse
<
VersionBean
>>
{
return
apiService
.
getLineVersion
(
ApiParams
<
VersionBody
>().
setParams
(
VersionBody
(
"2"
,
"2"
)
)
)
}
/**
/**
* 登陆
* 登陆
*/
*/
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/respons/VersionBean.kt
0 → 100644
View file @
1963544a
package
com.xx.hbhconsumer.data.http.respons
class
VersionBean
(
var
appVersion
:
String
,
var
pushFlag
:
String
,
//是否强制推送 0-不强制 1-强制
var
versionFile
:
String
)
{
}
\ No newline at end of file
consumer/src/main/java/com/xx/hbhconsumer/data/staticdata/StaticData.kt
View file @
1963544a
package
com.xx.
hbhconsumer
.data.staticdata
package
com.xx.
merchanthbh
.data.staticdata
object
StaticData
{
object
StaticData
{
/**
* 当前版本号*/
@JvmField
@JvmField
var
sUserType
=
"02"
var
appVersionNumber
=
""
@JvmField
var
sUserType
=
"02"
/**
* 登录-强制更新状态位 0-不能登录 1-可登录
*/
@JvmField
var
updateLogin
:
Int
=
1
/**
* 订单详情-状态位 订单状态 1-待付款 2-已完成 3-已关闭
*/
@JvmField
var
statusData
:
Int
=
0
/**
* 反馈详情-状态位 是否有图片状态 0-有 1-没有
*/
@JvmField
var
imageFilesData
:
Int
=
0
/**
* 店员列表-状态位 是否有数据 0-有 1-没有
*/
@JvmField
var
AssistantData
:
Int
=
0
/**
* 消息列表-状态位 是否有数据 0-有 1-没有
*/
@JvmField
var
messageData
:
Int
=
0
/**
* 积分列表-状态位 是否有数据 0-有 1-没有
*/
@JvmField
var
PointData
:
Int
=
0
/**
* 订单详情-状态位 订单状态 1-待付款 2-已完成 3-已关闭
*/
lateinit
var
filePath
:
String
/**
* 活动中心-状态位 flag 0-未读 1-已读
*/
@JvmField
var
flag
:
Int
=
0
/**
* 登录人角色 personType 0-店长 1-店员
*/
@JvmField
var
personType
:
Int
=
1
/**
5 用户协议
4 积分说明
3 隐私条款
2 服务条款
1 会员体系
*/
@JvmField
var
Protocols
:
List
<
String
>
=
ArrayList
();
/**
* 支付方式
*/
@JvmField
var
PayWay
:
Map
<
String
,
String
>
=
mapOf
(
"ALIPAY"
to
"支付宝"
,
"WECHAT"
to
"微信"
,
"UNION_PAY"
to
"银联云闪付"
)
}
}
\ No newline at end of file
consumer/src/main/java/com/xx/hbhconsumer/ui/login/LoginActivity.kt
View file @
1963544a
package
com.xx.hbhconsumer.ui.login
package
com.xx.hbhconsumer.ui.login
import
android.content.Intent
import
android.net.Uri
import
android.os.Bundle
import
android.os.Bundle
import
android.provider.Settings
import
androidx.lifecycle.Observer
import
androidx.lifecycle.Observer
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
com.jakewharton.rxbinding3.widget.checked
import
com.jakewharton.rxbinding3.widget.checked
import
com.jakewharton.rxbinding3.widget.checkedChanges
import
com.jakewharton.rxbinding3.widget.checkedChanges
import
com.tbruyelle.rxpermissions3.RxPermissions
import
com.xx.hbhconsumer.BR
import
com.xx.hbhconsumer.BR
import
com.xx.hbhconsumer.R
import
com.xx.hbhconsumer.R
import
com.xx.hbhconsumer.adapter.CollectionGoodsAdapter
import
com.xx.hbhconsumer.adapter.CollectionGoodsAdapter
...
@@ -29,6 +33,20 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -29,6 +33,20 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
override
fun
initData
()
{
override
fun
initData
()
{
super
.
initData
()
super
.
initData
()
//检查版本
viewModel
.
rxPermissions
=
RxPermissions
(
this
)
viewModel
.
checkVersion
(
binding
.
root
.
rootView
)
//安装新版本
viewModel
.
openInstall
.
observe
(
this
,
Observer
<
String
?>
{
fun
onChanged
(
s
:
String
)
{
if
(
"1"
==
s
)
{
val
packageURI
=
Uri
.
parse
(
"package:"
+
applicationContext
.
packageName
)
val
intent
=
Intent
(
Settings
.
ACTION_MANAGE_UNKNOWN_APP_SOURCES
,
packageURI
)
startActivityForResult
(
intent
,
1002
)
}
}
})
viewModel
.
consentAgreementFlag
.
observe
(
this
,
viewModel
.
consentAgreementFlag
.
observe
(
this
,
Observer
<
Boolean
>
{
consentAgreementFlag
->
Observer
<
Boolean
>
{
consentAgreementFlag
->
if
(
binding
.
rbLoginAgreement
.
isSelected
)
{
if
(
binding
.
rbLoginAgreement
.
isSelected
)
{
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/login/LoginViewModel.java
View file @
1963544a
This diff is collapsed.
Click to expand it.
consumer/src/main/java/com/xx/hbhconsumer/ui/storeservices/StoreServicesActivity.java
View file @
1963544a
...
@@ -52,11 +52,11 @@ public class StoreServicesActivity extends BaseActivity<ActivityStoreServicesBin
...
@@ -52,11 +52,11 @@ public class StoreServicesActivity extends BaseActivity<ActivityStoreServicesBin
switch
(
tab
.
getPosition
())
{
switch
(
tab
.
getPosition
())
{
case
0
:
case
0
:
viewModel
.
basic
=
"
1
"
;
viewModel
.
basic
=
"
6
"
;
viewModel
.
loadAgreement
();
viewModel
.
loadAgreement
();
break
;
break
;
case
1
:
case
1
:
viewModel
.
basic
=
"
2
"
;
viewModel
.
basic
=
"
7
"
;
viewModel
.
loadAgreement
();
viewModel
.
loadAgreement
();
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment