edit-sylive-kpi_order
This commit is contained in:
@@ -466,4 +466,54 @@ class Syt extends CI_Controller
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
|
||||
public function up_order_kpi(){
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->library('market/sylive2_entity');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$activityId = 6;
|
||||
$time_start = strtotime('2022-12-16 00:00:00');
|
||||
$where = [
|
||||
'activityId' => $activityId,
|
||||
'kpi' => 'order',
|
||||
'createTime<' => $time_start
|
||||
];
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id desc',$page,$size,'id,activityId,cfUserId');
|
||||
if($rows){
|
||||
foreach ($rows as $key => $val) {
|
||||
$this->mdSytActivityKpiData->update(['kpi'=>'beforeOrder'],['id'=>$val['id']]);
|
||||
$val['cfUserId'] && $this->sylive2_entity->kpi_count($activityId,'beforeOrder',$val['cfUserId']);
|
||||
echo "执行成功:{$val['id']}\n";
|
||||
}
|
||||
}else{
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
|
||||
public function up_kpi_count(){
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->library('market/sylive2_entity');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$activityId = 6;
|
||||
$where = [
|
||||
'activityId' => $activityId,
|
||||
'kpi' => 'order',
|
||||
'id<=' => 237801
|
||||
];
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id desc',$page,$size,'id,activityId,cfUserId');
|
||||
if($rows){
|
||||
foreach ($rows as $key => $val) {
|
||||
$val['cfUserId'] && $this->sylive2_entity->kpi_count($activityId,'order',$val['cfUserId']);
|
||||
echo "执行成功:{$val['id']}\n";
|
||||
}
|
||||
}else{
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class Sylive2_data_entity{
|
||||
|
||||
private $ci;
|
||||
private $map_kpi_biz = [
|
||||
'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch'
|
||||
'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch','beforeOrder' => 'beforeOrderTotal'
|
||||
];
|
||||
|
||||
public function __construct(){
|
||||
|
||||
@@ -6,7 +6,7 @@ class Sylive2_entity{
|
||||
|
||||
private $ci;
|
||||
private $map_kpi_biz = [
|
||||
'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch'
|
||||
'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch','beforeOrder' => 'beforeOrderTotal'
|
||||
];
|
||||
|
||||
public function __construct(){
|
||||
|
||||
@@ -58,13 +58,16 @@ class Notify extends CI_Controller {
|
||||
throw new Exception("支付失败,sid={$sid}");
|
||||
}else{ //支付成功
|
||||
$res = $this->order_model->update(['status'=>1,'payTime'=>date('Y-m-d H:i:s')],['id'=>$order['id']]);
|
||||
$act = $this->market_sylive_activity_model->get(['activityId'=>$order['activityId']]);
|
||||
$kpi = time() > strtotime($act['timeStart']) ? 'order' : 'beforeOrder';
|
||||
if($res){
|
||||
$act_user = $this->act_user_model->get(['userId'=>$order['userId'],'activityId'=>$order['activityId']]);
|
||||
|
||||
$params = [
|
||||
'a_id' => $order['activityId'],
|
||||
'uid' => $order['userId'],
|
||||
'cf_uid' => $act_user['channelId'],
|
||||
'kpi' => 'order',
|
||||
'kpi' => $kpi,
|
||||
'tagId' => $order['id'],
|
||||
'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid,'mch_id'=>$this->mch_id],
|
||||
'itemId' => $order['itemId']
|
||||
|
||||
@@ -169,7 +169,7 @@ class Stic extends Admin{
|
||||
$owner_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据
|
||||
$mine = [
|
||||
['title'=>'观看用户','num'=>"{$owner_browse_count}人",'url'=>'/h5/market/sylive2/stic/users?type=owner&kpi=watch'],
|
||||
['title'=>'下单数','num'=>"{$owner_subscribe_count}人",'url'=>'/h5/market/sylive2/stic/users?type=owner&kpi=order'],
|
||||
['title'=>'下单数','num'=>"{$owner_subscribe_count}单",'url'=>'/h5/market/sylive2/stic/users?type=owner&kpi=order'],
|
||||
['title'=>'转化率','num'=>$owner_browse_count ? round($owner_subscribe_count/$owner_browse_count*100,2)."%" : 0],
|
||||
];
|
||||
$sub_lists = [
|
||||
@@ -200,7 +200,7 @@ class Stic extends Admin{
|
||||
$biz_subscribe_count = $this->mdSytActivityKpiData->count($where); //下单数据
|
||||
$biz = [
|
||||
['title'=>'观看用户','num'=>"{$biz_browse_count}人",'url' => "/h5/market/sylive2/stic/users?type=biz&type_id={$biz_id}&kpi=watch"],
|
||||
['title'=>'下单数','num'=>"{$biz_subscribe_count}人",'url' => "/h5/market/sylive2/stic/users?type=biz&type_id={$biz_id}&kpi=order"],
|
||||
['title'=>'下单数','num'=>"{$biz_subscribe_count}单",'url' => "/h5/market/sylive2/stic/users?type=biz&type_id={$biz_id}&kpi=order"],
|
||||
['title'=>'转化率','num'=>$biz_browse_count ? round($biz_subscribe_count/$biz_browse_count*100,2)."%" : 0],
|
||||
];
|
||||
$sub_lists[] = ['title'=>'本店','lists'=>$biz];
|
||||
@@ -209,7 +209,7 @@ class Stic extends Admin{
|
||||
$disk = $this->sylive2_entity->level_disk($this->a_id);
|
||||
if(!$group_row['groupsLevel'] && !$group_row['ifBiz']){//顶级
|
||||
$browse_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'watch']); //观看数据
|
||||
$subscribe_count = $this->market_sylive_order_model->count(['activityId' => $this->a_id, 'status' => 1]); //下单数据
|
||||
$subscribe_count = $this->market_sylive_order_model->count(['activityId' => $this->a_id, 'status' => 1,'createTime>='=>$row['timeStart']]); //下单数据
|
||||
}else{
|
||||
$browse_count = $group_row['watch'];//观看数据
|
||||
$subscribe_count = $group_row['orderTotal'];//下单数据
|
||||
@@ -221,7 +221,7 @@ class Stic extends Admin{
|
||||
}
|
||||
$biz = [
|
||||
['title'=>'观看用户','num'=>"{$browse_count}人",'url'=>$b_url],
|
||||
['title'=>'下单数','num'=>"{$subscribe_count}人",'url'=>$sub_url],
|
||||
['title'=>'下单数','num'=>"{$subscribe_count}单",'url'=>$sub_url],
|
||||
['title'=>'转化率','num'=>$browse_count ? round($subscribe_count/$browse_count*100,2)."%" : 0],
|
||||
];
|
||||
$title = $disk[$group_row['groupsLevel']+1]? '所有'.$disk[$group_row['groupsLevel']+1] : '所有门店';
|
||||
@@ -500,7 +500,7 @@ class Stic extends Admin{
|
||||
|
||||
public function ajax_rank(){
|
||||
$map_kpi_biz = [
|
||||
'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch'
|
||||
'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch','beforeOrder' => 'beforeOrderTotal'
|
||||
];
|
||||
$params = $this->input->get();
|
||||
$title = '';
|
||||
|
||||
Reference in New Issue
Block a user