协议调试

This commit is contained in:
chen wei bo
2025-09-10 10:18:34 +08:00
parent 6c1f564f03
commit ce39270ebb
4 changed files with 41 additions and 20 deletions
@@ -17,7 +17,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
private category: number;
private girlId: number;
private resId: number;
private type: number;
private type: proto.cs.EnmResType;
private base: DetailImageItem;
openUIDataCT(data) {
this.category = data.category;
@@ -31,10 +31,10 @@ export class PopupGirlDetailPanel extends li_BaseView {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
this.priceLabel = this._nodeTab.Price.getComponent(Label);
if (this.type === 1) {
if (this.type === proto.cs.EnmResType.ERT_Image) {
// 图片
this.priceLabel.string = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
} else if (this.type === 2) {
} else if (this.type === proto.cs.EnmResType.ERT_Video) {
// 视频
this.priceLabel.string = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
}
@@ -47,14 +47,35 @@ export class PopupGirlDetailPanel extends li_BaseView {
Close() {
this.close();
}
buyCharacter() {
async buyCharacter() {
// 购买id为girlId的女生
console.log(this.girlId + "---" + this.resId);
const success = true;
if (success) {
this.close();
// 请求解锁
const reqData = {
girlId: this.girlId,
resId: this.resId,
type: this.type,
};
let res = await GirlService.I.reqUnlockGirlRes(reqData);
console.log("请求解锁资源响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
if (this.type === proto.cs.EnmResType.ERT_Image) {
// 图片
girlData.unlockImage(this.category.toString(), this.girlId, this.resId);
} else if (this.type === proto.cs.EnmResType.ERT_Video) {
// 视频
girlData.unlockVideo(this.category.toString(), this.girlId, this.resId);
}
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refreshVideoBuy(true);
this.close();
}
}
}