Commit efda913b authored by clone's avatar clone

查询均量

parent 42740e38
<?php <?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2017/12/7
* Time : 15:16
* Intro: c端首页资源 banner 月均价 上周成交量
*/
namespace app\api\controller; namespace app\api\controller;
use app\index\model\Agents; use app\api\extend\Basic;
use think\Controller; use app\model\HouseInfos;
use think\Request;
class Index extends Controller class Index extends Basic
{ {
/** public function banner(){
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/** }
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/** /**
* 显示编辑资源表单页. * 月均价 上周成交量
*
* @param int $id
* @return \think\Response
*/ */
public function edit($id) public function averagePriceAndTurnover(){
{
//
}
/** $HouseInfos = new HouseInfos();
* 保存更新的资源 $result = $HouseInfos->getAveragePrice();
* return $result;
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/** }
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
} }
...@@ -15,11 +15,12 @@ use app\model\HouseInfos; ...@@ -15,11 +15,12 @@ use app\model\HouseInfos;
class Shop extends Basic class Shop extends Basic
{ {
/** 获取商铺列表 /**
* @param $params * @return \think\Response
*/ */
public function getShopList() public function getShopList()
{ {
echo define(AAA);exit;
$params = array( $params = array(
"site_area" => 2, //来源 1首页 2搜索 "site_area" => 2, //来源 1首页 2搜索
"title" => "尚美", "title" => "尚美",
...@@ -33,8 +34,8 @@ class Shop extends Basic ...@@ -33,8 +34,8 @@ class Shop extends Basic
); );
$field = "id,agent_id,title,address,city,disc,disccircles,sales,yetai,room_area2,shangpu_type,is_test,room_num_left, $field = "id,agent_id,title,address,city,disc,disccircles,sales,yetai,room_area2,shangpu_type,is_test,
shangpu_tags,carefully_chosen,price"; room_num_left,shangpu_tags,carefully_chosen,price";
$conditions = []; $conditions = [];
if (empty($params['site_area'])) { if (empty($params['site_area'])) {
......
...@@ -7,27 +7,17 @@ ...@@ -7,27 +7,17 @@
*/ */
if(!function_exists('create_editor')){ if (!function_exists('create_editor')) {
function create_editor($id,$value='',$config=array()){ function create_editor($id, $value = '', $config = array())
// Include the CKEditor class. {
include_once "../public/resource/lib/Ckeditor/ckeditor.php"; include_once "../public/resource/lib/Ckeditor/ckeditor.php";
// Create a class instance. $CKEditor = new CKEditor('http://' . $_SERVER['HTTP_HOST'] . '/resource/lib/Ckeditor/');
$CKEditor = new CKEditor( 'http://' . $_SERVER['HTTP_HOST'] . '/resource/lib/Ckeditor/');
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
// Replace a textarea element with an id (or name) of "editor1".
$_config['filebrowserBrowseUrl'] = '/resource/lib/Ckfinder/ckfinder.html'; $_config['filebrowserBrowseUrl'] = '/resource/lib/Ckfinder/ckfinder.html';
$_config['filebrowserImageBrowseUrl'] = '/resource/lib/Ckfinder/ckfinder.html?Type=Images'; $_config['filebrowserImageBrowseUrl'] = '/resource/lib/Ckfinder/ckfinder.html?Type=Images';
//$_config['filebrowserUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; if (!empty($config)) {
//$_config['filebrowserImageUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; $_config = array_merge($_config, $config);
if(!empty($config)){
$_config = array_merge($_config,$config);
} }
$CKEditor->editor("describe",$value,$_config); $CKEditor->editor("describe", $value, $_config);
//$CKEditor->replace("describe");
} }
} }
\ No newline at end of file
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com> // | Author: liu21st <liu21st@gmail.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
return [ return [
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 应用设置 // | 应用设置
......
...@@ -15,7 +15,16 @@ class HouseInfos extends Model ...@@ -15,7 +15,16 @@ class HouseInfos extends Model
$this->dbHouseInfo = Db::table($this->table); $this->dbHouseInfo = Db::table($this->table);
} }
function getHouseInfoList($pageNo = 1, $pageSize = 15, $order_ = 'id desc' , $field, $params) /**
* 获取商铺列表
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
function getHouseInfoList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params)
{ {
return $data = $this->dbHouseInfo return $data = $this->dbHouseInfo
->field($field) ->field($field)
...@@ -27,4 +36,21 @@ class HouseInfos extends Model ...@@ -27,4 +36,21 @@ class HouseInfos extends Model
} }
function getAveragePrice()
{//price
$params['rent_type'] = array( "eq", 1 ); //月租金类型
$params['room_num_left'] = array("<>",0);//剩余店铺为0的不算
$sumPrice = $this->dbHouseInfo
->where($params)
->sum("price");
$count_ = $this->dbHouseInfo
->field("id")
->where($params)
->count("id");
$averagePrice = ceil($sumPrice / $count_);
return $averagePrice;
}
} }
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