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);
}
}
......@@ -283,10 +283,10 @@ class DailyPaperService
*/
private function getPayLogList($store_id, $daily_data)
{
$ids = $this->getAgentsByStoreId($store_id);
/* $ids = $this->getAgentsByStoreId($store_id);
if (!$ids) {
return null;
}
}*/
$payLogModel = new OPayLogModel();
$officePayLogModel = new OfficeOPayLogModel();
......@@ -296,7 +296,7 @@ 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.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;
......@@ -375,7 +375,7 @@ 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["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"));
......@@ -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,7 +285,7 @@ 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;
......@@ -288,6 +294,7 @@ class OrderLogService
$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"];
......@@ -1351,7 +1358,7 @@ class OrderLogService
//排除 总负责人等角色
$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])) {
if (!in_array($auth_rule_id, [1, 2, 22, 23, 25, 26])) {
$aService = new VerifyService();
$ids = $aService->getAgentsByAgentId($agent_id);
$params["ids"] = $ids;
......@@ -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,
......
......@@ -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;
......@@ -143,6 +144,7 @@ class PayLogService
$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/'); //头像地址
......
......@@ -22,11 +22,28 @@ class SubletImgModel extends Model
* @param $data
* @return int|string
*/
public function saveSubletImg($data) {
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