Commit 9ff376a7 authored by clone's avatar clone

1

parent d1a72162
<?php
namespace app\api_broker\controller;
/**
* Created by PhpStorm.
* User : zw
* Date : 2017/12/12
* Time : 10:39
* Intro: 委托转铺
*/
use app\api_broker\extend\Basic;
use app\model\SubletImgModel;
use app\model\SubletModel;
class Sublet extends Basic
{
protected $subletMode;
public function __construct($request = null)
{
parent::__construct($request);
$this->subletMode = new SubletModel();
}
/**
* 委托转铺列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function subletList()
{
$params = $this->params;
/* $params = array(
"agent_id" => 1,
"pageNo" => 1,
"pageSize" => 15,
);*/
if (empty($params['agent_id'])) {
return $this->response("101", "经纪人id不能为空");
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$where = array();
$where['a.city'] = $this->city;
$where['d.site_id'] = $this->siteId;
$where['d.agent_id'] = $params['agent_id'];
$sublet = new SubletModel();
$fields = 'a.id,a.user_id,a.shop_name,a.manage_type,a.address_detail,a.province,a.city,a.district,FORMAT(a.expected_rent/100,2) as expected_rent,
if(b.status=2,"3",a.status) as status,a.appellation,a.create_time,a.status,c.user_nick,c.user_phone';
$data = $sublet->getSubletAgent($pageNo, $pageSize, 'a.id desc', $fields, $where);
foreach ($data as $key => $item) {
$data[$key]["user_phone"] = substr_replace($item["user_phone"], '****', 3, 4);
$m_sublet_img = new SubletImgModel();
$data[$key]["img_path"] = CK_IMG_URL;
$data[$key]["img_arr"] = $m_sublet_img->getSubletImg("file_name,sublet_id,type,status", ["sublet_id" => $item["id"], ["status" => 0]]);
}
return $this->response("200", "success", $data);
}
}
......@@ -182,11 +182,11 @@ class DailyPaperService
$params["source"] = array("in", ("0,1"));
$params["create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$payLogModel = new OPayLogModel();
$officePayLogModel = new OfficeOPayLogModel();
$total_shop = $payLogModel->getTotal($field, $params, "pay_type");
$total_office = $officePayLogModel->getTotal($field, $params, "pay_type");
$total_arr = array_merge($total_shop, $total_office);
$payLogModel = new OPayLogModel();
$officePayLogModel = new OfficeOPayLogModel();
$total_shop = $payLogModel->getTotal($field, $params, "pay_type");
$total_office = $officePayLogModel->getTotal($field, $params, "pay_type");
$total_arr = array_merge($total_shop, $total_office);
$total["alipay"] = 0;
$total["alipay_2"] = 0;
$total["alipay_3"] = 0;//陈志杰支付宝
......@@ -283,10 +283,10 @@ class DailyPaperService
*/
private function getPayLogList($store_id, $daily_data)
{
$ids = $this->getAgentsByStoreId($store_id);
if (!$ids) {
return null;
}
/* $ids = $this->getAgentsByStoreId($store_id);
if (!$ids) {
return null;
}*/
$payLogModel = new OPayLogModel();
$officePayLogModel = new OfficeOPayLogModel();
......@@ -296,15 +296,15 @@ class DailyPaperService
a.receipt_number,a.create_time,a.remark,a.received_money,a.transaction_fee, a.order_no,a.order_id,a.report_id,
a.bargain_id,a.real_money";
$params["a.agent_id"] = array("in", ($ids));
$params["a.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$params["a.is_del"] = 0;
$params["a.type"] = 91;
$params["c.father_id"] = 0;
$agency_fee_shop = $this->getHouseAndAgentInfo(
$params["a.reckon_in_store"] = $store_id;
$params["a.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$params["a.is_del"] = 0;
$params["a.type"] = 91;
$params["c.father_id"] = 0;
$agency_fee_shop = $this->getHouseAndAgentInfo(
$payLogModel->selectPayLogListByBargain($field . ",1 as types", $params)
);
$agency_fee_office = $this->getHouseAndAgentInfo(
$agency_fee_office = $this->getHouseAndAgentInfo(
$officePayLogModel->selectPayLogListByBargain($field . ",2 as types", $params), 2
);
......@@ -375,10 +375,10 @@ class DailyPaperService
$field_adjustment = "b.id,c.house_id,b.new_paylog_id as pay_log_id,a.agent_id,b.money,a.income_time,b.type,
a.receipt_number,a.create_time,a.transaction_fee,b.paylog_id as old_paylog_id,a.report_id,a.real_money";
$params_adjustment["b.operation_id"] = array("in", ($ids));
$params_adjustment["a.is_del"] = 0;
$params_adjustment["b.is_del"] = 0;
$params_adjustment["b.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$params_adjustment["b.reckon_in_store"] = $store_id;
$params_adjustment["a.is_del"] = 0;
$params_adjustment["b.is_del"] = 0;
$params_adjustment["b.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$adjustment_shop = $this->getHouseAndAgentInfo(
$payLogModel->selectAdjustmentList($field_adjustment . ",1 as types", $params_adjustment)
......@@ -639,7 +639,7 @@ class DailyPaperService
if ($is_ok > 0) {
//更新财务日报未提交记录表数据
$s_daily_uncommitted = new DailyUncommittedService();
$s_daily_uncommitted->updateUncommittedList($agent_info[0]["store_id"],$daily_date);
$s_daily_uncommitted->updateUncommittedList($agent_info[0]["store_id"], $daily_date);
return ["code" => 200, "data" => null];
} else {
return ["code" => 101, "msg" => "审核异常"];
......
......@@ -66,6 +66,7 @@ class OrderLogService
* @param $type_ext
* @param $bargain_id
* @param $is_open
* @param $site_id
* @return int|string
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
......@@ -81,6 +82,11 @@ class OrderLogService
$father_id = 0;
$money = 0;
$type = 0;
//获取门店id
$redis_service = new RedisCacheService();
$agent_data = $redis_service->getRedisCache(2, $agent_id);
$store_id = $agent_data['store_id'];
foreach ($collecting_bill as $collecting) {
if (isset($collecting["type"]) && isset($collecting["pay_type"]) && isset($collecting["money"])) {
if (!$this->verifyType($collecting["type"], $collecting["pay_type"], $receipt_number)) {
......@@ -98,13 +104,13 @@ class OrderLogService
$params = $this->collectingBillBin($father_id, $collecting, $agent_id, $agent_name, $report_id,
$order_id, $order_no, $house_number, $industry_type, $remark, $transfer_img, $source, $income_time,
$is_dividend, $last_transfer_time, $receipt_number, $transfer_name, $received_money, $type_ext,
$bargain_id, $is_open);
$bargain_id, $is_open, $store_id);
$father_id = $this->payLogModel->insertPayLog($params);
} else {
array_push($bill_arr, $this->collectingBillBin($father_id, $collecting, $agent_id, $agent_name,
$report_id, $order_id, $order_no, $house_number, $industry_type, $remark, $transfer_img, $source,
$income_time, $is_dividend, $last_transfer_time, $receipt_number, $transfer_name, $received_money,
$type_ext, $bargain_id, $is_open));
$type_ext, $bargain_id, $is_open, $store_id));
}
//$this->updateBargainIsOpen($bargain_id, $collecting['type'], $is_open);
}
......@@ -118,7 +124,7 @@ class OrderLogService
if ($pay_id > 0) {
$payLogService = new PayLogService();
$payLogService->addAdjustment($father_id, $pay_id, $money, $type, $agent_id);
$payLogService->addAdjustment($father_id, $pay_id, $money, $type, $agent_id,$store_id);
}
$pushMarchIn = new PushMessageService();
......@@ -279,32 +285,33 @@ class OrderLogService
private function collectingBillBin($father_id, $collecting_arr, $agent_id, $agent_name, $report_id, $order_id,
$order_no, $house_number, $industry_type, $remark, $transfer_img, $source,
$income_time, $is_dividend, $last_transfer_time, $receipt_number, $transfer_name,
$received_money, $type_ext, $bargain_id, $is_open)
$received_money, $type_ext, $bargain_id, $is_open, $store_id)
{
$arr["report_id"] = $report_id;
$arr["father_id"] = $father_id;
$arr["order_no"] = $order_no;
$arr["order_id"] = $order_id;
$arr["source"] = $source;
$arr["agent_id"] = $agent_id;
$arr["agent_name"] = $agent_name;
$arr["type"] = $collecting_arr["type"];
$arr["pay_type"] = $collecting_arr["pay_type"];
$arr["money"] = $collecting_arr["money"];
$arr["house_number"] = $house_number;
$arr["industry_type"] = $industry_type;
$arr["remark"] = $remark;
$arr["receipt_number"] = $receipt_number;
$arr["transfer_name"] = $transfer_name;
$arr["transfer_img"] = $transfer_img;
$arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time());
$arr["is_dividend"] = $is_dividend;
$arr["received_money"] = $received_money;
$arr["type_ext"] = $type_ext;
$arr["bargain_id"] = $bargain_id;
$arr["is_open"] = $is_open;
$arr["report_id"] = $report_id;
$arr["father_id"] = $father_id;
$arr["order_no"] = $order_no;
$arr["order_id"] = $order_id;
$arr["source"] = $source;
$arr["agent_id"] = $agent_id;
$arr["reckon_in_store_id"] = $store_id;
$arr["agent_name"] = $agent_name;
$arr["type"] = $collecting_arr["type"];
$arr["pay_type"] = $collecting_arr["pay_type"];
$arr["money"] = $collecting_arr["money"];
$arr["house_number"] = $house_number;
$arr["industry_type"] = $industry_type;
$arr["remark"] = $remark;
$arr["receipt_number"] = $receipt_number;
$arr["transfer_name"] = $transfer_name;
$arr["transfer_img"] = $transfer_img;
$arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time());
$arr["is_dividend"] = $is_dividend;
$arr["received_money"] = $received_money;
$arr["type_ext"] = $type_ext;
$arr["bargain_id"] = $bargain_id;
$arr["is_open"] = $is_open;
if ($income_time) {
$arr["income_time"] = date("Y-m-d H:i:s", $income_time);
}
......@@ -1347,21 +1354,21 @@ class OrderLogService
$pageSize = empty($params["page_size"]) ? 15 : $params["page_size"];
$agent_id = $params["submit_agent_id"];
$redis = new RedisCacheService();
$redis = new RedisCacheService();
//排除 总负责人等角色
$agent_data = $redis->getRedisCache(2, $agent_id);
$agent_data = $redis->getRedisCache(2, $agent_id);
$auth_rule_id = $agent_data['auth_group_id'];
if (!in_array($auth_rule_id, [1,2,22,23,25,26])) {
$aService = new VerifyService();
$ids = $aService->getAgentsByAgentId($agent_id);
if (!in_array($auth_rule_id, [1, 2, 22, 23, 25, 26])) {
$aService = new VerifyService();
$ids = $aService->getAgentsByAgentId($agent_id);
$params["ids"] = $ids;
}
$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,
$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,c.order_no,d.id as house_id,d.internal_title,d.internal_address,b.id as report_id";
$result = $bargainModel->selectBargainList($filed, $params, $pageNo, $pageSize);
$list = [];
$result = $bargainModel->selectBargainList($filed, $params, $pageNo, $pageSize);
$list = [];
foreach ($result as $k => $v) {
$father_id = $v["father_id"];
if ($father_id > 0 && in_array($father_id, $list)) {
......@@ -1568,7 +1575,7 @@ class OrderLogService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchBargainAgents($type, $order_id,$site_id)
public function searchBargainAgents($type, $order_id, $site_id)
{
$orderModel = new OrderModel();
$field = "a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_nick,c.user_phone,
......@@ -1590,12 +1597,12 @@ class OrderLogService
$list = $houseAgents->getAgentsByHouseId($field, $params);
break;
case 2:
$fields = "c.id,c.phone,c.name";
$userModel = new Users();
$params["a.id"] = $result[0]["user_id"];
$params["c.status"] = 0;
$fields = "c.id,c.phone,c.name";
$userModel = new Users();
$params["a.id"] = $result[0]["user_id"];
$params["c.status"] = 0;
$params["b.site_id"] = $site_id;
$list = $userModel->getAgentBySiteId($fields, $params);
$list = $userModel->getAgentBySiteId($fields, $params);
break;
case 3: //反签 == 报备人
$reportModel = new OReportModel();
......@@ -1680,11 +1687,11 @@ class OrderLogService
$key++;
}
$userModel = new Users();
$userModel = new Users();
$where_user['c.site_id'] = $site_id;
$where_user["a.id"] = $result[0]["user_id"];
$where_user["b.status"] = 0;
$user_data = $userModel->getAgentUser($field, $where_user);
$where_user["a.id"] = $result[0]["user_id"];
$where_user["b.status"] = 0;
$user_data = $userModel->getAgentUser($field, $where_user);
//客方
if (isset($user_data[0]['id'])) {
......
......@@ -79,9 +79,10 @@ class PayLogService
* @param $money
* @param $type
* @param $agent_id
* @param $store_id
* @return int
*/
public function addAdjustment($new_pay_id, $pay_id, $money, $type, $agent_id)
public function addAdjustment($new_pay_id, $pay_id, $money, $type, $agent_id, $store_id)
{
$filed = "id,type";
$pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]);
......@@ -89,7 +90,7 @@ class PayLogService
return -1;
}
$oPayLogAdjustment = new OPayLogAdjustment();
$where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"]);
$where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"], $store_id);
$oPayLogAdjustment->addAdjustment($where_);
}
......@@ -102,7 +103,7 @@ class PayLogService
* @param $old_type
* @return mixed
*/
private function adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $old_type)
private function adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $old_type, $store_id)
{
$arr["paylog_id"] = $pay_id;
......@@ -141,10 +142,11 @@ class PayLogService
}
}
$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());
$arr["type"] = $val;
$arr["operation_id"] = $agent_id;
$arr["reckon_in_store"] = $store_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;
}
......
......@@ -13,7 +13,6 @@ define('IMG_PATH','https://admin.tonglianjituan.com/houseImg/');
define('LOCAL_IMG_HOST','/resource/lib/Attachments/');
define('PAGESIZE', 15); //分页每页条数
define('ADMIN_URL_TL','https://admin.tonglianjituan.com/'); //B端网址
//define('TEST_ADMIN_URL_TL','https://dev.tonglianjituan.com/'); //B端网址
define('CURRENT_URL', 'https://'.$_SERVER['HTTP_HOST'].'/'); //取当前域名地址
define('IMAGES_URL', 'https://images.tonglianjituan.com/'); //取当前域名地址
define('HEADERIMGURL', IMAGES_URL . 'static'. DS . 'head_portrait/'); //头像地址
......
......@@ -9,7 +9,7 @@ class SubletImgModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_sublet_img';
private $db_;
private $db_;
public function __construct($data = [])
{
......@@ -22,11 +22,28 @@ class SubletImgModel extends Model
* @param $data
* @return int|string
*/
public function saveSubletImg($data) {
$time = date("Y-m-d H:i:s", time());
public function saveSubletImg($data)
{
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
return $this->db_ ->insert($data);
return $this->db_->insert($data);
}
/**获取图片信息
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getSubletImg($field, $params)
{
return $this->db_
->field($field)
->where($params)
->select();
}
......
......@@ -1049,6 +1049,8 @@ Route::group('broker', [
'deviceList' => ['api_broker/Broker/deviceList', ['method' => 'GET']],//设备列表
'uploadWorkLearning' => ['api_broker/UploadWorkLearning/workLearningImage', ['method' => 'POST']],//保存0素质测评 1方法分析 2价值观考核图片
'subletList' => ['api_broker/Sublet/subletList', ['method' => 'GET']],//委托转铺列表
]);
Route::group('search', [
......
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