Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
3f1a3438
Commit
3f1a3438
authored
Aug 17, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分佣方调业绩统计
parent
2b60c283
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
24 deletions
+92
-24
Finance.php
application/index/controller/Finance.php
+39
-11
AAgents.php
application/model/AAgents.php
+45
-10
OBargainModel.php
application/model/OBargainModel.php
+7
-2
OFinancialAudit.php
application/model/OFinancialAudit.php
+1
-1
No files found.
application/index/controller/Finance.php
View file @
3f1a3438
...
@@ -1397,6 +1397,7 @@ class Finance extends Basic
...
@@ -1397,6 +1397,7 @@ class Finance extends Basic
$num
=
$m_partial
->
updateBargainById
(
$partial_id
,
$data
);
$num
=
$m_partial
->
updateBargainById
(
$partial_id
,
$data
);
if
(
$num
>
0
)
{
if
(
$num
>
0
)
{
$this
->
updatePerformance
(
$this
->
params
[
'partial_id'
]);
$result
[
'code'
]
=
200
;
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
'删除成功'
;
$result
[
'msg'
]
=
'删除成功'
;
}
else
{
}
else
{
...
@@ -1460,9 +1461,9 @@ class Finance extends Basic
...
@@ -1460,9 +1461,9 @@ class Finance extends Basic
}
}
//检查成交报告是否存在
//检查成交报告是否存在
$data
=
$m_bargain
->
getBargainPartialDetail
(
'a.id,a.agent_id,a.create_time'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]]);
$data
_arr
=
$m_bargain
->
getBargainPartialDetail
(
'a.id,a.agent_id,a.create_time'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]]);
if
(
empty
(
$data
[
'id'
]))
{
if
(
empty
(
$data
_arr
[
'id'
]))
{
return
$this
->
response
(
101
,
'没有成交报告信息'
);
return
$this
->
response
(
101
,
'没有成交报告信息'
);
}
}
...
@@ -1473,15 +1474,8 @@ class Finance extends Basic
...
@@ -1473,15 +1474,8 @@ class Finance extends Basic
$data
=
$m_bargain
->
updateBargainById
(
$this
->
params
[
'bargain_id'
],
$update
);
//更改分佣方
$data
=
$m_bargain
->
updateBargainById
(
$this
->
params
[
'bargain_id'
],
$update
);
//更改分佣方
//获取被修改人信息
$this
->
updatePerformance
(
0
,
$this
->
params
[
'agent_id'
]);
$m_agent
=
new
AAgents
();
$this
->
updatePerformance
(
0
,
$data_arr
[
'agent_id'
]);
$agent_data
=
$m_agent
->
verifyUser
(
'id,store_id,district_id'
,
''
,[
'id'
=>
$this
->
params
[
'agent_id'
]]);
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
$date
=
date
(
'Y-m-d'
,
strtotime
(
$data
[
'create_time'
]));
$sum
->
updateTotalByAgentId
(
$agent_data
[
'id'
],
$agent_data
[
'store_id'
],
$agent_data
[
'district_id'
],
$date
);
//被修改的人
$sum
->
updateTotalByAgentId
(
$data
[
'agent_id'
],
$data
[
'store_id'
],
$data
[
'district_id'
],
$date
);
//修改为最新的分佣方
/*记录日志 start*/
/*记录日志 start*/
$bargain_data
=
$m_bargain
->
selectBargainByOrderNo
(
'agent_id,father_id'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]]);
$bargain_data
=
$m_bargain
->
selectBargainByOrderNo
(
'agent_id,father_id'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]]);
...
@@ -1524,6 +1518,8 @@ class Finance extends Basic
...
@@ -1524,6 +1518,8 @@ class Finance extends Basic
if
(
$result
)
{
if
(
$result
)
{
$code
=
200
;
$code
=
200
;
$this
->
editRecordLog
(
$this
->
params
[
'bargain_id'
],
'[撤销成交报告]'
,
3
);
//日志记录
$this
->
editRecordLog
(
$this
->
params
[
'bargain_id'
],
'[撤销成交报告]'
,
3
);
//日志记录
$this
->
updatePerformance
(
$this
->
params
[
'bargain_id'
]);
$msg
=
'撤销成功'
;
$msg
=
'撤销成功'
;
}
else
{
}
else
{
$code
=
101
;
$code
=
101
;
...
@@ -1531,4 +1527,36 @@ class Finance extends Basic
...
@@ -1531,4 +1527,36 @@ class Finance extends Basic
}
}
return
$this
->
response
(
$code
,
$msg
);
return
$this
->
response
(
$code
,
$msg
);
}
}
/**
* 更新个人业绩
*
* @param int $bargain_id
* @param int $agent_id
* @return bool
*/
private
function
updatePerformance
(
int
$bargain_id
=
0
,
int
$agent_id
=
0
)
:
bool
{
$where
=
[];
if
(
$bargain_id
)
{
$where
[
'b.id'
]
=
$bargain_id
;
}
if
(
$agent_id
)
{
$where
[
'a.id'
]
=
$agent_id
;
}
if
(
!
empty
(
$where
))
{
//获取被修改人信息
$m_agent
=
new
AAgents
();
$agent_data
=
$m_agent
->
agentBragainDetail
(
'a.id,a.store_id,a.district_id,b.create_time'
,
[
'b.id'
=>
$bargain_id
]);
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
$date
=
date
(
'Y-m-d'
,
strtotime
(
$agent_data
[
'create_time'
]));
$sum
->
updateTotalByAgentId
(
$agent_data
[
'id'
],
$agent_data
[
'store_id'
],
$agent_data
[
'district_id'
],
$date
);
//被修改的人
}
return
true
;
}
}
}
application/model/AAgents.php
View file @
3f1a3438
...
@@ -178,20 +178,20 @@ class AAgents extends BaseModel
...
@@ -178,20 +178,20 @@ class AAgents extends BaseModel
* @param $join
* @param $join
* @param $params
* @param $params
* @return array|false|\PDOStatement|string|\think\Model
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
verifyUser
(
$field
,
$join
,
$params
)
public
function
verifyUser
(
$field
,
$join
,
$params
)
{
{
try
{
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
$join
)
->
where
(
$params
)
->
find
();
}
catch
(
\Exception
$e
)
{
$data
=
[];
}
$r
=
$this
->
field
(
$field
)
return
$data
;
->
alias
(
'a'
)
->
join
(
$join
)
->
where
(
$params
)
->
find
();
//echo $this->getLastSql();
return
$r
;
}
}
/**
/**
...
@@ -1005,6 +1005,14 @@ class AAgents extends BaseModel
...
@@ -1005,6 +1005,14 @@ class AAgents extends BaseModel
return
$result
;
return
$result
;
}
}
/**
* @param $field
* @param $params
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsIdsArray
(
$field
,
$params
)
public
function
getAgentsIdsArray
(
$field
,
$params
)
{
{
$params
[
"status"
]
=
0
;
$params
[
"status"
]
=
0
;
...
@@ -1023,6 +1031,14 @@ class AAgents extends BaseModel
...
@@ -1023,6 +1031,14 @@ class AAgents extends BaseModel
}
}
/**
* @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
getAgentsInfo
(
$field
,
$params
)
public
function
getAgentsInfo
(
$field
,
$params
)
{
{
$params
[
"a.status"
]
=
0
;
$params
[
"a.status"
]
=
0
;
...
@@ -1036,4 +1052,22 @@ class AAgents extends BaseModel
...
@@ -1036,4 +1052,22 @@ class AAgents extends BaseModel
return
$result
;
return
$result
;
}
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
*/
public
function
agentBragainDetail
(
$field
,
$where
)
{
try
{
$data
=
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_bargain b'
,
'a.id = b.agent_id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
catch
(
\Exception
$e
)
{
$data
=
[];
}
return
$data
;
}
}
}
\ No newline at end of file
application/model/OBargainModel.php
View file @
3f1a3438
...
@@ -906,10 +906,9 @@ class OBargainModel extends Model
...
@@ -906,10 +906,9 @@ class OBargainModel extends Model
$insert_data
[
'father_id'
]
=
$id
;
$insert_data
[
'father_id'
]
=
$id
;
}
else
{
}
else
{
$insert_data
[
'father_id'
]
=
$bargain_data
[
'father_id'
];
$insert_data
[
'father_id'
]
=
$bargain_data
[
'father_id'
];
$insert_data
[
'create_time'
]
=
$bargain_data
[
'create_time'
];
$insert_data
[
'is_commission'
]
=
1
;
$insert_data
[
'is_commission'
]
=
1
;
}
}
$insert_data
[
'create_time'
]
=
$bargain_data
[
'create_time'
];
//分佣方保留打成交报告时间
$insert_data
[
'report_id'
]
=
$bargain_data
[
'report_id'
];
$insert_data
[
'report_id'
]
=
$bargain_data
[
'report_id'
];
$insert_data
[
'agent_id'
]
=
$agent_id
;
$insert_data
[
'agent_id'
]
=
$agent_id
;
$insert_data
[
'order_id'
]
=
$bargain_data
[
'order_id'
];
$insert_data
[
'order_id'
]
=
$bargain_data
[
'order_id'
];
...
@@ -933,6 +932,12 @@ class OBargainModel extends Model
...
@@ -933,6 +932,12 @@ class OBargainModel extends Model
$result
=
$this
->
insert
(
$insert_data
);
$result
=
$this
->
insert
(
$insert_data
);
if
(
$result
==
1
)
{
if
(
$result
==
1
)
{
$this
->
commit
();
$this
->
commit
();
$agent_data
=
$m_agent
->
verifyUser
(
'store_id,district_id'
,
''
,
[
'id'
=>
$agent_id
]);
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
$date
=
date
(
'Y-m-d'
,
strtotime
(
$bargain_data
[
'create_time'
]));
$sum
->
updateTotalByAgentId
(
$agent_id
,
$agent_data
[
'store_id'
],
$agent_data
[
'district_id'
],
$date
);
//被修改的人
}
else
{
}
else
{
$this
->
rollback
();
$this
->
rollback
();
$result
=
false
;
$result
=
false
;
...
...
application/model/OFinancialAudit.php
View file @
3f1a3438
...
@@ -84,7 +84,7 @@ class OFinancialAudit extends BaseModel
...
@@ -84,7 +84,7 @@ class OFinancialAudit extends BaseModel
$this
->
startTrans
();
$this
->
startTrans
();
$data
[
'status'
]
=
4
;
$data
[
'status'
]
=
4
;
$data
[
'is_del'
]
=
1
;
//去除之前的审核记录
$data
[
'is_del'
]
=
1
;
//去除之前的审核记录
$
result_audit
=
$
this
->
editData
(
$data
,
$bargain_id
,
'bargain_id'
);
$this
->
editData
(
$data
,
$bargain_id
,
'bargain_id'
);
$m_bargain
=
new
OBargainModel
();
$m_bargain
=
new
OBargainModel
();
$update_data
[
'status'
]
=
20
;
$update_data
[
'status'
]
=
20
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment