LikeViewModel.ets
899 Bytes
import { LikeModel } from '../model/LikeModel'
/**
* 点赞*/
export class LikeViewModel {
likeModel: LikeModel
constructor() {
this.likeModel = new LikeModel();
}
executeLike(contentId: string, userName: string, contentType: string, title: string, userHeaderUrl: string, channelId: string, status: string) {
let bean: Record<string, string> = {}
bean['contentId'] = contentId
bean['userName'] = userName
bean['contentType'] = contentType
bean['title'] = title
bean['userHeaderUrl'] = userHeaderUrl
bean['channelId'] = channelId
bean['status'] = status
this.likeModel.executeLike(bean)
}
executeLike2(bean: Record<string, string>) {
return new Promise<object>((success, fail) => {
this.likeModel.executeLike(bean).then((data) => {
success(data)
}).catch((error: string) => {
fail(error)
})
})
}
}