Commit 7e30d161 authored by Steven杜宇's avatar Steven杜宇

// 人脉

parent dd2d0b62
...@@ -101,9 +101,13 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -101,9 +101,13 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 0 { if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHAddFriendCardCell.cellReuseIdentifier, for: indexPath) as! YHAddFriendCardCell let cell = tableView.dequeueReusableCell(withIdentifier: YHAddFriendCardCell.cellReuseIdentifier, for: indexPath) as! YHAddFriendCardCell
cell.cardCount = self.friendRequestArr.count cell.cardCount = self.friendRequestArr.count
if self.friendRequestArr.count > 0 {
cell.friendModel = self.friendRequestArr[0]
}
cell.acceptBlock = { cell.acceptBlock = {
[weak self] accept in [weak self] accept in
guard let self = self else { return } guard let self = self else { return }
self.viewModel.receiveFriendApply()
self.friendRequestArr.removeFirst() self.friendRequestArr.removeFirst()
self.tableView.reloadData() self.tableView.reloadData()
} }
......
...@@ -188,11 +188,6 @@ class YHAddFriendCardCell: UITableViewCell { ...@@ -188,11 +188,6 @@ class YHAddFriendCardCell: UITableViewCell {
cardView.addSubview(ignoreBtn) cardView.addSubview(ignoreBtn)
cardView.addSubview(acceptBtn) cardView.addSubview(acceptBtn)
self.headImgV.backgroundColor = .red
self.nameLabel.text = "XASAFSDFASDXASAFSDFASDXASAFSDFASDXASAFSDFASD"
self.professionalLabel.text = "咨询副总监 | 资讯科技及电讯"
self.msgLabel.text = "资讯科技及电讯资资讯科技及电讯资资讯科技及电讯资资讯科技及讯科技及电讯资资讯科技及电讯资资讯科技及电讯资资讯科技及科技及电讯资资讯科技及讯科技及电讯资资讯科技及科技及电讯资资讯科技及讯科技及电讯资资讯科技及"
cardView.snp.makeConstraints { make in cardView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview() make.left.right.top.equalToSuperview()
make.bottom.equalTo(self.secondCardView).offset(-6) make.bottom.equalTo(self.secondCardView).offset(-6)
......
...@@ -129,5 +129,27 @@ class YHMatchUserViewModel: NSObject { ...@@ -129,5 +129,27 @@ class YHMatchUserViewModel: NSObject {
} }
} }
func receiveFriendApply(userId:String, isReceive:Bool, callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let act = isReceive ? 2 : 1
let params = ["act": act,
"yh_id": userId] as [String : Any]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.receiveFriendRequestApi
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {
[weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog(json)
if json.code == 200 {
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBack(false, error)
}
} failBlock: { err in
callBack(false, err)
}
}
} }
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