Commit 050e447b authored by Alex朱枝文's avatar Alex朱枝文

直播分享相关

parent afc70514
...@@ -21,6 +21,7 @@ import HyphenateChat ...@@ -21,6 +21,7 @@ import HyphenateChat
@main @main
class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
private lazy var liveViewModel = YHLiveSalesViewModel()
var window: UIWindow? var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...@@ -69,7 +70,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -69,7 +70,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
YHOSSManager.share.getOSSID() YHOSSManager.share.getOSSID()
AGCInstance.startUp() AGCInstance.startUp()
AGCAppLinking.instance().handle { (link, error) in AGCAppLinking.instance().handle { [weak self] (link, error) in
guard let self = self else {
return
}
if let deepLink = link?.deepLink,deepLink.contains(YhConstant.DeepLink.compareUrl) { if let deepLink = link?.deepLink,deepLink.contains(YhConstant.DeepLink.compareUrl) {
if let url = URL(string: deepLink) { if let url = URL(string: deepLink) {
let components = URLComponents(url: url, resolvingAgainstBaseURL: false) let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
...@@ -92,6 +96,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -92,6 +96,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
} }
//直播 - 获取它对应的参数 //直播 - 获取它对应的参数
if let liveId = arrItems["LiveID"] as? String { if let liveId = arrItems["LiveID"] as? String {
if let userId = arrItems["fromUserId"] as? String, let sourceType = arrItems["sourceType"] as? String {
self.liveViewModel.postLiveViewRecords(id: liveId.intValue(), userId: userId, sourceType: sourceType.intValue()) { _, _ in
//
}
}
let playbackInfo = YHPlayerManager.PlaybackInfo(id: liveId.intValue(), isLive: true, isFromSaleDetail: false) let playbackInfo = YHPlayerManager.PlaybackInfo(id: liveId.intValue(), isLive: true, isFromSaleDetail: false)
YHPlayerManager.shared.enterLive(from: nil, playbackInfo: playbackInfo) YHPlayerManager.shared.enterLive(from: nil, playbackInfo: playbackInfo)
} }
......
...@@ -539,7 +539,9 @@ class YHLivePlayerViewController: YHBasePlayerViewController { ...@@ -539,7 +539,9 @@ class YHLivePlayerViewController: YHBasePlayerViewController {
} else { } else {
oldUrl = oldUrl + "?appDeepLink=\(tmpT)" oldUrl = oldUrl + "?appDeepLink=\(tmpT)"
} }
if let userId = YHLoginManager.shared.userModel?.id, userId.count > 0 {
oldUrl += "&sourceType=1&fromUserId=\(userId)"
}
YHShareAlertView.show(image: liveModel.live_image, title: "@" + liveModel.account, subMessage: liveModel.live_title, linkUrl: oldUrl, isLive: true, fromAiSale: true) YHShareAlertView.show(image: liveModel.live_image, title: "@" + liveModel.account, subMessage: liveModel.live_title, linkUrl: oldUrl, isLive: true, fromAiSale: true)
return return
} }
......
...@@ -328,6 +328,28 @@ extension YHLiveSalesViewModel { ...@@ -328,6 +328,28 @@ extension YHLiveSalesViewModel {
callback(nil, err) callback(nil, err)
} }
} }
func postLiveViewRecords(id: Int, userId: String, sourceType: Int, callback: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["live_id": id,
"from_user_id": userId,
"view_port": 1,
"source_type": sourceType,
]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.LiveSales.viewRecords
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
// 1. json字符串 转 对象
printLog("model 是 ==> \(json)")
if json.code == 200 {
callback(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback(false, err)
}
} failBlock: { err in
callback(false, err)
}
}
} }
......
...@@ -732,6 +732,8 @@ class YHAllApiName { ...@@ -732,6 +732,8 @@ class YHAllApiName {
static let shareLive = "super-app/live/share-live" static let shareLive = "super-app/live/share-live"
// app直播间状态 // app直播间状态
static let liveStatus = "super-app/live/live-status" static let liveStatus = "super-app/live/live-status"
// 查看浏览记录
static let viewRecords = "super-app/live/viewing-records"
} }
struct AIChat { struct AIChat {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment