Commit 74c6f727 authored by hujun's avatar hujun

修改分佣方调业绩统计

parent 462401b0
......@@ -21,6 +21,7 @@ use app\model\OFinancialAudit;
use app\model\OPartialCommission;
use app\model\OPayLogModel;
use app\model\ORefundModel;
use app\task\controller\ResultsSummaryNewTask;
class Finance extends Basic
{
......@@ -1433,13 +1434,30 @@ class Finance extends Basic
if (empty($this->params['scale'])) {
return $this->response(101, '分佣比例为空');
}
//检查成交报告是否存在
$data = $m_bargain->getBargainPartialDetail('a.id,a.agent_id,a.create_time', ['id'=>$this->params['bargain_id']]);
if (empty($data['id'])) {
return $this->response(101, '没有成交报告信息');
}
$update['agent_id'] = $this->params['agent_id'];
$update['scale'] = $this->params['scale'];
$update['role'] = $this->params['role'];
$update['scale_fee'] = $this->params['scale_fee'];
$data = $m_bargain->updateBargainById($this->params['bargain_id'], $update);
$data = $m_bargain->updateBargainById($this->params['bargain_id'], $update); //更改分佣方
//获取被修改人信息
$m_agent = new AAgents();
$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*/
$bargain_data = $m_bargain->selectBargainByOrderNo('agent_id,father_id', ['id'=>$this->params['bargain_id']]);
......
......@@ -1251,12 +1251,14 @@ class OBargainModel extends Model
->find();
$m_agent = new AAgents();
$filed_agent = 'a.id,a.name,a.phone,b.store_name,c.district_name';
$filed_agent = 'a.id,a.name,a.phone,b.store_name,c.district_name,a.store_id,a.district_id';
$agent_info = $m_agent->getAgentsInfoByAgentId($filed_agent, [ 'agent_id' => $result['agent_id'] ]);
$result['district_name'] = $agent_info[0]['district_name'];
$result['store_name'] = $agent_info[0]['store_name'];
$result['name'] = $agent_info[0]['name'];
$result['phone'] = $agent_info[0]['phone'];
$result['store_id'] = $agent_info[0]['store_id'];
$result['district_id'] = $agent_info[0]['district_id'];
} catch (\Exception $ex) {
$result = false;
......
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