Commit bd35380f authored by zw's avatar zw

个人中心升级看铺数

parent 3bc55dff
...@@ -5,6 +5,7 @@ namespace app\api_broker\service; ...@@ -5,6 +5,7 @@ namespace app\api_broker\service;
use app\extra\RedisExt; use app\extra\RedisExt;
use app\model\AAgents; use app\model\AAgents;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\SystemConfig;
use think\Log; use think\Log;
/** /**
...@@ -20,6 +21,7 @@ class LookShopService ...@@ -20,6 +21,7 @@ class LookShopService
private $nowTime; private $nowTime;
private $gHousesToAgentsModel; private $gHousesToAgentsModel;
private $agentsModel; private $agentsModel;
private $systemConfigModel;
const LOOK_SHOP = "look_shop_";//存入已看的楼盘id const LOOK_SHOP = "look_shop_";//存入已看的楼盘id
const LOOK_TOTAL = "look_total_";//记录每个经纪人的看铺总数 const LOOK_TOTAL = "look_total_";//记录每个经纪人的看铺总数
...@@ -30,6 +32,7 @@ class LookShopService ...@@ -30,6 +32,7 @@ class LookShopService
$this->nowTime = date("Y-m-d", time()); $this->nowTime = date("Y-m-d", time());
$this->gHousesToAgentsModel = new GHousesToAgents(); $this->gHousesToAgentsModel = new GHousesToAgents();
$this->agentsModel = new AAgents(); $this->agentsModel = new AAgents();
$this->systemConfigModel = new SystemConfig();
} }
...@@ -107,13 +110,20 @@ class LookShopService ...@@ -107,13 +110,20 @@ class LookShopService
* 判断是否可以继续看铺,返回剩余数量 * 判断是否可以继续看铺,返回剩余数量
* @param int $agent_id * @param int $agent_id
* @return int * @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function isLookShop(int $agent_id): int public function isLookShop(int $agent_id): int
{ {
$lookNum = 0; $lookNum = 50;//默认50看铺数量
if (!$this->redis->get("lookNum")) { if (!$this->redis->get("lookNum")) {
$lookNum = 5;//数据库查询 //数据库查询
$data = $this->systemConfigModel->getSetting(["config_type"=>40], "rule");
if ($data && $data["agent_shop_num"] > 0) {
$lookNum = $data["agent_shop_num"];
}
$this->redis->set("lookNum", $lookNum); $this->redis->set("lookNum", $lookNum);
}else{ }else{
$lookNum = $this->redis->get("lookNum"); $lookNum = $this->redis->get("lookNum");
......
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