diff --git a/admin/controllers/app/licheb/Main.php b/admin/controllers/app/licheb/Main.php index 0b88749a..f8761832 100644 --- a/admin/controllers/app/licheb/Main.php +++ b/admin/controllers/app/licheb/Main.php @@ -16,6 +16,7 @@ class Main extends HD_Controller parent::__construct(); $this->load->model('app/licheb/App_licheb_users_model', 'userM'); $this->load->model('app/material/Material_template_model', 'mdTemplate'); + $this->load->model('app/material/Material_biz_model', 'mdMaterialBiz'); } public function index() @@ -42,6 +43,14 @@ class Main extends HD_Controller array('name' => '查看详情', 'url' => '/app/material/template/index?app_id=' . $this->app_id), ), ); + $value = $this->mdMaterialBiz->count(array('app_id' => $this->app_id), 'distinct(biz_id)'); + $list[] = array( + 'title' => '素材门店统计(家)', + 'value' => $value, + 'btns' => array( + array('name' => '查看详情', 'url' => '/app/material/template/lists_biz?app_id=' . $this->app_id), + ), + ); $conditions[] = array('icon' => 'am-icon-home', 'list' => $list); /*小程序设置 end*/ diff --git a/admin/controllers/app/material/Template.php b/admin/controllers/app/material/Template.php index 3c1bf699..c48d2f27 100644 --- a/admin/controllers/app/material/Template.php +++ b/admin/controllers/app/material/Template.php @@ -75,6 +75,43 @@ class Template extends HD_Controller } public function lists_biz() + { + $params = $this->input->get(); + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $params['size'] = $params['size'] ? intval($params['size']) : 20; + $lists = $users = array(); + $where = array('app_id' => $params['app_id']); + if ($params['biz_name']) { + $where['biz_id in (select id from lc_biz where biz_name like "%' . $params['biz_name'] . '%")'] = null; + } + $count = $this->mdMaterialBiz->count($where,'distinct(biz_id)'); + if ($count) { + $fileds = "distinct(biz_id)"; + $res = $this->mdMaterialBiz->select($where, "biz_id desc", $params['page'], $params['size'], $fileds); + $str_ids = implode(',', array_unique(array_column($res, 'biz_id'))); + $map_biz = $this->mdBiz->map('id', 'biz_name', array("id in({$str_ids})" => null)); + foreach ($res as $key => $value) { + $setValue = array(); + $biz_id = intval($value['biz_id']); + $re_s = $this->mdBizStatistics->sum('browse_num', array('app_id' => $params['app_id'], 'biz_id' => $biz_id)); + $count_c = $this->mdCustomers->count(array('biz_id' => $biz_id, 'cf_id' => $this->cf_id, 'status >=' => 0)); + $count_o = $this->mdBizStatistics->count_order(array('c.biz_id' => $biz_id, 'c.cf_id' => $this->cf_id, 'c.status >=' => 0)); + $setValue['browse_num'] = intval($re_s['browse_num']); + $setValue['baoming_num'] = $count_c; + $setValue['order_name'] = $count_o; + $setValue['biz_id'] = $biz_id; + $setValue['biz_name'] = $map_biz[$value['biz_id']]; + $lists[] = $setValue; + } + } + $this->data['lists'] = $lists; + $this->data['params'] = $params; + $this->data['_title'] = '门店使用数据列表'; + $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); + return $this->show_view('/app/material/template/lists_biz', true); + } + + public function lists_t_biz() { $params = $this->input->get(); $t_id = intval($params['t_id']); @@ -114,7 +151,7 @@ class Template extends HD_Controller $this->data['params'] = $params; $this->data['_title'] = $re['title'] . '_门店使用数据列表'; $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); - return $this->show_view('/app/material/template/lists_biz', true); + return $this->show_view('/app/material/template/lists_t_biz', true); } //展示单条数据 diff --git a/admin/views/app/material/template/lists.php b/admin/views/app/material/template/lists.php index 73e3a0f9..7260c17f 100644 --- a/admin/views/app/material/template/lists.php +++ b/admin/views/app/material/template/lists.php @@ -72,7 +72,7 @@
| 门店 | +浏览次数 | +报名客户 | +订单客户 | +创建时间 | +操作 | +
|---|---|---|---|---|---|
| = $v['biz_name'] ?> | += $v['browse_num'] ?> | += $v['baoming_num'] ?> | += $v['order_name'] ?> | += $v['c_time'] ?> | +分享链接 | +