Commit 5c4b7af8 authored by hujun's avatar hujun

Merge branch 'test' into test-v2.0-0530

# Conflicts: # application/api_broker/controller/Performance.php # application/api_broker/controller/Shop.php # application/app/view/index/share_detail.html # application/model/GHouses.php # public/resource/js/user.js
parents fead0bb9 67228408
......@@ -7,6 +7,7 @@ use app\model\AAgents;
use app\model\Agents;
use app\model\Evaluate;
use app\model\EvaluateSign;
use app\model\OBargainModel;
use app\model\Remarks;
/**
......@@ -168,30 +169,31 @@ class Broker extends Basic{
if ($params['agent_id']) {
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? PAGESIZE : $params['pageSize'];
$evalutate = new Evaluate();
$remarks = new Remarks();
$fields_evaluate = 'house_id,user_id,user_nick,user_phone,user_pic,evaluate_grade,evaluate_content,evaluate_sign,a.create_time,record_id,a.source';
$fields_journal = 'house_id,apply_id,created';
$where['shopuser_id'] = $params['agent_id'];
$where['transaction_status'] = 3;
$bargain = new OBargainModel();
$evaluate = new Evaluate();
$fields_evaluate = 'house_id,user_id,user_nick,user_phone,user_pic,evaluate_grade,evaluate_content,';
$fields_evaluate .= 'evaluate_sign,a.create_time,record_id,a.source,a.house_id,c.internal_address';
$bargain_fields = 'a.id,a.price,a.create_time as singntime,d.external_title as title,d.rent_type,d.shop_sign as shangpu_tags,shop_area_start as room_area';
switch ($params['type']) {
case 0:
//评价列表信息
$result['evaluate'] = $evalutate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
$result['evaluate'] = $evaluate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
//成交记录
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'id desc', $fields_journal, $where, $params['agent_id']);
$result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, ['a.agent_id'=>$this->params['agent_id']]);
$data['data'] = $result;
break;
case 1:
//评价列表信息
$result['evaluate'] = $evalutate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
$result['evaluate'] = $evaluate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
$data['data'] = $result;
break;
case 2:
//成交记录
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'id desc', $fields_journal, $where, $params['agent_id']);
$result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, ['a.agent_id'=>$this->params['agent_id']]);
$data['data'] = $result;
break;
default:
......@@ -221,7 +223,7 @@ class Broker extends Basic{
$data['msg'] = '';
if ($this->params['agent_id']) {
$agents = new Agents();
$agents = new AAgents();
$data['data'] = $agents->agentsDetail($this->params['agent_id']);
} else {
$data['status'] = 101;
......
<?php
namespace app\api\controller;
/**
* Created by PhpStorm.
* User : zw
......@@ -14,35 +16,41 @@ use app\model\GHouses;
use app\model\HouseInfos;
use app\model\JournalAccounts;
use app\model\OrderModel;
use app\model\Users;
class Index extends Basic
{
public function banner(){
public function banner()
{
}
/**
* 月均价 上周成交量 ==>修改为日均价了==》改成求租人
*/
public function averagePriceAndTurnover()
{
/* $houseInfos = new GHouses();
$averagePrice = $houseInfos->getAveragePrice();*/
$userModel = new Users();
$user_count = $userModel->countUser();
// $journalAccounts = new JournalAccounts();
$journalAccounts = new OrderModel();
$turnover = $journalAccounts->getTurnover();
$result['averagePrice'] = $user_count;
$result['turnover'] = $turnover * 9;//不要问为什么乘以9,产品说怎么搞就怎么搞
return $this->response("request success", "200", $result);
}
}
/**
* 月均价 上周成交量 ==>修改为日均价了
* 处理错误的url
*
* @return type
*/
public function averagePriceAndTurnover(){
$houseInfos = new GHouses();
$averagePrice = $houseInfos->getAveragePrice();
// $journalAccounts = new JournalAccounts();
$journalAccounts = new OrderModel();
$turnover = $journalAccounts ->getTurnover();
$result['averagePrice'] = $averagePrice;
$result['turnover'] = $turnover;
return $this->response("request success","200",$result);
}
/**
* 处理错误的url
*
* @return type
*/
public function miss() {
return $this->response('101','URL is error');
}
public function miss()
{
return $this->response('101', 'URL is error');
}
}
......@@ -52,9 +52,9 @@ class Index
{
return view('index/agreement_app');
}
public function download()
public function download_c()
{
return view('index/download');
return view('index/download_c');
}
public function more_pingjia()
{
......
......@@ -9,6 +9,12 @@
<meta name="Description" content="" />
<link rel="stylesheet" href="/app/css/common.css">
<link rel="stylesheet" href="/app/css/agent_detail.css">
<style>
/*因为一些新页面用了vue实现,所以很多这样的元素默认是隐藏的,在common.css里。但原来的文件是需要默认隐藏的*/
.loading_pic_new,.no_more,.zanwu_data,.loading_pic_samll_new{
display: none;
}
</style>
</head>
<body>
<header id="header">
......@@ -135,6 +141,6 @@
<script src="/app/js/jquery-1122-min.js" charset="UTF-8"></script>
<script src="/app/js/common.js" charset="UTF-8"></script>
<script src="/app/js/agent_detail.js" charset="UTF-8"></script>
<script src="/app/js/agent_detail.js?new1" charset="UTF-8"></script>
</body>
</html>
......@@ -41,11 +41,15 @@
$('#app_ban').attr('src','/app/images/bg_download.png');
$('title').html('下载');
$('.xiazai-p-fuju').show();
//0是c端,2是b端
$.ajax({
type: "post",
url: "/app/getVersionNo",
type: "get",
url: ServerHostTempC+"/api/getVersionNo",
timeout: 10000,
dataType: "json",
data: {
'type': 0
},
beforeSend: function() {},
success: function(data) {
$('#android_link').attr('href',data.data.app_path);
......
......@@ -9,6 +9,12 @@
<meta name="Description" content="" />
<link rel="stylesheet" href="/app/css/common.css">
<link rel="stylesheet" href="/app/css/agent_detail.css">
<style>
/*因为一些新页面用了vue实现,所以很多这样的元素默认是隐藏的,在common.css里。但原来的文件是需要默认隐藏的*/
.loading_pic_new,.no_more,.zanwu_data,.loading_pic_samll_new{
display: none;
}
</style>
</head>
<body>
<header id="header">
......
......@@ -9,6 +9,12 @@
<meta name="Description" content="" />
<link rel="stylesheet" href="/app/css/common.css">
<link rel="stylesheet" href="/app/css/agent_detail.css">
<style>
/*因为一些新页面用了vue实现,所以很多这样的元素默认是隐藏的,在common.css里。但原来的文件是需要默认隐藏的*/
.loading_pic_new,.no_more,.zanwu_data,.loading_pic_samll_new{
display: none;
}
</style>
</head>
<body>
<header id="header">
......
......@@ -110,9 +110,9 @@ class Index
return view('index/imagebody');
}
public function xiazai()
public function download_b()
{
return view('index/xiazai');
return view('index/download_b');
}
public function __construct()
......
......@@ -39,14 +39,18 @@
$('#app_ban').attr('src','/app/images/bg_download.png');
$('title').html('下载');
$('.xiazai-p-fuju').show();
//0是c端,2是b端
$.ajax({
type: "post",
url: ServerHostTempC+"/AppTab5/versions",
type: "get",
url: ServerHostTempC+"/api/getVersionNo",
timeout: 10000,
dataType: "json",
data: {
'type': 2
},
beforeSend: function() {},
success: function(data) {
$('#android_link').attr('href',data.apk_url);
$('#android_link').attr('href',data.data.app_path);
},
error: function() {
......
......@@ -268,7 +268,7 @@ class Member extends Basic{
$insert_data['user_pswd'] = md5(md5($params['pwd']).'+123');
$insert_data['status'] = 0;
$insert_data['create_time'] = $date;
$insert_data['update_time'] = $date;
$insert_data['source'] = $date;
$insert_data['agent_id'] = $params['agent_id']; //客方
$insert_data['industry_type'] = $params['industry_type']; //业态
$insert_data['price_demand'] = $params['price_demand']; //价格需求 元
......
......@@ -835,4 +835,60 @@ class AAgents extends BaseModel
->where($where)
->find();
}
/**
* 经纪人详情
* @param $id
* @return array|bool|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentsDetail($id)
{
if ($id) {
$result = $this->field('id,name as realname,create_time,img,store_id')->find($id);
$result['head_portrait'] = 'user_header/' . $result['img']; //头像
$evaluate_grade = Db::table('u_evaluate')
->field('sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num')
->where('agents_id', $id)->where('is_show', 0)->find();
$m_store = new AStore();
$result['sub_shopname'] = $m_store->getStoreKeyById('store_name', ['id'=>$result['store_id']]);
if ($evaluate_grade['evaluate_grade']) {
$grade = floor(($evaluate_grade['evaluate_grade'] / 2) / $evaluate_grade['evaluate_num']);
} else {
$grade = 0;
}
$result['evaluate_grade'] = $grade; //评分等级
$result['evaluate_num'] = $evaluate_grade['evaluate_num']; //评论数量
$result['watch_shop'] = Db::table('u_appoint_watch_shop')
->where('agents_id', $id)->count(); //看铺
$result['head_portrait'] = AGENTHEADERIMGURL.$result['head_portrait'];
$bargain = new OBargainModel();
$result['JournalAccounts'] = $bargain->ifBargainNumByOrderId([ 'agent_id' => $id ]); //成交记录
$current_time = time();
$user_time = strtotime($result['create_time']);
$year = date('Y', $current_time) - date('Y', $user_time);
//入职年限
if ($year == 0) {
$result['created'] = $year . '个月以上';
} else {
$result['created'] = $year . '年以上';
}
$result['label'] = array( 0 => '待定标签数据', 1 => '待定标签数据' );
$data = $result;
} else {
$data = false;
}
return $data;
}
}
\ No newline at end of file
......@@ -11,27 +11,30 @@ class Evaluate extends Model
/**
* 获得评价列表
*
* @param type $pageNo
* @param type $pageSize
* @param type $order_
* @param type $field
* @param type $params
* @param type $agent_id //获得经纪人的评价
* @return type
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param string $agent_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getEvaluate($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $agent_id = '') {
if ($agent_id) {
$result = $this->field($field)->alias('a')
->join('u_users b','a.user_id = b.id','left')
->join('g_houses c','a.house_id = c.id','left')
->where('agents_id',$agent_id)
->where('is_show',0)
->where('a.is_show',0)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
} else {
$result = $this->field($field)->alias('a')
->join('u_users b', 'a.user_id = b.id', 'left')
......@@ -41,9 +44,9 @@ class Evaluate extends Model
->page($pageNo)
->select();
}
$data = array();
$data = [];
$sign = new EvaluateSign();
$watch = new AppointWatchShop();
foreach ($result as $k=>$v) {
$v->evaluate_grade = floor($v->evaluate_grade/2);
$data[$k] = $v->getData();
......@@ -55,25 +58,18 @@ class Evaluate extends Model
->select();
}
if ($v->source == 10) {
$applies_time = $watch->alias('a')
->field('b.receptiontime')
->join('applies b','b.id = a.applies_id','left')
->where('a.applies_id',$v->record_id)
->find();
} else {
$applies_time = Db::table('Journalaccounts')->alias('a')
->field('b.receptiontime')
->join('applies b','b.id = a.apply_id','left')
->where('a.apply_id',$v->record_id)
->find();
if (isset($v['house_id'])) {
$applies_time = Db::table('o_bargain')->alias('a')
->join('o_order b', 'a.order_id = b.id', 'left')
->join('o_report c', 'a.report_id = c.id', 'left')
->where('b.house_id', $v['house_id'])
->where('c.user_id', $v['user_id'])
->where('a.agent_id', $agent_id)
->value('a.create_time');
}
$house_address = Db::table('HouseInfos')->field('address')->where('id',$v['house_id'])->find();
$data[$k]['houserAddress'] = $house_address['address'] ? $house_address['address'] : '';
$data[$k]['receptiontime'] = $applies_time['receptiontime'];
$data[$k]['houserAddress'] = isset($v['internal_address']) ? $v['internal_address'] : '';
$data[$k]['receptiontime'] = $applies_time;
$data[$k]['created'] = $v['create_time'] ? $v['create_time']:'';
}
......@@ -82,10 +78,14 @@ class Evaluate extends Model
/**
* 获取商铺是否评价
* @param int $source
*
* @param $source
* @param $recordId
* @param $userId
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getIsEvaluate($source ,$recordId , $userId){
$params["source"] = $source ;
......@@ -94,6 +94,5 @@ class Evaluate extends Model
return $this->field("id")
->where($params)
->select();
}
}
......@@ -492,6 +492,46 @@ class OBargainModel extends Model
if (isset($data['id'])) {
$m_fee = new ORealIncome();
$data['practical_fee'] = $m_fee->getBargainTaxes($data['id']); //获取实收佣金
} else {
$data = [];
}
return $data;
}
/**
* 获取成交报告详情
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainOrderList($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field, $params)
{
$data = $this->field($field)->alias('a')
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
foreach ($data as $k=>$v) {
if (isset($v['singntime'])) {
$data[$k]['singntime'] = date('Y-m-d', strtotime($v['singntime']));
}
if (empty($v['shangpu_tags'])) {
$data[$k]['shangpu_tags'] = "";
}
}
return $data;
......
......@@ -564,4 +564,13 @@ class Users extends Model
{
return $this->saveAll($data);
}
public function countUser(){
$result = $this
->field("id")
->where(["user_status"=>0])
->count("id");
// echo $this->getLastSql();
return $result;
}
}
......@@ -21,7 +21,7 @@ Route::group('app', [
'share_register' => [ 'app/index/share_register', [ 'method' => 'get' ] ],
'agreement' => [ 'app/index/agreement', [ 'method' => 'get' ] ],
'agreement_app' => [ 'app/index/agreement_app', [ 'method' => 'get' ] ],
'download' => [ 'app/index/download', [ 'method' => 'get' ] ],
'download_c' => [ 'app/index/download_c', [ 'method' => 'get' ] ],
'getShopDetails' => [ 'app/index/getShopDetail', [ 'method' => 'get | post' ] ],
'getVersionNo' => [ 'app/index/getVersionNo', [ 'method' => 'get | post' ] ],
'feed' => [ 'app/index/feed', [ 'method' => 'get' ] ]
......@@ -48,7 +48,7 @@ Route::group('app_broker', [
'bargaininfo_detail_pc' => [ 'app_broker/index/bargaininfo_detail_pc', [ 'method' => 'get' ] ],
'customerinfo_customer_add' => [ 'app_broker/index/customerinfo_customer_add', [ 'method' => 'get' ] ],
'customerinfo_details_new' => [ 'app_broker/index/customerinfo_details_new', [ 'method' => 'get' ] ],
'xiazai' => [ 'app_broker/index/xiazai', [ 'method' => 'get' ] ],
'download_b' => [ 'app_broker/index/download_b', [ 'method' => 'get' ] ],
'imagebody' => [ 'app_broker/index/imagebody', [ 'method' => 'get' ] ],
]);
......@@ -299,7 +299,7 @@ Route::group('api', [
//Version
'getVersionNo' => [ 'api/Version/getVersionNo', [ 'method' => 'post' ] ],
'getVersionNo' => [ 'api/Version/getVersionNo', [ 'method' => 'post|get' ] ],
// 'agentUserTb' => [ 'api_broker/Client/agentUserTb', [ 'method' => 'get' ] ],//客户列表
// 'agentUserFollow' => [ 'api_broker/Client/agentUserFollow', [ 'method' => 'get' ] ],//客户列表
// 'agentSearch' => [ 'api_broker/Client/agentSearch', [ 'method' => 'get' ] ],//经纪人搜索
......@@ -346,7 +346,7 @@ Route::group('task', [
'updateStatusByNum' => [ 'task/updateShopStatusTask/updateStatusByNum', [ 'method' => 'get' ] ], //修改下架根据数量
'totalAgentResults' => [ 'task/ResultsSummaryTask/totalAgentResults', [ 'method' => 'get' ] ], //业绩统计
'totalAgentResults_new' => [ 'task/ResultsSummaryTask/totalAgentResults', [ 'method' => 'get' ] ], //业绩统计
'rongBilledInformUrl' => [ 'task/PrivacyNumber/rongBilledInformUrl', [ 'method' => 'post | get' ] ],//隐私号码回调[话单通知]
......
......@@ -2,6 +2,7 @@
namespace app\task\controller;
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\GHouses;
use app\model\OBargainModel;
......@@ -29,6 +30,7 @@ class ResultsSummaryTask
private $reportModel;
private $marchInModel;
private $payLogModel;
private $redis_;
function __construct()
{
......@@ -40,30 +42,37 @@ class ResultsSummaryTask
$this->reportModel = new OReportModel();
$this->marchInModel = new OMarchInModel();
$this->payLogModel = new OPayLogModel();
$this->redis_ = RedisExt::getRedis();
}
public function totalAgentResults()
{
set_time_limit(0); // 取消脚本运行时间的超时上限
//todo 1.分页查询经纪人, 2遍历执行,判断一个经纪人在统计表最后一条统计数据的日期
//TODO 3.日期加一天并判断是否大于等于当前时间大于return 4.执行此日期的统计,5.当次日期小于当前日期,递归日期加一。继续统计
$total = $this->agentsModel->getAgentsCountByTask();
$pageSize = 200;
$pageTotal = ceil($total / $pageSize);
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$resultArr = $this->agentsModel->getAgentsListByTask($pageNo, $pageSize, "id,store_id,district_id");
$this->executeTotal($resultArr);
unset($resultArr);
}
unset($this->agentsModel);
unset($this->tAgentTotalModel);
unset($this->houseModel);
unset($this->userModel);
unset($this->bargainModel);
unset($this->reportModel);
unset($this->marchInModel);
unset($this->payLogModel);
$day = date("Y-m-d", time());
if ($this->redis_ && $this->redis_->get("run_total" . $day)) {
return false;
}
$this->redis_->set("run_total" . $day, 1, 24 * 3600);
//todo 1.分页查询经纪人, 2遍历执行,判断一个经纪人在统计表最后一条统计数据的日期
//TODO 3.日期加一天并判断是否大于等于当前时间大于return 4.执行此日期的统计,5.当次日期小于当前日期,递归日期加一。继续统计
$total = $this->agentsModel->getAgentsCountByTask();
$pageSize = 200;
$pageTotal = ceil($total / $pageSize);
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$resultArr = $this->agentsModel->getAgentsListByTask($pageNo, $pageSize, "id,store_id,district_id");
$this->executeTotal($resultArr);
unset($resultArr);
}
unset($this->agentsModel);
unset($this->tAgentTotalModel);
unset($this->houseModel);
unset($this->userModel);
unset($this->bargainModel);
unset($this->reportModel);
unset($this->marchInModel);
unset($this->payLogModel);
}
......
......@@ -175,7 +175,7 @@ $(function() {
'1': dealStar(item['evaluate_grade']),
'2': dealStarText(item['evaluate_grade']),
'3': item['created'],
'4': (item['receptiontime'] != ''||item['houserAddress'] != '')?(dealTimeKf(item['receptiontime'])+'在'+item['houserAddress']['address']+'看房'):'暂无看房数据',
'4': (item['receptiontime'] != ''||item['houserAddress'] != '')?(dealTimeKf(item['receptiontime'])+'在'+item['houserAddress']+'看房'):'暂无看房数据',
'5': item['evaluate_content'],
'6': item['user_pic'],
'7': ServerHost+'/app/images/ic_default_headpic.png'
......
......@@ -82,8 +82,7 @@ function jumpEvent(){
$('#jump_link').click(function(e){
e.preventDefault();
e.stopPropagation();
var _ym = (~ServerHost.indexOf('estate.'))?'https://admin.tonglianjituan.com/mobile4.0/xiazai.html':'https://develop.tonglianjituan.com/mobile4.0/xiazai.html';
location.href = _clientType==='b'?_ym:'download';
location.href = ServerHostTempC + _clientType==='b'?'/app_broker/download_b':'/app.php/app/download_c'
});
// var _ft = getUrlParam('ft');
......
......@@ -90,7 +90,7 @@ $(function() {
'1': dealStar(item['evaluate_grade']),
'2': dealStarText(item['evaluate_grade']),
'3': item['created'],
'4': (item['receptiontime'] != ''||item['houserAddress'] != '')?(dealTimeKf(item['receptiontime'])+'在'+item['houserAddress']['address']+'看房'):'暂无看房数据',
'4': (item['receptiontime'] != ''||item['houserAddress'] != '')?(dealTimeKf(item['receptiontime'])+'在'+item['houserAddress']+'看房'):'暂无看房数据',
'5': item['evaluate_content'],
'6': item['user_pic'],
'7': ServerHost+'/app/images/ic_default_headpic.png'
......
......@@ -136,7 +136,7 @@ var sends = {
if (response.code == 200) {
//成功跳转
$(".conform").html("提交.");
window.location.href="/app/download";
window.location.href="/app.php/app/download_c";
} else {
......
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