Commit 2c481061 authored by zw's avatar zw

bug

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