Commit 2c481061 authored by zw's avatar zw

bug

parent 3c69e2e7
<?php <?php
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService; use app\api_broker\service\LookShopService;
use app\model\AAgents; use app\model\AAgents;
use app\model\SystemConfig;
use think\Request; use think\Request;
/** /**
...@@ -12,9 +15,11 @@ use think\Request; ...@@ -12,9 +15,11 @@ use think\Request;
* Time : 上午11:29 * Time : 上午11:29
* Intro: * Intro:
*/ */
class LookShop extends Basic{ class LookShop extends Basic
protected $lookShopService_ ; {
protected $lookShopService_;
protected $agentsModel; protected $agentsModel;
function __construct(Request $request = null) function __construct(Request $request = null)
{ {
parent::__construct($request); parent::__construct($request);
...@@ -26,23 +31,24 @@ class LookShop extends Basic{ ...@@ -26,23 +31,24 @@ class LookShop extends Basic{
* 升级经纪人的看铺数量 * 升级经纪人的看铺数量
* @return \think\Response * @return \think\Response
*/ */
public function setAgentLookNum(){ public function setAgentLookNum()
{
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"agent_id" => 1, "agent_id" => 1,
"submit_agent_id" => 1, "submit_agent_id" => 1,
);*/ );*/
if(!isset($params["agent_id"]) || !isset($params["submit_agent_id"])){ if (!isset($params["agent_id"]) || !isset($params["submit_agent_id"])) {
return $this->response("101","请求参数错误"); return $this->response("101", "请求参数错误");
} }
//todo 验证申请提交人和此经纪人是否是所属关系 //todo 验证申请提交人和此经纪人是否是所属关系
$is_ok = $this->lookShopService_->setAgentLookNum($params["agent_id"]); $is_ok = $this->lookShopService_->setAgentLookNum($params["agent_id"]);
if($is_ok){ if ($is_ok) {
return $this->response("200","request success",[]); return $this->response("200", "request success", []);
}else{ } else {
return $this->response("101","升级看铺数量失败"); return $this->response("101", "升级看铺数量失败");
} }
} }
...@@ -53,32 +59,42 @@ class LookShop extends Basic{ ...@@ -53,32 +59,42 @@ class LookShop extends Basic{
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getAgentsResidueNumList(){ public function getAgentsResidueNumList()
{
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"store_id" => 1, "store_id" => 1,
);*/ );*/
if(!isset($params["store_id"])){ if (!isset($params["store_id"])) {
return $this->response("101","请求参数错误"); return $this->response("101", "请求参数错误");
} }
$field = "id,store_id,level,name,phone,img"; $field = "id,store_id,level,name,phone,img";
$where_["store_id"] = $params["store_id"]; $where_["store_id"] = $params["store_id"];
$where_["status"] = 0; $where_["status"] = 0;
$where_["level"] = 10; $where_["level"] = 10;
$agentList = $this->agentsModel->getAgentById($field,$where_); $agentList = $this->agentsModel->getAgentById($field, $where_);
if(count($agentList) <= 0){ if (count($agentList) <= 0) {
return $this->response("101","request null"); return $this->response("101", "request null");
}
$systemConfigModel = new SystemConfig();
$lookNum = 0;
$data = $systemConfigModel->getSetting([ "config_type" => 40 ], "rule");
if ($data && $data["agent_shop_num"] > 0) {
$lookNum = $data["agent_shop_num"];
} }
foreach ($agentList as $key=>$item){
foreach ($agentList as $key => $item) {
$residue_num = $this->lookShopService_->isLookShop($item["id"]); $residue_num = $this->lookShopService_->isLookShop($item["id"]);
if($residue_num <= 0){ if ($residue_num <= 0) {
$agentList[$key]["is_show_button"] = true; $agentList[$key]["is_show_button"] = true;
}else{ } else {
$agentList[$key]["is_show_button"] = false; $agentList[$key]["is_show_button"] = false;
} }
} }
return $this->response("200","request success",$agentList); $result["look_num"] = $lookNum;
$result["list"] = $agentList;
return $this->response("200", "request success", $result);
} }
} }
\ No newline at end of file
...@@ -200,11 +200,11 @@ class Shop extends Basic ...@@ -200,11 +200,11 @@ class Shop extends Basic
public function getShopDetail() public function getShopDetail()
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
/*$params = array( $params = array(
"id" => 445, "id" => 4,
"site_area" => 3, //1.c端 3.b端 "site_area" => 3, //1.c端 3.b端
"user_id" => 2 //if c端 用户登录后传入user_id //"user_id" => 2 //if c端 用户登录后传入user_id
);*/ );
$params = $this->params; $params = $this->params;
$conditions = []; $conditions = [];
......
...@@ -563,12 +563,14 @@ class GHouses extends BaseModel ...@@ -563,12 +563,14 @@ class GHouses extends BaseModel
*/ */
public function getHouseDetailById($field, $params) public function getHouseDetailById($field, $params)
{ {
return Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join('g_houses_ext b', 'a.id=b.house_id', 'left') ->join('g_houses_ext b', 'a.id=b.house_id', 'left')
->where($params) ->where($params)
->find($params["a.id"]); ->find($params["a.id"]);
echo Db::table($this->table)->getLastSql();
return $result;
} }
/** /**
......
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