Commit 9645d3c3 authored by clone's avatar clone

bug

parent c01db511
......@@ -1122,13 +1122,19 @@ class OrderLogService
$filed = "a.id,a.father_id,a.house_number,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";
$result = $bargainModel->selectBargainList($filed, $params, $pageNo, $pageSize);
$list = [];
foreach ($result as $k => $v) {
if($v["father_id"] > 0){
$father_id = $v["father_id"];
if($father_id > 0 && in_array($father_id, $list)){
unset($result[$k]);
}else{
$result[$k]["create_time"] = date("Y-m-d", strtotime($v["create_time"]));
$result[$k]["id"] = $v["father_id"];
array_push($list,$father_id);
}
$result[$k]["create_time"] = date("Y-m-d", strtotime($v["create_time"]));
}
return $result;
return ;
}
......
......@@ -43,12 +43,13 @@ class StatementService
* @param $agent_id
* @param $time_start
* @param $time_end
* @param $day_or_week
* @return array|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectStatementByAgentId($agent_id, $time_start, $time_end,$day_or_week)
public function selectStatementByAgentId($agent_id, $time_start, $time_end, $day_or_week)
{
$field = "id,store_id,district_id,level,name,phone,sex,status";
......@@ -70,7 +71,7 @@ class StatementService
$conditions["agent_id"] = $agent_id;
$conditions['create_time'] = array( 'between', array( $time_start, $time_end ) );
//dump($user_type);
return $this->selectStatement($conditions, $user_type, $store_id, $district_id,$day_or_week);
return $this->selectStatement($conditions, $user_type, $store_id, $district_id, $day_or_week);
}
......@@ -82,7 +83,7 @@ class StatementService
* @param $district_id
* @return array
*/
private function selectStatement($conditions, $user_type, $store_id, $district_id,$day_or_week)
private function selectStatement($conditions, $user_type, $store_id, $district_id, $day_or_week)
{
$result = $params = [];
......@@ -119,7 +120,7 @@ class StatementService
$conditions["agent_id"] = array( "in", $agentIds );
if ($user_type == 2) {
$district_lists = $this->getDistrictList($conditions, $district_id,$day_or_week);
$district_lists = $this->getDistrictList($conditions, $district_id, $day_or_week);
$district_list = $district_lists["district_list"];
$result["last_week_total"] = $district_lists["last_week_total"];
}
......@@ -127,7 +128,6 @@ class StatementService
}
$result["agent_total"] = $agent_total;
$result["house_num"] = $this->houseModel->getAddHouseNumByAgentId($conditions);
//dump($conditions);
......@@ -138,9 +138,9 @@ class StatementService
//本月业绩
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", strtotime("-1 day"));
if($user_type == 2){//如果是总监
if ($user_type == 2) {//如果是总监
$where_["agent_id"] = array( "in", $agentIds );
}else{
} else {
$where_["district_id"] = $district_id;
}
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
......@@ -152,7 +152,7 @@ class StatementService
//本周业绩
$start_time = date("Y-m-d", strtotime("-7 day"));
$where_['create_time'] = ['between', [$start_time . " 00:00:00", $end_time . " 23:59:59"]];
$where_['create_time'] = [ 'between', [ $start_time . " 00:00:00", $end_time . " 23:59:59" ] ];
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$result["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
......@@ -160,9 +160,9 @@ class StatementService
//本月完成单数
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", strtotime("-1 day"));
if($user_type == 2){//如果是总监
if ($user_type == 2) {//如果是总监
$where_["agent_id"] = array( "in", $agentIds );
}else{
} else {
$where_["district_id"] = $district_id;
}
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
......@@ -213,12 +213,12 @@ class StatementService
$result["district_list"] = $district_list;
if($user_type == 2){//如果是总监
if ($user_type == 2) {//如果是总监
//todo 判断是日报还是周报
if($day_or_week == 'day'){//日报
if ($day_or_week == 'day') {//日报
}else{//周报
} else {//周报
//todo 本月业绩
$where_ = [];
$start_time = date("Y-m-01", time());
......@@ -280,9 +280,6 @@ class StatementService
}
return $result;
}
......@@ -310,7 +307,7 @@ class StatementService
$start_time = date("Y-m-d", strtotime("-7 day"));
$end_time = date("Y-m-d", strtotime("-1 day"));
$where_["agent_id"] = $agent_id;
$where_['create_time'] = ['between', [$start_time . " 00:00:00", $end_time . " 23:59:59"]];
$where_['create_time'] = [ 'between', [ $start_time . " 00:00:00", $end_time . " 23:59:59" ] ];
$obargain = new OBargainModel();
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
......@@ -329,7 +326,7 @@ class StatementService
* @param $district_id
* @return mixed
*/
private function getDistrictList($conditions, $district_id,$day_or_week)
private function getDistrictList($conditions, $district_id, $day_or_week)
{
//根据门店统计本周人数和上周人数
$time_start = $conditions['time_start'];
......@@ -358,7 +355,7 @@ class StatementService
}
}
if($day_or_week == 'week'){
if ($day_or_week == 'week') {
//todo 本月业绩
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", strtotime("-1 day"));;
......
......@@ -221,12 +221,11 @@ class OBargainModel extends Model
->join("o_order c", "a.order_id = c.id", "left")
->join("g_houses d", "c.house_id = d.id", "left")
->where($where_)
->group("a.father_id")
->order("a.create_time desc")
->limit($pageSize)
->page($pageNo)
->select();
//echo $this->db_->getLastSql();
// echo $this->db_->getLastSql();
return $result;
}
......
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