fixed
This commit is contained in:
@@ -155,8 +155,10 @@ class Score extends HD_Controller
|
||||
'type' => Receiver_score_day_model::TYPE_BIZ
|
||||
];
|
||||
$scoreDayRow = $receiverScoreDayModel->get($where);
|
||||
$total_num = $receiverScoreDayModel->count(['biz_id' => $item['biz_id'], 'day' => $day]);
|
||||
$scoreSum = $receiverScoreDayModel->sum('score', ['biz_id' => $item['biz_id'], 'day' => $day]);
|
||||
$score = $scoreSum ? $scoreSum['score'] : 0;
|
||||
$total_score = $scoreSum ? $scoreSum['score'] : 0;
|
||||
$score = $total_num > 0 ? $total_score / $total_num : 0;
|
||||
//获取上一天数据
|
||||
$where = [
|
||||
'biz_id' => $item['biz_id'],
|
||||
@@ -166,11 +168,18 @@ class Score extends HD_Controller
|
||||
$dayRow = $receiverScoreDayModel->select($where, 'day desc', 1, 1, 'score');
|
||||
$change_score = $dayRow[0]['score'] ? $score - $dayRow[0]['score'] : $score;
|
||||
if ($scoreDayRow) {
|
||||
$receiverScoreDayModel->update(['score' => $score, 'change_score' => $change_score], ['id' => $scoreDayRow['id']]);
|
||||
$receiverScoreDayModel->update([
|
||||
'score' => $score, 'total_score' => $total_score,
|
||||
'total_num' => $total_num, 'change_score' => $change_score
|
||||
], ['id' => $scoreDayRow['id']]);
|
||||
} else {
|
||||
$addData = [
|
||||
'biz_id' => $item['biz_id'], 'score' => $score, 'day' => $day,
|
||||
'type' => Receiver_score_day_model::TYPE_USER,
|
||||
'biz_id' => $item['biz_id'],
|
||||
'score' => $score,
|
||||
'total_score' => $total_score,
|
||||
'total_num' => $total_num,
|
||||
'day' => $day,
|
||||
'type' => Receiver_score_day_model::TYPE_BIZ,
|
||||
'change_score' => $change_score, 'c_time' => time()
|
||||
];
|
||||
$receiverScoreDayModel->add($addData);
|
||||
|
||||
@@ -549,13 +549,13 @@ abstract class Wxapp extends HD_Controller
|
||||
return false;
|
||||
}
|
||||
if (in_array($this->session['group_id'], [App_licheb_users_model::GROUP_BIZ, App_licheb_users_model::GROUP_MANAGER])) {
|
||||
$redis->save($cache_key, 1, 60 * 60);
|
||||
$this->load->model('receiver/receiver_score_log_model');
|
||||
$this->load->model('receiver/receiver_score_config_model');
|
||||
$scoreLogModel = new receiver_score_log_model();
|
||||
$day = date('Y-m-d');
|
||||
$scoreLogModel->add_score($this->session['uid'], $this->get_biz_id(), $day, Receiver_score_config_model::TYPE_BASE,
|
||||
Receiver_score_config_model::TYPE_BASE_KG, '请求接口', 1);
|
||||
$redis->save($cache_key, 1, 60 * 60);
|
||||
Receiver_score_config_model::TYPE_BASE_KG, '基础分', 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ class Cusorderdata extends Wxapp
|
||||
'uid' => $this->session['uid'],
|
||||
'uname' => $this->session['uname'],
|
||||
'type' => 1,
|
||||
'log' => $key,
|
||||
'log' => $key ?: '',
|
||||
'cf_platform' => 'wxapp',
|
||||
'c_time' => time(),
|
||||
);
|
||||
|
||||
@@ -43,10 +43,10 @@ class Score_entity
|
||||
switch ($type) {
|
||||
case Receiver_score_config_model::TYPE_BASE: //基础分
|
||||
if ($sub_type == Receiver_score_config_model::TYPE_BASE_DEFAULT) {
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, '默认分', 1);
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, '基础分', 1);
|
||||
}
|
||||
if ($sub_type == Receiver_score_config_model::TYPE_BASE_KG) {
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, '接口请求默认值', 1, 0, 0);
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, '开工', 1, 0, 0);
|
||||
}
|
||||
break;
|
||||
case Receiver_score_config_model::TYPE_CLUE:
|
||||
@@ -128,7 +128,7 @@ class Score_entity
|
||||
'u_time>=' => strtotime($day . ' 00:00:00'), 'u_time<=' => strtotime($day . ' 23:59:59')
|
||||
];
|
||||
$rows = $receiverOrdersModel->select($where, '', 1, 1000, 'id');
|
||||
$desc = '开票时间大于订单录入时间';
|
||||
$desc = '开票时间早于订单录入时间';
|
||||
if ($rows) {
|
||||
foreach ($rows as $val) {
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, "{$desc}:" . $val['id'], 2, $val['id']);
|
||||
@@ -146,7 +146,7 @@ class Score_entity
|
||||
"b.status" => 1, "a.admin_id" => $uid
|
||||
];
|
||||
$rows = $mdCustomerVisitData->select_visit($where, 'a.id desc', 1, 100, 'a.id');
|
||||
$desc = '线索回访时间逾期未跟进';
|
||||
$desc = '线索逾期未跟进';
|
||||
if ($rows) {
|
||||
foreach ($rows as $val) {
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, "{$desc}:" . $val['id'], 2, $val['id']);
|
||||
@@ -163,7 +163,7 @@ class Score_entity
|
||||
'apply_def_time>=' => strtotime($day . ' 00:00:00'), 'apply_def_time<=' => strtotime($day . ' 23:59:59')
|
||||
];
|
||||
$rows = $receiverOrdersModel->select($where, '', 1, 1000, 'id');
|
||||
$desc = '战败未处理';
|
||||
$desc = '战败申请当日未处理';
|
||||
if ($rows) {
|
||||
foreach ($rows as $val) {
|
||||
Receiver_score_log_model::add_score($uid, $biz_id, $day, $type, $sub_type, "{$desc}:" . $val['id'], 2, $val['id']);
|
||||
|
||||
Reference in New Issue
Block a user