Commit 08ebc110 authored by zw's avatar zw

bug

parent 41ea3703
...@@ -26,6 +26,7 @@ class LookShopService ...@@ -26,6 +26,7 @@ class LookShopService
private $systemConfigModel; private $systemConfigModel;
const LOOK_SHOP = "look_shop_";//存入已看的楼盘id const LOOK_SHOP = "look_shop_";//存入已看的楼盘id
const LOOK_TOTAL = "look_total_";//记录每个经纪人的看铺总数 const LOOK_TOTAL = "look_total_";//记录每个经纪人的看铺总数
const LOOK_UP_NUM = "look_up_num_";//记录每个经纪人的看铺升级次数
public function __construct() public function __construct()
{ {
...@@ -149,10 +150,10 @@ class LookShopService ...@@ -149,10 +150,10 @@ class LookShopService
if (!$this->redis->hExists($this->nowTime, $agent_id)) { //设置每个经纪人的看铺总数 if (!$this->redis->hExists($this->nowTime, $agent_id)) { //设置每个经纪人的看铺总数
$this->redis->hSet($this->nowTime, $agent_id, 0); //开始计数 $this->redis->hSet($this->nowTime, $agent_id, 0); //开始计数
$this->redis->hSet(self::LOOK_TOTAL . $this->nowTime, $agent_id, $lookNum);//总 $this->redis->hSet(self::LOOK_UP_NUM . $this->nowTime, $agent_id, 1);//初始次
} }
$agentLookNum = (int)$this->redis->hGet($this->nowTime, $agent_id); $agentLookNum = (int)$this->redis->hGet($this->nowTime, $agent_id);
$totalNum = (int)$this->redis->hGet(self::LOOK_TOTAL . $this->nowTime, $agent_id); $totalNum = $lookNum * (int)$this->redis->hGet(self::LOOK_UP_NUM . $this->nowTime, $agent_id);
Log::record('info ----look agentLookNum-------' . $agentLookNum, "info"); Log::record('info ----look agentLookNum-------' . $agentLookNum, "info");
Log::record('info ----look totalNum-------' . $totalNum, "info"); Log::record('info ----look totalNum-------' . $totalNum, "info");
if ($agentLookNum >= $totalNum) { //如果数量为大于等于总数 证明看铺达到上限 if ($agentLookNum >= $totalNum) { //如果数量为大于等于总数 证明看铺达到上限
...@@ -176,7 +177,7 @@ class LookShopService ...@@ -176,7 +177,7 @@ class LookShopService
} }
/** /**
* 升级经纪人看铺数量 * 升级经纪人看铺次数
* @param int $agent_id * @param int $agent_id
* @return bool * @return bool
*/ */
...@@ -185,10 +186,9 @@ class LookShopService ...@@ -185,10 +186,9 @@ class LookShopService
if(!$this->redis){ if(!$this->redis){
return false; return false;
} }
$agentNum = $this->redis->hGet(self::LOOK_TOTAL . $this->nowTime, $agent_id); $agentUpNum = $this->redis->hGet(self::LOOK_UP_NUM . $this->nowTime, $agent_id);
$lookNum = $this->redis->get("lookNum"); $upLookNum = (int)$agentUpNum + 1;
$upLookNum = (int)$lookNum + (int)$agentNum; $this->redis->hSet(self::LOOK_UP_NUM . $this->nowTime, $agent_id, $upLookNum);
$this->redis->hSet(self::LOOK_TOTAL . $this->nowTime, $agent_id, $upLookNum);
return true; return true;
} }
} }
\ No newline at end of file
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