Commit f84c25e8 authored by clone's avatar clone

Merge branch '0225-v3.1.0' into test

# Conflicts: # application/index/extend/Basic.php # application/model/AAgents.php
parents 6e23d4db 9e470043
......@@ -11,6 +11,7 @@ use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
use app\model\GImageDepot;
use app\model\OPayLogModel;
use app\model\OPushMessageModel;
use app\model\OReportModel;
use app\model\Users;
......@@ -254,13 +255,43 @@ class AppointmentTime extends Basic
$result[$key]["images"] = count($res) > 0 ? $res : [];
}
}
//todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
$result[$key]["is_evaluate"] = $this->isEvaluate($val["id"],$params["user_id"]);
}
return $result;
}
/**
* 评价,追评 标签显示
* 0 显示评价经纪人 1 显示追评 2 显示已评价 7151
* @param $report_id
* @param $user_id
* @return int
*/
public function isEvaluate($report_id,$user_id){
//是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $report_id, $user_id);
$evaluate_count = count($evaluateResult);
//收款
$is_pay = 0;
$field_pay_log = "id,report_id";
$m_paylog = new OPayLogModel();
$payLogData = $m_paylog->selectPayLogByOrderNo($field_pay_log, ["report_id" => $report_id]);
if (count($payLogData) > 0) {
$is_pay = 1;
}
if ($evaluate_count == 0) {
$is_evaluate = 0;
} elseif (($evaluate_count == 1)&&($is_pay == 1)) {
$is_evaluate = 1;
} else {
$is_evaluate = 2;
}
return $is_evaluate;
}
/**
* @param $pageNo
* @param $pageSize
......
......@@ -111,6 +111,93 @@ class Broker extends Basic
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 indexV2()
{
header('Access-Control-Allow-Origin:*');
if (empty($this->params['house_id'])) {
$this->response(101, '参数错误');
}
$list = [];
$agents = new AAgents();
$m_march = new OMarchInModel();
$m_evaluate = new Evaluate();
//查找30天带看最多的人
$report_fields = 'a.reception_id';
$report_where['b.house_id'] = $this->params['house_id'];
$report_where['a.create_time'] = ['between', [date('Y-m-d', strtotime("-30 day")) . ' 00:00:00', date('Y-m-d').' 23:59:59']];
$reception_id = $m_march->getMaxMarchInAgent($report_fields, $report_where);
$fields_agent = 'id,name,img,phone';
if (!empty($reception_id['reception_id'])) {
$march_agent = $agents->findByOne($fields_agent, [ 'id' => $reception_id['reception_id']]);
if (!empty($march_agent)){
$march_agent['show_content'] = '我对本铺非常了解,最近带看本铺多次';
array_push($list, $march_agent);
}
}
$fields = 'a.id,a.name,a.img,a.phone';
//客方
if (!empty($this->userId)) {
if (!empty($list[0]['id'])) {
$client_where['b.agent_id'] = ['neq', $list[0]['id']];
}
$client_where['b.id'] = $this->userId;
$client = $agents->getAgentUser($fields, $client_where); //客方
if (!empty($client)){
$client['show_content'] = '帮助客户找更多,善于了解客户需求';
array_push($list, $client);
}
}
//独家方
if (!empty($list[0]['id']) && !empty($list[1]['id'])) {
$where['a.id'] = ['not in', [$list[0]['id'], $list[1]['id']]];
} elseif (!empty($list[0]['id'])) {
$where['a.id'] = ['neq', $list[0]['id']];
} elseif (!empty($list[1]['id'])) {
$where['a.id'] = ['neq', $list[1]['id']];
}
$where['b.houses_id'] = $this->params['house_id'];
$where['b.is_del'] = $where['a.status'] = 0;
$where['b.type'] = 3;
$house_agent = $agents->getAgentHouseType($fields, $where);
if (!empty($house_agent)){
$house_agent['show_content'] = '本铺由我登记,熟悉房源信息';
array_push($list, $house_agent);
}
foreach ($list as $k => $v) {
$list[$k]['head_portrait'] = $v['img'];
$evaluate_data = $m_evaluate->getAgentEvaluateFraction('count(id) as evaluate,sum(evaluate_grade) as evaluate_grade', ['agents_id'=>$v['id']]);
if ($evaluate_data[0]['evaluate_grade']) {
$evaluate_grade = floor(($evaluate_data[0]['evaluate_grade'] / 2) / $evaluate_data[0]['evaluate']);
} else {
$evaluate_grade = 0;
}
$list[$k]['evaluate_grade'] = $evaluate_grade;
$list[$k]['evaluate'] = $evaluate_data[0]['evaluate'];
unset($list[$k]['img']);
}
$data['list'] = $list;
$data['url'] = AGENTHEADERIMGURL;
return $this->response(200, '', $data);
}
/**
* 评价经纪人
*
......@@ -139,6 +226,12 @@ class Broker extends Basic
return $this->response($data['status'], 'source is null');
}
if (is_numeric($params['type'])) {
$type = $params['type'];
}else{
$type = 0;
}
$date = date('Y-m-d H:i:s');
$id_arr = [];
if (isset($params['sign_name'])) {
......@@ -170,6 +263,7 @@ class Broker extends Basic
'create_time' => $date,
'update_time' => $date,
'is_show' => 0,
'type' => $type,
'house_id' => $params['house_id']
]);
......
......@@ -324,7 +324,7 @@ class Shop extends Basic
return $this->response("101", "请求来源错误");
}
$field = "a.id,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,a.external_image_id,
$field = "a.id,a.internal_title,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,a.external_image_id,
a.industry_type,a.shop_area_start,a.shop_area_end,a.shop_type,a.residue_num,a.shop_sign,a.is_carefully_chosen,a.rent_type,
a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude,
b.enter_num,b.external_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
......@@ -404,6 +404,9 @@ class Shop extends Basic
$result['new_sign_rule'] = "付{$result['payment_month']}{$result['deposit_month']},签订{$result['age_limit']}年";
$result['payment_deposit'] = empty($result['payment_month']) ? "" : "付{$result['payment_month']}{$result['deposit_month']}";
$result['age_limit'] = empty($result['age_limit']) ? "" : "签订{$result['age_limit']}年";
$result['address'] = $result['city'].$result['disc'].$result['internal_title'];//7151
return $this->response("200", 'request success', $result);
}
......
......@@ -57,6 +57,7 @@ class Basic extends Controller
"api/bannerList",
"api/averagePriceAndTurnover",
"api/getBroker",
"api/getBrokerV2",
"api/brokerDetail",
"api/commentAndDeal",
"api/check_code",
......
......@@ -196,4 +196,24 @@ class MessageUntils
return false;
}
}
/**
* 对客户发送短信
* @param $phone
* @param string $templd = '226972'
* @return bool
*/
public function sendSMSForUser($phone,$data,$templd){
if((!$phone)or(!$data)or(!$templd)){
return false;
}
$message = new MessageUntils();
$result = $message->sendCCPSMS($phone,$data,$templd);
if ($result['statusCode'] == "000000") {
return true;
} else {
return false;
}
}
}
......@@ -23,6 +23,8 @@ use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\ACollectUser;
use app\model\ASite;
use app\model\AuthGroup;
use app\model\AuthRule;
use app\model\ChatUserExt;
use app\model\Evaluate;
use app\model\GOperatingRecords;
......@@ -61,6 +63,8 @@ class Broker extends Basic
*/
public function login()
{
return $this->response(101, '请升级');
$data['data'] = [];
if (empty($this->params['phone']) && empty($this->params['pwd'])) {
......@@ -153,21 +157,30 @@ class Broker extends Basic
$status = 0;
$agents_data = $v;
break; //查找正常状态
} else {
$status = $v['status'];
}
}
if ($status == 4) {
return $this->response(101, '该账号已被列入黑名单!');
}
if ($status) {
foreach ($agents_data_list as $v) {
if ($v['status'] == 4) {
return $this->response(101, '该账号已被列入黑名单!');
break;
switch ($agents_data['status']) {
case 1 :
$msg = '您目前是长假状态,请联系人事进行更改';break;
case 2 :
$msg = '您目前是已离职状态,请联系人事进行更改。';break;
case 3 :
$msg = '您已转勤';break;
case 4 :
$msg = '该账号已被列入黑名单!';break;
case 5 :
$msg = '该账号已被冻结!';break;
default :
$msg = '帐号异常';
}
if ($msg) {
return $this->response(101, $msg);
}
return $this->response(101, '你目前是长假/离职状态,请联系人事进行更改');
}
if ($agents_data['password'] != md5($this->params['pwd'])) {
......@@ -221,6 +234,17 @@ class Broker extends Basic
// }
// }
// /*处理多个手机登录聊天*/
$m_auth_group = new AuthGroup();
$auth_group = $m_auth_group->getAuthGroup($data['data']['auth_group_id'], 'title,rules');
$m_rule = new AuthRule();
$id = $m_rule->getAuthRuleByName('index/dailyDetailsFinance', 'id');
$rules_arr = explode(',', $auth_group['rules']);
$data['data']['show_daily'] = 0;
if (in_array($id, $rules_arr)) {
$data['data']['show_daily'] = 1; //财务日报显示
}
return $this->response(200, $data['msg'], $data['data']);
}
......
......@@ -117,8 +117,12 @@ class DailyPaper extends Basic
$other_bank = $params["other_bank"];
$bank_card = $params["bank_card"];
$site_id = $this->siteId;
$bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0;
$bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0;
$bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0;
$result = $this->service_->addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card);
$family_pay,$private_bank ,$cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card,$bank_card_yun
,$bank_card_lin,$bank_card_new);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
......
......@@ -90,8 +90,8 @@ class HomePageLog extends Basic
}
if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$time = strtotime($end_time) - strtotime($start_time);
if ($time > 1296000 || $time < 0) {
return $this->response(101, '搜索时间不能大于15天');
if ($time > 2592000 || $time < 0) {
return $this->response(101, '搜索时间不能大于30天');
}
$where_["create_time"] = array( 'between', array( $start_time, $end_time ) );
......@@ -202,8 +202,8 @@ class HomePageLog extends Basic
$end_time = date("Y-m-d H:i:s", $params["end_time"]);
$time = strtotime($end_time) - strtotime($start_time);
if ($time > 1296000 || $time < 0) {
return $this->response(101, '搜索时间不能大于15天');
if ($time > 2592000 || $time < 0) {
return $this->response(101, '搜索时间不能大于30天');
}
$where_["f.create_time"] = array( 'between', array( $start_time, $end_time ) );
}
......
......@@ -3,6 +3,7 @@
namespace app\api_broker\controller;
use app\api\service\PushClientService;
use app\api\untils\MessageUntils;
use app\api_broker\extend\Basic;
use app\api_broker\service\HouseNumUpdateService;
use app\api_broker\service\OrderLogService;
......@@ -16,6 +17,7 @@ use app\model\OImg;
use app\model\OMarchInModel;
use app\model\OrderModel;
use app\model\ORefundModel;
use app\model\OReportModel;
use think\Exception;
use Think\Log;
......@@ -132,6 +134,9 @@ class OrderLog extends Basic
//评价经纪人
$push_client = new PushClientService();
$push_client->record((int)$params["report_id"], (int)$params["order_id"], 0, '', (int)$this->agentId);
//对客户发送短信通知 7151
$this->sendSMSForUser($params["report_id"]);
return $this->response("200", "request success", []);
} else {
return $this->response("101", "request faild");
......@@ -140,6 +145,24 @@ class OrderLog extends Basic
}
/**
* 对客户发送短信通知
* @param $report_id
* @return bool
*/
public function sendSMSForUser($report_id){
$report = new OReportModel();
$messageUntil = new MessageUntils();
$user_phone = $report->getFieldValue('user_phone', ['id'=>$report_id]);
$result = $messageUntil->sendSMSForUser($user_phone,[SMS_TEMPLATE_URL],'415209');
if ($result == 'true') {
return true;
} else {
return false;
}
}
/**
* 收款
* @return \think\Response
......
......@@ -52,7 +52,7 @@ class Performance extends Basic
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $start_day, $end_day,$params["site_id"]);
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $start_day, $end_day, $params["site_id"]);
if (count($list) > 0) {
$result["list"] = $list;
$result["start_time"] = $start_day;
......@@ -86,7 +86,7 @@ class Performance extends Basic
$house_id = $params["house_id"];
}
try {
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"] ." 23:59:59",
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"] . " 23:59:59",
$params["is_case"], $house_id);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
......@@ -112,7 +112,7 @@ class Performance extends Basic
return $this->response("101", "请求参数错误");
}
try {
$result = $this->service_->storePerformance($params["agent_id"], $params["start_time"], $params["end_time"]." 23:59:59",$params["site_id"]);
$result = $this->service_->storePerformance($params["agent_id"], $params["start_time"], $params["end_time"] . " 23:59:59", $params["site_id"]);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
......@@ -168,14 +168,14 @@ class Performance extends Basic
"end_time" => "2018-04-12",
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"] )|| !isset($params["site_id"])) {
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["site_id"])) {
return $this->response("101", "请求参数错误");
}
Log::write($params, 'storeOrAgentSort'); //记录日志
//城市选择
$site_id = $params["site_id"]? $params["site_id"]: '';
$site_id = $params["site_id"] ? $params["site_id"] : '';
try {
$result = $this->service_->storeSortByDistrictId($params["agent_id"], $params["is_store"], $params["start_time"], $params["end_time"]." 23:59:59",$site_id);
$result = $this->service_->storeSortByDistrictId($params["agent_id"], $params["is_store"], $params["start_time"], $params["end_time"] . " 23:59:59", $site_id);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
......@@ -468,12 +468,6 @@ class Performance extends Basic
}
}
/**
* 获取时间段实收数据
* @return \think\Response
......@@ -490,7 +484,7 @@ class Performance extends Basic
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->paylogListPcInfo($params["id"],$params["type"], $start_day, $end_day, $page_no, $page_size);
$result = $this->service_->paylogListPcInfo($params["id"], $params["type"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
......@@ -514,12 +508,12 @@ class Performance extends Basic
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->marchInListPcInfo($params["id"],$params["type"], $start_day, $end_day, $page_no, $page_size);
$result = $this->service_->marchInListPcInfo($params["id"], $params["type"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
// return $this->response("200", "success", $result["date"]);
return $this->response("200", "success", [ "date" => $result["date"] , "total" => $result["total"] ]);
return $this->response("200", "success", ["date" => $result["date"], "total" => $result["total"]]);
}
}
......@@ -549,12 +543,12 @@ class Performance extends Basic
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->getFollowListPcInfo($params["id"],$params["type"], $start_day, $end_day, $page_no, $page_size);
$result = $this->service_->getFollowListPcInfo($params["id"], $params["type"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
//return $this->response("200", "success", $result["date"]);
return $this->response("200", "success", [ "date" => $result["date"] , "total" => $result["total"] ]);
return $this->response("200", "success", ["date" => $result["date"], "total" => $result["total"]]);
}
}
......@@ -577,7 +571,7 @@ class Performance extends Basic
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
//todo 最后跟进时间
$result = $this->service_->getHousingResourceListPcInfo($params["id"],$params["type"], $start_day, $end_day, $page_no, $page_size);
$result = $this->service_->getHousingResourceListPcInfo($params["id"], $params["type"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
......@@ -602,8 +596,8 @@ class Performance extends Basic
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->getUserResourceListPcInfo($params["id"],$params["type"], $start_day, $end_day,
$page_no, $page_size,$this->siteId);
$result = $this->service_->getUserResourceListPcInfo($params["id"], $params["type"], $start_day, $end_day,
$page_no, $page_size, $this->siteId);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
......@@ -628,7 +622,7 @@ class Performance extends Basic
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
// dump($params);
$result = $this->service_->getTeamNumPcInfo($params["id"],$params["type"], $page_no, $page_size,$this->siteId);
$result = $this->service_->getTeamNumPcInfo($params["id"], $params["type"], $page_no, $page_size, $this->siteId);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
......@@ -656,7 +650,7 @@ class Performance extends Basic
$request_source_type = !empty($params["request_source_type"]) ? $params["request_source_type"] : 0;
$result = $this->service_->getBargainSumPcInfo($params["id"],$params["type"], $start_day, $end_day, $page_no, $page_size,$request_source_type);
$result = $this->service_->getBargainSumPcInfo($params["id"], $params["type"], $start_day, $end_day, $page_no, $page_size, $request_source_type);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
......@@ -664,4 +658,30 @@ class Performance extends Basic
}
}
/**
* 收款信息
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=815
*/
public function collectionListByBargainId()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"bargain_id" => 121,
);*/
$checkResult = $this->validate($params, "PerformanceValidate.verifyCollectionList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$result = $this->service_->collectionList($params["bargain_id"]);
return $this->response("200", "success", $result);
}
}
......@@ -131,13 +131,23 @@ class Report extends Basic
$params["report_agent_id"] = $params["agent_id"];
$result = [];
if(isset($params["is_all"]) && $params["is_all"] == 1){
$vip = new VipService();
$check = $vip->vip($this->agentId, 'index/inspectionRecordAll');
if ($check) {
$check_type = $this->service_->getCheckType($this->agentId);
if ($check_type == 0) {
return $this->response(101, "暂无权限");
}
$result = $this->service_->orderListAll($field, $params, $pageNo, $pageSize);
$result = $this->service_->orderListAll($field, $params, $pageNo, $pageSize,$check_type);
}else{
$result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
}
......@@ -149,6 +159,22 @@ class Report extends Basic
}
}
/**
* 获取权限
* @return int|\think\Response
*/
public function getCheckType()
{
$result = $this->service_->getCheckType($this->agentId);
if ($result == 0) {
return $this->response(101, "暂无权限");
} else {
return $this->response("200", "request success", ['check_type'=>$result]);
}
}
/**
* 获取报备列表 pc
* @return \think\Response
......@@ -183,9 +209,8 @@ class Report extends Basic
$params["a.id"] = $params["report_id"];
}
$params["report_agent_id"] = $params["agent_id"];
$result = $this->service_->orderListForPc($field, $params, $pageNo, $pageSize);
// $result = $this->service_->orderListForPc($field, $params, $pageNo, $pageSize);
$result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
......
......@@ -2,6 +2,7 @@
namespace app\api_broker\service;
use app\model\AAgents;
use app\model\AuthGroup;
use app\model\AuthRule;
/**
* Created by PhpStorm.
......@@ -62,8 +63,18 @@ class MyCenterService{
if (!empty($result['auth_group_id'])) {
$m_auth_group = new AuthGroup();
$auth_group_name = $m_auth_group->getValue('title', ['id'=>$result['auth_group_id']]);
$result['auth_group_name'] = empty($auth_group_name) ? '':$auth_group_name;
$auth_group = $m_auth_group->getAuthGroup($result['auth_group_id'], 'title,rules');
$result['auth_group_name'] = empty($auth_group['title']) ? '':$auth_group['title'];
$m_rule = new AuthRule();
$id = $m_rule->getAuthRuleByName('index/dailyDetailsFinance', 'id');
$rules_arr = explode(',', $auth_group['rules']);
$result['show_daily'] = 0;
if (in_array($id, $rules_arr)) {
$result['show_daily'] = 1; //财务日报显示
}
}
return $result;
}
......
......@@ -231,6 +231,12 @@ class OrderLogService
break;
case 70:
break;
case 71:
break;
case 72:
break;
case 73:
break;
default:
return false;
}
......@@ -851,7 +857,8 @@ class OrderLogService
//报备
foreach ($reportData as $k => $v) {
$v["step_name"] = "report";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "报备【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
......@@ -873,7 +880,8 @@ class OrderLogService
if (count($marchInData) > 0) {
foreach ($marchInData as $k => $v) {
$v["step_name"] = "march_in";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "进场【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -902,7 +910,8 @@ class OrderLogService
if (count($payLogData) > 0) {
foreach ($payLogData as $k => $v) {
$v["step_name"] = "pay_log";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "收款【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -916,7 +925,8 @@ class OrderLogService
if (count($refundData) > 0) {
foreach ($refundData as $k => $v) {
$v["step_name"] = "refund";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "退款【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -928,7 +938,8 @@ class OrderLogService
if (count($bargainData) > 0) {
foreach ($bargainData as $k => $v) {
$v["step_name"] = "bargain";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "成交报告【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -986,7 +997,8 @@ class OrderLogService
//报备
foreach ($reportData as $k => $v) {
$v["step_name"] = "report";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "报备【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
......@@ -1009,7 +1021,8 @@ class OrderLogService
if (count($marchInData) > 0) {
foreach ($marchInData as $k => $v) {
$v["step_name"] = "march_in";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "进场【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -1038,7 +1051,8 @@ class OrderLogService
if (count($payLogData) > 0) {
foreach ($payLogData as $k => $v) {
$v["step_name"] = "pay_log";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "收款【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -1052,7 +1066,8 @@ class OrderLogService
if (count($refundData) > 0) {
foreach ($refundData as $k => $v) {
$v["step_name"] = "refund";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "退款【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......@@ -1064,7 +1079,8 @@ class OrderLogService
if (count($bargainData) > 0) {
foreach ($bargainData as $k => $v) {
$v["step_name"] = "bargain";
$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "成交报告【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
......
......@@ -7,9 +7,11 @@ use app\model\ASuperviseModel;
use app\model\GHouses;
use app\model\GHousesFollowUp;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OPayLogModel;
use app\model\ORefundModel;
use app\model\OReportModel;
use app\model\TAgentTotalModel;
use app\model\UPhoneFollowUp;
......@@ -894,5 +896,54 @@ class PerformanceService
return [ "code" => 200, "date" => $list ];
}
/**
* @param $bargain_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function collectionList($bargain_id){
$paylogModel = new OPayLogModel();
$orderParams["bargain_id"] = $bargain_id;
$field_pay_log = "a.id,a.report_id,a.create_time,a.bargain_id,a.money,a.type,a.income_time,a.source,c.id as agent_id,c.name,d.store_name,b.house_id";
$list = $paylogModel->getPayLogByOrderId($field_pay_log,$orderParams);
$reportModel = new OReportModel();
$gModel = new GHousesToAgents();
$refundModel = new ORefundModel();
$field_report = "c.name";
foreach ($list as $key=>$item){
//查询是否被退款
$refundParam["pay_log_id"] = $item["id"];
$refundResult = $refundModel->selectRefundByOrderNo("id" , $refundParam);
$list[$key]["is_refund"] = 0;
if( count($refundResult) > 0){
$list[$key]["is_refund"] = 1;
}
$list[$key]["salesman"] = "";
if($item["type"] == 91){
$params["id"] = $item["report_id"];
$result = $reportModel->getReport($field_report,$params);
$list[$key]["salesman"] = $result[0]["name"];
}
if($item["type"] == 92){
$param["a.houses_id"] = $item["house_id"];
$param["a.type"] = 3;
$param["a.is_del"] = 0;
$exclusive = $gModel->getAgentsHouses( "a.houses_id,b.name", $param);
if(empty($exclusive)){
$param["type"] = 1;
$param["is_del"] = 0;
$data = $gModel->getAgentsHouses( "a.houses_id,b.name", $param);
$list[$key]["salesman"] = $data[0]["name"];
}else{
$list[$key]["salesman"] = $exclusive[0]["name"];
}
}
}
return $list;
}
}
\ No newline at end of file
......@@ -112,7 +112,7 @@ class ReportService
// $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
$params["agent_id_s"] = array( "in", $params["report_agent_id"] );
$caseHouseId = $vModel->getCaseHouseIdByAgentId($params["agent_id_s"]);
$caseHouseId = $vModel->getPanpartyAndExclusiveHouseIdByAgentId($params["agent_id_s"]);
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
......@@ -184,9 +184,36 @@ class ReportService
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function orderListAll($field, $params, $pageNo, $pageSize)
public function orderListAll($field, $params, $pageNo, $pageSize,$check_type)
{
$vModel = new VerifyService();
$result = [];
switch ($check_type) {
case 1 :
$result = $this->oReportModel->selectReportListAll($field, $params, $pageNo, $pageSize);
break;
case 2 :
case 3 :
$agentArr = $vModel->getAgentsByAgentIdAndType($params["report_agent_id"], $check_type);
$params["agent_id_s"] = array( "in", $agentArr);
$params["report_agent_id"] = $agentArr;
$caseHouseId = $vModel->getPanpartyAndExclusiveHouseIdByAgentId($params["agent_id_s"]);
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
}
}
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
$params["house_ids"] = $ids;
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
break;
default:
}
return $this->returnResult($result);
}
......@@ -336,4 +363,26 @@ class ReportService
return $param;
}
/**
* 获取权限
* @param $agent_id
* @return int
*/
public function getCheckType($agent_id)
{
$vip = new VipService();
if($vip->vip($agent_id, 'index/inspectionRecordAll/3') == 0){//代表公司
return 1;
}
if($vip->vip($agent_id, 'index/inspectionRecordDistrict/2') == 0){//代表部门
return 2;
}
if($vip->vip($agent_id, 'index/inspectionRecordStore/1') == 0){//代表门店
return 3;
}
return 0;
}
}
\ No newline at end of file
......@@ -56,7 +56,13 @@ class UploadFileService
switch ($type) {
case 'chat':
$path .= 'static/chat_image/';
if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$internet_path = CHAT_IMG_URL;
} elseif (CURRENT_URL == 'https://pre2.tonglianjituan.com/') {
$internet_path = 'https://pre2.tonglianjituan.com/static/chat_image/';
} else {
$internet_path = CURRENT_URL . 'static/chat_image/';
}
break;
case 'user_header' :
$path .= 'static/user_header/';
......
......@@ -59,6 +59,35 @@ class VerifyService
return null;
}
public function getAgentsByAgentIdAndType($agent_id,$type)
{
$params["id"] = $agent_id;
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
if (count($result) > 0) {
$arr_list = [];
switch ($type) {
case 2:
$arr_list = $this->agentModel->searchAgentsByKeyword("id", ["district_id" => $result[0]["district_id"]]);
break;
case 3:
$arr_list = $this->agentModel->searchAgentsByKeyword("id", ["store_id" => $result[0]["store_id"]]);
break;
default:
return $agent_id;
break;
}
$ids = "";
if (count($arr_list) > 0) {
foreach ($arr_list as $item) {
$ids .= $item["id"] . ",";
}
}
$ids = rtrim($ids, ",");
return $ids;
}
return null;
}
/**
* 经纪人身份验证 获取经纪人
......@@ -196,6 +225,27 @@ class VerifyService
}
/**
* 获取我的盘方和独家
* @param $agent_id
* @return false|null|\PDOStatement|string|\think\Collection
*/
public function getPanpartyAndExclusiveHouseIdByAgentId($agent_id)
{
$houseToAgentModel = new GHousesToAgents();
$params["a.agents_id"] = $agent_id;
$params["a.type"] = array("in",'2,3'); //盘方和独家
$params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params);
if (count($house_arr) > 0) {
return $house_arr;
}
return null;
}
/**
* 获取我的盘方 楼盘
* @param $agent_id
......
......@@ -5,6 +5,7 @@ namespace app\api_broker\service;
use app\model\AAgents;
use app\model\AuthGroup;
use app\model\AuthRule;
use think\Exception;
/**
* Created by PhpStorm.
......@@ -14,6 +15,16 @@ use app\model\AuthRule;
*/
class VipService
{
private $agentModel;
private $groupModel;
private $rulesModel;
public function __construct()
{
$this->agentModel = new AAgents();
$this->groupModel = new AuthGroup();
$this->rulesModel = new AuthRule();
}
/**
* 是否具有查看vip客户权限
*
......@@ -24,20 +35,20 @@ class VipService
public function vip($id, $name = 'auth_vip')
{
//$id= 5743;
$agent = new AAgents();
$fields = 'auth_group_id';
$auth_group_id = $agent->getAgentsById($id, $fields);
if ($id == 1) {
return 0;
}
$auth_group = New AuthGroup();
$fields = 'auth_group_id';
$auth_group_id = $this->agentModel->getAgentsById($id, $fields);
$fields = 'rules';
$rules = $auth_group->getAuthGroupById($auth_group_id, $fields);
$rules = $this->groupModel->getAuthGroupById($auth_group_id, $fields);
$auth_group = New AuthRule();
$fields = 'id';
$auth_rule_id = $auth_group->getAuthRuleByName($name, $fields);
$auth_rule_id = $this->rulesModel->getAuthRuleByName($name, $fields);
$rules_arr = explode(',', $rules);
if (in_array($auth_rule_id, $rules_arr) || $id == 1) {
if (in_array($auth_rule_id, $rules_arr)) {
return 0;
} else {
return 1;
......@@ -55,9 +66,9 @@ class VipService
if (!$agent_id or !$group_id) {
return false;
}
$agent = new AAgents();
$fields = 'auth_group_id';
$auth_group_id = $agent->getAgentsById($agent_id, $fields);
$auth_group_id = $this->agentModel->getAgentsById($agent_id, $fields);
$rules_arr = explode(',', $group_id);
if (in_array($auth_group_id, $rules_arr)) {
return true;
......@@ -65,4 +76,34 @@ class VipService
return false;
}
}
/**
* 是否具有权限
*
* @param int $id
* @param string $name
* @return int 是否可以查看 0:可查看 1:不可查看
*/
public function checkRule(int $id,string $name)
{
if ($id == 1) {
return 0;
}
try {
$auth_group_id = $this->agentModel->getAgentsById($id, 'auth_group_id');
$rules = $this->groupModel->getAuthGroupById($auth_group_id, 'rules');
$auth_rule_id = $this->rulesModel->getAuthRuleByName($name, 'id');
} catch (Exception $e) {
return -1;
}
$rules_arr = explode(',', $rules);
$result = 1;
if (in_array($auth_rule_id, $rules_arr)) {
$result = 0;
}
return $result;
}
}
\ No newline at end of file
......@@ -22,6 +22,7 @@ class PerformanceValidate extends Validate
'push_id' => 'require',
'is_forbidden' => 'require|in:0,1',
'operator_id' => 'require|number',
'bargain_id' => 'require|number',
];
protected $message = [
......@@ -39,6 +40,8 @@ class PerformanceValidate extends Validate
'is_forbidden.in' => '是否绑定字段值只能为0或1',
'operator_id.require' => '操作人为必填字段',
'operator_id.number' => '操作人编号只能为数字',
'bargain_id.require' => '成交报告编号为必填字段',
'bargain_id.number' => '成交报告编号只能为数字',
];
protected $scene = [
......@@ -47,5 +50,6 @@ class PerformanceValidate extends Validate
'login' => [ 'phone', 'pwd', 'device_id', "push_id" ],
'verifyStatus' => [ 'agent_id', 'device_id' ],
'verifyIsForbidden' => [ 'phone', 'device_id', 'is_forbidden', 'operator_id' ],
'verifyCollectionList' => ['bargain_id'],
];
}
\ No newline at end of file
......@@ -609,12 +609,14 @@ class AppChat extends Basic
{
$params = $this->params;
/* $params = array(
"agent_id" => 5775
"agent_id" => 5775,
"user_id" => 123,
);*/
if (empty($params['agent_id'])) {
if (empty($params['agent_id']) && empty($params['user_id'])) {
return $this->response("101", "请求参数错误");
}
//todo 先获取是否有店铺或客户修改消息是否为0,大于0返回true,否则查询聊天消息是否有未读
if (!empty($params['agent_id'])){
$param["addressee_id"] = $params["agent_id"];
$param["is_read"] = 0;
//TODO 获取未读个数
......@@ -626,6 +628,10 @@ class AppChat extends Basic
}
$where["to_id"] = "agent_" . $params["agent_id"];
}else{
$where["to_id"] = "user_" . $params["user_id"];
}
$where["is_read"] = 0;
$chatModel = new ChatMsg();
$msg_count = $chatModel->getTotalByToId($where);
......
......@@ -26,6 +26,8 @@ define('WEEK_WORK_IMG', IMAGES_URL . 'static'. DS . 'week_work_img/'); //周报
define('PHONE_VOICE', ROOT_PATH.'public'.DS.'static'.DS.'voice'); //录音绝对路径
define('SHOP_IMAGE_DEPOT_URL', IMAGES_URL . 'static'. DS . 'shop_image_depot/'); //C端商铺随机图片地址
define('SMS_TEMPLATE_URL', 'https://dwz.cn/fUipTngy'); //进场对客户短信提醒变量短连接
return [
// +----------------------------------------------------------------------
// | 应用设置
......
......@@ -438,7 +438,7 @@ class Auth extends Basic
$where_rule['is_menu'] = 1;
//超级管理员
$auth = new AuthRule();
$nav = $auth->getRule('',$where_rule);
$nav = $auth->getRule('',$where_rule, 'sort ASC');
$menu_data = [];
......
......@@ -20,6 +20,7 @@ use app\model\AAgentsBlackListImg;
use app\model\ABindingDevice;
use app\model\AOperatingRecords;
use app\model\AStore;
use app\model\AuthGroupSite;
use app\model\Evaluate;
use app\model\GHousesToAgents;
use app\model\GOperatingRecords;
......@@ -110,8 +111,12 @@ class Broker extends Basic
$where['district_id'] = $this->params['district_id'];
}
if ($this->params['site_id'] && ($this->userId != 1)) {
$where['site_id'] = $this->params['site_id'];
if ($this->userId != 1) {
$group_site = new AuthGroupSite();
$agent_model = new AAgents();
$auth_group_id = $agent_model->getAgentFieldById($this->userId, 'auth_group_id');
$site_id = $group_site->getAgentField('site_id', ['group_id'=>$auth_group_id]);
$where['site_id'] = ['in', $site_id];
}
if ($this->params['position'] == -1) {
......
......@@ -78,25 +78,19 @@ class DailyPaper extends Basic
"private_bank" => "55",//3000账号
"cash" => "666",//现金
"pos" => "777",//pos机
"other_bank" => "888"//其他
"other_bank" => "888",//其他
"bank_card_yun" => "2323",
"bank_card_lin"=>"1213",
"bank_card_new"=>"123123"
);*/
if ($this->siteId == 10003) {
if (empty($params["agent_id"]) || empty($params["agent_name"]) || empty($params["daily_date"]) ||
!isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params['bank_card'])
) {
return $this->response("101", "请求参数错误");
}
} else {
if (empty($params["agent_id"]) || empty($params["agent_name"]) || empty($params["daily_date"]) ||
!isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params["realty_pay"]) ||
!isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) ||
!isset($params["pos"]) || !isset($params["other_bank"])
// || !isset($params["bank_card_yun"]) || !isset($params["bank_card_lin"]) || !isset($params["bank_card_new"])
) {
return $this->response("101", "请求参数错误");
}
}
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
......@@ -112,9 +106,13 @@ class DailyPaper extends Basic
$pos = $params["pos"];
$other_bank = $params["other_bank"];
$bank_card = $params["bank_card"];
$bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0;
$bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0;
$bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0;
$site_id = $this->siteId;
$result = $this->service_->addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card);
$family_pay,$private_bank ,$cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card,$bank_card_yun
,$bank_card_lin,$bank_card_new);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
......@@ -146,36 +144,24 @@ class DailyPaper extends Basic
"other_bank" => "888",//其他,
"operation_status" => 1,//0审核通过 1转为已审核
"remark" => "888"//备注,
"bank_card_yun" => "2323",
"bank_card_lin"=>"1213",
"bank_card_new"=>"123123"
);*/
// if (!isset($params["daily_id"]) || empty($params["agent_id"]) || empty($params["agent_name"]) ||
// !isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params["realty_pay"]) ||
// !isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) ||
// !isset($params["pos"]) || !isset($params["other_bank"]) || !isset($params["operation_status"])
// ) {
// return $this->response("101", "请求参数错误");
// }
$m_daily = new ODaily();
$daily_data = $m_daily->getDailyList('id,site_id',['id'=>$params['daily_id']],1,1);
if (empty($daily_data)) {
return $this->response(101, '没有该记录,审核失败');
}
if ($daily_data[0]['site_id'] == 10003) {
if (empty($params["agent_id"]) || empty($params["agent_name"]) || empty($params["daily_id"]) ||
!isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params['bank_card']) || !isset($params["operation_status"])
) {
return $this->response("101", "请求参数错误");
}
} else {
if (!isset($params["daily_id"]) || empty($params["agent_id"]) || empty($params["agent_name"]) ||
!isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params["realty_pay"]) ||
!isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) ||
!isset($params["pos"]) || !isset($params["other_bank"]) || !isset($params["operation_status"])
//|| !isset($params["bank_card_yun"]) || !isset($params["bank_card_lin"]) || !isset($params["bank_card_new"])
) {
return $this->response("101", "请求参数错误");
}
}
$daily_id = $params["daily_id"];
$agent_id = $params["agent_id"];
......@@ -193,11 +179,15 @@ class DailyPaper extends Basic
$tenpay_2 = $params["tenpay_2"];
$alipay_2 = $params["alipay_2"];
$bank_card = $params["bank_card"];
$bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0;
$bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0;
$bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0;
if($operation_status != 0 && $operation_status != 1){
return $this->response("101", "审核状态错误");
}
$result = $this->service_->addDailyCheck($daily_id,$agent_id, $agent_name, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank,$remark,$operation_status, $tenpay_2, $alipay_2, $bank_card);
$family_pay,$private_bank ,$cash, $pos, $other_bank,$remark,$operation_status, $tenpay_2, $alipay_2, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
......
......@@ -9,7 +9,10 @@
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ADistrict;
use app\model\AStore;
class District extends Basic
{
protected $code = 200;
......@@ -30,7 +33,6 @@ class District extends Basic
return view('index');
}
$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'];
......@@ -58,7 +60,23 @@ class District extends Basic
$where['a.site_id'] = $this->params['site_id'];
}
$data['list'] = $agents->getListDistrict($pageNo, $pageSize, 'id DESC', $field, $where,$join);
$list = $agents->getListDistrict($pageNo, $pageSize, 'id DESC', $field, $where,$join);
$m_agent = new AAgents();
$m_store = new AStore();
$agent_where['level'] = ['in', '30,40'];
$status_arr = [0=>'正常',1=>'长假',2=>'离职',3=>'转勤',4=>'黑名单',5=>'冻结'];
foreach ($list as $k=>$v) {
$agent_where['district_id'] = $v['id'];
$agent_data = $m_agent->getStoreIdByAgentId('name,phone,status', $agent_where);
$agent_name = '';
foreach ($agent_data as $k2=>$v2) {
$agent_name .= $v2['name'].'-'.$v2['phone'].'('.$status_arr[$v2['status']].')-';
}
$list[$k]['name'] = rtrim($agent_name,'-');
$list[$k]['store_num'] = $m_store->getTotal(['district_id'=>$v['id'],'status'=>0]);
}
$data['list'] = $list;
$data['total'] = $agents->getListDistrictTotal($where,$join);
return $this->response($data['status'], $data['msg'], $data);
}
......
......@@ -2618,14 +2618,13 @@ class Finance extends Basic
foreach ($list as $k=>$v) {
$list[$k]['source_id'] = $list[$k]['is_adjustment'] = '';
if ($v['source'] == 2) {
$source_id = $m_pay_adjustment->getFieldColumn('id', ['new_paylog_id'=> $v['id']]);
$source_id = $m_pay_adjustment->getFieldColumn('id', ['new_paylog_id'=> $v['id'],'is_del'=>0]);
$list[$k]['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
} else {
$source_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id'=> $v['id']]);
$source_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id'=> $v['id'],'is_del'=>0]);
$list[$k]['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
$list[$k]['is_adjustment'] = $source_id ? 1 : 0;
}
$num = $m_refund->getFind('id',['pay_log_id'=>$v['id'],'is_del'=>0]);
if ($num['id'] > 0) {
$list[$k]['is_refund'] = 1;
......@@ -3057,7 +3056,11 @@ class Finance extends Basic
}
if ($id[0]['source'] == 2) {
return $this->response(101, '调整后收款不能修改');
unset($this->params['receipt_number']);
unset($this->params['pay_type']);
unset($this->params['transfer_name']);
unset($this->params['money']);
// return $this->response(101, '调整后收款不能修改');
}
$m_pay_log = new OPayLogAdjustment();
......@@ -3869,7 +3872,7 @@ class Finance extends Basic
return $this->response(101, '你已审核过');
}
}
if (count($check_agent_id) == 3) {
if (count($check_agent_id) >= 1) {
$status = 3; //已审核
}
$save_data['status'] = 1;
......@@ -3879,7 +3882,7 @@ class Finance extends Basic
$log_where['status'] = 1;
$check_num = $m_refund_log->getTotal($log_where);
$id = 0;
if ($check_num == 4) {
if ($check_num >= 2) {
$save_data['status'] = $status = 2; //已审核
$num = $id = $m_refund_log->insertData($save_data);
}
......@@ -4015,13 +4018,6 @@ class Finance extends Basic
if (empty($this->params['pay_id'])) {
return $this->response(101, '参数错误');
}
$m_paylog = new OPayLogModel();
$field = 'a.id,a.create_time,a.order_id,a.father_id,a.money,a.real_money,a.pay_type,a.type,a.source,a.transaction_fee,a.source,b.f_id,a.transfer_name,a.receipt_number,';
$field .= 'e.name,a.income_time,e.store_id,b.house_id,b.order_no,a.report_id,a.house_number,a.is_dividend,a.last_transfer_time,a.industry_type,a.agent_id,d.internal_address as address,e.name as agent_name';
$where['a.is_del'] = $where_2['a.is_del'] = $where_3['a.is_del'] = 0;
$where_2['a.paylog_id'] = $where['a.father_id'] = $where_3['a.pay_log_id'] = $this->params['pay_id'];
$list = $m_paylog->getAddPayLogOrderListLimit(1, 1000, '', $field, $where);
$m_store = new AStore();
$m_pay_adjustment = new OPayLogAdjustment();
$m_report = new OReportModel();
......@@ -4029,6 +4025,21 @@ class Finance extends Basic
$m_house = new GHouses();
$m_refund = new ORefundModel();
$m_agent = new AAgents();
$m_paylog = new OPayLogModel();
$field = 'a.id,a.create_time,a.order_id,a.father_id,a.money,a.real_money,a.pay_type,a.type,a.source,a.transaction_fee,a.source,b.f_id,a.transfer_name,a.receipt_number,';
$field .= 'e.name,a.income_time,e.store_id,b.house_id,b.order_no,a.report_id,a.house_number,a.is_dividend,a.last_transfer_time,a.industry_type,a.agent_id,d.internal_address as address,e.name as agent_name';
$where['a.is_del'] = $where_2['a.is_del'] = $where_3['a.is_del'] = 0;
$where_2['a.paylog_id'] = $where_3['a.pay_log_id'] = $this->params['pay_id'];
$adjustment_id = $m_pay_adjustment->getFieldColumn('new_paylog_id',['paylog_id'=>$this->params['pay_id']]);
if ($adjustment_id) {
$sql_where = ' or a.id in ('.implode(',',$adjustment_id).')';
}
$where[] = ['EXP','a.father_id='.$this->params['pay_id']. $sql_where];
$list = $m_paylog->getAddPayLogOrderListLimit(1, 1000, '', $field, $where);
foreach ($list as $k=>$v) {
$list[$k]['source_id'] = $list[$k]['is_adjustment'] = '';
if ($v['source'] == 2) {
......
......@@ -2,6 +2,7 @@
namespace app\index\controller;
use app\api\untils\MessageUntils;
use app\api_broker\service\VipService;
use app\index\extend\Basic;
use app\index\service\ImageDepotService;
......@@ -9,6 +10,7 @@ use app\index\service\UserService;
use app\model\AAgents;
use app\model\GBusinessDistrict;
use app\model\GImageDepot;
use app\model\OReportModel;
use think\Cache;
use think\Log;
......@@ -179,12 +181,16 @@ class ImageDepot extends Basic
public function ceshi()
{
$arr=array('1','2','3');
$result=array_shift($arr);
dump($result);
dump($arr);
dump(count($arr));
dump(array_sum($arr));
$messageUntil = new MessageUntils();
$data = '朱伟2';
$result = $messageUntil->sendSMSForUser('18112347151',$data,'415209');
if ($result == 'true') {
return $this->response("200", "短信发送成功", $result);
} else {
return $this->response("101", $result);
}
}
......
......@@ -82,12 +82,25 @@ class Login extends Basic
return $this->response(101, '用户名或密码错误');
}
if ($user_data['status'] == 1 || $user_data['status'] == 2) {
return $this->response(101, '你目前是长假/离职状态,请联系人事进行更改');
if ($user_data['status']) {
switch ($user_data['status']) {
case 1 :
$msg = '您目前是长假状态,请联系人事进行更改。';break;
case 2 :
$msg = '您目前是已离职状态,请联系人事进行更改。';break;
case 3 :
$msg = '您已转勤';break;
case 4 :
$msg = '该账号已被列入黑名单!';break;
case 5 :
$msg = '该账号已被冻结!';break;
default :
$msg = '帐号异常';
}
if ($user_data['status'] == 4) {
return $this->response(101, '该账号已被列入黑名单!');
if ($msg) {
return $this->response(101, $msg);
}
}
$auth_group_id = '';
......@@ -121,11 +134,11 @@ class Login extends Basic
$where_rule['status'] = 0;
if ($user_data['id'] == 1) {
//超级管理员
$nav = $this->m_authRule->getRule('', $where_rule);
$nav = $this->m_authRule->getRule('', $where_rule, 'sort ASC');
} else {
$where_rule['id'] = [ 'in', $auth_group_id ];
//查询后台菜单
$nav = $this->m_authRule->getRule('', $where_rule);
$nav = $this->m_authRule->getRule('', $where_rule, 'sort ASC');
}
$menu_data = $auth_data = [];
......
......@@ -223,7 +223,8 @@ class PerformanceInfo extends Basic
$field .= 'District.district_name,';
$field .= 'Obargain.scale,';
$field .= 'Obargain.scale_fee,';
$field .= 'PartialCommission.practical_fee';
$field .= 'PartialCommission.practical_fee,';
$field .= 'Obargain.role';
$return = $this->oBargainModel->performancelInfoExcel($where,$field);
if(!$return){
......@@ -232,6 +233,7 @@ class PerformanceInfo extends Basic
$export = new ExportExcelUntil();
$e_data_new = [];
$role_arr = [1=>'盘方',2=>'客方',3=>'反签',4=>'独家',5=>'合作方',6=>'APP盘下载方',7=>'APP客下载方'];
foreach ($return as $key => $v) {
$e_data_old['bargain_id'] = $v["father_id"] == 0 ? $v["id"] : $v["father_id"];
......@@ -260,6 +262,7 @@ class PerformanceInfo extends Basic
$e_data_old['landmark'] = $landmark;//商铺地址
$e_data_old['house_id'] = $v['house_id'];//商铺编号
//$e_data_old['name_phone'] = $v['name'].'-'.$v['phone'];//分佣提成方
$e_data_old['role_name'] = $role_arr[$v['role']];//分佣提成方
$e_data_old['name_phone'] = $v['name'];//分佣提成方
//$e_data_old['district_name'] = $v['district_name'].'-'.$v['store_name'];//所属部门
$e_data_old['district_name'] = $v['store_name'];//所属部门
......@@ -270,7 +273,7 @@ class PerformanceInfo extends Basic
$e_data_new[]=$e_data_old;
}
$title = [ '成交报告ID', '分佣ID','提交时间', '成交类型', '商铺地址', '商铺编号', '分佣提成方', '所属部门门店', '分佣比例', '应分佣金', '实收佣金' ,'成交价'];
$title = [ '成交报告ID', '分佣ID','提交时间', '成交类型', '商铺地址', '商铺编号','角色', '分佣提成方', '所属部门门店', '分佣比例', '应分佣金', '实收佣金' ,'成交价'];
$export->exportTable('业绩明细', $e_data_new, count($e_data_new[0]), '业绩明细表', $title);
return '';
}
......
......@@ -184,8 +184,8 @@ class Remark extends Basic
if (!empty($this->params['start_date']) || !empty($this->params['end_date'])) {
$time = strtotime($this->params['end_date']) - strtotime($this->params['start_date']);
if ($time > 1296000 || $time < 0) {
return $this->response(101, '搜索时间不能大于15天');
if ($time > 2592000 || $time < 0) {
return $this->response(101, '搜索时间不能大于30天');
}
}
......
......@@ -10,6 +10,7 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\OReportModel;
class Report extends Basic
......@@ -28,6 +29,23 @@ class Report extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$m_report = new OReportModel();
$m_agent = new AAgents();
switch ($this->params['check_status']) {
case 0 :
$where['a.report_agent_id'] = $this->userId;
break;
case 1 :
$store_id = $m_agent->getAgentFieldById($this->userId, 'store_id');
$where['d.store_id'] = $store_id;
break;
case 2 :
$district_id = $m_agent->getAgentFieldById($this->userId, 'district_id');
$where['d.district_id'] = $district_id;
break;
case 3 :
break;
}
$data['code'] = 200;
$data['msg'] = "";
$where["a.status"] = 0;
......@@ -63,7 +81,7 @@ class Report extends Basic
$where['b.id'] = $this->params['order_id'];
}
$field = 'b.id as order_id,a.user_name,a.user_phone,a.create_time,a.report_agent_name,c.internal_title,a.predict_see_time';
$field = 'b.id as order_id,a.user_name,a.user_phone,a.create_time,a.report_agent_name,c.internal_title as house_title,a.predict_see_time';
$field .= ',a.id,b.order_no';
try {
......
......@@ -168,6 +168,7 @@ class Setting extends Basic
$redis->set('s_lookNum', $agent_shop_num); //业务员最多可查看的商铺数量
$redis->set('s_agent_call_day', $data['agent_call_day']); //业务员多少天可以打多少电话
$redis->set('s_agent_call_number', $data['agent_call_number']); //业务员多少天可以打多少电话
$redis->set('s_agent_suspend', $data['agent_suspend']); //业务员多少天可以打多少电话
return ;
}
......
......@@ -79,6 +79,7 @@ class Basic extends Controller
'index/userModalList',
'index/mainIndex',
'index/uploadImg',
'index/uploadEditor'
'index/uploadEditor',
'index/downloadFile'
);
......
......@@ -19,6 +19,7 @@ use app\model\ADistrict;
use app\model\AOperatingRecords;
use app\model\ASite;
use app\model\AuthGroupSite;
use app\model\Evaluate;
use app\model\GHousesToAgents;
use app\model\GOperatingRecords;
use app\model\OMarchInModel;
......@@ -52,8 +53,10 @@ class BrokerService
$select_where['name'] = $data['name'];
$select_where['site_id'] = $data['site_id'];
if (empty($data['id'])) {
$select_where['status'] = 0;
$select_where['phone'] = ['<>', $data['phone']];
} else {
$select_where['status'] = 0;
$select_where['id'] = ['<>', $data['id']];
}
$check_id = $this->m_agent->getAgentsByWhere($select_where, 'id');
......@@ -341,20 +344,24 @@ class BrokerService
unset($data['id']);
$data['password_md5'] = $agent_old[0]['password'];
$data['img'] = $agent_old[0]['img'];
$id = $this->m_agent->saveAgent($data); //普通转勤
$this->transferUserHouse($id, $agent_old[0]['id'], $operation_id, $data);
$this->transferEvaluate($id, $agent_old[0]['id']);
} else {
$agent_old[0]['status'] = 3;
unset($agent_old[0]['id']);
$this->m_agent->saveAgent($agent_old[0]); //新增一条转勤状态
$data['id'] = $agent_old[0]['id']; //将原来的id作为新的
$data['img'] = $agent_old[0]['img'];
$id = $this->m_agent->saveAgent($data);
}
} else {
$this->m_agent->saveAgent(['id'=>$agent_old[0]['id'], 'status'=>3]); //将原来的设置为转勤状态
$this->m_agent->saveAgent(['id'=>$transfer_agent, 'status'=>0]); //将原来转勤状态处理为正常
$this->m_agent->saveAgent(['id'=>$transfer_agent, 'status'=>0, 'img'=>$agent_old[0]['img']]); //将原来转勤状态处理为正常
$this->transferUserHouse($transfer_agent, $agent_old[0]['id'], $operation_id, $data);
$this->transferEvaluate($transfer_agent, $agent_old[0]['id']);
$id = $transfer_agent;
}
......@@ -383,17 +390,26 @@ class BrokerService
$m_user = new Users();
$update_user = $update_house = [];
$user_id_arr = $m_user->getUserByWhereColumn(['agent_id' => $change_old_id], 'id');
$referrer_id_arr = $m_user->getUserByWhereColumn(['referrer_id' => $change_old_id, 'referrer_source'=>20], 'id');
foreach ($user_id_arr as $k => $v) {
$update_user[$k]['id'] = $v;
$update_user[$k]['agent_id'] = $id;
}
$record_data['user_id'] = empty($user_id_arr) ? "" : implode(',', $user_id_arr);
foreach ($referrer_id_arr as $k2=>$v2) {
$update_referrer = [
'id'=>$v2,
'referrer_id'=>$id
];
array_push($update_user, $update_referrer);
}
$record_data['user_id'] = empty($user_id) ? "" : implode(',', $user_id);
$m_house = new GHousesToAgents();
$house_where['is_del'] = 0;
$house_where['agents_id'] = $change_old_id;
$house_where['type'] = ['in', '2,3'];
// $house_where['type'] = ['in', '2,3'];
$house_id_arr = $m_house->getAgentHouseOne('id', $house_where);
foreach ($house_id_arr as $k => $v) {
......@@ -432,7 +448,7 @@ class BrokerService
*/
private function rootDOLog($id, $status)
{
$agent_status =[0=>'正常',1=>'长假',2=>'离职',3=>'转勤'];
$agent_status =[0=>'正常',1=>'长假',2=>'离职',3=>'转勤',4=>'锁定'];
$records = new GOperatingRecords();
$remark = '修改为 '.$agent_status[$status];
$result = $records->record(0, 7, $remark, '',$id);
......@@ -454,5 +470,16 @@ class BrokerService
return true;
}
/**
* 转换评价
*
* @param $agent_id
* @param $change_old_id
* @return Evaluate
*/
public function transferEvaluate($agent_id, $change_old_id){
$m_evaluate = new Evaluate();
return $m_evaluate->updateData(['agents_id'=>$agent_id], ['agents_id'=>$change_old_id]);
}
}
\ No newline at end of file
......@@ -635,6 +635,9 @@ class UserService
$where[] = ['EXP', "(bind_id = '{$user_info['bind_id']}' or id = '{$user_info['bind_id']}') and id != '{$user_id}'"];
}
$user_info_list = $this->user->getUserByWhere($where,$field);
foreach ($user_info_list as $k=>$v) {
$user_info_list[$k]['user_phone'] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
}
return $user_info_list;
}
......
......@@ -156,6 +156,8 @@
<option value="2">离职</option>
<option value="3">已转勤</option>
<option value="4">黑名单</option>
<option value="5">自动锁定</option>
</select>
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
......
......@@ -380,9 +380,11 @@
<option value="42">3000账号</option>
<option value="50">现金</option>
<option value="70">银满谷银行卡</option>
<option value="71">筠姐上海银行卡</option>
<option value="72">林老师建行卡</option>
<option value="73">新同联福居银行卡</option>
<option value="60">其他</option>
</select>
<select class="form-control btn2 ld-Marheight" id="come_from">
<option value="-1">来源</option>
......@@ -828,21 +830,24 @@
<option value="21" class="shanghai">林老师微信</option>
<option value="30" class="shanghai">pos机器</option>
<option value="40" class="shanghai">地产转账</option>
<option value="41" class="shanghai">世家公账</option>
<option value="42" class="shanghai">3000账号</option>
<option value="50" class="shanghai">现金</option>
<option value="60" class="shanghai">其他</option>
<option value="70" class="shanghai">银满谷银行卡</option>
<option value="73" class="shanghai">新同联福居银行卡</option>
<option value="41" class="shanghai">世家公账</option>
<option value="11" class="hangzhou">林老师支付宝</option>
<option value="21" class="hangzhou">林老师微信</option>
<option value="30" class="hangzhou">pos机器</option>
<option value="40" class="hangzhou">地产转账</option>
<option value="50" class="hangzhou">现金</option>
<!--<option value="60" class="hangzhou">其他</option>-->
<option value="70" class="hangzhou">银满谷银行卡</option>
<option value="72" class="hangzhou">林老师建行卡</option>
<option value="12" class="shenzheng">筠姐支付宝</option>
<option value="22" class="shenzheng">筠姐微信</option>
<option value="70" class="shenzheng">银满谷银行卡</option>
<option value="71" class="shenzheng">筠姐上海银行卡</option>
<option value="41" class="shenzheng">世家公账</option>
<option value="30" class="shenzheng">pos机器</option>
</select>
</div>
......
......@@ -290,6 +290,12 @@
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<div class="text-danger">
备注:一、在审核中状态时,有2个人审核通过,则单子 自动从 审核中 状态 走到 已审核 状态。即 退款只要经过了2个人审核,便审核通过。<br />
</div>
<div style="margin-left: 42px;margin-bottom: 10px;" class="text-danger">
二、出纳人员在已审核列表,点击【转到已退款】按钮,上传转账图片,进行退款转账操作,则退款单子从已审核状态 走到已退款状态。
</div>
<li>
<a href="javascript:;">退款出账</a>
</li>
......@@ -415,7 +421,7 @@
<!-- /.modal -->
</div>
<!-- 收款详情 -->
<div class="modal fade" id="modal-check" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal fade" id="modal-check" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="font-size: 16px;">
<div class="modal-dialog modal-body-width">
<div class="modal-content">
<div class="modal-header">
......
......@@ -86,6 +86,7 @@
</td>
</tr>
<tr>
<th class="text-center">带看ID</th>
<th class="text-center">客户姓名</th>
<th class="text-center">客户电话</th>
<th class="text-center">进场时间</th>
......@@ -133,6 +134,7 @@
<!--主要列表模板-->
<script id="marchin_list_tpl" type="text/template">
<tr class="text-center">
<td>{7}</td>
<td>{0}</td>
<td>{1}</td>
<td>{2}</td>
......
......@@ -6,6 +6,9 @@
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container">
<div class="row">
......
......@@ -210,6 +210,19 @@
<div class="col-xs-12 p-a-0" style="height:3.86rem" >
<div class="col-xs-8 p-a-10 p-t-0" >
<div class="panel panel-default">
<div style="float:right;margin-top:.1rem;margin-right : .1rem ;">
<select class="form-control" id="orderCity">
<!--<option value="0">
上海
</option>
<option value="1">
杭州
</option>
<option value="2">
深圳
</option>-->
</select>
</div>
<div class="area-title p-a-15 p-tb-10">
<span><strong>团队荣誉榜</strong><span class="time_control" id="tymd"></span></span>
</div>
......@@ -267,7 +280,7 @@
<div class="area-title p-a-15 p-b-10">
<a><span id="table-title" class="active table-choose">职称</span></a>
<a><span id="group-title" class="table-choose left-padding ">团队</span></a>
<a><span class="btn more-news-long-1" id="initOder" style="font-size:15px;">加载</span></a>
<!--<a><span class="btn more-news-long-1" id="initOder" style="font-size:15px;">加载</span></a>-->
<a><span class="title-time" id="table-time"></span></a>
</div>
......
......@@ -54,6 +54,14 @@
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<!--同步app-->
<tr>
<td colspan="14" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn" id="our">我的</a>
<a class="btn btn-default liudan_pic_btn" id="is_show_store">门店</a>
<a class="btn btn-default liudan_pic_btn" id="is_show_district">部门</a>
<a class="btn btn-default liudan_pic_btn" id="is_show_all">全部</a>
</td>
</tr>
<tr>
<td colspan="10">
<form id="form_search">
......
......@@ -386,6 +386,21 @@ class AAgents extends BaseModel
->select();
}
public function selectFollowUpNumByAgent( $field = "a.id",$table,$params,$num)
{
$params["district_id"] = array( 'not in', array( '13', '14', '15' ) );
$result = Db::table($this->table)
->field($field)
->alias("a")
->join( "$table b" ,"a.id = b.agent_id","left")
->where($params)
->group("a.id")
->having("count < $num")
->select();
//echo $this->getLastSql();
return $result;
}
/**
* @param string $field
* @param $params
......@@ -1576,6 +1591,9 @@ class AAgents extends BaseModel
}
public function findByOne($field,$params) {
if (!isset($params['status'])) {
$where['status'] = 0;
}
$result = $this
->field($field)
->where($params)
......@@ -1600,6 +1618,36 @@ class AAgents extends BaseModel
->count();
//dump($this->getLastSql());
return $return;
} /**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentUser($field, $where) {
return $this->alias('a')
->field($field)
->join('u_users b','a.id = b.agent_id', 'left')
->where($where)
->find();
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentHouseType($field, $where) {
return $this->alias('a')
->field($field)
->join('g_houses_to_agents b', 'a.id=b.agents_id', 'left')
->where($where)
->find();
}
}
\ No newline at end of file
......@@ -116,7 +116,6 @@ class ADistrict extends BaseModel
$data['city'] = Db::table('a_site')->where('id', $district['site_id'])->value('city');
$agents = Db::table('a_agents')->field('name,phone')
->where([
'status' => 0,
'level' => ['in',[30,40]],
'district_id' => $id
])->find();
......@@ -153,30 +152,6 @@ class ADistrict extends BaseModel
->limit($pageSize)
->page($pageNo)
->select();
$result = array();
foreach ($data as $k=>$v){
$result[$k] = $v;
if (isset($v->id)) {
if ($result[$k]['district_name']) {
$agents = Db::table('a_agents')->field('name,phone')->where([
'status'=>0,'district_id'=>$v->id,'level'=>['in','30,40']
])->find();
$result[$k]['name'] = $agents['name'].'-'.$agents['phone'];
$result[$k]['store_num'] = Db::table('a_store')->where([
'status'=>0,'district_id'=>$v->id
])->count('store_name');
} else {
$result[$k]['store_num'] = '';
}
}
if ($v['site_id']) {
$result[$k]['city'] = Db::table('a_site')->where('id', $v['site_id'])->value('city');
} else {
$result[$k]['city'] = "";
}
}
} else {
$data = $this->field($field)->alias('a')
->join('a_agents b','a.id=b.district_id','left')
......@@ -185,30 +160,9 @@ class ADistrict extends BaseModel
->limit($pageSize)
->page($pageNo)
->select();
$result = array();
foreach ($data as $k=>$v){
$result[$k] = $v;
if (isset($v->id)) {
if ($result[$k]['district_name']) {
$result[$k]['name'] = $v['name'].'-'.$v['phone'];
$result[$k]['store_num'] = Db::table('a_store')->where([
'status'=>0,'district_id'=>$v->id
])->count('store_name');
} else {
$result[$k]['store_num'] = '';
}
}
if ($v['site_id']) {
$result[$k]['city'] = Db::table('a_site')->where('id', $v['site_id'])->value('city');
} else {
$result[$k]['city'] = "";
}
}
}
return $result;
return $data;
}
/**
......
......@@ -79,4 +79,20 @@ class AuthGroup extends BaseModel
->where('status', $status)
->value($fields);
}
/**
* @param $id
* @param $fields
* @param int $status
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAuthGroup($id, $fields, $status = 0)
{
return $this->field($fields)->where('id',$id)
->where('status', $status)
->find();
}
}
......@@ -69,4 +69,14 @@ class AuthGroupSite extends BaseModel
return $data;
}
/**
* @param $id
* @param $fields
* @return mixed
*/
public function getAgentField($fields, $where)
{
return $this->where($where)->value($fields);
}
}
\ No newline at end of file
......@@ -170,15 +170,16 @@ class AuthRule extends BaseModel
*
* @param string $field
* @param $where
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRule($field = 'id,name,title,pid,is_menu', $where) {
public function getRule($field = 'id,name,title,pid,is_menu', $where, $order = 'sort ASC') {
return $this->field($field)
->where($where)
->order('sort ASC')
->order($order)
->select();
}
......
......@@ -17,11 +17,12 @@ class BaseModel extends Model
* 记录总数
*
* @param $params
* @param string $field
* @return int|string
*/
public function getTotal($params)
public function getTotal($params,$field = 'id')
{
return $this->where($params)->count();
return $this->where($params)->count($field);
}
/**
......
......@@ -111,6 +111,7 @@ class Evaluate extends Model
$params["user_id"] = $userId;
return $this->field("id")
->where($params)
->group("type")
->select();
}
......@@ -192,4 +193,13 @@ class Evaluate extends Model
//dump($this->getLastSql());
return $result;
}
/**
* @param $data
* @param $where
* @return Evaluate
*/
public function updateData($data, $where) {
return $this->where($where)->update($data);
}
}
......@@ -266,6 +266,27 @@ class GHousesToAgents extends BaseModel
return $result;
}
/**
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsHouses( $field = '', $params = '')
{
$data = $this->field($field)
->alias('a')
->join('a_agents b', 'a.agents_id = b.id', 'left')
->where($params)
->select();
// echo $this->getLastSql();
return $data;
}
/**
* @param $field
* @param $params
......@@ -425,7 +446,7 @@ class GHousesToAgents extends BaseModel
* @param array $where
* @return array
*/
public function getHouseAgent(string $field = '', array $where = []) : array
public function getHouseAgent(string $field = "", array $where = []) : array
{
try {
$where['a.is_del'] = 0;
......
......@@ -138,6 +138,9 @@ class OPayLogModel extends Model
if (isset($params["house_title"])) {
$where_["b.house_title"] = $params["house_title"];
}
if (isset($params["bargain_id"])) {
$where_["a.bargain_id"] = $params["bargain_id"];
}
$where_["a.is_del"] = 0;
return Db::table($this->table)
->field($field)
......@@ -149,6 +152,7 @@ class OPayLogModel extends Model
->select();
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
......
......@@ -92,6 +92,9 @@ class ORefundModel extends Model{
if (isset($params["status"])) {
$where_["status"] = $params["status"];
}
if (isset($params["pay_log_id"])) {
$where_["pay_log_id"] = $params["pay_log_id"];
}
return $this->db_
->field($filed)
......
......@@ -176,6 +176,9 @@ class OReportModel extends Model
if (isset($params["user_id"])) {
$where_["a.user_id"] = $params["user_id"];
}
if (isset($params["id"])) {
$where_["a.id"] = $params["id"];
}
return $this->db->field($filed)
->alias("a")
->join("o_order b", "a.id = b.f_id", "left")
......@@ -742,6 +745,7 @@ class OReportModel extends Model
{
$result = $this->db->field($field)
->alias("a")
->join("a_agents d", "a.report_agent_id = d.id", "left")
->join("o_order b", "a.id = b.f_id", "left")
->join("g_houses c", "b.house_id = c.id", "left")
->where($params)
......@@ -761,6 +765,7 @@ class OReportModel extends Model
public function getAddReportListTotal($params)
{
return $this->db->alias("a")
->join("a_agents d", "a.report_agent_id = d.id", "left")
->join("o_order b", "a.id = b.f_id", "left")
->join("g_houses c", "b.house_id = c.id", "left")
->where($params)
......
......@@ -381,7 +381,10 @@ Route::group('index', [
'addSite' => ['index/Site/addSite', ['method' => 'POST|GET']], //获取站点列表 朱伟 2018-10-18
'getSiteList' => ['index/Site/getSiteList', ['method' => 'POST|GET']], //获取站点列表 朱伟 2018-10-18
'delImageDepot_Site' => ['index/Site/delImageDepot', ['method' => 'POST|GET']], //关闭或开启站点 朱伟 2018-10-18
'inspectionRecordAll' => ['index/Report/inspectionRecordAll', ['method' => 'GET']], //全部约带看
'inspectionRecordOur/:check_status' => ['index/Report/inspectionRecordAll', ['method' => 'GET'],['check_status'=>0]], //我的约带看
'inspectionRecordStore/:check_status' => ['index/Report/inspectionRecordAll', ['method' => 'GET'], ['check_status'=>1]], //门店约带看
'inspectionRecordDistrict/:check_status' => ['index/Report/inspectionRecordAll', ['method' => 'GET'],['check_status'=>2]], //部门约带看
'inspectionRecordAll/:check_status' => ['index/Report/inspectionRecordAll', ['method' => 'GET'],['check_status'=>3]], //全部约带看
'setSite' => ['index/auth/setSite', ['method' => 'GET|POST']], //设置角色站点
......@@ -430,6 +433,7 @@ Route::group('api', [
//get broker
'getBroker' => ['api/broker/index', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'getBrokerV2' => ['api/broker/indexV2', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'test' => ['api/broker/testtest', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'commentAndDeal' => ['api/broker/commentAndDeal', ['method' => 'get']], //获取当前经纪人的评价和交易列表
'brokerDetail' => ['api/broker/brokerDetail', ['method' => 'get']], //经纪人详情
......@@ -577,6 +581,8 @@ Route::group('task', [
'test' => ['task/FollowUpTask/test', ['method' => 'get']],
'isExistTable' => ['task/FollowUpTask/isExistTable', ['method' => 'get']],
'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']],
'frostAgent' => ['task/FrostAgentTask/frostAgent', ['method' => 'get']],
]);
Route::group('broker', [
......@@ -639,6 +645,7 @@ Route::group('broker', [
'reportList' => ['api_broker/Report/reportList', ['method' => 'get']],
'getCheckType' => ['api_broker/Report/getCheckType', ['method' => 'get|post']],
'reportListForPc' => ['api_broker/Report/reportListForPc', ['method' => 'get']],
'orderDetail' => ['api_broker/OrderLog/orderDetail', ['method' => 'get|post']],
......@@ -717,6 +724,7 @@ Route::group('broker', [
'performanceList' => ['api_broker/Performance/performanceList', ['method' => 'POST|GET']], //业绩list
'superviseList' => ['api_broker/Performance/superviseList', ['method' => 'POST|GET']], //监督执行list
'officialReceiptsList' => ['api_broker/Performance/officialReceiptsList', ['method' => 'POST|GET']], //实收list
'collectionListByBargainId' => ['api_broker/Performance/collectionListByBargainId', ['method' => 'POST|GET']], //实收list
'paylogListPcInfo' => ['api_broker/Performance/paylogListPcInfo', ['method' => 'POST|GET']], //
'marchInListPcInfo' => ['api_broker/Performance/marchInListPcInfo', ['method' => 'POST|GET']], //
......
<?php
namespace app\task\controller;
/**
* Created by PhpStorm.
* User: fuju
* Date: 2019/2/27
* Time: 16:05
*/
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\ASite;
class FrostAgentTask{
private $agentsModel;
private $table = 'u_phone_follow_up_';
private $date ;
private $siteModel;
private $redis_;
function __construct()
{
$this->agentsModel = new AAgents();
$this->date = date("Y-m-d",strtotime("-1 day"));
$this->siteModel = new ASite();
$this->redis_ = RedisExt::getRedis();
}
public function frostAgent(){
$num = $this->redis_->get("s_agent_suspend");
//大于30不合理,容错
if($num < 0 && $num >30){
return;
}
$site_arr = $this->siteModel->getSite("id,name,city,is_del", ["is_del" => 0]);
if (count($site_arr) <= 0) {
return;
}
$field = "count(1) as count,a.id";
$params["a.status"] = 0;
$params["a.level"] = 10;
foreach ($site_arr as $item) {
$table_name = $this->table . $item["id"] . "_" . $this->date;
$params["a.site_id"] = $item["id"];
$agent_arr = $this->agentsModel->selectFollowUpNumByAgent( $field,$table_name,$params,$num);
if(count($agent_arr) > 0){
$this->execute_update($agent_arr);
}
}
}
private function execute_update($agent_arr){
$ids = "";
foreach ($agent_arr as $item) {
$ids .= $item["id"] . ",";
}
$ids = rtrim($ids, ",");
$this->agentsModel->saveStatus("status","5",$ids);
}
}
\ No newline at end of file
......@@ -23,4 +23,4 @@
if(!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);</script><link href=./static/css/app.8e7a1294243657c878b001aee61ce09a.css rel=stylesheet></head><body><div id=app></div><script src=https://api.tonglianjituan.com/app/js/libs/vue.min.js></script><script src=https://api.tonglianjituan.com/app/js/libs/vue-router.min.js></script><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1b35a927314506fe4a4f.js></script><script type=text/javascript src=./static/js/app.95bcdcbc5ae5c04a833f.js></script></body></html>
\ No newline at end of file
})(document, window);</script><link href=./static/css/app.fb0495c45d8e8f4a215b24c757e3a74d.css rel=stylesheet></head><body><div id=app></div><script src=https://api.tonglianjituan.com/app/js/libs/vue.min.js></script><script src=https://api.tonglianjituan.com/app/js/libs/vue-router.min.js></script><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1b35a927314506fe4a4f.js></script><script type=text/javascript src=./static/js/app.ea8ef220e6c195a1a4bc.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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