Commit 7ae25e78 authored by clone's avatar clone

Merge branch 'test'

# Conflicts: # application/api/controller/Member.php # application/database.php # application/index/controller/Member.php # application/index/view/global/navigation.html # application/index/view/member/users_list.html # application/model/Users.php # public/resource/js/user.js
parents 1644a806 6604a53d
...@@ -33,5 +33,23 @@ ...@@ -33,5 +33,23 @@
<arguments>1.0-name-matches-false-false-node_modules</arguments> <arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher> </matcher>
</filter> </filter>
<filter>
<id>1521081255881</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher>
</filter>
<filter>
<id>1522052779116</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher>
</filter>
</filteredResources> </filteredResources>
</projectDescription> </projectDescription>
...@@ -6,6 +6,8 @@ use app\api\extend\Basic; ...@@ -6,6 +6,8 @@ use app\api\extend\Basic;
use app\model\Applies; use app\model\Applies;
use app\model\AppointWatchShop; use app\model\AppointWatchShop;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use think\helper\Time; use think\helper\Time;
use app\model\HouseImgs; use app\model\HouseImgs;
...@@ -31,10 +33,11 @@ class AppointmentTime extends Basic ...@@ -31,10 +33,11 @@ class AppointmentTime extends Basic
{ {
parent::__construct($request); parent::__construct($request);
$this->appointmentTimeModel = new AppointWatchShop(); $this->appointmentTimeModel = new AppointWatchShop();
$this->houseInfoModel = new HouseInfos(); //$this->houseInfoModel = new HouseInfos();
$this->dbImg = new HouseImgs(); $this->houseInfoModel = new GHouses();
$this->appliesModel = new Applies(); $this->dbImg = new GHousesImgs();
$this->evaluateMode = new Evaluate(); $this->appliesModel = new Applies();
$this->evaluateMode = new Evaluate();
} }
/** /**
...@@ -44,15 +47,15 @@ class AppointmentTime extends Basic ...@@ -44,15 +47,15 @@ class AppointmentTime extends Basic
public function addAppointmentSeeShop() public function addAppointmentSeeShop()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"user_id" => 1, "user_id" => 116,
"house_id" => 1, "house_id" => 49,
"house_title" => "楼盘1", "house_title" => "楼盘1",
"appellation" => "张三", "appellation" => "张三",
"phone" => "13817616312", "phone" => "13817616312",
"expect_time" => time() + 1000, "expect_time" => time() + 1000,
"other_require" => "没有其他要求" "other_require" => "没有其他要求"
);*/ );*/
//todo 验证楼盘信息 //todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) { if (isset($params["house_id"]) && isset($params["house_title"])) {
...@@ -65,7 +68,7 @@ class AppointmentTime extends Basic ...@@ -65,7 +68,7 @@ class AppointmentTime extends Basic
return $this->response("101", "楼盘信息不能为空"); return $this->response("101", "楼盘信息不能为空");
} }
//todo 参数校验 //todo 参数校验
if (!isset($params["phone"]) || !preg_match('/1[345678]\d{9}/', $params["phone"])) { if (!isset($params["phone"]) || !preg_match('/^1[345678]\d{9}$/', $params["phone"])) {
return $this->response("101", "手机号为空或手机号无效"); return $this->response("101", "手机号为空或手机号无效");
} }
...@@ -73,14 +76,15 @@ class AppointmentTime extends Basic ...@@ -73,14 +76,15 @@ class AppointmentTime extends Basic
return $this->response("101", "预约时间为空,或者小于当前时间"); return $this->response("101", "预约时间为空,或者小于当前时间");
} }
$addPrams = array( $addPrams = array(
'expect_time' => date("Y-m-d H:i:s", $params["expect_time"] / 1000), 'expect_time' => date("Y-m-d H:i:s", $params["expect_time"] / 1000),
'phone' => $params["phone"], 'phone' => $params["phone"],
'house_title' => $params["house_title"], 'house_title' => $params["house_title"],
'house_id' => $params["house_id"], 'house_id' => $params["house_id"],
'appellation' => $params["appellation"], 'appellation' => $params["appellation"],
'user_id' => $params["user_id"], 'user_id' => $params["user_id"],
'create_time' => date("Y-m-d H:i:s", time()), 'other_require' => $params["other_require"],
'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); $result = $this->appointmentTimeModel->insertAppointWatchShop($addPrams);
if ($result["code"] == 200) { if ($result["code"] == 200) {
...@@ -98,13 +102,13 @@ class AppointmentTime extends Basic ...@@ -98,13 +102,13 @@ class AppointmentTime extends Basic
*/ */
public function getAppointmentSeeShopList() public function getAppointmentSeeShopList()
{ {
/* $params = array( /* $params = array(
"status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2 "status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2
"user_id" => "1",//对应u_users表 "user_id" => "122",//对应u_users表
"phone" => "18112347151",//phone "phone" => "17717536290",//phone
"pageNo" => "1", "pageNo" => "1",
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$params = $this->params; $params = $this->params;
...@@ -120,10 +124,11 @@ class AppointmentTime extends Basic ...@@ -120,10 +124,11 @@ class AppointmentTime extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$result = [];
if ($params["status"] == 1) { if ($params["status"] == 1) {
$result = $this->getWaitList($pageNo, $pageSize, $params); $result = $this->getWaitList($pageNo, $pageSize, $params);
} elseif ($params["status"] == 2) { } elseif ($params["status"] == 2) {
$result = $this->getYetList($pageNo, $pageSize, $params); $result = $this->getYetListV2($pageNo, $pageSize, $params);
} }
if (count($result) > 0) { if (count($result) > 0) {
...@@ -148,16 +153,17 @@ class AppointmentTime extends Basic ...@@ -148,16 +153,17 @@ class AppointmentTime extends Basic
$where_["status"] = array( "in", array( "0,1" ) ); $where_["status"] = array( "in", array( "0,1" ) );
$where_["user_id"] = array( "eq", $params["user_id"] ); $where_["user_id"] = array( "eq", $params["user_id"] );
$where_["applies_id"] = 0;
$result = $this->appointmentTimeModel->getAppointWatchShopList($pageNo, $pageSize, "id desc", $field, $where_); $result = $this->appointmentTimeModel->getAppointWatchShopList($pageNo, $pageSize, "id desc", $field, $where_);
//获取图片信息 //获取图片信息
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"]; $param["house_id"] = $val["house_id"];
$param["imgtype"] = 1; //默认主图 $param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1); $result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
$houseInfo = $this->houseInfoModel->getHouseDetails("a.room_num_left,b.foreign_name", array( "a.id" => $val["house_id"] )); $houseInfo = $this->houseInfoModel->getHouseDetail("residue_num as room_num_left,external_title as foreign_name", array( "id" => $val["house_id"] ));
$result[$key]["room_num_left"] = $houseInfo["room_num_left"]; $result[$key]["room_num_left"] = $houseInfo["room_num_left"];
$result[$key]["foreign_name"] = $houseInfo["foreign_name"]; $result[$key]["foreign_name"] = $houseInfo["foreign_name"];
...@@ -185,7 +191,35 @@ class AppointmentTime extends Basic ...@@ -185,7 +191,35 @@ class AppointmentTime extends Basic
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"]; $param["house_id"] = $val["house_id"];
$param["imgtype"] = 1; //默认主图 $param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
//todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
}
return $result;
}
/**
* 已看列表
* @param $pageNo
* @param $pageSize
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getYetListV2($pageNo, $pageSize, $params)
{
$field = "a.id,a.phone,c.reception_id as agents_id,c.create_time as expect_time,a.house_id,
d.external_title as house_title,d.residue_num as room_num_left";
$where_["a.user_id"] = $params["user_id"];
$result = $this->appointmentTimeModel->getHaveToSeeList($pageNo, $pageSize, "id desc", $field, $where_);
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1); $result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
//todo 是否评价 //todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]); $evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
......
...@@ -4,6 +4,7 @@ namespace app\api\controller; ...@@ -4,6 +4,7 @@ namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\AttentionModel; use app\model\AttentionModel;
use app\model\GHousesImgs;
use think\Request; use think\Request;
use app\model\HouseImgs; use app\model\HouseImgs;
...@@ -19,12 +20,14 @@ class AttentionShop extends Basic ...@@ -19,12 +20,14 @@ class AttentionShop extends Basic
protected $attentionModel; protected $attentionModel;
protected $dbImg; protected $dbImg;
protected $imgModel;
public function __construct($request = null) public function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->attentionModel = new AttentionModel(); $this->attentionModel = new AttentionModel();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->imgModel = new GHousesImgs();
} }
/** /**
...@@ -61,20 +64,20 @@ class AttentionShop extends Basic ...@@ -61,20 +64,20 @@ class AttentionShop extends Basic
*/ */
public function attentionList() public function attentionList()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"user_id" => 47, "user_id" => 816,
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15, "pageSize" => 15,
);*/ );*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$order_ = 'a.create_time desc'; $order_ = 'a.create_time desc';
//b.room_num_left 前端显示已下架,不可点击到详情 //b.room_num_left 前端显示已下架,不可点击到详情
$field = "a.id,a.house_id,b.title,b.room_area,b.room_area2,b.price,b.shangpu_tags,b.shangpu_type,b.room_num_left $field = "a.id,a.house_id,b.external_title as title,b.shop_area_start as room_area,b.shop_area_end as room_area2,b.rent_price as price,
,b.rent_type,c.foreign_name"; b.shop_sign as shangpu_tags,b.shop_type as shangpu_type,b.residue_num as room_num_left,b.rent_type";
if (!isset($params["user_id"])) { if (!isset($params["user_id"])) {
return $this->response("101", "用户id不能为空"); return $this->response("101", "用户id不能为空");
...@@ -88,12 +91,11 @@ class AttentionShop extends Basic ...@@ -88,12 +91,11 @@ class AttentionShop extends Basic
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$imgParam["house_id"] = $val["house_id"]; $imgParam["house_id"] = $val["house_id"];
$imgParam["imgtype"] = 1; //默认主图 $imgParam["img_type"] = 1; //默认主图
$imgArr = $this->dbImg->getHouseImages($imgParam, 1); $imgArr = $this->imgModel->getHouseImages($imgParam, 1);
$result[$key]["images"] = $imgArr; $result[$key]["images"] = $imgArr;
} }
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
......
...@@ -31,13 +31,27 @@ class Banner extends Basic ...@@ -31,13 +31,27 @@ class Banner extends Basic
*/ */
public function getBannerList() public function getBannerList()
{ {
$params = $this->params;
/*$params = array(
"site_area" => 1,//1表示c端 2表示b端
);*/
$where_ = [];
if(!isset($params["site_area"])){
return $this->response("101","请求参数错误");
}
if($params["site_area"] == 1){
$where_["type"] = array("in",[0,1]);
}else{
$where_["type"] = array("in",[2,3]);
}
$field = "id,title,CONCAT('".CK_IMG_URL."' , pic_path) as pic_path, url, type,sort,is_show,create_time,update_time"; $field = "id,title,CONCAT('".CK_IMG_URL."' , pic_path) as pic_path, url, type,sort,is_show,create_time,update_time";
$params['is_show'] = array( "eq", 0 ); $where_['is_show'] = array( "eq", 0 );
$result = $this->bannerModel $result = $this->bannerModel
->getBannerList(1, 15, "sort desc", $field, $params); ->getBannerList(1, 15, "sort desc", $field, $where_);
// $jwt = new JwtUntils();
// $data['is_login'] = '0'; //0未登录
// $result['AuthToken'] = $jwt->createToken($data);
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace app\api\controller; namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\api_broker\service\PushMessageService;
use app\model\AAgents;
use app\model\Agents; use app\model\Agents;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\EvaluateSign; use app\model\EvaluateSign;
...@@ -10,7 +12,7 @@ use app\model\Remarks; ...@@ -10,7 +12,7 @@ use app\model\Remarks;
/** /**
* Description of Agents * Description of Agents
* *
* @user :hujun * @user :hu jun
* @date :2017-12-11 * @date :2017-12-11
* @time :11:15:05 * @time :11:15:05
* Intro : * Intro :
...@@ -18,32 +20,46 @@ use app\model\Remarks; ...@@ -18,32 +20,46 @@ use app\model\Remarks;
class Broker extends Basic{ class Broker extends Basic{
/** /**
* 获取当前商铺或街铺的经纪人 * 咨询经纪人
* *
* @return type * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function index() { public function index() {
$params = $this->params; $params = $this->params;
$data['status'] = 101; $data['status'] = 101;
$data['data'] = array(); $data['data'] = [];
$data['msg'] = '';
if ($params['house_id']) { if ($params['house_id']) {
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? PAGESIZE : $params['pageSize']; $pageSize = empty($params['pageSize']) ? PAGESIZE : $params['pageSize'];
$agents = new Agents();
$data['msg'] = '';
$fields = 'a.id,realname,phone,COUNT(b.id) evaluate,sum(evaluate_grade) as evaluate_grade,a.head_portrait';
$list = $agents->getUser($pageNo, $pageSize, 'evaluate desc', $fields, '', $params['house_id']);
if ($list) { $agents = new AAgents();
foreach ($list as $k=>$v) {
$v->head_portrait = ADMIN_URL_TL.'user_header/'.$v->head_portrait; $fields = 'a.id,name,phone,COUNT(b.id) evaluate,sum(evaluate_grade) as evaluate_grade,a.img';
$list[$k] = $v->toArray();
$agent_client = 0;
if (!empty($this->userId) && ($this->params['source'] != 'B-APP')) {
$agent_client = $agents->getAgentClient($fields, ['c.id'=>$this->userId]);
}
$where['c.houses_id'] = $params['house_id'];
$where['c.is_del'] = 0;
$list = $agents->getUser($pageNo, $pageSize, 'evaluate desc', $fields, $where);
if (!empty($agent_client['id'])) {
array_unshift($list, $agent_client);
}
if (!empty($list)) {
foreach ($list as $k=>$v) {
$v['head_portrait'] = AGENTHEADERIMGURL.$v['img'];
if ($list[$k]['evaluate_grade']) { if ($list[$k]['evaluate_grade']) {
$evaluate_grade = floor(($list[$k]['evaluate_grade']/2)/$list[$k]['evaluate']); $evaluate_grade = floor(($list[$k]['evaluate_grade']/2)/$list[$k]['evaluate']);
$evaluate_grade = $evaluate_grade;
} else { } else {
$evaluate_grade = 0; $evaluate_grade = 0;
} }
...@@ -59,13 +75,15 @@ class Broker extends Basic{ ...@@ -59,13 +75,15 @@ class Broker extends Basic{
} else { } else {
$data['msg'] = 'house_id 为空'; $data['msg'] = 'house_id 为空';
} }
return $this->response($data['status'], $data['msg'], $data['data'] ); return $this->response($data['status'], $data['msg'], $data['data'] );
} }
/** /**
* 评价经纪人 * 评价经纪人
* *
* @return type * @return \think\Response
* @throws \Exception
*/ */
public function appraiser() { public function appraiser() {
$params = $this->params; $params = $this->params;
...@@ -187,11 +205,14 @@ class Broker extends Basic{ ...@@ -187,11 +205,14 @@ class Broker extends Basic{
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
/** /**
* 经纪人详情 * 经纪人详情
* *
* @return type * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function brokerDetail() { public function brokerDetail() {
...@@ -209,4 +230,11 @@ class Broker extends Basic{ ...@@ -209,4 +230,11 @@ class Broker extends Basic{
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
public function testtest() {
$push = new PushMessageService();
// $push->pushReportMessage(2362,3670,1);
// $push->pushMarchInMessage(26964);
$push->pushBargainCommissionMessage('小杨-业务员',3, 15539);
}
} }
This diff is collapsed.
<?php <?php
namespace app\api\controller;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User : zw * User : zw
...@@ -6,11 +7,13 @@ ...@@ -6,11 +7,13 @@
* Time : 15:16 * Time : 15:16
* Intro: c端首页资源 月均价 上周成交量 * Intro: c端首页资源 月均价 上周成交量
*/ */
namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\GHouses;
use app\model\HouseInfos; use app\model\HouseInfos;
use app\model\JournalAccounts; use app\model\JournalAccounts;
use app\model\OrderModel;
class Index extends Basic class Index extends Basic
{ {
...@@ -23,9 +26,10 @@ class Index extends Basic ...@@ -23,9 +26,10 @@ class Index extends Basic
*/ */
public function averagePriceAndTurnover(){ public function averagePriceAndTurnover(){
$houseInfos = new HouseInfos(); $houseInfos = new GHouses();
$averagePrice = $houseInfos->getAveragePrice(); $averagePrice = $houseInfos->getAveragePrice();
$journalAccounts = new JournalAccounts(); // $journalAccounts = new JournalAccounts();
$journalAccounts = new OrderModel();
$turnover = $journalAccounts ->getTurnover(); $turnover = $journalAccounts ->getTurnover();
$result['averagePrice'] = $averagePrice; $result['averagePrice'] = $averagePrice;
$result['turnover'] = $turnover; $result['turnover'] = $turnover;
......
This diff is collapsed.
<?php
namespace app\api\controller;
use app\extra\RedisExt;
use think\cache\driver\Redis;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/20
* Time : 11:01
* Intro:
*/
class RedisController
{
public function index()
{
$Redis = RedisExt::getRedis();
$Redis->set("test", "test");
echo $Redis->get("test");
}
}
\ No newline at end of file
...@@ -11,6 +11,7 @@ namespace app\api\controller; ...@@ -11,6 +11,7 @@ namespace app\api\controller;
*/ */
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\AttentionModel; use app\model\AttentionModel;
use app\model\GLabels;
use app\model\HouseImgs; use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use app\model\Labels; use app\model\Labels;
...@@ -27,7 +28,7 @@ class Shop extends Basic ...@@ -27,7 +28,7 @@ class Shop extends Basic
parent::__construct($request); parent::__construct($request);
$this->db = new HouseInfos(); $this->db = new HouseInfos();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->labels = new Labels(); $this->labels = new GLabels();
$this->attentionModel = new AttentionModel(); $this->attentionModel = new AttentionModel();
} }
...@@ -235,7 +236,7 @@ class Shop extends Basic ...@@ -235,7 +236,7 @@ class Shop extends Basic
} }
} }
} }
$result['yetai'] = array( '全部', '餐饮美食', '零售', '休闲娱乐', '其他' ); $result['yetai'] = array( '全部', '餐饮美食', '百货零售', '休闲娱乐', '其他' );
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万) //租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array( array( 'id' => '-1', 'value' => '全部' ), array( 'id' => '0', 'value' => '3万以上' ), $result['money'] = array( array( 'id' => '-1', 'value' => '全部' ), array( 'id' => '0', 'value' => '3万以上' ),
......
...@@ -7,6 +7,7 @@ use app\model\Evaluate; ...@@ -7,6 +7,7 @@ use app\model\Evaluate;
use app\model\HouseImgs; use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use app\model\JournalAccounts; use app\model\JournalAccounts;
use app\model\OrderModel;
use app\model\SubletModel; use app\model\SubletModel;
/** /**
...@@ -20,6 +21,7 @@ class TradeLog extends Basic ...@@ -20,6 +21,7 @@ class TradeLog extends Basic
{ {
protected $journalAccountsMode; protected $journalAccountsMode;
protected $orderModel;
protected $dbImg; protected $dbImg;
protected $evaluateMode; protected $evaluateMode;
protected $houseInfoModel; protected $houseInfoModel;
...@@ -29,6 +31,7 @@ class TradeLog extends Basic ...@@ -29,6 +31,7 @@ class TradeLog extends Basic
{ {
parent::__construct($request); parent::__construct($request);
$this->journalAccountsMode = new JournalAccounts(); $this->journalAccountsMode = new JournalAccounts();
$this->orderModel = new OrderModel();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->houseInfoModel = new HouseInfos(); $this->houseInfoModel = new HouseInfos();
$this->evaluateMode = new Evaluate(); $this->evaluateMode = new Evaluate();
...@@ -89,4 +92,49 @@ class TradeLog extends Basic ...@@ -89,4 +92,49 @@ class TradeLog extends Basic
} }
public function getTradeListV2(){
$params = $this->params;
/* $params = array(
"user_id" => "4",
"pageNo" => 1,
"pageSize" => 15,
);*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if (!isset($params["user_id"])) {
return $this->response("101", "userId不能为空");
}
$order_ = 'a.created desc';
$field = "min(a.id) as id,a.tradecode,a.created as singntime,b.phpone,b.house_id,b.agent_id";
$result = $this->journalAccountsMode->getJournalAccountsList($pageNo, $pageSize, $order_, $field, $params);
if (count($result) <= 0) {
return $this->response("200", "请求数据为空");
}
foreach ($result as $key => $val) {
$houseInfo = $this->houseInfoModel->getHouseDetails("a.room_num_left,b.foreign_name", array( "a.id" => $val["house_id"] ));
$result[$key]["room_num_left"] = $houseInfo["room_num_left"];
$result[$key]["foreign_name"] = $houseInfo["foreign_name"];
$result[$key]["api_path"] = IMG_PATH;
$imgParam["house_id"] = $val["house_id"];
$imgParam["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($imgParam, 1);
$evaluateResult = $this->evaluateMode->getIsEvaluate(20, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
//todo 是否以上架
$subParam["user_id"] = $params["user_id"];
$subParam["house_id"] = $val["house_id"];
$subletResult = $this->subletModel->getSubletByHoseId($subParam);
if (count($subletResult) > 0) {
$result[$key]["is_added"] = $subletResult[0]["status"];
} else {
$result[$key]["is_added"] = -1;
}
}
return $this->response("200", "request", $result);
}
} }
\ No newline at end of file
This diff is collapsed.
...@@ -14,6 +14,8 @@ use think\Controller; ...@@ -14,6 +14,8 @@ use think\Controller;
use think\Request; use think\Request;
use think\Response; use think\Response;
use Qiniu; use Qiniu;
use UnexpectedValueException;
use InvalidArgumentException;
class Basic extends Controller class Basic extends Controller
{ {
...@@ -48,7 +50,10 @@ class Basic extends Controller ...@@ -48,7 +50,10 @@ class Basic extends Controller
"api/getBroker", "api/getBroker",
"api/brokerDetail", "api/brokerDetail",
"api/commentAndDeal", "api/commentAndDeal",
"api/check_code" "api/check_code",
"api/convertOrderByTime",
"api/convertMarchIn",
"api/convertCollectingBill",
); );
/** /**
...@@ -69,18 +74,28 @@ class Basic extends Controller ...@@ -69,18 +74,28 @@ class Basic extends Controller
} }
if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) { if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT(); $jwt = new \Firebase\JWT\JWT();
try {
$result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} catch( UnexpectedValueException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken parameter error!", "data" => [], "type" => "json" ));
exit;
} catch( InvalidArgumentException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken parameter error!", "data" => [], "type" => "json" ));
exit;
}
$this->authToken = $this->params['AuthToken']; $this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result->data->id; $this->userId = $result->data->id;
$this->phone = $result->data->phone; $this->phone = $result->data->phone;
$this->userNick = $result->data->userNick; $this->userNick = isset($result->data->userNick) ? $result->data->userNick : "";
$this->timeStamp_ = $result->timeStamp_; $this->timeStamp_ = $result->timeStamp_;
} }
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1]; $requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口 //过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) { if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify(); ///$this->tokenVerify();
} }
} }
......
...@@ -123,22 +123,24 @@ class GeTuiUntils { ...@@ -123,22 +123,24 @@ class GeTuiUntils {
return $template; return $template;
} }
/** /**
* 对某个人推送消息-公共 * 对某个人推送消息-公共
* *
* zhuwei
*
* 2017-11-07 10:31:27 * 2017-11-07 10:31:27
* @author zhuwei
* @param $id
* @param $device_id
* @param $title
* @param $content
* @return array|void
*/ */
function public_push_message_for_one($id, $device_id, $title, $content) function public_push_message_for_one($id, $device_id, $title, $content)
{ {
$homeurl = $this->http_host(); $home_url = $this->http_host();
$data['agent_id'] =$id; $data['agent_id'] = $id;
$data['black_title'] = $title; $data['black_title'] = $title;
$data['content'] = $content; $data['content'] = $content;
$data['device_id'] = $device_id; $data['device_id'] = $device_id;
$data['touchuan'] = json_encode(array( $data['touchuan'] = json_encode(array(
'title' => $title, 'title' => $title,
'content' => $content, 'content' => $content,
...@@ -146,11 +148,10 @@ class GeTuiUntils { ...@@ -146,11 +148,10 @@ class GeTuiUntils {
'url' => '', 'url' => '',
'name' => $title, 'name' => $title,
'id' => '69', 'id' => '69',
'imageUrl' => $homeurl .'notice_android_logo.png')); 'imageUrl' => $home_url .'notice_android_logo.png'));
return $this->push_message_for_one($data); return $this->push_message_for_one($data);
} }
public function http_host() public function http_host()
{ {
$http_type = $http_type =
......
...@@ -7,27 +7,40 @@ use Endroid\QrCode\QrCode; ...@@ -7,27 +7,40 @@ use Endroid\QrCode\QrCode;
* @author fuju * @author fuju
*/ */
class GenerateCodeUntils { class GenerateCodeUntils {
/** /**
* 生成二维码 * 生成二维码
* *
* @param type $param * @param $param
* @param $file_name
* @param int $type
* @return string
* @throws \Endroid\QrCode\Exception\InvalidPathException
* @throws \Endroid\QrCode\Exception\InvalidWriterException
*/ */
public function getCode($param, $file_name) { public function getCode($param, $file_name, $type = 1) {
$path = 'static'.DS.'qrcode'.DS.date(Ymd); $path = 'static'.DS.'qrcode'.DS.date('Ymd');
if (!file_exists($path)) { if (!file_exists($path)) {
mkdir($path, 0777); mkdir($path, 0777);
} }
$qrCode = new QrCode($param); $qrCode = new QrCode($param);
$qrCode->setSize(300); $qrCode->setSize(400);
$qrCode->setWriterByName('png'); $qrCode->setWriterByName('png');
$qrCode->setMargin(10); $qrCode->setMargin(10);
$qrCode->setEncoding('UTF-8'); $qrCode->setEncoding('UTF-8');
$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0]); $qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0]);
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255]); $qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255]);
$qrCode->setValidateResult(false); $qrCode->setValidateResult(false);
$path = $path.DS.$file_name.'.png'; if ($type == 2) {
$qrCode->setLogoPath(ROOT_PATH.'/public/static/qrcode/agent_app_logo.png');
$qrCode->setLogoWidth(80);
$qrCode->setValidateResult(false);
$path = $path.DS.$file_name.'-agent.png';
} else {
$path = $path.DS.$file_name.'-client.png';
}
$qrCode->writeFile($path); $qrCode->writeFile($path);
return $path; return $path;
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
namespace app\api\untils; namespace app\api\untils;
use app\model\NoteLog;
class MessageUntils { class MessageUntils {
public function __construct() { public function __construct() {
...@@ -62,4 +64,62 @@ class MessageUntils { ...@@ -62,4 +64,62 @@ class MessageUntils {
return $data; return $data;
} }
/**
* 发送常规验证短信
*
* @param $phone
* @return SimpleXMLElement[]
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function sendCheckCode($phone) {
$result_data['msg'] = '';
$result_data['status'] = true;
$noteLog = new NoteLog();
$send_time = $noteLog->field('send_time')->where('phone', $phone)
->where('is_success',1)
->where('send_time','between time',[date('Y-m-d').' 00:00:00',date('Y-m-d').' 23:59:59'])
->select();
$num = count($send_time); //发送数量
if (!empty($send_time[$num-1]) && (time() - strtotime($send_time[$num-1]->send_time) < 58) && $num != 0) {
$result_data['msg'] = '1分钟内不能再次获取验证码';
$result_data['status'] = false;
return $result_data;
}
if ($num > 7){
$result_data['msg'] = '短信发送超过上限';
$result_data['status'] = false;
return $result_data;
}
$message = new MessageUntils();
$_code = mt_rand(1000, 9999) . '';
$result = $message->sendCCPSMS($phone, array($_code, '5分钟'), 214759);
$noteLog->phone = $phone;
$noteLog->template_msg = '【同联商业】您的验证码为'.$_code.',请于5分钟内正确输入,如非本人操作,请忽略此短信。';
$noteLog->code = $_code;
$noteLog->send_time = date('Y-m-d H:i:s');
$result['statusCode'] = 0;
if ($result['statusCode'] == "000000") {
$jwt = new JwtUntils();
$noteLog->is_success = 1;
$jwt_data['phone'] = $phone;
$jwt_data['code'] = $_code;
$result_data['sms_code'] = $_code;
$result_data['token'] = $jwt->createToken($jwt_data);
$result_data['status'] = true;
} else {
$noteLog->is_success = 2;
$result_data['status'] = false;
}
$noteLog->save();
return $result_data;
}
} }
<?php
namespace app\api_broker\consts;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/17
* Time : 9:50
* Intro: 公共常量
*/
class ConfigConst
{
const USER_TYPE_A = "A类(成交意愿较强)";
const USER_TYPE_B = "B类(成交意愿中等)";
const USER_TYPE_C = "C类(成交意愿较弱)";
const INDUSTRY_TYPE_FIRST = "轻餐饮";
const INDUSTRY_TYPE_SECOND = "重餐饮";
const INDUSTRY_TYPE_THIRD = "百货零售";
const INDUSTRY_TYPE_FOURTH = "服装";
const INDUSTRY_TYPE_FIFTH = "亲子教育";
const INDUSTRY_TYPE_SIXTH = "休闲娱乐";
const AREA_REQUIREMENT_FIRST = "30平米内";
const AREA_REQUIREMENT_SECOND = "30-60平米";
const AREA_REQUIREMENT_THIRD = "60-100平米";
const AREA_REQUIREMENT_FOURTH = "100平米以上";
const PRICE_REQUIREMENT_FIRST = "月租金10000元以内";
const PRICE_REQUIREMENT_SECOND = "月租金10000-30000元";
const PRICE_REQUIREMENT_THIRD = "月租金30000元以上";
}
\ No newline at end of file
...@@ -88,6 +88,9 @@ class CellPhone extends Basic ...@@ -88,6 +88,9 @@ class CellPhone extends Basic
$aliYunPhone->editStatus($phone_x, $phone_a, $phone_b, $record, $time, 0,$result['data']['mappingId'],$setting['is_privacy']); //记录绑定 $aliYunPhone->editStatus($phone_x, $phone_a, $phone_b, $record, $time, 0,$result['data']['mappingId'],$setting['is_privacy']); //记录绑定
$this->msg = 'Binding Rong success'; $this->msg = 'Binding Rong success';
$this->data = ['phone' => $phone_x['phone_x']]; $this->data = ['phone' => $phone_x['phone_x']];
} else{
$this->code = 101;
$this->msg = '操作频繁,请10秒后再操作。';
} }
}else { }else {
/*阿里云*/ /*阿里云*/
...@@ -98,7 +101,7 @@ class CellPhone extends Basic ...@@ -98,7 +101,7 @@ class CellPhone extends Basic
$this->data = ['phone' => $phone_x['phone_x']]; $this->data = ['phone' => $phone_x['phone_x']];
} else { } else {
$this->code = 101; $this->code = 101;
$this->msg = '绑定失败,请重试!'; $this->msg = '操作频繁,请10秒后再操作。';
} }
} }
......
...@@ -29,13 +29,13 @@ class FollowUp extends Basic ...@@ -29,13 +29,13 @@ class FollowUp extends Basic
*/ */
public function report() public function report()
{ {
/* $params = $this->params; $params = $this->params;
if (!isset($params['report_agent_id']) || !isset($params['report_store_id']) || !isset($params['user_id']) || if (!isset($params['report_agent_id']) || !isset($params['report_store_id']) || !isset($params['user_id']) ||
!isset($params['house_ids']) || !isset($params['vehicle']) ) { !isset($params['house_ids']) || !isset($params['vehicle']) ) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
}*/ }
$params = array( /* $params = array(
"report_agent_id" => 1, "report_agent_id" => 1,
"report_store_id" => 1, "report_store_id" => 1,
"user_id" => 1, "user_id" => 1,
...@@ -43,7 +43,7 @@ class FollowUp extends Basic ...@@ -43,7 +43,7 @@ class FollowUp extends Basic
"vehicle" => 10, "vehicle" => 10,
"intro" => "123123123", "intro" => "123123123",
"to_see_time" => date("Y-m-d H:i:s", time()), "to_see_time" => date("Y-m-d H:i:s", time()),
); );*/
$result = $this->followUpModel->addFollowUp($params); $result = $this->followUpModel->addFollowUp($params);
if($result["code"] == 200){ if($result["code"] == 200){
return $this->response("200", "request success", ["id",$result["msg"]]); return $this->response("200", "request success", ["id",$result["msg"]]);
......
<?php <?php
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: fuju * User: fu ju
* Date: 2018/2/6 * Date: 2018/2/6
* Time: 15:03 * Time: 15:03
*/ */
namespace app\index\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\index\extend\Basic;
use app\model\GLabels; use app\model\GLabels;
use think\Session; use think\Session;
...@@ -54,6 +53,9 @@ class Label extends Basic ...@@ -54,6 +53,9 @@ class Label extends Basic
* 获取打电话的标签 * 获取打电话的标签
* *
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getLabelsList() { public function getLabelsList() {
$result['code'] = 200; $result['code'] = 200;
...@@ -67,4 +69,24 @@ class Label extends Basic ...@@ -67,4 +69,24 @@ class Label extends Basic
return $this->response($result['code'], $result['msg'], $result['data']); return $this->response($result['code'], $result['msg'], $result['data']);
} }
/**
* 楼盘标签
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getLabelsShopList() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$labels = new GLabels();
$field = 'id,name,create_time';
$where['type'] = 0;
$result['data']['list'] = $labels->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$result['data']['total'] = $labels->getTotal($where);
return $this->response($result['code'], $result['msg'], $result['data']);
}
} }
\ No newline at end of file
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\MyCenterService;
use think\Exception;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/12
* Time : 下午1:34
* Intro:
*/
class MyCenter extends Basic
{
private $service_;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new MyCenterService();
}
/**
* 我得个人中心
* @return \think\Response
*/
public function center()
{
$params = $this->params;
/* $params = array(
"agent_id" => 1
);*/
if (empty($params['agent_id'])) {
if (empty($this->agentId)) {
return $this->response("101", "请求参数错误");
}
$agent_id = $this->agentId;
} else {
$agent_id = $params["agent_id"];
}
try {
$result = $this->service_->center($agent_id);
if ($result) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "request null");
}
} catch (Exception $exception) {
return $this->response("101", "request error, msg:" . $exception);
}
}
}
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\PerformanceService;
use Think\Exception;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/20
* Time : 下午2:06
* Intro: 业绩模块
*/
class Performance extends Basic
{
private $service_;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new PerformanceService();
}
/**
* 业绩汇总,
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectPerformanceByTime()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 10013,
"type" => 1, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/
if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误");
}
//默认排序一周
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-d", strtotime("-7 day"));
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $end_day, $start_day);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list;
$result["start_time"] = $start_day;
$result["end_time"] = $end_day;
return $this->response("200", "request success", $result);
}
return $this->response("200", "request null");
}
/**
* 个人业绩
* @return \think\Response
*/
public function agentPerformanceBySearch()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-04-12",
"end_time" => "2018-04-12",
"is_case" => 2,//1经纪人 2案场
"house_id" => 0
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"] )|| !isset($params["is_case"] )) {
return $this->response("101", "请求参数错误");
}
$house_id = 0;
if (isset($params["house_id"])) {
$house_id = $params["house_id"];
}
try {
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"],
$params["is_case"], $house_id);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
}
/**
* 门店业绩
* @return \think\Response
*/
public function storePerformanceBySearch()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
);*/
try {
$result = $this->service_->storePerformance($params["agent_id"], $params["start_time"], $params["end_time"]);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
}
/**
* 各个状态的订单列表暂不分页,
* @return \think\Response
*/
public function orderNoList()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0,
"type" => 1 // 1带看 2进场 3收款 4成交报告
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误");
}
$house_id = 0;
if (isset($params["house_id"])) {
$house_id = $params["house_id"];
}
try {
$result = $this->service_->orderList($params["agent_id"], $params["start_time"], $params["end_time"],
$params["is_case"], $house_id, $params["type"]);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
}
/**
* 门店或者经纪人业绩排行
* @return \think\Response
*/
public function storeOrAgentSort(){
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 6,
"is_store" => 1,//1经纪人排行 2门店
"start_time" => "2018-04-12",
"end_time" => "2018-04-12",
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"])) {
return $this->response("101", "请求参数错误");
}
try {
$result = $this->service_->storeSortByDistrictId($params["agent_id"],$params["is_store"] , $params["start_time"], $params["end_time"]);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
}
}
...@@ -4,6 +4,7 @@ namespace app\api_broker\controller; ...@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\ReportService; use app\api_broker\service\ReportService;
use app\model\AAgents;
use app\model\FollowUpLogModel; use app\model\FollowUpLogModel;
use app\model\OReportModel; use app\model\OReportModel;
use think\Exception; use think\Exception;
...@@ -13,13 +14,12 @@ use think\Exception; ...@@ -13,13 +14,12 @@ use think\Exception;
* User : zw * User : zw
* Date : 2018/1/24 * Date : 2018/1/24
* Time : 14:24 * Time : 14:24
* Intro: * Intro: 报备流程
*/ */
class Report extends Basic class Report extends Basic
{ {
private $service_; private $service_;
private $fulModel; private $fulModel;
private $oReportModel;
public function __construct($request = null) public function __construct($request = null)
...@@ -37,13 +37,14 @@ class Report extends Basic ...@@ -37,13 +37,14 @@ class Report extends Basic
public function report() public function report()
{ {
$params = $this->params; $params = $this->params;
if (!isset($params['report_agent_id']) || !isset($params['report_store_id']) || !isset($params['user_id']) || if (!isset($params['report_agent_id']) || !isset($params['report_agent_phone']) || !isset($params['report_store_id']) || !isset($params['user_id']) ||
!isset($params['house_ids']) || !isset($params['vehicle'])) { !isset($params['house_ids']) || !isset($params['vehicle'])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
/* $params = array( /* $params = array(
"report_agent_id" => 1,//报备经纪人id "report_agent_id" => 1,//报备经纪人id
"report_agent_phone" => '13817616471',//报备经纪人id
"report_store_id" => 1,//门店id "report_store_id" => 1,//门店id
"user_id" => 1,//用户id "user_id" => 1,//用户id
"house_ids" => "1,2,3",//楼盘id "house_ids" => "1,2,3",//楼盘id
...@@ -55,6 +56,7 @@ class Report extends Basic ...@@ -55,6 +56,7 @@ class Report extends Basic
$agent_id = $params["report_agent_id"]; $agent_id = $params["report_agent_id"];
$agent_phone = $params["report_agent_phone"];
$store_id = $params["report_store_id"]; $store_id = $params["report_store_id"];
$user_id = $params["user_id"]; $user_id = $params["user_id"];
$house_ids = $params["house_ids"]; $house_ids = $params["house_ids"];
...@@ -67,7 +69,7 @@ class Report extends Basic ...@@ -67,7 +69,7 @@ class Report extends Basic
if (!$userArr) { if (!$userArr) {
return $this->response("101", "不存在此用户"); return $this->response("101", "不存在此用户");
} }
$is_ok = $this->service_->verifyReport($agent_id, $this->agentName, $store_id, $user_id, $userArr["user_phone"], $is_ok = $this->service_->verifyReport($agent_id, $agent_phone, $this->agentName, $store_id, $user_id, $userArr["user_phone"],
$userArr["user_name"], $house_ids, $vehicle, $intro, $predict_see_time); $userArr["user_name"], $house_ids, $vehicle, $intro, $predict_see_time);
if ($is_ok > 0) { if ($is_ok > 0) {
return $this->response("200", "request success", []); return $this->response("200", "request success", []);
...@@ -82,33 +84,84 @@ class Report extends Basic ...@@ -82,33 +84,84 @@ class Report extends Basic
* 获取报备列表 * 获取报备列表
* @return \think\Response * @return \think\Response
*/ */
public function reportList(){ public function reportList()
/* $params = array( {
"agent_id" =>1, $params = $this->params;
/*$params = array(
"agent_id" => 4022,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告 "type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1, "page_no" => 1,
"page_size"=>15 "page_size" => 15
);*/ );*/
$params = $this->params;
if(!isset($params["agent_id"]) || !isset($params["type"])){
if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$pageNo = empty($params['page_no']) ? 1 : $params['page_no']; $pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size']; $pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,b.id as order_id,b.order_no,b.house_id,b.house_title"; $field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,a.create_time,b.id as order_id,b.order_no,b.house_id,b.house_title";
$params["report_agent_id"] = $params["agent_id"]; $params["report_agent_id"] = $params["agent_id"];
$result = $this->service_->orderList($field,$params,$pageNo,$pageSize); $result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
if (count($result) > 0) {
return $this->response("200","request success",$result); return $this->response("200", "request success", $result);
} else {
return $this->response("200", "request null");
}
} }
/**
* 权限判定
* @return \think\Response
*/
public function appAgentAuth()
{
$params = $this->params;
/* $params = array(
"agent_id" => 51,
);*/
$auth_arr = [
/*'broker/report',
'broker/addFollowUp',*/
'broker/marchIn',
'broker/collectingBill',
'broker/refund',
'broker/bargain',
/* 'broker/statusBargain',*/
];
$param["name"] = array( "in", $auth_arr );
$agents = new AAgents();
$is_auth = $agents->agentsAuthIds($params["agent_id"], $param);
/* $result["report"] = $result["addFollowUp"] = $result["statusBargain"] =*/
$result["marchIn"] = $result["collectingBill"] = $result["refund"]
= $result["bargain"] = false;
if (count($is_auth) > 0) {
foreach ($is_auth as $item) {
if ($item['name'] == "broker/marchIn") {
$result["marchIn"] = true;
}
if ($item['name'] == "broker/collectingBill") {
$result["collectingBill"] = true;
}
if ($item['name'] == "broker/refund") {
$result["refund"] = true;
}
if ($item['name'] == "broker/bargain") {
$result["bargain"] = true;
}
}
return $this->response("200", "request success", $result);
}
return $this->response("200", "request null");
}
/** /**
...@@ -120,6 +173,7 @@ class Report extends Basic ...@@ -120,6 +173,7 @@ class Report extends Basic
/* $params = array( /* $params = array(
"report_id" => 1, "report_id" => 1,
"agent_id" => 12, "agent_id" => 12,
"agent_name" => "saewerw",
"user_type" =>"1,2", // 用户类型 "user_type" =>"1,2", // 用户类型
"decision_maker" =>"zhangsan",// 第一决策人 "decision_maker" =>"zhangsan",// 第一决策人
"industry_type" =>"1,2",//租商铺做什么 "industry_type" =>"1,2",//租商铺做什么
...@@ -133,9 +187,9 @@ class Report extends Basic ...@@ -133,9 +187,9 @@ class Report extends Basic
"explain" =>"1,2",//备注 "explain" =>"1,2",//备注
"explain_img" =>"1,2"//备注图 "explain_img" =>"1,2"//备注图
);*/ );*/
header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
if (!isset($params['report_id']) || !isset($params['agent_id']) || !isset($params['user_type']) || if (!isset($params['report_id']) || !isset($params['agent_id']) || !isset($params['agent_name']) || !isset($params['user_type']) ||
!isset($params['industry_type']) || !isset($params['area_requirement']) || !isset($params['price_requirement'])) { !isset($params['industry_type']) || !isset($params['area_requirement']) || !isset($params['price_requirement'])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -155,10 +209,11 @@ class Report extends Basic ...@@ -155,10 +209,11 @@ class Report extends Basic
*/ */
public function getFollowUpList() public function getFollowUpList()
{ {
/* $params = array( /* $params = array(
"report_id" => 1,// 报备id "report_id" => 1,// 报备id
"agent_id" => 1,//非必填 经纪人id 没有就获取最新一条跟进记录 "agent_id" => 1,//非必填 经纪人id 没有就获取最新一条跟进记录
);*/ );*/
header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
if (!isset($params["report_id"])) { if (!isset($params["report_id"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
...@@ -166,7 +221,7 @@ class Report extends Basic ...@@ -166,7 +221,7 @@ class Report extends Basic
$field_ = "id,report_id,agent_id,user_type,decision_maker,industry_type,area_requirement,price_requirement,province $field_ = "id,report_id,agent_id,user_type,decision_maker,industry_type,area_requirement,price_requirement,province
,city,district,business_area,other_area,explain,explain_img,create_time,update_time"; ,city,district,business_area,other_area,explain,explain_img,create_time,update_time";
$order_ = "crate_time desc"; $order_ = "create_time desc";
$where_ = []; $where_ = [];
$where_["report_id"] = $params["report_id"]; $where_["report_id"] = $params["report_id"];
...@@ -181,7 +236,7 @@ class Report extends Basic ...@@ -181,7 +236,7 @@ class Report extends Basic
return $this->response("300", "not fund list", []); return $this->response("300", "not fund list", []);
} }
} catch (Exception $e) { } catch (Exception $e) {
return $this->response("101", "request error:" . $e); return $this->response("101", "request error:" . $e);
} }
......
This diff is collapsed.
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\StatementService;
use app\model\RAgentNote;
use app\model\RAgentReport;
use think\Exception;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/8
* Time : 上午11:22
* Intro:
*/
class Statement extends Basic
{
private $service_;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new StatementService();
}
/**
* 日报周报获取新增数据
* @return \think\Response
*/
public function dayStatement()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"agent_id" => 10015,
"time_start" => date("Y-m-d", time()),
"time_end" => date("Y-m-d", time()) . " 23:59:59",
);*/
if (!isset($params["agent_id"]) || !isset($params["time_start"]) || !isset($params["time_end"])) {
return $this->response("101", "请求参数错误");
}
try {
$result = $this->service_->selectStatementByAgentId($params["agent_id"], $params["time_start"], $params["time_end"]);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "request is null");
}
} catch (Exception $exception) {
return $this->response("101", "request is error,msg:" . $exception);
}
}
/**
* 生成日报和周报图片
*
* @return \think\Response
*/
public function weekWorkImg()
{
header('Access-Control-Allow-Origin:*');
if (empty($this->params["agent_id"]) || empty($this->params["img"])) {
return $this->response("101", "参数错误");
}
$img_title = "";
$img = "";
//单图
$base64_image_content = $this->params["img"];
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $array)) {
$img_title = $array[2]; //jpeg
$img = base64_decode(str_replace($array[1], '', $base64_image_content)); //返回文件流
}
$tmp_file = time();
$img_name = md5(uniqid($tmp_file)) . '.' . $img_title;//图片名
$url = 'static/week_work_img/' . $img_name;
$code = 200;
$msg = '';
if (file_put_contents($url, $img)) {
$agent_report = new RAgentReport();
if (empty($this->params['type'])) {
$data['start_date'] = $this->params['start_date'];
$data['end_date'] = $this->params['end_date'];
} else {
$data['start_date'] = $this->params['start_date'];
$data['end_date'] = $this->params['start_date'];
}
$data['agent_id'] = $this->params['agent_id'];
$data['img_url'] = $img_name;
$data['type'] = $this->params['type'];
$data['img_name'] = CURRENT_URL.$url;
$result = $agent_report->editData($data);
} else {
$result = 0;
}
if (!$result) {
$code = 101;
$msg = '生成图片失败';
}
return $this->response($code, $msg, $data['img_name']);
}
/**
* 保存周报日报四个字段
*
* @return \think\Response
* @throws \think\exception\DbException
*/
public function setReportContent() {
header('Access-Control-Allow-Origin:*');
$code = 200;
$msg = '';
$data = [];
$note = new RAgentNote();
if ($this->request->isGet()) {
$data = $note->get(['agent_id'=>$this->agentId]);
} else {
$save_data['agent_id'] = $this->agentId;
$save_data['content'] = $this->params['content'];
if (empty($this->params['id'])) {
$result = $note->editData($save_data);
} else {
$result = $note->editData($save_data, $this->params['id']);
}
if (!$result) {
$code = 101;
$msg = '添加失败';
}
}
return $this->response($code, $msg, $data);
}
/**
* 获取周报或者日报
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getWeekOrDay() {
header('Access-Control-Allow-Origin:*');
$code = 200;
$msg = '';
if (empty($this->agentId)) {
return $this->response(101, 'Agent_id is null!');
}
$agent_report = new RAgentReport();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$fields = 'id,create_time,start_date,end_date,img_url';
$where['is_del'] = 0;
$where['agent_id'] = $this->agentId;
if ($this->params['type'] == 1) {
$where['type'] = 1;
} else {
$where['type'] = 0;
}
$data['list'] = $agent_report->getList($pageNo, $pageSize, 'id desc', $fields, $where);
$data['total'] = $agent_report->getTotal($where);
foreach ($data['list'] as $k=>$v) {
$data['list'][$k]['img_url'] = CURRENT_URL.'static/week_work_img/'.$data['list'][$k]['img_url'];
}
return $this->response($code, $msg, $data);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/3/23
* Time: 18:06
*/
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\AAgents;
use app\model\AgentsVisitors;
use app\model\SSupervision;
class Supervise extends Basic
{
/**
* 监督执行
*
* @return \think\Response
*/
public function add() {
if (empty($this->params['id'])) {
return $this->response(101, 'Id is null');
}
$supervision = new AgentsVisitors();
$data['id'] = '';
$data['user_id'] = $this->agentId;
$data['usertable'] = $this->params['usertable'];
$data['visitor'] = $this->agentPhone;
$data['visitor_name'] = $this->agentName;
$data['agentshopname'] = $this->params['agentshopname'];
$data['leader_name'] = $this->params['leader_name'];
$data['leader_phone'] = $this->params['leader_phone'];
$data['address'] = $this->params['address'];
$data['remarks'] = $this->params['remarks'];
$data['longitude'] = $this->params['longitude'];
$data['latitude'] = $this->params['latitude'];
$data['distance'] = $this->params['distance'];
$data['shop_id'] = $this->params['shop_id'];
$data['modified'] = date('Y-m-d H:i:s');
$supervision->editData($data, $this->params['id']);
return $this->response(200, '', ['id'=>$this->params['id']]);
}
/**
* 上传监督执行图片
*
* @return \think\Response
*/
public function uploadSuperviseFile() {
$data['status'] = 101;
$data['msg'] = '';
$data['data'] = '';
$file = $this->request->file('file');
if($file){
$path = ROOT_PATH . 'public' . DS . 'resource'. DS . 'lib'. DS .'Attachments'. DS .'images'.DS.'supervise';
$info = $file->validate(['size'=>1024000,'ext'=>'jpg,png'])->move($path);
if($info){
$img_path = $info->getSaveName(); //生成的图片路径
$data['scene_photo'] = $img_path;
$data['created'] = date('Y-m-d H:i:s');
$data['visit_type'] = empty($this->params['visit_type']) ? 0:1; //拜访类型(0代表门店拜访、1代表监督执行)
$supervision = new AgentsVisitors();
$supervision->editData($data);
$data['status'] = 200;
$data['msg'] = '上传成功';
$data['data'] = [
'file_name' => CK_IMG_URL .'images/supervise/' . $img_path,
'id' => $supervision->id
];
}else{
// 上传失败获取错误信息
$data['msg'] = $file->getError();
}
} else {
$data['msg'] = '没有该文件';
}
return $this->response($data['status'], $data['msg'], $data['data']);
}
/**
* 监督执行和门店拜访列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getSupervise() {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$verify = new AAgents();
$agent_data = $verify->getAgentInfo('level,store_id,district_id', $this->agentId);
if ($agent_data['level'] == 10) {
$where = 'a.user_id = '.$this->params['agent_id'];
} else {
$where = 'b.store_id = '.$agent_data['store_id'];
}
//拜访类型(0代表门店拜访、1代表监督执行)
if (empty($this->params['visit_type'])) {
$where .= ' AND visit_type = 0';
$fields = 'a.longitude,a.latitude,c.province,c.city,c.district,c.address as agent_address,a.address,a.remarks,scene_photo,b.name,a.created,leader_name,leader_phone,b.phone,agentshopname';
} else {
$where .= ' AND visit_type = 1';
$fields = 'a.longitude,a.latitude,a.address,a.remarks,scene_photo,b.name,a.created';
}
if (empty($where)) {
return $this->response(101, 'Params is error');
}
$supervision = new AgentsVisitors();
$data['list'] = $supervision->getVisitorsList($pageNo, $pageSize, 'a.id desc', $fields, $where);
if (empty($this->params['visit_type'])) {
foreach ($data['list'] as $k => $v) {
$data['list'][$k]['agent_address'] = $data['list'][$k]['province'].$data['list'][$k]['city'].$data['list'][$k]['district'].$data['list'][$k]['agent_address'];
}
}
foreach ($data['list'] as $k=>$v) {
$data['list'][$k]['scene_photo'] = CK_IMG_URL .'images/supervise/' . $v['scene_photo'];
}
$data['total'] = $supervision->getVisitorsListTotal($where);
return $this->response(200, '', $data);
}
/**
* 拜访列表查询
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchInfo() {
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where = 'a.status <> 2';
if ($this->params['search']) {
$where .= ' AND (concat(phone,name) like "%'.$this->params['search'].'%" or store_name like "%'.$this->params['search'].'%")';
}
if ($this->params['level']) {
$where .= ' AND level in ('.$this->params['level'].')';
} else {
$where .= ' AND level in (20,40)';
}
if ($where) {
$agent = new AAgents();
$field = 'a.id,b.store_name,a.name,a.phone,b.province,b.city,b.district,b.address,b.longitude,b.latitude,a.store_id';
$data['data'] = $agent->searchAgentShop($pageNo, $pageSize, 'id DESC', $field, $where);
} else {
$data['msg'] = '没有经纪人信息';
}
return $this->response($data['status'], $data['msg'], $data['data']);
}
}
\ No newline at end of file
...@@ -10,11 +10,10 @@ namespace app\api_broker\extend; ...@@ -10,11 +10,10 @@ namespace app\api_broker\extend;
* 基类 * 基类
*/ */
use app\model\AAgents; use app\model\AAgents;
use app\model\Users;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use Firebase\JWT\JWT; use UnexpectedValueException;
use InvalidArgumentException;
use think\Controller; use think\Controller;
use think\Db;
use think\Request; use think\Request;
use think\Response; use think\Response;
use Qiniu; use Qiniu;
...@@ -43,13 +42,16 @@ class Basic extends Controller ...@@ -43,13 +42,16 @@ class Basic extends Controller
'broker/token', 'broker/token',
'broker/getShopList', 'broker/getShopList',
'broker/getShopDetail', 'broker/getShopDetail',
'broker/getRegions',
'broker/getAddress',
'broker/getBroker',
'broker/searchAgentShop',
'broker/forgetPwd'
); );
/** /**
* 基础接口SDK * 基础接口SDK
* @param Request|null $request *
*/
/**
* Basic constructor. * Basic constructor.
* @param Request|null $request * @param Request|null $request
*/ */
...@@ -65,48 +67,34 @@ class Basic extends Controller ...@@ -65,48 +67,34 @@ class Basic extends Controller
} elseif (strtoupper($this->request->method()) === "POST") { } elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null; $this->params = $this->request->param() != null ? $this->request->param() : null;
} }
/*临时验证 start*/
if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) { if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new JWT(); $jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array('HS256')); //解码token
if (isset($result->data)) {
$this->timeStamp_ = $result->timeStamp_;
$this->agentPhone = $result->data->phone;
$is = Db::table('agents')->where('phone', $this->agentPhone)->count();
} else {
$is = 0;
}
if ($is == 0) { try {
echo json_encode(array("code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json")); $result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} catch( UnexpectedValueException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken参数错误!", "data" => [], "type" => "json" ));
exit;
} catch( InvalidArgumentException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken参数错误!", "data" => [], "type" => "json" ));
exit; exit;
} }
}
$this->authToken = $this->params['AuthToken'];
$this->agentId = $result->data->id;
$this->agentPhone = $result->data->phone;
$this->agentName = $result->data->name;
$this->timeStamp_ = $result->timeStamp_;
}
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1]; $requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) { if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify(); $this->tokenVerify();
// $this->userAuth(trim($requestPath));
} }
/*临时验证 end*/ unset($this->params["AuthToken"]);
/* if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result->data->id;
$this->phone = $result->data->phone;
$this->userNick = $result->data->userNick;
$this->timeStamp_ = $result->timeStamp_;
}
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
}*/
} }
/** /**
...@@ -141,7 +129,7 @@ class Basic extends Controller ...@@ -141,7 +129,7 @@ class Basic extends Controller
public function verifyAgentInfo() public function verifyAgentInfo()
{ {
$agentModel = new AAgents(); $agentModel = new AAgents();
$agentArr = $agentModel->getAgentById("id,store_id,name,phone"); $agentArr = $agentModel->getAgentById("id,store_id,name,phone");
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId || $agentArr["user_phone"] != $this->agentPhone)) { if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId || $agentArr["user_phone"] != $this->agentPhone)) {
echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" )); echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" ));
exit; exit;
...@@ -205,7 +193,7 @@ class Basic extends Controller ...@@ -205,7 +193,7 @@ class Basic extends Controller
$attr[$path] = "{$ppath}-{$attr[$id]}"; $attr[$path] = "{$ppath}-{$attr[$id]}";
$attr['sub'] = isset($attr['sub']) ? $attr['sub'] : []; $attr['sub'] = isset($attr['sub']) ? $attr['sub'] : [];
$attr['spl'] = str_repeat("&nbsp;&nbsp;&nbsp;├&nbsp;&nbsp;", substr_count($ppath, '-')); $attr['spl'] = str_repeat("&nbsp;&nbsp;&nbsp;├&nbsp;&nbsp;", substr_count($ppath, '-'));
$sub = $attr['sub']; $sub = $attr['sub'];
unset($attr['sub']); unset($attr['sub']);
$tree[] = $attr; $tree[] = $attr;
if (!empty($sub)) { if (!empty($sub)) {
...@@ -278,15 +266,41 @@ class Basic extends Controller ...@@ -278,15 +266,41 @@ class Basic extends Controller
* @param int $user_id * @param int $user_id
* @return bool|false|int * @return bool|false|int
*/ */
public function operating_records($agents_id = 0, $type = '' ,$remark = '',$house_id=0,$user_id=0) { public function operating_records($agents_id = 0, $type = '', $remark = '', $house_id = 0, $user_id = 0)
{
$records = new GOperatingRecords(); $records = new GOperatingRecords();
$result = $records->record($agents_id, $type, $remark,$house_id,$user_id); $result = $records->record($agents_id, $type, $remark, $house_id, $user_id);
return $result; return $result;
} }
/**
* 权限判定
*
* @param $requestPath
* @return bool
*/
public function userAuth($requestPath){
$agents = new AAgents();
$is_auth = $agents->agentsAuthId($this->agentId, $requestPath);
$auth_arr = [
'broker/report',
'broker/addFollowUp',
'broker/marchIn',
'broker/collectingBill',
'broker/refund',
'broker/bargain',
'broker/statusBargain',
'broker/getFollowUpList',
];
if (in_array($requestPath, $auth_arr) && empty($is_auth) && $this->agentId != 1) {
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
}
return true;
}
} }
<?php
namespace app\api_broker\service;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\OrderModel;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/13
* Time : 10:04
* Intro:
*/
class HouseNumUpdateService
{
public function __construct()
{
}
/**
* 新增成交报告修改楼盘数量,
* @param $order_id
*/
public static function updateHouseNumByBargain($order_id)
{
//todo 1.查询同一个订单的成交报告提交了几次 2.if 仅仅一次 则查询订单中楼盘id 3.根据楼盘id查询楼盘表获取商铺数量,数量减一,
//todo 4.如果数量小于等于0 修改楼盘为下架
$bargainModel = new OBargainModel();
$params["father_id"] = 0;
$params["order_id"] = $order_id;
$params["status"] = 10;
$bargainNum = $bargainModel->ifBargainNumByOrderId($params);
if($bargainNum == 1){
$orderModel = new OrderModel();
$field = "b.id as house_id,b.status,b.residue_num";
$orderParams["a.id"] = $order_id;
$houseInfo = $orderModel->getHouseInfoByOrderId($field,$orderParams);
if(count($houseInfo) > 0 && $houseInfo[0]["residue_num"] > 0 && $houseInfo[0]["status"] == 1){
//减数量
$houseModel = new GHouses();
$id = $houseInfo[0]["house_id"];
$updateParams["residue_num"] = $houseInfo[0]["residue_num"] - 1;
if( $houseInfo[0]["residue_num"] == 1 ){
$updateParams["status"] = 2;
}
$houseModel->updateHouseNum($id,$updateParams); //type 1表示减少 2表示增加
}
}
}
/**
* 撤销成交报告修改楼盘数量
* @param $bargain_id
* @return null
*/
public static function updateHouseNumByRevocationBargain($bargain_id)
{
//todo 1.查询同一个订单的成交报告正常状态的订单是否存在 2.if没有则查询订单中楼盘id 3.根据楼盘id查询楼盘表获取商铺数量,数量加一,
//todo 4.修改楼盘为上架
$bargainModel = new OBargainModel();
$bargainArr = $bargainModel->getBargainDetail("order_id",["id"=>$bargain_id]);
if(count($bargainArr) <= 0){
return null;
}
$order_id = $bargainArr[0]["order_id"];
$params["father_id"] = 0;
$params["order_id"] = $order_id;
$params["status"] = 10;
$bargainNum = $bargainModel->ifBargainNumByOrderId($params);
if($bargainNum <= 0){
$orderModel = new OrderModel();
$field = "b.id as house_id,b.status,b.residue_num";
$orderParams["a.id"] = $order_id;
$houseInfo = $orderModel->getHouseInfoByOrderId($field,$orderParams);
if(count($houseInfo) > 0 && $houseInfo[0]["residue_num"] > 0 && $houseInfo[0]["status"] == 1){
//减数量
$houseModel = new GHouses();
$id = $houseInfo[0]["house_id"];
$updateParams["residue_num"] = $houseInfo[0]["residue_num"] + 1;
if( $houseInfo[0]["residue_num"] == 2 ){
$updateParams["status"] = 1;
}
$houseModel->updateHouseNum($id,$updateParams); //type 1表示减少 2表示增加
}
}
}
}
\ No newline at end of file
<?php
namespace app\api_broker\service;
use app\model\AAgents;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/12
* Time : 下午1:47
* Intro:
*/
class MyCenterService{
private $agentModel;
const USER_LEVEL_FIST = "业务员"; //经纪人
const USER_LEVEL_SECOND = "店长"; //店长
const USER_LEVEL_THIRD = "总监"; //总监
function __construct()
{
$this->agentModel = new AAgents();
}
/**
* 我得个人中心
* @param $agent_id
* @return false|null|\PDOStatement|string|\think\Collection
*/
public function center($agent_id){
$field = "a.id,a.store_id,a.auth_group_id,a.district_id,a.level,a.name,a.phone,a.sex,a.img,a.status,b.store_name,
c.district_name";
$params["agent_id"] = $agent_id;
$result = $this->agentModel->getAgentsInfoByAgentId($field,$params);
if(count($result) <= 0){
return null;
}
$result = $result[0];
$level_name = self::USER_LEVEL_FIST;
if($result["level"] == 20){
$level_name = self::USER_LEVEL_SECOND;
}elseif ($result["level"] == 30 || $result["level"] == 40 ){
$level_name = self::USER_LEVEL_THIRD;
}
$result["level_name"] = $level_name;
$result["sign"] = $result["district_name"].$result["store_name"];
if(!empty($result["img"])){
$result["img"] = AGENTHEADERIMGURL . $result["img"];
}
//todo 需要计算暂时没做。
//$result["money_total"] = 1000;
return $result;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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