|
@@ -88,14 +88,15 @@ class HeroDiscussProc {
|
|
|
$uid = $req->uid;
|
|
|
list($heroId, $score) = $req->paras; # 提取参数: 英雄ID, 打分值
|
|
|
my_Assert($score > 0 && $score <= 5, ErrCode::paras_err); # 参数非法: 打分区间不对
|
|
|
-
|
|
|
- $pubifno = $req->mem->get(MemKey_User::Union_PublicState_normal($uid)); # 玩家各区共享的数据
|
|
|
+// $pubifno = $req->mem->get(MemKey_User::Union_PublicState_hash($uid)); # 玩家各区共享的数据
|
|
|
+ $pubifno = new PublicStateModel(); # 玩家各区共享的数据
|
|
|
+ $pubifno->readDataFromMem(MemKey_User::Union_PublicState_hash($uid));
|
|
|
$scoredlist = $pubifno->scoredheros;
|
|
|
if (is_null($scoredlist) || !is_array($scoredlist)) {
|
|
|
$scoredlist = ArrayInit();
|
|
|
}
|
|
|
if (CommUtil::isInArray($scoredlist, $heroId)) { # 判断玩家是否给此英雄打过分了
|
|
|
- return Resp::ok(array('err' => 1, 'msg' => 'has scored!'));
|
|
|
+ return Resp::ok(array('err' => 1, 'msg' => 'has scored!')); # -- 业务逻辑内部错误码
|
|
|
}
|
|
|
// 添加打分数据,
|
|
|
// 取英雄的打分数据 {cnt:xxx,totalscore:xxx}
|
|
@@ -109,7 +110,8 @@ class HeroDiscussProc {
|
|
|
$heroscore->totalscore += $score;
|
|
|
$scoredlist[] = $heroId; # 玩家记录打分记录
|
|
|
$pubifno->scoredheros = $scoredlist; # 回存数据
|
|
|
- $req->mem->set(MemKey_User::Union_PublicState_normal($uid), $pubifno);
|
|
|
+ $pubifno->updateData(MemKey_User::Union_PublicState_hash($uid));
|
|
|
+
|
|
|
$req->mem->set(MemKey_GameRun::HeroDiscusses_userScore_normal($heroId), $heroscore);
|
|
|
$newscore = $heroscore->amt > 0 ? $heroscore->totalscore / $heroscore->amt : 0;
|
|
|
return Resp::ok(array('err' => 0, # # 返回
|