Commit ce23a501 authored by zw's avatar zw

Merge branch '1210-v3.0.2' into test

# Conflicts: # application/index/controller/Finance.php # application/index/controller/ImageDepot.php # public/app/dist/index.html # public/app/dist/static/css/app.18f66e05aeedf4028dbf86453eab6b23.css # public/app/dist/static/css/app.370df8a02c6ffd39798798a503aab7d5.css # public/app/dist/static/css/app.a73181a8689d77665f3ecd7635761082.css # public/appnew/src/components/shop/redPackMask.vue # public/appnew/src/components/shop/shopList.vue
parents 819646d8 af672367
......@@ -39,13 +39,14 @@ class Bargain extends Basic
"is_my_correlation" => 1, //是否与我相关 0全部 1与我相关
// "keyword" => "17717536291",
"page_no" => 1,
"page_size" => 10
"page_size" => 10,
"bargain_id" =>10
);*/
$checkResult = $this->validate($params, "BargainValidate.bargainList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
return $this->response("10111", $checkResult);
}
$pageNo = empty($params["page_no"]) ? 1 : $params["page_no"];
$pageSize = empty($params["page_size"]) ? 15 : $params["page_size"];
......@@ -53,6 +54,7 @@ class Bargain extends Basic
$status = $params["status"];
$is_my_correlation = $params["is_my_correlation"];
$keyword = empty($params["keyword"]) ? "" : $params["keyword"];
$bargain_id = empty($params['bargain_id']) ? '':$params['bargain_id'];
/*业务员不允许点击查看全部成交报告 start*/
$agent_field = "a.level";
$agent_res = $this->agentModel->getAgentsInfoByAgentId($agent_field, [ "agent_id" => $submit_agent_id ]);
......@@ -62,7 +64,7 @@ class Bargain extends Basic
}
/*业务员不允许点击查看全部成交报告 end*/
$result = $this->service_->getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword);
$result = $this->service_->getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id);
return $this->response("200", "success", $result);
}
......
......@@ -81,6 +81,10 @@ class Broker extends Basic
return $this->response(101, '账号已冻结', $data['data']);
}
if ($agents_data['status'] == 4) {
return $this->response(101, '该账号已被列入黑名单!', $data['data']);
}
if ($agents_data['password'] != md5($this->params['pwd'])) {
return $this->response(101, '密码错误', $data['data']);
}
......
......@@ -189,21 +189,25 @@ class OrderLog extends Basic
}
return $this->response("101", "request faild");
}
/**
* 收款
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws Exception
*/
public function collectingBill()
{
$params = $this->params;
if (!isset($params["agent_id"]) || !isset($params["agent_id"]) || !isset($params["report_id"]) || !isset($params["order_id"]) || !isset($params["order_no"])
|| !isset($params["collecting_bill"]) || !isset($params["house_number"]) || !isset($params["industry_type"])) {
if (!isset($params["agent_id"]) || !isset($params["report_id"]) ||
!isset($params["order_id"]) || !isset($params["order_no"]) | !isset($params["collecting_bill"]) ||
!isset($params["house_number"]) || !isset($params["industry_type"]) ) {
return $this->response("101", "请求参数错误");
}
/* $params = array(
"agent_id" => 1,//收款经纪人id
"agent_name" => 1,//收款经纪人id
......@@ -213,24 +217,45 @@ class OrderLog extends Basic
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额 存分',
// `money` '入账金额',
"collecting_bill" => [ { "type" : 10, "pay_type" : 10, "money" : 1100 }, { "type" :10, "pay_type" : 10, "money": 1200 } ],
"house_number" => "3301号",
"industry_type" => "asdasdasd",
"remark" => "没什么备注",
"transfer_img" => "12312312312"
"transfer_img" => "12312312312",
"is_dividend" => 1, //是否分红 1否 0是
"last_transfer_time" => "2018-10-18", //最后转定时间
"pay_id" => 1,
"receipt_number" => "12312",
"transfer_name" => "sdafsdf",
);*/
$params["collecting_bill"] = json_decode($params["collecting_bill"], true);
$remark = isset($params["remark"]) ? $params["remark"] : "";
$transfer_img = isset($params["transfer_img"]) ? $params["transfer_img"] : "";
$transfer_img = isset($params["transfer_img"]) ? json_decode($params["transfer_img"] ,true): "";
$income_time = isset($params["income_time"]) ? $params["income_time"] : "";
$pay_id = isset($params["pay_id"]) ? $params["pay_id"] : 0;
$source = $params["source"] ? $params["source"] : 0;
$is_ok = $this->service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"], $params["order_id"], $params["order_no"],
$params["collecting_bill"], $params["house_number"], $params["industry_type"], $remark, $transfer_img, $source);
$receipt_number = isset($params["receipt_number"]) ? $params["receipt_number"] : "";
$transfer_name = isset($params["transfer_name"]) ? $params["transfer_name"] : "";
if($pay_id > 0){
$source = 2;
}
$is_ok = $this->service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"],
$params["order_id"], $params["order_no"], $params["collecting_bill"], $params["house_number"], $params["industry_type"],
$remark, $transfer_img, $source,$income_time,$params["is_dividend"],$params["last_transfer_time"],$pay_id,
$receipt_number,$transfer_name);
if ($is_ok > 0) {
return $this->response("200", "request success", [ "bill_id" => $is_ok ]);
}elseif($is_ok == -1){
return $this->response("101", "付款类型或支付方式错误");
}elseif($is_ok == -2){
return $this->response("101", "调整金额不能多于可被调整的金额");
}
return $this->response("101", "request faild");
}
......@@ -446,7 +471,7 @@ class OrderLog extends Basic
{
$params = $this->params;
/* $params = array(
"order_id" => 38024,
"order_id" => 112,
);*/
if (!isset($params["order_id"])) {
return $this->response("101", "请求参数错误");
......
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\PayLogService;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/13
* Time : 3:41 PM
* Intro:
*/
class PayLog extends Basic
{
private $service_;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new PayLogService();
}
/**
* 获取上次提交收款的门牌号等
* @return \think\Response
*/
public function getBeForNum()
{
$params = $this->params;
/* $params = array(
"order_id" => 15523, //关联order表id
);*/
if (!isset($params["order_id"])) {
return $this->response("101", "订单编号不能为空");
}
$billInfo = $this->service_->getBeForNum($params["order_id"]);
if (count($billInfo) > 0) {
return $this->response("200", "request success", $billInfo[0]);
} else {
return $this->response("200", "request null");
}
}
/**
* 剩余可以调整或退款的钱
* @return \think\Response
*/
public function adjustment()
{
$params = $this->params;
/* $params = array(
"pay_id" => 1,
);*/
if (empty($params["pay_id"])) {
return $this->response("101", "请求参数错误");
}
$result = $this->service_->adjustment($params["pay_id"]);
if ($result == -1) {
return $this->response("101", "不存在此条记录");
}
return $this->response("200","success",["residue_money"=>$result]);
}
}
\ No newline at end of file
......@@ -110,9 +110,9 @@ class Report extends Basic
{
$params = $this->params;
/* $params = array(
"agent_id" =>10013,
"agent_id" =>6446,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"is_all"=>1,//0搜索我自己的,1全部
"is_all"=>0,//0搜索我自己的,1全部
"page_no"=>1,
"page_size"=>15
);*/
......@@ -125,7 +125,8 @@ class Report extends Basic
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,a.create_time,b.id as order_id,b.order_no,b.house_id,b.house_title";
$field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,a.create_time,b.id as order_id,b.order_no,
b.house_id,b.house_title";
$params["report_agent_id"] = $params["agent_id"];
$result = [];
......
......@@ -7,6 +7,7 @@ use app\api_broker\service\LookShopService;
use app\api_broker\service\VerifyService;
use app\api_broker\service\VipService;
use app\index\service\HouseService;
use app\index\service\UserService;
use app\model\AAgents;
use app\model\ACollectHouse;
use app\model\AttentionModel;
......@@ -117,7 +118,6 @@ class Shop extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//c端查对外的名字 b端查对内的名字
if (isset($params['title']) && $params['site_area'] == 1 || $params['site_area'] == 2) {
$conditions['external_title'] = array("like", "%" . trim($params['title']) . "%");
......@@ -262,12 +262,18 @@ class Shop extends Basic
$conditions['status'] = !empty($params['status']) ? $params['status'] : array('in', "1,2"); //只显示上架或下架的
}
$result = $this->gHousesModel->getHousesList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr);
$m_business_district = new GBusinessDistrict();
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = CK_IMG_URL . 'images/';
$result[$key]["rent_price"] = $val["rent_price"] * 0.01;
$result[$key]["title"] = $val["disc"] . $result[$key]["title"];
// $business_district = '';//查商圈
// if($val["business_district_id"]){
// $business_district = $m_business_district->getValue(['id'=>$val["business_district_id"]], 'name');
// }
// $result[$key]["title"] = $val["disc"] . $business_district .$result[$key]["title"];
$result[$key]["title"] = $val["disc"] .$result[$key]["title"];
$param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图
......@@ -650,6 +656,12 @@ class Shop extends Basic
$external_image = $m_image_depot->getInfo('img_name', ['id'=>$image_id[0], 'img_status'=>0]);
$result['external_image'] = empty($external_image['img_name']) ? "" : SHOP_IMAGE_DEPOT_URL.$external_image['img_name'];
}
//302版本
//判断是否有权限点击独家合同按钮 0:可查看 1:不可查看
$s_house = new HouseService();
$result['is_can_edit_only_contract'] = $s_house->isCanEditOnlyContract($this->agentId,$params["id"]);
unset($result['external_image_id']);
return $this->response("200", 'request success', $result);
}
......@@ -993,4 +1005,48 @@ class Shop extends Basic
$params["id"] = $businessDistrictId;
return $model->getValue($params,"name");
}
/**
* 获取独家方
*/
public function getExclusive()
{
if ($this->params['houses_id']) {
$res = $this->gHousesModel->getExclusive($this->params['houses_id']);
// dump($res);
foreach ($res['exclusive_img'] as $key => $val) {
$res['exclusive_img'][$key]['file_name'] = CURRENT_URL.'resource/lib/Attachments/images/'.$val['img_name'];
$res['exclusive_img'][$key]['save_path'] = $val['img_name'];
}
} else {
return $this->response("101", "houses_id is null");
}
return $this->response("200", "request success", $res);
}
/**
* 商铺列表添加和编辑独家
*/
public function editExclusive()
{
// $res = $this->gHousesModel->exclusive($this->params, $this->params['houses_id'], $this->agentId, $this->siteId);
if (empty($this->params['id'])) {
return $this->response(101, '参数错误');
}
$code = 200;
$msg = "";
if ($this->params['is_exclusive_type'] == 1) {
$house = new HouseService();
$result = $house->addHouse($this->params, $this->agentId, 1, 0, 'exclusive');
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
}
} else {
$this->gHousesModel->editData(['is_exclusive_type'=>0], $this->params['id']);
}
return $this->response($code, $msg);
}
}
......@@ -24,7 +24,7 @@ class BargainService
* @param $keyword
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword)
public function getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id)
{
$condition = [];
......@@ -57,9 +57,13 @@ class BargainService
$condition["keyword"] = $keyword;
}
if (!empty($bargain_id)) {
$condition["id"] = $bargain_id;
}
$bargainModel = new OBargainModel();
$filed = "a.id,a.father_id,a.house_number,a.price,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
d.id as house_id,d.internal_title,d.internal_address";
$filed = "a.id,a.father_id,a.house_number,a.price,a.commission,a.agent_id,a.create_time,b.user_phone,
b.user_name,b.user_id,c.id as order_id,c.order_no,d.id as house_id,d.internal_title,d.internal_address,b.id as report_id";
$result = $bargainModel->selectBargainList($filed, $condition, $pageNo, $pageSize);
......
......@@ -28,8 +28,10 @@ class BrokerService
* @param string $model
* @param int $type 0提交记录到后台, 1仅仅判断
* @param string $push_id
* @param int $is_pc 0 app 1pc端
* @param int $is_pc
* @return bool
* @throws \Exception
* @throws \think\Exception
*/
public function judgeBand(string $device_id, int $agent_id, string $model, int $type, string $push_id, int $is_pc): bool
{
......@@ -48,18 +50,40 @@ class BrokerService
"is_pc" => $is_pc ]);
return true;
}
$is_exits = false;
foreach ($result as $item) {
//如果是客户端登录
if($is_pc == 2){
if ($device_id == $item["device_id"])
{
if ($item["is_forbidden"] == 0) {
return true;
} elseif ($item["is_forbidden"] == 1) { //已存在申请关系
$is_exits = true;
}
}
}else{
//todo 1.判断ip是否相同$device_id字段,2.ip不同则判断push_id是否相同,相同更新ip,3.ip相同则判断push_id是否相同,
if ($model == $item["model"] && !empty($push_id) &&
(($device_id != $item["device_id"] && $push_id == $item["push_id"]) ||
($device_id == $item["device_id"] && $push_id != $item["push_id"]))
if (
$model == $item["model"]
&& !empty($push_id)
&& (
($device_id != $item["device_id"] && $push_id == $item["push_id"])
||
($device_id == $item["device_id"] && $push_id != $item["push_id"]
)
)
) {
$this->aBD->updateDevice([ "id" => $item["id"], "push_id" => $push_id, "device_id" => $device_id ]);
return true;
}
if (($is_pc == 0 && $device_id == $item["device_id"])
|| ($is_pc == 1 && $push_id == $item["push_id"] && $device_id == $item["device_id"])) {
if (
($is_pc == 0 && $device_id == $item["device_id"])
||
($is_pc == 1 && $push_id == $item["push_id"] && $device_id == $item["device_id"]))
{
if ($item["is_forbidden"] == 0) {
return true;
} elseif ($item["is_forbidden"] == 1) { //已存在申请关系
......@@ -67,6 +91,7 @@ class BrokerService
}
}
}
}
if (!$is_exits && $type == 0)
//新增申请绑定关系,需要后台同意登陆
$this->aBD->addDevice([ "device_id" => $device_id,
......
This diff is collapsed.
<?php
namespace app\api_broker\service;
use app\model\OPayLogAdjustment;
use app\model\OPayLogModel;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/13
* Time : 3:45 PM
* Intro:
*/
class PayLogService
{
private $payLogModel;
private $payLogAdjustmentModel;
public function __construct()
{
$this->payLogModel = new OPayLogModel();
$this->payLogAdjustmentModel = new OPayLogAdjustment();
}
public function getBeForNum($order_id)
{
$filed = "house_number,industry_type";
return $this->payLogModel->getBeforeBillInfo($filed, ["order_id" => $order_id]);
}
/**
* 计算可以分佣的金额
* @param $pay_id
* @return int
*/
public function adjustment($pay_id)
{
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed = "id,money";
$pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]);
if (count($pay_log_arr) < 0) {
return -1;
}
$pay_log_arr = $pay_log_arr[0];
$where_["paylog_id"] = $pay_id;
$where_["is_del"] = 0;
//调整
$adjustment_sum = $this->payLogAdjustmentModel->getAdjustmentSum("money", $where_);
$residue_money = $pay_log_arr["money"] - $adjustment_sum;
return $residue_money;
}
/**
* @param $new_pay_id
* @param $pay_id
* @param $money
* @param $type
* @param $agent_id
* @return int
*/
public function addAdjustment($new_pay_id, $pay_id, $money, $type, $agent_id)
{
$filed = "id,type";
$pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]);
if (count($pay_log_arr) < 0) {
return -1;
}
$oPayLogAdjustment = new OPayLogAdjustment();
$where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"]);
$oPayLogAdjustment->addAdjustment($where_);
}
/**
* @param $new_pay_id
* @param $pay_id
* @param $money
* @param $type
* @param $agent_id
* @param $old_type
* @return mixed
*/
private function adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $old_type)
{
$arr["paylog_id"] = $pay_id;
$arr["new_paylog_id"] = $new_pay_id;
$arr["money"] = $money;
$val = 0;
if ($old_type == 10) {//意向金
switch ($type) {
case 10:
$val = 3;
break;
case 91:
$val = 1;
break;
case 92:
$val = 2;
break;
default:
}
} elseif ($old_type == 30) {//保管金
switch ($type) {
case 30:
$val = 6;
break;
case 91:
$val = 4;
break;
case 92:
$val = 5;
break;
default:
}
}
$arr["type"] = $val;
$arr["operation_id"] = $agent_id;
$arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
}
\ No newline at end of file
......@@ -127,16 +127,37 @@ class ReportService
$params["house_ids"] = $ids;
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
return $this->returnResult($result);
}
/**
* @param $result
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function returnResult($result){
$ids_str = "";
$house_id_str = "";
if (count($result) > 0) {
foreach ($result as $k => $v) {
//$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$ids_str .= $v["order_id"] . ",";
$order_id = 0;
if(isset($v["order_id"])){
$order_id = $v["order_id"];
}else{
$order_id = $v["id"];
}
$ids_str .= $order_id . ",";
$house_id_str .= $v["house_id"] . ",";
}
$ids_str = rtrim($ids_str, ",");
$house_id_str = rtrim($house_id_str, ",");
$sign_arr = $this->orderSign($ids_str);
$house_arr = $this->houseInfo($house_id_str);
foreach ($result as $k => $v) {
$result[$k]["sign"] = "";
......@@ -145,13 +166,16 @@ class ReportService
$result[$k]["sign"] .= $this->signTitle($value["type"]) . ",";
}
}
foreach ($house_arr as $item) {
if ($v["house_id"] == $item["id"]) {
$result[$k]["house_address"] .= $item["internal_address"];
}
}
}
return $result;
}
return null;
return $result;
}
/**
* 报备订单列表All
* @param $field
......@@ -166,29 +190,7 @@ class ReportService
{
$params = [];
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
$ids_str = "";
if (count($result) > 0) {
foreach ($result as $k => $v) {
//$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$ids_str .= $v["order_id"] . ",";
}
$ids_str = rtrim($ids_str, ",");
$sign_arr = $this->orderSign($ids_str);
foreach ($result as $k => $v) {
$result[$k]["sign"] = "";
foreach ($sign_arr as $value) {
if ($v["order_id"] == $value["order_id"]) {
$result[$k]["sign"] .= $this->signTitle($value["type"]) . ",";
}
}
}
return $result;
}
return null;
return $this->returnResult($result);
}
/**
......@@ -225,27 +227,9 @@ class ReportService
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
$count = $this->oReportModel->selectReportCount($field,$params);
$ids_str = "";
if (count($result) > 0) {
foreach ($result as $k => $v) {
//$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$ids_str .= $v["order_id"] . ",";
}
$ids_str = rtrim($ids_str, ",");
$sign_arr = $this->orderSign($ids_str);
foreach ($result as $k => $v) {
$result[$k]["sign"] = "";
foreach ($sign_arr as $value) {
if ($v["order_id"] == $value["order_id"]) {
$result[$k]["sign"] .= $this->signTitle($value["type"]) . ",";
}
}
}
$data["result"] = $result;
if (count($result) > 0) {
$data["result"] = $this->returnResult($result);
$data["total"] = $count[0]["total"] ? $count[0]["total"] : 0;
return $data;
}
......@@ -258,6 +242,20 @@ class ReportService
return $this->orderModel->selectSign($ids_str);
}
/**
* @param $house_id_str
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function houseInfo($house_id_str)
{
$houseModel = new GHouses();
$params["id"] = array("in",($house_id_str));
return $houseModel->getHouseInfo("id,internal_address",$params);
}
public function signTitle($type)
{
switch ($type) {
......
......@@ -86,6 +86,10 @@ class UploadFileService
$path .= 'static/exclusive_file/';
$internet_path = 'static/exclusive_file/';
break;
case 'agent_black_list_img':
$path .= 'static/agent_black_list/';
$internet_path = 'static/agent_black_list/';
break;
default :
$data['code'] = 101;
$data['msg'] = "上传图片类型错误";
......@@ -93,11 +97,11 @@ class UploadFileService
}
$date = date('Ymd');
$path .= $date;
$name_str = date('YmdHis') . mt_rand(10,1000);
$name_str = date('YmdHis');
if (is_array($_upload_file['tmp_name'])) {
foreach ($_upload_file['tmp_name'] as $k => $v) {
$name_str .= $k;
$name_str .= mt_rand(10,10000);
$_file = new File($v);
$file_info = pathinfo($_upload_file['name'][$k]);
$info = $_file->validate($valid_date)->move($path, $name_str . '.' . $file_info['extension']);
......@@ -115,7 +119,7 @@ class UploadFileService
}
} else {
$name_str .= mt_rand(10,1000);
$_file = new File($_upload_file['tmp_name']);
$file_info = pathinfo($_upload_file['name']);
$info = $_file->validate($valid_date)->move($path, $name_str . '.' . $file_info['extension']);
......
......@@ -32,6 +32,16 @@
</h6>
<h6 v-else>{{switchTitle(item.step_name)}}</h6>
<p v-if="item.step_name==='adjustment'">调整ID:<span>{{item.id}}</span></p>
<p v-if="item.step_name==='adjustment'">调整前收款ID:<span>{{item.paylog_id}}</span></p>
<p v-if="item.step_name==='adjustment'">调整后收款ID:<span>{{item.new_paylog_id}}</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 1">调整类型:<span>意向金转中介费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 2">调整类型:<span>意向金转案场费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 3">调整类型:<span>意向金转意向金</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 4">调整类型:<span>保管金转中介费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 5">调整类型:<span>保管金转案场费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 6">调整类型:<span>保管金转保管金</span></p>
<p v-if="item.step_name==='adjustment'">调整金额:<span>{{item.money}}元</span></p>
<p v-if="item.step_name==='report'">{{item.house_title}}</p>
<p v-if="item.step_name==='report'">客户:<span>{{item.user_name}}</span></p>
<p v-if="item.step_name==='report'">客户电话:<span>{{hideTel(item.user_phone)}}</span></p>
......@@ -52,8 +62,17 @@
<p>入账金额:<span class="span-active">{{item2.money}}元</span></p>
</div>
</div>
<p v-if="item.step_name==='pay_log'">最后转定时间:<span>{{item.list[0].last_transfer_time}}</span></p>
<p v-if="item.step_name==='pay_log'">收条编号:<span>{{item.list[0].receipt_number}}</span></p>
<p v-if="item.step_name==='pay_log'">入账姓名:<span>{{item.list[0].transfer_name}}</span></p>
<p v-if="item.step_name==='pay_log'">商铺号:<span>{{item.list[0].house_number}}</span></p>
<p v-if="item.step_name==='pay_log'">业态/品牌:<span>{{item.list[0].industry_type}}</span></p>
<p v-if="item.step_name==='pay_log' && item.list[0].source == 0">来源:<span>APP</span></p>
<p v-if="item.step_name==='pay_log' && item.list[0].source == 1">来源:<span>智能pos机</span></p>
<p v-if="item.step_name==='pay_log' && item.list[0].source == 2">来源:<span>调整</span></p>
<ol v-if="item.step_name==='pay_log'" class="li-img-list">
<li v-for="(item2, idnex2) in item.img">
<a href="javascript:;" class="click-big-img-a"><img :src="item.img_path+item2.img_name"></a>
......@@ -99,6 +118,7 @@
<!--<p v-if="item.step_name==='financial' && item.status == '4' ">备注:<span>{{item.remark}}</span></p>-->
<p v-if="item.step_name==='financial'" class="li-caozuoren">操作人:<span>{{item.audit_name}}</span></p>
<p v-if="item.step_name==='adjustment'" class="li-caozuoren">操作人:<span>{{item.name}}</span></p>
</div>
</div>
......
......@@ -178,3 +178,13 @@ function del_array_string($string = '', $array_str = []) {
}
return $array_str;
}
/**
* 独立记录日志文件
* @param $content
*/
function big_log($content){
$filename = ROOT_PATH.'runtime/log/find_bug.log';
$content = '['.date("Y-m-d H:i:s", time()).'] '.$content;
file_put_contents($filename, $content."\r\n", FILE_APPEND);
}
\ No newline at end of file
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/11/12
* Time: 15:48
*/
use app\index\extend\Basic;
class BlackList extends Basic
{
public function blackList()
{
if (!$this->request->isAjax()) {
return view('blackList/blackListCon');
}
}
}
\ No newline at end of file
......@@ -9,11 +9,14 @@
namespace app\index\controller;
use app\api_broker\service\VipService;
use app\index\service\BrokerService;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\PushMessageService;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\AAgentsBlackList;
use app\model\AAgentsBlackListImg;
use app\model\ABindingDevice;
use app\model\AOperatingRecords;
use app\model\AStore;
......@@ -352,13 +355,9 @@ class Broker extends Basic
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$where['a.id'] = [ '<>', 1 ];
if ($params['status'] != -1) {
if ($params['status']) {
$where['a.status'] = ['<>', 0];
} else {
$where['a.status'] = 0;
}
//302版本
if (is_numeric($params['status'])) {
$where['a.status'] = $params['status'];
}
if (!empty($params['search'])) {
......@@ -895,4 +894,163 @@ class Broker extends Basic
return $this->response($code, $msg,['data'=>$list,'total'=>$total]);
}
/**
* 添加黑名单
*/
public function addAgentsBlackList(){
$params = $this->params;
/* $params = array(
"agents_id" => 6524,//需要被拉黑经纪人id
"content" => 'ceshi',//理由
);*/
if (!isset($params["agents_id"]) && !isset($params["agents_black_list_id"])) {
return $this->response("101", "请求参数错误");
}
$vip_services = new VipService();
//拉黑权限 0:有权限 1:无权限
$is_can_edit = $vip_services->vip($this->userId,'addAgentsBlackList');
if ($is_can_edit == 1) {
return $this->response("101", "无拉黑权限");
}
$service_broker = new BrokerService();
$m_agents_black_list = new AAgentsBlackList();
if($params["agents_black_list_id"]){//更新
$insert["id"] = $params["agents_black_list_id"];
$insert["content"] = $params['content'];
$res = $m_agents_black_list->updateDatas($insert);
if($res && $params["img_info"]){
$service_broker->addAgentsBlackListImg($params["img_info"],$params["agents_black_list_id"]);
}
}else{//新增
$save_data['status'] = 4;
$save_data['id'] = $params['agents_id'];
$broker_service = new BrokerService();
$data = $broker_service->updateStatus($save_data, $this->userId);
if ($data['status'] == 'fail') {
return $this->response("101", $data['msg']);
}
//先判断是否已经存在数据
$field = 'id,status';
$get_params['status'] = 0;
$get_params['agents_id'] = $params["agents_id"];
$get_data_res = $m_agents_black_list->getDatas($field, $get_params);
if($get_data_res){//如果存在
$res = true ;
}else{//不存在则新增数据
$insert["agents_id"] = $params['agents_id'];
$insert["content"] = $params['content'];
$insert["status"] = 0;
$res = $m_agents_black_list->saveData($insert);
if($res && $params["img_info"]){
$service_broker->addAgentsBlackListImg($params["img_info"],$res);
}
}
}
if ($res) {
return $this->response("200", "成功");
} else {
return $this->response("101", "失败");
}
}
/**
* 黑名单列表
*/
public function getAgentsBlackList()
{
$params = $this->params;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$m_agents_black_list = new AAgentsBlackList();
if (isset($params["name"])) {
$get_params['Agents.name'] = ['LIKE', '%'.$params["name"].'%'];
}
if (isset($params["phone"])) {
$get_params['Agents.phone'] = ['LIKE', '%'.$params["phone"].'%'];
}
$get_params['BlackList.status'] = 0;
$field = 'BlackList.id as agents_black_list_id,';
$field .= 'BlackList.agents_id,';
$field .= 'Agents.status,';
$field .= 'Agents.name,';
$field .= 'Agents.phone,';
$field .= 'Agents.img,';
$field .= 'Agents.create_time,';
$field .= 'Store.store_name';
$res = $m_agents_black_list->getAgentsBlackList($pageNo,$pageSize,$field,$get_params);
$res_total = $m_agents_black_list->getDatasTotal($get_params);
foreach($res as $k=>$v)
{
$res[$k]['head_portrait'] = $v['img'] ? AGENTHEADERIMGURL . $v['img'] : '';
}
$data['total'] =$res_total;
$data['data_list'] =$res;
return $this->response("200", "成功",$data);
}
/**
* 黑名单详情
*/
public function getBlackListInfo(){
$params = $this->params;
// $params = array(
// "agents_black_list_id" => 1
// );
if (!isset($params["agents_black_list_id"])) {
return $this->response("101", "请求参数错误");
}
$internet_path = CURRENT_URL.'static/agent_black_list/';
$m_agents_black_list = new AAgentsBlackList();
$m_agents_black_list_img = new AAgentsBlackListImg();
$field = 'agents_id,content';
$res = $m_agents_black_list->getDataById($params["agents_black_list_id"],$field);
$field = 'id as agents_black_list_img_id,file_name';
$get_params['status'] = 0;
$get_params['father_id'] = $params["agents_black_list_id"];
$get_data_res = $m_agents_black_list_img->getDatas($field, $get_params);
foreach($get_data_res as $k=>$v)
{
$get_data_res[$k]['internet_path']=$internet_path.$v['file_name'];
}
$res['img_list']=$get_data_res;
if ($res) {
return $this->response("200", "成功",$res);
} else {
return $this->response("101", "失败");
}
}
/**
* 删除文件
*/
public function delAgentsBlackListImg() {
if (empty($this->params['agents_black_list_img_id'])) {
return $this->response(101, '参数错误');
}
$m_agents_black_list_img = new AAgentsBlackListImg();
$params['status'] = 1;
$params['id'] = $this->params['agents_black_list_img_id'];
$m_agents_black_list_img->updateDatas($params);
return $this->response(200, '删除成功');
}
}
\ No newline at end of file
This diff is collapsed.
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\api_broker\service\DailyPaperService;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/17
* Time : 11:09 AM
* Intro:
*/
class DailyPaper extends Basic
{
private $service_;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new DailyPaperService();
}
/**
* 财务日报
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function dailyDetail()
{
$params = $this->params;
/* $params = array(
"store_id" => 730,//门店id
"is_store" => 0,//身份是否是店长,财务显示不一样 0店长 1财务
"daily_data" => "2018-12-18"
);
$this->userId = 5775;*/
if (!isset($params["store_id"]) || !isset($params["is_store"]) || !isset($params["daily_data"])) {
return $this->response("101", "请求参数错误");
}
$store_id = $params["store_id"];
$is_store = $params["is_store"];
$daily_data = $params["daily_data"];
$result = $this->service_->getDaily($this->userId, $store_id, $is_store, $daily_data);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
return $this->response("200", "success", $result["data"]);
}
}
/**
* 店长提交财务日报
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addDaily()
{
$params = $this->params;
/* $params = array(
"agent_id" => 5775,//经纪人id
"agent_name" => "222",//经纪人姓名
"daily_date" => "2018-12-02",//日报日期
"alipay" => "12",//支付宝收款
"tenpay" => "2323",//微信收款
"realty_pay" => "232",//地产转帐
"family_pay" => "444",//世家公账
"private_bank" => "55",//3000账号
"cash" => "666",//现金
"pos" => "777",//pos机
"other_bank" => "888"//其他
);*/
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"])
) {
return $this->response("101", "请求参数错误");
}
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$daily_date = $params["daily_date"];
$alipay = $params["alipay"];
$tenpay = $params["tenpay"];
$realty_pay = $params["realty_pay"];
$private_bank = $params["private_bank"];
$family_pay = $params["family_pay"];
$cash = $params["cash"];
$pos = $params["agent_id"];
$other_bank = $params["other_bank"];
$result = $this->service_->addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
return $this->response("200", "success", $result["data"]);
}
}
/**
* 财务审核新增
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function commitCheck(){
$params = $this->params;
/*$params = array(
"daily_id" => 1,//日报id
"agent_id" => 5775,//经纪人id
"agent_name" => "222",//经纪人姓名
"alipay" => "12",//支付宝收款
"tenpay" => "2323",//微信收款
"realty_pay" => "232",//地产转帐
"family_pay" => "444",//世家公账
"private_bank" => "55",//3000账号
"cash" => "666",//现金
"pos" => "777",//pos机
"other_bank" => "888",//其他,
"operation_status" => 1,//0审核通过 1转为已审核
"remark" => "888"//备注,
);*/
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", "请求参数错误");
}
$daily_id = $params["daily_id"];
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$alipay = $params["alipay"];
$tenpay = $params["tenpay"];
$realty_pay = $params["realty_pay"];
$private_bank = $params["private_bank"];
$family_pay = $params["family_pay"];
$cash = $params["cash"];
$pos = $params["pos"];
$other_bank = $params["other_bank"];
$remark = $params["remark"];
$operation_status = $params["operation_status"];
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);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
return $this->response("200", "success", $result["data"]);
}
}
/**
* @return \think\Response
*/
public function getPayLogImg(){
$params = $this->params;
/* $params = array(
"pay_log_id" => 1
);*/
if(!isset($params["pay_log_id"])){
return $this->response("101", "请求参数错误");
}
$img_list = $this->service_->getImgs($params["pay_log_id"]);
if(count($img_list) > 0){
$result["img_path"] = CHAT_IMG_URL;
$result["img_info"] = $img_list;
return $this->response("200","success",$result);
}else{
return $this->response("200","request null");
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -10,6 +10,7 @@ namespace app\index\controller;
use app\api_broker\service\LookShopService;
use app\api_broker\service\VipService;
use app\index\extend\Basic;
use app\index\service\BrokerService;
use app\index\service\HouseService;
......@@ -419,6 +420,13 @@ class Houses extends Basic
$list[$k]["is_collect"] = 1;
}
}
//302版本
//判断是否有权限点击独家合同按钮 0:可查看 1:不可查看
$s_house = new HouseService();
$list[$k]['is_can_edit_only_contract'] = $s_house->isCanEditOnlyContract($this->userId,$v["id"]);
}
$data['data']['list'] = $list;
return $this->response($data['status'], $data['msg'], $data['data']);
......
......@@ -173,44 +173,13 @@ class ImageDepot extends Basic
}
public function ceshi(){
public function getUserMacAddress($mac_address){
echo 'Mac地址:'.$mac_address;
}
$records = array(
array(
'bargain_id' => 2135,
'scale_fee' => 12,
),
array(
'bargain_id' => 2135,
'scale_fee' => 12,
),
array(
'bargain_id' => 2135,
'scale_fee' => 12,
),
array(
'bargain_id' => 5623,
'scale_fee' => 12,
)
);
$first_names = $this->arr_unset($records,'bargain_id');
dump($first_names);
}
//对一个二维数组的某个键进行去重
private function arr_unset($arr,$key){
$res = array();
foreach ($arr as $value) {
if(isset($res[$value[$key]])){//查看有没有重复项
unset($value[$key]); //有:销毁
}
else{
$res[$value[$key]] = $value;
}
}
return $res;
public function ceshi(){
$content = '99888888';
big_log($content);
}
}
......
......@@ -41,6 +41,7 @@ class Login extends Basic
public function login()
{
$this->assign('mac_address',$this->params['mac_address'] ? $this->params['mac_address']: '');
return view("/login/login");
}
......@@ -55,7 +56,7 @@ class Login extends Basic
$password = $this->params["password"];
$model = $this->params["model"];
$only_id = $this->params["only_id"];
$mac_address = $this->params["mac_address"];
if (empty($name) || empty($password)) {
return $this->response(101, '用户名或密码不能为空');
}
......@@ -75,6 +76,11 @@ class Login extends Basic
if ($user_data['status'] == 1 || $user_data['status'] == 2) {
return $this->response(101, '你目前是长假/离职状态,请联系人事进行更改');
}
if ($user_data['status'] == 4) {
return $this->response(101, '该账号已被列入黑名单!');
}
$auth_group_id = '';
if (!empty($user_data['auth_group_id'])) {
$auth_group_id = $this->m_auth_group->getAuthGroupById($user_data['auth_group_id'], 'rules');
......@@ -88,7 +94,14 @@ class Login extends Basic
if ($user_data['id'] != 1) {
//判断设备id是否存在
$is_login = $this->brokerService->judgeBand($last_login_ip, $user_data['id'], $model, 0,$only_id , 1);
if($mac_address){
$is_pc = 2;//客户端
$last_login_ip = $mac_address;//device_id存MAC地址
}else{
$is_pc = 1;//浏览器
}
$is_login = $this->brokerService->judgeBand($last_login_ip, $user_data['id'], $model, 0,$only_id , $is_pc);
if (!$is_login) {
return $this->response("102", "该账号没有绑定该设备的浏览器,请先向店长申请,由店长致电财务董飞。");
}
......
......@@ -57,7 +57,16 @@ class Notice extends Basic
$where['a.title'] = ['LIKE', '%' . $this->params['title'] . '%'];
}
$field = 'a.id,a.title,a.content,a.create_time,a.create_time,b.name';
//302版本
if (is_numeric($this->params['auth_group_id'])) {
if($this->params['auth_group_id'] == 1){
$where['b.auth_group_id'] = 2;
}else{
$where['b.auth_group_id'] = array('in','22,23,25,26');
}
}
$field = 'a.id,a.title,a.content,a.create_time,a.create_time,b.auth_group_id,b.name';
$where['a.status'] = 0;
$where['a.type'] = 1;
......
......@@ -19,4 +19,11 @@ class PkList extends Basic
return view('pkList/pkListCon');
}
}
public function pkWeekList()
{
if (!$this->request->isAjax()) {
return view('pkList/pkWeekListCon');
}
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
use app\extra\RedisExt;
use app\index\extend\Basic;
use app\index\service\RankingListService;
use app\index\untils\ExportExcelUntil;
......@@ -31,12 +32,16 @@ class RankingList extends Basic{
*/
public function getRandKingList(){
$params = $this->params;
/*$params["position"] = 1;//职称 1店长 2经理 3主任 4顾问 0新人
$this->siteId = 10002;*/
/* $params = array(
"position" => 1,//职称 1店长 2经理 3主任 4顾问 0新人
"pk_type" => 2//pk类型 1月pk 2周pk
);
$this->siteId = 10001;*/
if(!isset($params["position"]) || $params["position"] < 0 || $params["position"] > 5){
return $this->response("101","请求参数错误");
}
$result = $this->service_->RankingList( $params["position"],$this->siteId);
$pk_type = empty($params["pk_type"]) ? 0 : $params["pk_type"];
$result = $this->service_->RankingList( $params["position"],$this->siteId,$pk_type);
if(count($result) > 0){
return $this->response("200","success",$result);
}
......@@ -51,8 +56,12 @@ class RankingList extends Basic{
* @throws \think\exception\DbException
*/
public function getStoreRandKingList(){
//$this->siteId = 10001;
$result = $this->service_->StoreRankingList( $this->siteId);
$params = $this->params;
/* $params = array(
"pk_type" => 1//pk类型 1月pk 2周pk
);*/
$pk_type = empty($params["pk_type"]) ? 0 : $params["pk_type"];
$result = $this->service_->StoreRankingList( $this->siteId,$pk_type);
if(count($result) > 0){
return $this->response("200","success",$result);
}
......@@ -68,10 +77,13 @@ class RankingList extends Basic{
*/
public function exportReport(){
$params = $this->params;
/* $params["position"] = 1;
$this->siteId = 10001;*/
/* $params = array(
"position" => 1,//职称 1店长 2经理 3主任 4顾问 0新人
"pk_type" => 1//pk类型 1月pk 2周pk
);*/
$pk_type = empty($params["pk_type"]) ? 0 : $params["pk_type"];
$export = new ExportExcelUntil();
$result = $this->service_->RankingList( $params["position"],$this->siteId);
$result = $this->service_->RankingList( $params["position"],$this->siteId,$pk_type);
$title = [ '经纪人ID', '门店名称', '经纪人姓名', '经纪人电话', '业绩'];
$export->exportTables('PK明细表', $result, 5, 'PK明细表', $title);
......@@ -86,10 +98,13 @@ class RankingList extends Basic{
* @throws \think\exception\DbException
*/
public function exportReportStore(){
/* $params["position"] = 1;
$this->siteId = 10001;*/
$params = $this->params;
/* $params = array(
"pk_type" => 1//pk类型 1月pk 2周pk
);*/
$pk_type = empty($params["pk_type"]) ? 0 : $params["pk_type"];
$export = new ExportExcelUntil();
$result = $this->service_->StoreRankingList( $this->siteId);
$result = $this->service_->StoreRankingList( $this->siteId,$pk_type);
$title = [ '部门ID', '门店名称', '业绩'];
$export->exportTables('门店PK明细表', $result, 3, '门店PK明细表', $title);
......@@ -208,4 +223,18 @@ class RankingList extends Basic{
}
return $this->response("200","null");
}
public function setWeekPk(){
$params = $this->params;
$siteId = $this->siteId;
$params = array(
"total_date_start" => "2018-10-01",
"total_date_end" => "2018-10-08",
"sort_date_start" => "2018-11-01",
"sort_date_end" => "2018-11-08",
);
$redisExt = RedisExt::getRedis();
$redisExt->set();
}
}
\ No newline at end of file
......@@ -13,10 +13,18 @@ use app\api_broker\service\LookShopService;
use app\extra\RedisExt;
use app\index\extend\Basic;
use app\model\SystemConfig;
use think\Cache;
use think\Request;
class Setting extends Basic
{
private $m_config;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_config = new SystemConfig();
}
/**
* 显示视图,新增和编辑设置数据
*
......@@ -29,11 +37,10 @@ class Setting extends Basic
if ($this->request->isAjax()) {
$data = [];
$config = new SystemConfig();
if ($this->request->isGet()) {
//获取数据
$data = $config->getSetting();
$data = $this->m_config->getSetting();
} else {
//新增或编辑数据
$data['is_privacy'] = (int)$this->params['is_privacy'];
......@@ -76,7 +83,7 @@ class Setting extends Basic
$config_data[3]['rule'] = json_encode(['agent_shop_num'=>$agent_shop_num]);
$config_data[3]['agent_id'] = $this->userId;
$config->insertSetting($config_data, true);
$this->m_config->insertSetting($config_data, true);
$look = new LookShopService();
$look->setLookNum($agent_shop_num);
......@@ -97,4 +104,141 @@ class Setting extends Basic
return view('setting/index');
}
}
/**
* 系统设置
*
* @return \think\Response|\think\response\View
*/
public function getSettingV2() {
if (!$this->request->isAjax()) {
return view('setting/index');
}
$data = [];
$msg = "";
try {
//获取数据
$data = $this->m_config->getSettingV2();
if ($this->request->isPost()) {
foreach ($data as $k=>$v) {
if (empty($v['rule'])) {
continue;
}
$rule = json_decode($v['rule'], true);
if (empty($rule)) {
continue;
}
foreach ($rule as $k2=>$v2) {
if (isset($this->params[$k2])) {
$rule[$k2] = $this->params[$k2];
}
}
$save_data[$k]['id'] = $v['id'];
$save_data[$k]['rule'] = json_encode($rule);
$save_data[$k]['agent_id'] = $this->userId;
}
if (!empty($save_data)) {
$this->m_config->saveDataAll($save_data);
}
$this->configRedis($this->params);
}
} catch (\Exception $e) {
$msg = '内部错误:'.$e->getMessage();
}
return $this->response(200, $msg, $data);
}
/**
* @param $data
*/
private function configRedis($data) {
$new_client_hours = empty($data['new_client_hours']) ? 12 : $data['new_client_hours'];
$agent_shop_num = empty($this->params['agent_shop_num']) ? 5 : $this->params['agent_shop_num'];
$redis = RedisExt::getRedis();
$redis->set('s_down_time', $data['down_time']); //商铺自动下架天数
$redis->set('s_is_privacy', $data['is_privacy']); //是否使用隐号系统
$redis->set('s_day_num', $data['day_num']); //客户隐号绑定有效期(天数):
$redis->set('s_landlord_phone_day', $data['landlord_phone_day']); //房东隐号绑定有效期(天数):
$redis->set('s_new_client_hours', $new_client_hours); //新客户保护期有效小时数
$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']); //业务员多少天可以打多少电话
return ;
}
/**
* 周竞赛搜索时间存储
*
* @return \think\Response
*/
public function configWeek() {
try {
$code = 200;
$msg = '';
$data = [];
$where['params'] = 'week_competition_'.$this->params['site_id'];
if (empty($this->params['site_id'])) {
return $this->response(101, '参数错误');
}
$id = $this->m_config->getSettingV2($where, 'id,rule');
if ($this->request->isPost()) {
if (empty($this->params['total_date_start']) || empty($this->params['total_date_end']) ||
empty($this->params['sort_date_start']) || empty($this->params['sort_date_end'])) {
return $this->response(101, '参数错误');
}
$rule['total_date_start'] = $this->params['total_date_start'];
$rule['total_date_end'] = $this->params['total_date_end'];
$rule['sort_date_start'] = $this->params['sort_date_start'];
$rule['sort_date_end'] = $this->params['sort_date_end'];
$save_data[0] = [
'rule' => json_encode($rule),
'params' => $where['params']
];
if (empty($id[0])) {
$this->m_config->insertSetting($save_data);
} else {
$save_data[0]['id'] = $id[0]['id'];
$this->m_config->saveDataAll($save_data);
}
} else {
$data = $id[0]['rule'];
}
} catch (\Exception $e) {
$msg = '内部错误:'.$e->getMessage();
$code = 101;
}
return $this->response($code, $msg, $data);
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getConfigWeek() {
$code = 200;
$msg = '';
$where['params'] = 'week_competition_'.$this->params['site_id'];
if (empty($this->params['site_id'])) {
return $this->response(101, '参数错误');
}
$id = $this->m_config->getSettingV2($where, 'id,rule');
$data = $id[0]['rule'];
return $this->response($code, $msg, $data);
}
}
\ No newline at end of file
......@@ -66,6 +66,8 @@ class Basic extends Controller
'index/shareShop',
'index/yindaoAndroid',
'index/yindaoIos',
'index/getUserMacAddress',
'index/getConfigWeek'
);
/**
......@@ -219,7 +221,7 @@ class Basic extends Controller
if (empty($is_auth) && $this->userId != 1) {
if($this->request->isAjax()){
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
//echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
} else {
$this->error('没有当前页面权限');exit;
}
......
......@@ -13,6 +13,7 @@ use app\api_broker\service\CallPhoneService;
use app\api_broker\service\PushMessageService;
use app\index\validate\AAgentValidate;
use app\model\AAgents;
use app\model\AAgentsBlackListImg;
use app\model\ABindingDevice;
use app\model\ADistrict;
use app\model\AOperatingRecords;
......@@ -436,4 +437,22 @@ class BrokerService
$remark = '修改为 '.$agent_status[$status];
$result = $records->record(0, 7, $remark, '',$id);
}
/**
* 添加黑名单图片
*/
public function addAgentsBlackListImg($img_info,$father_id){
$m_agents_black_list_img = new AAgentsBlackListImg();
foreach (explode(',',$img_info) as $k=>$v){
$insert=[];
$insert["file_name"] = $v;
$insert["father_id"] = $father_id;
$insert["type"] = 0;
$insert["status"] = 0;
$m_agents_black_list_img->saveData($insert);
}
return true;
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ use app\model\GHousesToAgents;
use app\model\GLandlordPhone;
use app\model\GOperatingRecords;
use app\task\controller\ResultsSummaryNewTask;
use think\Log;
class HouseService
{
......@@ -47,16 +48,20 @@ class HouseService
* @param array $data
* @param int $agent_id
* @param int $is_app
* @param int $site_id
* @param $site_id
* @param string $operation_type
* @return array
*/
public function addHouse(array $data, int $agent_id, $is_app = 0, $site_id): array
public function addHouse(array $data, int $agent_id, $is_app = 0, $site_id, $operation_type = ''): array
{
$result = [];
$validate = new HouseValidate();
if (empty($data['id'])) {
$check = $validate->scene('add')->check($data);
} elseif ($operation_type == 'exclusive') {
$check = $validate->scene('exclusive')->check($data);
$this->exclusiveFile($data, $data['id']);
} else {
$check = $validate->scene('edit')->check($data);
}
......@@ -74,11 +79,13 @@ class HouseService
}
try {
if (isset($data['landlord_phone'])) {
if ($is_app == 1) {
$landlord_phone_new = json_decode($data['landlord_phone'], true);
} else {
$landlord_phone_new = $data['landlord_phone'];
}
}
if (!empty($data['id'])) {
$house_data = $this->m_house->getHouseInfo('id,internal_address,internal_title', ['id' => $data['id']]);
......@@ -89,24 +96,31 @@ class HouseService
}
$m_operating = new GOperatingRecords();
$remark = '';
if (isset($data['residue_num'])) {
$remark = '修改为:剩余铺数' . $data['residue_num'];
}
if ($data['is_exclusive_type'] == 1) {
$remark .= '独家有效期 ' . $data['agent_start_time'] . '—' . $data['agent_end_time'];
$remark .= '|独家有效期 ' . $data['agent_start_time'] . '—' . $data['agent_end_time'];
}
if ($data['internal_title'] != $house_data[0]['internal_title']) {
if (isset($data['internal_title']) && $data['internal_title'] != $house_data[0]['internal_title']) {
$remark .= ',商铺名改为:' . $data['internal_title'];
}
if ($data['internal_address'] != $house_data[0]['internal_address']) {
if (isset($data['internal_address']) && $data['internal_address'] != $house_data[0]['internal_address']) {
$remark .= ',地址改为:' . $data['internal_address'];
}
if (!empty($landlord_phone_new)) {
$landlord_phone_old = $this->landlordPhoneEdit($landlord_phone_new, $data['id']);
if (!empty($landlord_phone_old)) {
$remark .= ',删除房东手机号:' . implode(',', $landlord_phone_old);
}
}
$m_operating->record($agent_id, 6, $remark, $data['id']);
}
......@@ -119,7 +133,7 @@ class HouseService
}
//新增房东手机号
if (empty($data['id'])) {
if (empty($data['id']) && !empty($landlord_phone_new)) {
$this->landlordPhoneEdit($landlord_phone_new, $house_id);
}
......@@ -130,12 +144,29 @@ class HouseService
//商铺图片
if ($is_app == 1) {
if (isset($data['cover'])) {
$data['cover'] = json_decode($data['cover'], true);
foreach ($data['cover'] as $k=>$v) {
$data['cover'][$k] = stripslashes($v);
}
}
if (isset($data['slide_show'])) {
$data['slide_show'] = json_decode($data['slide_show'], true);
foreach ($data['slide_show'] as $k=>$v) {
$data['slide_show'][$k] = stripslashes($v);
}
}
if (isset($data['exclusive_img'])) {
$data['exclusive_img'] = json_decode($data['exclusive_img'], true);
foreach ($data['exclusive_img'] as $k=>$v) {
$data['exclusive_img'][$k] = stripslashes($v);
}
}
}
if ($data['id'] == '') {
if (empty($data['id'])) {
$house_img->add($data, $house_id); //只记录新增图片
} else {
$image_result = $house_img->edit($data, $house_id); //编辑图片
......@@ -180,10 +211,12 @@ class HouseService
if (!empty($data['id'])) {
//剩余商铺为0下架
if (isset($data['residue_num']) || isset($data['total'])) {
if (empty($data['residue_num']) || empty($data['total'])) {
$this->push->record(1, [0 => $house_id], 0, $agent_id); //记录推送信息
}
}
}
$result['data']['house_id'] = $house_id;
$result['data']['internal_title'] = $data['internal_title'];
......@@ -654,4 +687,110 @@ class HouseService
return $return;
}
/**
*查询当前经纪人是否是某个独家方的总监或者店长
* @param $shop_agent_id 1当前商铺独家方
* @param $agent_id 1当前登录用户
* @return int 0:可查看 1:不可查看
*/
public function isUserAgentBoss($shop_agent_id,$agent_id){
if(!$shop_agent_id){
return 1;
}
if(!$agent_id){
return 1;
}
$params_["id"] = $shop_agent_id;
$result = $this->agent->searchAgentsByKeyword("id,store_id,district_id,level", $params_);
//店长
$params__=[];
$params__['store_id']=$result[0]['store_id'];
$params__['level']=20;
$result_dz = $this->agent->searchAgentsByKeyword("id,store_id,district_id,level", $params__);
//总监
$params__=[];
$params__['district_id']=$result[0]['district_id'];
$params__['level']=30;
$result_zj = $this->agent->searchAgentsByKeyword("id,store_id,district_id,level", $params__);
if (($shop_agent_id == $agent_id)or($result_dz[0]['id'] == $agent_id)or($result_zj[0]['id'] == $agent_id)) {
return 0;//可编辑
}else{
return 1;//不可编辑
}
}
/**
* 根据商铺id获取商铺独家方
* @param $shop_id
* @return mixed
*/
public function getShopOnlyAgentId($shop_id){
$where_houses_to_agents['houses_id']=$shop_id;
$where_houses_to_agents['type']=3;
$where_houses_to_agents['is_del']=0;
return $this->agent_house->getAgentHouseValue('agents_id', $where_houses_to_agents);
}
/**
* 判断是否有权限点击独家合同按钮 0:可查看 1:不可查看
* @param $agent_id
* @param $shop_id
* @return int
*/
public function isCanEditOnlyContract($agent_id,$shop_id){
$s_vip = new VipService();
$is_quanxian = $s_vip->vip($agent_id,'edit_only_contract');
if($is_quanxian == 1){
//是否存在独家方 查询
$m_houses_to_agents_res = $this->getShopOnlyAgentId($shop_id);
if($m_houses_to_agents_res){
//存在独家方则判断当前经纪人是否是该独家方的总监或者店长
return $this->isUserAgentBoss($m_houses_to_agents_res,$agent_id);
}else{
return 1;//无独家方不允许点击
}
}else{
return 0;//有权限不判断独家方
}
}
/**
* 独家附件操作
*
* @param $data
* @param $house_id
*/
public function exclusiveFile($data, $house_id) {
$m_house_file = new GHouseFile();
//新增附件
if (!empty($data['exclusive_file'])) {
$exclusive_file_arr = explode(',', $data['exclusive_file']);
$save_data = [];
foreach ($exclusive_file_arr as $k=>$v) {
$save_data[$k]['file_name'] = $v;
$save_data[$k]['house_id'] = $house_id;
$save_data[$k]['type'] = 0;
$save_data[$k]['status'] = 0;
}
$m_house_file->insertAll($save_data);
}
//伪删除附件
if (!empty($data['del_file_id'])) {
$file_id_arr = explode(',', $data['del_file_id']);
foreach ($file_id_arr as $k=>$v) {
$m_house_file->where('id', $v)->update(['status'=>1]);
}
}
return ;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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