Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
杨凯
YDL-Component-Medical
Commits
aa09a02c
Commit
aa09a02c
authored
Dec 16, 2019
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态支付功能
parent
76709a76
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
196 additions
and
60 deletions
+196
-60
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+3
-3
config.gradle
config.gradle
+1
-1
ThankActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/thank/ThankActivity.java
+1
-3
ThankHeadView.kt
m-dynamic/src/main/java/com/yidianling/dynamic/thank/view/ThankHeadView.kt
+47
-40
CommonPayDialog.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/CommonPayDialog.kt
+0
-0
BalanceBean.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/bean/BalanceBean.kt
+11
-0
BalanceParam.java
ydl-pay/src/main/java/com/yidianling/ydl_pay/bean/params/BalanceParam.java
+14
-0
ChargePayParam.java
ydl-pay/src/main/java/com/yidianling/ydl_pay/bean/params/ChargePayParam.java
+14
-0
HttpUtils.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/http/HttpUtils.kt
+40
-6
PayServices.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/http/PayServices.kt
+11
-0
PayInfoDetailView.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/widget/PayInfoDetailView.kt
+44
-6
view_pay_info_detail.xml
ydl-pay/src/main/res/layout/view_pay_info_detail.xml
+10
-1
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
aa09a02c
...
...
@@ -19,9 +19,9 @@ import java.util.List;
*/
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
String
APP_DOMAIN
=
"https://api.github.com/"
;
// String appEnv = YDLConstants.ENV_AUTO_TEST;
public
static
String
appEnv
=
YDLConstants
.
ENV_PROD
;
//
String appEnv = YDLConstants.ENV_TEST;
//
public static
String appEnv = YDLConstants.ENV_AUTO_TEST;
//
public static String appEnv = YDLConstants.ENV_PROD;
public
static
String
appEnv
=
YDLConstants
.
ENV_TEST
;
@Override
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
...
...
config.gradle
View file @
aa09a02c
ext
{
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/thank/ThankActivity.java
View file @
aa09a02c
...
...
@@ -101,8 +101,6 @@ public class ThankActivity extends BaseActivity implements PtrHandler, LoadMoreH
lv_content
.
setAdapter
(
adapter
);
getData
(
false
);
}
...
...
@@ -146,7 +144,7 @@ public class ThankActivity extends BaseActivity implements PtrHandler, LoadMoreH
}
void
getData
(
final
boolean
loadMore
)
{
public
void
getData
(
final
boolean
loadMore
)
{
if
(
loadMore
&&
!
hasMore
)
{
load_more_list_view_container
.
loadMoreFinish
(
false
,
false
);
return
;
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/thank/view/ThankHeadView.kt
View file @
aa09a02c
package
com.yidianling.dynamic.thank.view
import
android.app.Activity
import
android.text.TextUtils
import
android.view.View
import
android.widget.LinearLayout
import
butterknife.ButterKnife
import
butterknife.OnClick
import
com.ydl.ydl_image.module.GlideApp
import
com.ydl.ydl_image.transform.GlideCircleTransform
import
com.ydl.ydl_router.manager.YDLRouterManager
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.data.PlatformDataManager
import
com.ydl.ydlcommon.router.IYDLRouterConstant
import
com.ydl.ydlcommon.view.RoundCornerButton
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.dynamic.R
import
com.yidianling.dynamic.R2
import
com.yidianling.dynamic.common.net.DynamicApiUtils
import
com.yidianling.dynamic.event.ThankReplyUpdateEvent
import
com.yidianling.dynamic.model.Command
import
com.yidianling.dynamic.router.DynamicIn
import
com.yidianling.dynamic.thank.ShowIntroduceDialogFragment
import
com.yidianling.dynamic.thank.ThankActivity
import
com.yidianling.dynamic.thank.WorryDetailAnswer
import
com.yidianling.dynamic.thank.data.ThxData
import
com.yidianling.ydl_pay.CommonPayDialog
import
de.greenrobot.event.EventBus
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
...
...
@@ -62,7 +65,6 @@ class ThankHeadView(activity: Activity) : LinearLayout(activity) {
init
{
View
.
inflate
(
activity
,
R
.
layout
.
ui_thank_head
,
this
)
ButterKnife
.
bind
(
this
)
this
.
activity
=
activity
as
BaseActivity
}
...
...
@@ -70,31 +72,36 @@ class ThankHeadView(activity: Activity) : LinearLayout(activity) {
this
.
thxData
=
thxData
tsv_select
!!
.
setData
(
thxData
.
star_money
)
LogUtil
.
d
(
"thank userInfo head: "
+
thxData
.
userInfo
.
head
)
GlideApp
.
with
(
context
)
GlideApp
.
with
(
activity
)
.
load
(
thxData
.
userInfo
.
head
)
.
transform
(
GlideCircleTransform
(
context
))
.
transform
(
GlideCircleTransform
(
activity
))
.
placeholder
(
R
.
drawable
.
head_place_hold_pic
)
.
error
(
R
.
drawable
.
head_place_hold_pic
)
.
into
(
sdv_head
!!
)
}
@OnClick
(
R2
.
id
.
rcb_submit
,
R2
.
id
.
rcb_msg_submit
)
internal
fun
click
(
view
:
View
)
{
rcb_submit
.
setOnClickListener
{
if
(
answerId
==
0
)
return
return
@setOnClickListener
if
(
thxData
==
null
||
thxData
!!
.
userInfo
==
null
||
thxData
!!
.
userInfo
.
uid
==
null
)
return
return
@setOnClickListener
if
(
thxData
!!
.
userInfo
.
uid
==
DynamicIn
.
getUserInfo
()
!!
.
uid
)
{
ToastUtil
.
toastShort
(
"不能给自己点赞"
)
return
return
@setOnClickListener
}
if
(
view
.
id
==
R
.
id
.
rcb_submit
)
{
submitWithMoney
()
}
else
if
(
view
.
id
==
R
.
id
.
rcb_msg_submit
)
{
submitWithoutMoney
()
}
}
// @OnClick(R2.id.rcb_submit, R2.id.rcb_msg_submit)
// internal fun click(view: View) {
//
// if (view.id == R.id.rcb_submit) {
// submitWithMoney()
// } else if (view.id == R.id.rcb_msg_submit) {
// submitWithoutMoney()
// }
// }
internal
fun
submitWithMoney
()
{
var
starNum
=
0
if
(
selectId
==
-
1
)
{
...
...
@@ -121,7 +128,7 @@ class ThankHeadView(activity: Activity) : LinearLayout(activity) {
// payParams.setNeedPay(sendThxWithMoney.money)
// YdlCommonOut.startPayActivity(context as Activity, payParams, 0)
toPay
(
sendThxWithMoney
.
payId
,
sendThxWithMoney
.
money
)
toPay
(
sendThxWithMoney
.
payId
,
sendThxWithMoney
.
money
)
}
else
{
ToastUtil
.
toastShort
(
resp
.
msg
)
}
...
...
@@ -177,31 +184,31 @@ class ThankHeadView(activity: Activity) : LinearLayout(activity) {
fun
toPay
(
payId
:
String
,
money
:
Float
)
{
// TODO: 2019-12-13 支付逻辑待补充 by:HaoRui
//
// val userInfo = YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()
// if (userInfo == null || TextUtils.isEmpty(userInfo.userId)) {
// YDLRouterManager.router(IYDLRouterConstant.ROUTER_MINE_LOGIN)
// return
// }
//
// val build = CommonPayDialog.Build(activity)
// .setCourseId(course_id.toString())
// .setToken(userInfo.token)
// .setUid(userInfo.userId)
// .setFfrom(PlatformDataManager.getRam().getChannelName())
// .setListener(object : CommonPayDialog.OnPayResultListener {
// override fun onSuccesed() {
// //刷新界面
// initData()
// }
//
// override fun onFailed() {
val
userInfo
=
DynamicIn
.
getUserInfo
()
if
(
userInfo
==
null
||
TextUtils
.
isEmpty
(
userInfo
.
uid
))
{
YDLRouterManager
.
router
(
IYDLRouterConstant
.
ROUTER_MINE_LOGIN
)
return
}
//
// }
// })
// .setIsTestEnvironment(BuildConfig.DEBUG)
// build.build().show()
val
build
=
CommonPayDialog
.
Build
(
activity
)
.
setPayId
(
payId
)
.
setPayMoney
(
money
)
.
setToken
(
userInfo
.
accessToken
!!
)
.
setUid
(
userInfo
.
uid
)
.
setFfrom
(
PlatformDataManager
.
getRam
().
getChannelName
())
.
setListener
(
object
:
CommonPayDialog
.
OnPayResultListener
{
override
fun
onSuccesed
()
{
//刷新界面
(
activity
as
ThankActivity
).
getData
(
false
)
}
override
fun
onFailed
()
{
}
})
.
setIsTestEnvironment
(
false
)
build
.
build
().
show
()
}
}
ydl-pay/src/main/java/com/yidianling/ydl_pay/CommonPayDialog.kt
View file @
aa09a02c
This diff is collapsed.
Click to expand it.
ydl-pay/src/main/java/com/yidianling/ydl_pay/bean/BalanceBean.kt
0 → 100644
View file @
aa09a02c
package
com.yidianling.ydl_pay.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/16
*/
class
BalanceBean
(
val
balance
:
Float
)
\ No newline at end of file
ydl-pay/src/main/java/com/yidianling/ydl_pay/bean/params/BalanceParam.java
0 → 100644
View file @
aa09a02c
package
com
.
yidianling
.
ydl_pay
.
bean
.
params
;
import
com.ydl.ydlcommon.data.http.BaseCommand
;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/16
*/
public
class
BalanceParam
extends
BaseCommand
{
public
int
balance
=
1
;
}
ydl-pay/src/main/java/com/yidianling/ydl_pay/bean/params/ChargePayParam.java
0 → 100644
View file @
aa09a02c
package
com
.
yidianling
.
ydl_pay
.
bean
.
params
;
import
com.ydl.ydlcommon.data.http.BaseCommand
;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/16
*/
public
class
ChargePayParam
extends
BaseCommand
{
public
String
payId
;
}
ydl-pay/src/main/java/com/yidianling/ydl_pay/http/HttpUtils.kt
View file @
aa09a02c
package
com.yidianling.ydl_pay.http
import
com.google.gson.Gson
import
com.yidianling.ydl_pay.actionpoint.ActionDataBean
import
com.ydl.ydlcommon.data.http.BaseCommand
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.ydl.ydlcommon.utils.NetworkParamsUtils
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.ydl_pay.actionpoint.ActionDataBean
import
com.yidianling.ydl_pay.bean.*
import
com.yidianling.ydl_pay.bean.params.CheckRequestCouponBean
import
com.yidianling.ydl_pay.bean.params.CreateOrderRequestBean
...
...
@@ -29,7 +29,10 @@ class HttpUtils {
*/
fun
getOrderInfo
(
bean
:
OrderRequestBean
):
Observable
<
BaseResponse
<
OrderInfoBean
>>
{
var
str
=
Gson
().
toJson
(
bean
)
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
getOrderInfo
(
body
)
}
...
...
@@ -38,7 +41,10 @@ class HttpUtils {
*/
fun
checkCourseCoupon
(
bean
:
CheckRequestCouponBean
):
Observable
<
BaseResponse
<
CouponCodeInfoBean
>>
{
var
str
=
Gson
().
toJson
(
bean
)
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
checkCourseCoupon
(
body
)
}
...
...
@@ -48,7 +54,10 @@ class HttpUtils {
*/
fun
selectCoupon
(
bean
:
GetAllCouponRequestBean
):
Observable
<
BaseResponse
<
AllCouponListBean
>>
{
var
str
=
Gson
().
toJson
(
bean
)
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
selectCoupon
(
body
)
}
...
...
@@ -58,7 +67,10 @@ class HttpUtils {
*/
fun
createOrder
(
bean
:
CreateOrderRequestBean
):
Observable
<
BaseResponse
<
PayOrderBean
>>
{
var
str
=
Gson
().
toJson
(
bean
)
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
createOrder
(
body
)
}
...
...
@@ -83,10 +95,32 @@ class HttpUtils {
/**
* 余额的接口
*/
fun
getMyBalance
(
bean
:
BaseCommand
):
Observable
<
BaseResponse
<
BalanceBean
>>
{
var
params
=
NetworkParamsUtils
.
getPostList
(
bean
)
var
map
=
NetworkParamsUtils
.
getMaps
(
params
)
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
getMyBalance
(
map
)
}
/**
* 余额支付
*/
fun
payByCharge
(
bean
:
BaseCommand
):
Observable
<
BaseResponse
<
Any
>>
{
var
params
=
NetworkParamsUtils
.
getPostList
(
bean
)
var
map
=
NetworkParamsUtils
.
getMaps
(
params
)
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
pay
(
map
)
}
/**
* 行为数据埋点统计接口
*/
internal
fun
actionDataCount
(
actionDataParams
:
ActionDataBean
):
Observable
<
BaseResponse
<
String
>>
{
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
Gson
().
toJson
(
actionDataParams
))
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
Gson
().
toJson
(
actionDataParams
)
)
return
YDLHttpUtils
.
obtainApi
(
PayServices
::
class
.
java
).
actionDataCount
(
body
)
}
}
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/http/PayServices.kt
View file @
aa09a02c
...
...
@@ -65,4 +65,14 @@ interface PayServices {
//行为动作埋点统计接口
@POST
(
"maidian/writeMaiDianData"
)
fun
actionDataCount
(
@Body
body
:
RequestBody
):
Observable
<
BaseResponse
<
String
>>
//余额的接口
@FormUrlEncoded
@POST
(
"uc/mybalance"
)
fun
getMyBalance
(
@FieldMap
params
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
BalanceBean
>>
//余额支付
@FormUrlEncoded
@POST
(
"pay/vcount-pay"
)
fun
pay
(
@FieldMap
params
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
Any
>>
}
\ No newline at end of file
ydl-pay/src/main/java/com/yidianling/ydl_pay/widget/PayInfoDetailView.kt
View file @
aa09a02c
...
...
@@ -20,7 +20,8 @@ import java.math.BigDecimal
* @date 2019/4/4
*/
@SuppressLint
(
"ViewConstructor"
)
class
PayInfoDetailView
(
context
:
Context
,
var
listener
:
OnCouponDetailClickListener
)
:
LinearLayout
(
context
)
{
class
PayInfoDetailView
(
context
:
Context
,
var
listener
:
OnCouponDetailClickListener
)
:
LinearLayout
(
context
)
{
private
var
orderInfoBean
:
OrderInfoBean
?
=
null
/**
* 是否使用余额
...
...
@@ -76,7 +77,10 @@ class PayInfoDetailView(context: Context, var listener: OnCouponDetailClickListe
private
fun
initView
()
{
orientation
=
VERTICAL
val
params
=
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
val
params
=
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
layoutParams
=
params
View
.
inflate
(
context
,
R
.
layout
.
view_pay_info_detail
,
this
)
...
...
@@ -123,7 +127,13 @@ class PayInfoDetailView(context: Context, var listener: OnCouponDetailClickListe
MONEY_TYPE_CHANGE
}
if
(
orderInfoBean
!!
.
maxCoupon
!=
null
)
{
listener
.
ensurePay
(
payWay
,
sdkPayMoney
,
useMoneyType
,
orderInfoBean
!!
.
maxCoupon
.
code
,
orderInfoBean
!!
.
maxCoupon
.
couponType
)
listener
.
ensurePay
(
payWay
,
sdkPayMoney
,
useMoneyType
,
orderInfoBean
!!
.
maxCoupon
.
code
,
orderInfoBean
!!
.
maxCoupon
.
couponType
)
}
else
{
listener
.
ensurePay
(
payWay
,
sdkPayMoney
,
useMoneyType
,
""
,
""
)
}
...
...
@@ -154,6 +164,16 @@ class PayInfoDetailView(context: Context, var listener: OnCouponDetailClickListe
tv_pay_title
.
text
=
"咨询服务"
}
if
(
payBusinessType
==
5
)
{
tv_pay_title
.
text
=
"送感谢"
tv_change_money
.
isEnabled
=
false
if
(
orderInfoBean
.
availableMoney
>=
orderInfoBean
.
applyFee
)
{
rl_third_pay
.
visibility
=
View
.
INVISIBLE
rl_third_pay
.
isEnabled
=
false
}
}
//价格
tv_price
.
text
=
orderInfoBean
.
applyFee
.
toString
()
...
...
@@ -217,6 +237,7 @@ class PayInfoDetailView(context: Context, var listener: OnCouponDetailClickListe
ll_third_pay
.
isEnabled
=
true
}
if
(
isUseChange
)
{
//使用余额
if
(
orderInfoBean
!!
.
availableMoney
>=
needPay
)
{
tv_change_money
.
text
=
needPay
.
toString
()
...
...
@@ -275,9 +296,19 @@ class PayInfoDetailView(context: Context, var listener: OnCouponDetailClickListe
*/
private
fun
setChooseChangeMoney
(
isUse
:
Boolean
)
{
if
(
isUse
)
{
tv_change_money
.
setCompoundDrawablesWithIntrinsicBounds
(
0
,
0
,
R
.
drawable
.
pay_img_select
,
0
)
tv_change_money
.
setCompoundDrawablesWithIntrinsicBounds
(
0
,
0
,
R
.
drawable
.
pay_img_select
,
0
)
}
else
{
tv_change_money
.
setCompoundDrawablesWithIntrinsicBounds
(
0
,
0
,
R
.
drawable
.
pay_img_no_select
,
0
)
tv_change_money
.
setCompoundDrawablesWithIntrinsicBounds
(
0
,
0
,
R
.
drawable
.
pay_img_no_select
,
0
)
}
}
...
...
@@ -297,6 +328,12 @@ class PayInfoDetailView(context: Context, var listener: OnCouponDetailClickListe
* @param couponType 券类型 1兑换券 2新优惠券
*
*/
fun
ensurePay
(
payWay
:
Int
,
payMoney
:
Float
,
useMoneyType
:
Int
,
code
:
String
,
couponType
:
String
)
fun
ensurePay
(
payWay
:
Int
,
payMoney
:
Float
,
useMoneyType
:
Int
,
code
:
String
,
couponType
:
String
)
}
}
\ No newline at end of file
ydl-pay/src/main/res/layout/view_pay_info_detail.xml
View file @
aa09a02c
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@color/pay_color_FFFFFF"
>
android:background=
"@color/pay_color_FFFFFF"
android:orientation=
"vertical"
tools:parentTag=
"android.widget.LinearLayout"
>
<RelativeLayout
...
...
@@ -197,6 +199,11 @@
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/rl_third_pay"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:id=
"@+id/ll_third_pay"
...
...
@@ -297,6 +304,8 @@
</LinearLayout>
</RelativeLayout>
<View
android:id=
"@+id/view_empty"
android:layout_width=
"match_parent"
...
...
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