Commit c227e542 authored by clone's avatar clone

看铺列表,

parent ed84a374
......@@ -3,6 +3,7 @@
namespace app\api\controller;
use app\api\extend\Basic;
use app\model\Applies;
use app\model\AppointWatchShop;
use app\model\HouseInfos;
use think\helper\Time;
......@@ -22,6 +23,7 @@ class AppointmentTime extends Basic
protected $appointmentTimeModel;
protected $houseInfoModel;
protected $dbImg;
protected $appliesModel;
function __construct($request = null)
{
......@@ -29,6 +31,7 @@ class AppointmentTime extends Basic
$this->appointmentTimeModel = new AppointWatchShop();
$this->houseInfoModel = new HouseInfos();
$this->dbImg = new HouseImgs();
$this->appliesModel = new Applies();
}
/**
......@@ -66,25 +69,24 @@ class AppointmentTime extends Basic
if (!isset($params["expect_time"]) || $params['expect_time'] <= time()) {
return $this->response("101", "预约时间为空,或者小于当前时间");
}
$addPrams =array(
'expect_time' => date("Y-m-d H:i:s", strtotime($params["expect_time"]/1000)),
$addPrams = array(
'expect_time' => date("Y-m-d H:i:s", strtotime($params["expect_time"] / 1000)),
'phone' => $params["phone"],
'house_title' => $params["house_title"],
'house_id' => $params["house_id"],
'appellation' => $params["appellation"],
'user_id' => $params["user_id"],
'create_time'=>date("Y-m-d H:i:s", time()),
'update_time' =>date("Y-m-d H:i:s", time())
'create_time' => date("Y-m-d H:i:s", time()),
'update_time' => date("Y-m-d H:i:s", time())
);
$result = $this->appointmentTimeModel->insertAppointWatchShop($addPrams);
if ($result["code"] == 200) {
return $this->response("200", "数据保存成功", $result["msg"]);
}else{
} else {
return $this->response("101", "数据保存失败");
}
}
/**查询预约看铺列表
......@@ -93,32 +95,58 @@ class AppointmentTime extends Basic
*/
public function getAppointmentSeeShopList()
{
/* $params = array(
/* $params = array(
"status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2
"user_id" => "1",//对应u_users表
"phone" => "18112347151",//phone
"pageNo" => "1",
"pageSize" => 15
);*/
$params = $this->params;
$field = "id,user_id,agents_id,house_id,house_title,appellation,phone,expect_time,other_require,status,
is_cancel,is_evaluate,create_time";
$where_ = [];
if (!isset($params["status"])) {
return $this->response("101", "请求状态不能为空");
}
if (!isset($params["user_id"])) {
return $this->response("101", "请求用户不能为空");
}
if (!isset($params["phone"])) {
return $this->response("101", "请求用户手机号不能为空");
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if ($params["status"] == 1) {
$result = $this->getWaitList($pageNo, $pageSize, $params);
} elseif ($params["status"] == 2) {
$result = $this->getYetList($pageNo, $pageSize, $params);
}
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "此条件没有找到数据");
}
}
/**
* 待看列表
* @param $pageNo
* @param $pageSize
* @param $params
* @return mixed
*/
public function getWaitList($pageNo, $pageSize, $params)
{
$field = "id,agents_id,house_id,house_title,phone,expect_time,is_evaluate";
$where_["status"] = array( "eq", $params["status"] );
$where_["status"] = array( "in", array( "0,1" ) );
$where_["user_id"] = array( "eq", $params["user_id"] );
$result = $this->appointmentTimeModel->getAppointWatchShopList($pageNo, $pageSize, "id desc", $field, $where_);
......@@ -129,17 +157,39 @@ class AppointmentTime extends Basic
$param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
$houseInfo = $this->houseInfoModel->getHouseDetail("room_num_left", array("id"=>$val["house_id"]));
$houseInfo = $this->houseInfoModel->getHouseDetail("room_num_left", array( "id" => $val["house_id"] ));
$result[$key]["room_num_left"] = $houseInfo["room_num_left"];
}
return $result;
}
/**
* 已看列表
* @param $pageNo
* @param $pageSize
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getYetList($pageNo, $pageSize, $params)
{
$field = "a.id,a.phpone as phone,a.agent_id as agents_id,a.receptiontime as expect_time,a.house_id,b.title as house_title,b.room_num_left,IFNULL(1,1) as is_evaluate";
$where_["a.receptiontime"] = array( "neq", "null" );
$where_["a.phpone"] = array( "eq", $params["phone"] );
$result = $this->appliesModel->getAppliesList($pageNo, $pageSize, "a.id desc", $field, $where_);
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "此条件没有找到数据");
}
//todo 是否评价
return $result;
}
......
......@@ -19,7 +19,7 @@
</h1>
</div>
<div class="loginbox">
<form action="{{ constant('BASE_URL') }}/user/verification" method="post">
<form action="" method="post">
<div class="input-icon">
<input class="input-block" type="text" id="username" name="username" autofocus placeholder="请输入用户名" maxlength="16" required>
</div>
......@@ -27,7 +27,7 @@
<input class="input-block" type="password" id="passwd" name="passwd" placeholder="请输入登录密码" maxlength="16" required>
</div>
<div class="center">
<button type="submit" style="background: #fff;">立即登陆</button>
<button type="submit" style="background: #87b1ff;">立即登陆</button>
</div>
</form>
</div>
......
......@@ -6,5 +6,19 @@ use think\Model;
class Applies extends Model
{
//
protected $table = 'applies';
public function getAppliesList($pageNo, $pageSize, $order_, $field,$params){
return $this
->field($field)
->alias("a")
->join('houseinfos b','a.house_id = b.id' ,'LEFT')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
}
......@@ -20,7 +20,6 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
$ ('#modal-add-do').on ('show.bs.modal', function () {
$ ("#editor_modal_title").html ("编辑广告");
});
$ ("#save_banner").click (function () {
......
!(function () {
$(window).on('load', function () {
console.log(1);
$('.loginbox').addClass('active');
$ (window).on ('load', function () {
console.log (1);
$ ('.loginbox').addClass ('active');
});
//Forked from http://andreasstorm.com/
//Made by Bogden
//CANVAS
$(function () {
var canvas = document.querySelector('canvas'),
ctx = canvas.getContext('2d');
$ (function () {
var canvas = document.querySelector ('canvas'),
ctx = canvas.getContext ('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
ctx.lineWidth = .3;
ctx.strokeStyle = (new Color(150)).style;
ctx.strokeStyle = (new Color (150)).style;
var mousePosition = {
x: 30 * canvas.width / 200,
......@@ -28,65 +24,65 @@
array: []
};
function colorValue(min) {
return Math.floor(Math.random() * 255 + min);
function colorValue (min) {
return Math.floor (Math.random () * 255 + min);
}
function createColorStyle(r, g, b) {
function createColorStyle (r, g, b) {
return 'rgba(' + r + ',' + g + ',' + b + ', 0.8)';
}
function mixComponents(comp1, weight1, comp2, weight2) {
function mixComponents (comp1, weight1, comp2, weight2) {
return (comp1 * weight1 + comp2 * weight2) / (weight1 + weight2);
}
function averageColorStyles(dot1, dot2) {
function averageColorStyles (dot1, dot2) {
var color1 = dot1.color,
color2 = dot2.color;
var r = mixComponents(color1.r, dot1.radius, color2.r, dot2.radius),
g = mixComponents(color1.g, dot1.radius, color2.g, dot2.radius),
b = mixComponents(color1.b, dot1.radius, color2.b, dot2.radius);
return createColorStyle(Math.floor(r), Math.floor(g), Math.floor(b));
var r = mixComponents (color1.r, dot1.radius, color2.r, dot2.radius),
g = mixComponents (color1.g, dot1.radius, color2.g, dot2.radius),
b = mixComponents (color1.b, dot1.radius, color2.b, dot2.radius);
return createColorStyle (Math.floor (r), Math.floor (g), Math.floor (b));
}
function Color(min) {
function Color (min) {
min = min || 0;
this.r = colorValue(min);
this.g = colorValue(min);
this.b = colorValue(min);
this.style = createColorStyle(this.r, this.g, this.b);
this.r = colorValue (min);
this.g = colorValue (min);
this.b = colorValue (min);
this.style = createColorStyle (this.r, this.g, this.b);
}
function Dot() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
function Dot () {
this.x = Math.random () * canvas.width;
this.y = Math.random () * canvas.height;
this.vx = -.5 + Math.random();
this.vy = -.5 + Math.random();
this.vx = -.5 + Math.random ();
this.vy = -.5 + Math.random ();
this.radius = Math.random() * 2;
this.radius = Math.random () * 2;
this.color = new Color();
this.color = new Color ();
//console.log(this);
}
Dot.prototype = {
draw: function () {
ctx.beginPath();
ctx.beginPath ();
ctx.fillStyle = this.color.style;
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);
ctx.fill();
ctx.arc (this.x, this.y, this.radius, 0, Math.PI * 2, false);
ctx.fill ();
}
};
function createDots() {
function createDots () {
for (i = 0; i < dots.nb; i++) {
dots.array.push(new Dot());
dots.array.push (new Dot ());
}
}
function moveDots() {
function moveDots () {
for (i = 0; i < dots.nb; i++) {
var dot = dots.array[i];
......@@ -104,7 +100,7 @@
}
}
function connectDots() {
function connectDots () {
for (i = 0; i < dots.nb; i++) {
for (j = 0; j < dots.nb; j++) {
i_dot = dots.array[i];
......@@ -112,45 +108,45 @@
if ((i_dot.x - j_dot.x) < dots.distance && (i_dot.y - j_dot.y) < dots.distance && (i_dot.x - j_dot.x) > -dots.distance && (i_dot.y - j_dot.y) > -dots.distance) {
if ((i_dot.x - mousePosition.x) < dots.d_radius && (i_dot.y - mousePosition.y) < dots.d_radius && (i_dot.x - mousePosition.x) > -dots.d_radius && (i_dot.y - mousePosition.y) > -dots.d_radius) {
ctx.beginPath();
ctx.strokeStyle = averageColorStyles(i_dot, j_dot);
ctx.moveTo(i_dot.x, i_dot.y);
ctx.lineTo(j_dot.x, j_dot.y);
ctx.stroke();
ctx.closePath();
ctx.beginPath ();
ctx.strokeStyle = averageColorStyles (i_dot, j_dot);
ctx.moveTo (i_dot.x, i_dot.y);
ctx.lineTo (j_dot.x, j_dot.y);
ctx.stroke ();
ctx.closePath ();
}
}
}
}
}
function drawDots() {
function drawDots () {
for (i = 0; i < dots.nb; i++) {
var dot = dots.array[i];
dot.draw();
dot.draw ();
}
}
function animateDots() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
moveDots();
connectDots();
drawDots();
function animateDots () {
ctx.clearRect (0, 0, canvas.width, canvas.height);
moveDots ();
connectDots ();
drawDots ();
requestAnimationFrame(animateDots);
requestAnimationFrame (animateDots);
}
$('canvas').on('mousemove', function (e) {
$ ('canvas').on ('mousemove', function (e) {
mousePosition.x = e.pageX;
mousePosition.y = e.pageY;
});
$('canvas').on('mouseleave', function (e) {
$ ('canvas').on ('mouseleave', function (e) {
mousePosition.x = canvas.width / 2;
mousePosition.y = canvas.height / 2;
});
createDots();
requestAnimationFrame(animateDots);
createDots ();
requestAnimationFrame (animateDots);
});
})();
\ No newline at end of file
}) ();
\ 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