diff --git a/admin/controllers/app/liche/Main.php b/admin/controllers/app/liche/Main.php index ff49b7c3..b9528932 100644 --- a/admin/controllers/app/liche/Main.php +++ b/admin/controllers/app/liche/Main.php @@ -1,24 +1,27 @@ app_id = 1; parent::__construct(); $this->load->model('app/liche/App_liche_cms_model', 'cmsM'); $this->load->model('app/liche/App_liche_users_model', 'userM'); - + $this->load->model('topics/topics_model', 'mdTopics'); $this->load->model('Subjects_model', 'subM'); } - public function index(){ + public function index() + { /*应用状况*/ $conditions = array(); @@ -50,6 +53,16 @@ class Main extends HD_Controller{ array('name' => '查看详情', 'url' => '/app/liche/cms/index'), ), ); + + $value = $this->mdTopics->count(array('app_id' => $this->app_id)); + $list[] = array( + 'title' => '专题(个)', + 'value' => $value, + 'btns' => array( + array('name' => '查看详情', 'url' => '/topics/topics?app_id=' . $this->app_id), + //array('name' => '查看详情', 'url' => '/sys/company?app_id=' . $this->app_id), + ), + ); $conditions[] = array('icon' => 'am-icon-home', 'list' => $list); /*小程序设置 end*/ diff --git a/admin/controllers/topics/Enroll.php b/admin/controllers/topics/Enroll.php new file mode 100644 index 00000000..e0acee04 --- /dev/null +++ b/admin/controllers/topics/Enroll.php @@ -0,0 +1,329 @@ + '已失效', 0 => '未核销', 1 => '已核销'); + + public function __construct() + { + parent::__construct(); + $this->load->model('topics/topics_model', 'mdTopics'); + $this->load->model('topics/topic_modules_model', 'mdTopicModules'); + $this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll'); + $this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata'); + } + + public function index() + { + return $this->lists(); + } + + public function lists() + { + $params = $this->input->get(); + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $params['size'] = $params['size'] ? intval($params['size']) : 20; + $params['module_id'] = intval($params['module_id']); + + $res = $this->dataSelect($params); + if ($res['code'] == 0) { + return $this->show_json(SYS_CODE_FAIL, $res['msg']); + } + $lists = $res['lists']; + $count = $res['count']; + $this->data['params'] = $res['params']; + $this->data['_title'] = $res['title'] . '列表'; + $this->data['type'] = $res['type']; + $this->data['statusAry'] = $this->statusAry; + $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); + $this->data['lists'] = $lists; + return $this->show_view('topics/enroll/lists', true); + } + + /** + * 报名活动列表 + * @return bool + */ + public function lists_module() + { + $params = $this->input->get(); + $page = $params['page'] ? $params['page'] : 1; + $size = $params['size'] ? $params['size'] : 20; + + $app_id = $params['app_id']; + $search_ary = array("title" => "标题", "module_id" => "ID"); + + //根据应用获取模块 + $where = array('app_id' => $app_id); + $rows_topic = $this->mdTopics->select($where); + $module_ids = array(); + if ($rows_topic) { + foreach ($rows_topic as $v) { + if ($v['module_ids']) { + $ids = explode(',', $v['module_ids']); + if ($ids) { + $module_ids = array_merge($module_ids, $ids); + } + } + } + } + + $total = 0; + $lists = array(); + if ($module_ids) { + $str_ids = implode(',', $module_ids); + $where = array("module_id in ({$str_ids})" => null); + if ($params['search_v']) { + if ('title' == $params['search_k']) { + $where["m.title like '%{$params['search_v']}%'"] = null; + } else { + $where["m.{$params['search_k']}"] = $params['search_v']; + } + } + !$params['search_k'] && $params['search_k'] = 'title'; + + if (strlen($params['status']) > 0) { + $where['j.status'] = $params['status']; + } else { + $where['j.status>=0'] = null; + $params['status'] = ''; + } + + $total = $this->mdModuleEnroll->count_status($where); + if ($total) { + $orderby = 'id desc'; + $select = "module_id, title, es_time, ee_time, as_time, ae_time, j.status"; + $rows = $this->mdModuleEnroll->select_status($where, $orderby, $page, $size, $select); + foreach ($rows as $v) { + $lists[] = array( + 'id' => $v['module_id'], + 'title' => $v['title'], + 'e_time' => "{$v['es_time']}~{$v['ee_time']}", + 'a_time' => "{$v['as_time']}~{$v['ae_time']}", + 'status' => $v['status'], + 'statusion' => 1 == $v['status'] ? "正常" : "下架", + ); + } + } + } + + $this->data['params'] = $params; + $this->data['lists'] = $lists; + $this->data['search_ary'] = $search_ary; + $this->data['_title'] = '报名活动管理'; + $this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total); + + return $this->show_view('topics/enroll/lists_module', true); + } + + /** + * Notes:查找报名数据 + * Created on: 2020/5/19 16:37 + * Created by: dengbw + * @param $params + * @return array + */ + private function dataSelect($params) + { + $where = $lists = array(); + $title = '活动报名'; + $type = 0; + if ($params['module_id']) { + $where['module_id'] = $params['module_id']; + $row_en = $this->mdModuleEnroll->get(array('module_id' => $params['module_id']), 'title,type'); + $title = $row_en['title']; + $type = $row_en['type']; + } else { + //根据应用获取报名列表 + $app_id = $params['app_id']; + $where_topic = array('app_id' => $app_id); + $rows_topic = $this->mdTopics->select($where_topic); + $module_ids = array(); + if ($rows_topic) { + foreach ($rows_topic as $v) { + if ($v['module_ids']) { + $ids = explode(',', $v['module_ids']); + if ($ids) { + $module_ids = array_merge($module_ids, $ids); + } + } + } + } + if ($module_ids) { + $str_ids = implode(',', $module_ids); + $where["module_id in ({$str_ids})"] = null; + } else { + $where['module_id'] = -1; + } + } + + if (status_verify($params['status'])) { + $where['status'] = $params['status']; + } else { + $params['status'] = -99; + } + + if ($params['name']) { + $where['name like "%' . $params['name'] . '%"'] = null; + } + if ($params['mobile']) { + $where['mobile'] = $params['mobile']; + } + if ($params['code']) { + $where['code'] = $params['code']; + } + if ($params['time']) { + $time = explode(' ~ ', $params['time']); + $time[0] && $where["c_time >="] = strtotime($time[0] . ' 00:00:00'); + $time[1] && $where["c_time <="] = strtotime($time[1] . ' 23:59:59'); + } + $count = $this->mdModuleEnrolldata->count($where); + if ($count) { + $select = "id,module_id,name,mobile,code,status,c_time,jsondata"; + $lists = $this->mdModuleEnrolldata->select($where, "id desc", $params['page'], $params['size'], $select); + $map_module = array(); + if ($lists) { + $module_ids = array_unique(array_column($lists, 'module_id')); + $str_ids = implode(',', $module_ids); + $where_module = array("module_id in ({$str_ids})" => null); + $map_module = $this->mdModuleEnroll->map('module_id', '*', $where_module, '', 0, 0, 'module_id, title, descrip'); + } + foreach ($lists as $key => $value) { + $json = json_decode($value['jsondata'], true); + $module = $map_module[$value['module_id']]; + $lists[$key]['c_time'] = date('Y-m-d H:i', $value['c_time']); + $lists[$key]['status_name'] = $this->statusAry[$value['status']]; + $lists[$key]['remark'] = $json['remark'] ? $json['remark'] : ''; + $lists[$key]['title'] = $module['descrip'] ? $module['descrip'] : $module['title']; + } + } + $data['code'] = SYS_CODE_SUCCESS; + $data['type'] = $type; + $data['title'] = $title; + $data['lists'] = $lists; + $data['count'] = $count; + $data['params'] = $params; + return $data; + } + + public function get() + { + $id = intval($this->input->get('id')); + $module_id = intval($this->input->get('module_id')); + if (!$id || !$module_id) { + return $this->show_json(SYS_CODE_FAIL, '参数错误!'); + } + $re = $this->mdModuleEnrolldata->get(array("id" => $id)); + if (!$re || empty($re)) { + return $this->show_json(SYS_CODE_FAIL, '报名详情不存在!'); + } + $reEn = $this->mdModuleEnroll->get(array('module_id' => $module_id), 'enroll_json,type'); + $enroll_json = array(); + if ($reEn['enroll_json'] && $re['jsondata']) { + $enroll_json = json_decode($reEn['enroll_json'], true); + $jsondata = json_decode($re['jsondata'], true); + foreach ($enroll_json as $key => $value) { + $jsondata[$key] && $enroll_json[$key]['value'] = $jsondata[$key]; + } + } + $re['enroll_json'] = $enroll_json; + $re['type'] = $reEn['type']; + $re['c_time'] = date('Y-m-d H:i', $re['c_time']); + $re['status_name'] = $this->statusAry[$re['status']]; + $this->data['info'] = $re; + return $this->show_view('topics/enroll/edit'); + } + + public function del() + { + // TODO: Implement del() method. + } + + + public function batch() + { + } + + public function export() + { + $params = $this->input->get(); + $params['page'] = 1; + $params['size'] = 10000; + $params['export'] = 1; + $data = $indexs = array(); + $res = $this->dataSelect($params); + if ($params['module_id']) { + if ($params['type'] == 1) { + $fileName = '活动报名用户'; + foreach ($res['lists'] as $key => $value) { + $temp['name'] = $value['name']; + $temp['mobile'] = $value['mobile']; + $temp['code'] = $value['code']; + $temp['status_name'] = $value['status_name']; + $temp['c_time'] = $value['c_time']; + $temp['remark'] = $value['remark']; + $data[] = $temp; + } + $indexs = [ + 'name' => '姓名', + 'mobile' => '手机号', + 'code' => '核销码', + 'status_name' => '状态', + 'c_time' => '报名时间', + "remark" => "备注", + ]; + } else { + $fileName = '报名用户'; + foreach ($res['lists'] as $key => $value) { + $temp['name'] = $value['name']; + $temp['mobile'] = $value['mobile']; + $temp['c_time'] = $value['c_time']; + $temp['remark'] = $value['remark']; + $data[] = $temp; + } + $indexs = [ + 'name' => '姓名', + 'mobile' => '手机号', + 'c_time' => '报名时间', + "remark" => "备注", + ]; + } + } else { + $fileName = '活动报名'; + foreach ($res['lists'] as $key => $value) { + $temp['title'] = $value['title']; + $temp['name'] = $value['name']; + $temp['mobile'] = $value['mobile']; + $temp['c_time'] = $value['c_time']; + $temp['remark'] = $value['remark']; + $data[] = $temp; + } + $indexs = [ + 'title' => '活动名称', + 'name' => '姓名', + 'mobile' => '手机号', + 'c_time' => '报名时间', + "remark" => "备注", + ]; + } + array_unshift($data, $indexs); + $this->load->library('excel'); + $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); + } + + public function add() + { + // TODO: Implement add() method. + } + + public function edit() + { + // TODO: Implement edit() method. + } +} \ No newline at end of file diff --git a/admin/controllers/topics/Topics.php b/admin/controllers/topics/Topics.php new file mode 100644 index 00000000..58d49aa0 --- /dev/null +++ b/admin/controllers/topics/Topics.php @@ -0,0 +1,959 @@ + '下架', '1' => '上架'); + private $moduleAry = array( + array('name' => '文本模块', 'tag' => 'text'), + array('name' => '广告模块', 'tag' => 'ad'), + array('name' => '报名模块', 'tag' => 'enroll') + ); + + public function __construct() + { + parent::__construct(); + $this->load->model('topics/topics_model', 'mdTopics'); + $this->load->model('topics/topic_modules_model', 'mdTopicModules'); + $this->load->model('topics/topic_module_text_model', 'mdModuleText'); + $this->load->model('topics/topic_module_ad_model', 'mdModuleAd'); + $this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll'); + $this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata'); + $this->load->model('topics/topic_user_log_model', 'mdUserLog'); + $this->load->model("sys/sys_admin_model", 'mdSysAdmin'); + } + + /** + * 调用所有函数前 + * @param $method + * @return mixed + */ + function _remap($method) + { + return $this->$method(); + } + + public function index() + { + return $this->lists(); + } + + public function lists() + { + $params = $this->input->get(); + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $size = 20; + $where = array(); + $lists = array(); + $statusAry = $this->statusAry; + if ($params['status'] || $params['status'] == '0') { + $where['status'] = $params['status']; + } else { + $params['status'] = -99; + $where['status > -1'] = null; + } + if ($params['app_id']) { + $where['app_id'] = $params['app_id']; + } + if ($params['title']) { + $where['title like "%' . $params['title'] . '%"'] = null; + } + $res = $this->mdTopics->select($where, "id desc", $params['page'], $size); + $count = $this->mdTopics->count($where); + + $view_where["c_time > UNIX_TIMESTAMP(DATE_SUB(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 7 day))"] = null; + $view_select = "tid, count(id) as doc_count, count(distinct app_uid) as doc_count_uid"; + + $user_log_arr = $this->mdUserLog->map_groupby('tid', '*', $view_where, $view_select, 'tid'); + if ($res) { + foreach ($res as $key => $value) { + $setValue = array(); + $setValue['id'] = $value['id']; + $setValue['title'] = $value['title']; + if ($value['status'] == 0) { + $setValue['che_status'] = 1; + $setValue['che_status_name'] = $this->statusAry[1]; + } else { + $setValue['che_status'] = 0; + $setValue['che_status_name'] = $this->statusAry[0]; + } + $setValue['status_name'] = $statusAry[$value['status']]; + $setValue['c_time'] = date('Y-m-d H:i', $value['c_time']); + $setValue['count_view'] = $user_log_arr[$value['id']]['doc_count'] ?: 0; + $setValue['count_view_uid'] = $user_log_arr[$value['id']]['doc_count_uid'] ?: 0; + $lists[] = $setValue; + } + } + $this->data['appList'] = $this->app_list(); + $this->data['_title'] = '专题列表'; + $this->data['statusAry'] = $statusAry; + $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $params['page'], 'totle' => $count); + $this->data['lists'] = $lists; + $this->data['params'] = $params; + return $this->show_view('topics/lists', true); + } + + /** + * 访问用户概况 + * @return bool + */ + public function lists_userc() + { + $params = $this->input->get(); + $id = $params['id']; + $where = array('tid' => $id); + + if ($params['time']) { + list($s_time, $e_time) = explode(" ~ ", $params['time']); + $s_time = strtotime($s_time . ' 00:00:00'); + $e_time = strtotime($e_time . ' 23:59:59'); + $where["c_time > {$s_time}"] = null; + $where["c_time < {$e_time}"] = null; + } + + $lists = array(); + + $select = "cf_suid, count(id) as row_num"; + $this->mdUserLog->db->group_by('cf_suid'); + $rows = $this->mdUserLog->select($where, "cf_suid desc", 0, 0, $select); + $map_admin = array(); + if ($rows) { + $uids = array_diff(array_column($rows, "cf_suid"), array(0)); + $uids && $uids = array_unique($uids); + $map_coupon = array(); + if ($uids) { + $ids_str = implode(',', $uids); + $where_admin = array("id in ({$ids_str})" => null); + $select = "id, username, mobile"; + $map_admin = $this->mdSysAdmin->map('id', "*", $where_admin, 'id desc', 0, 0, $select); + } + $sum_view = 0; + $sum_couponc = 0; + foreach ($rows as $v) { + $cf_suid = $v["cf_suid"]; + $admin = $map_admin[$cf_suid]; + $mobile = $admin ? $admin['mobile'] : ""; + $mobile && 1 != $this->role && $mobile = substr_replace($mobile, "*****", 3, 5); + $viewc = intval($v['row_num']); + $couponc = intval($map_coupon[$cf_suid]); + $sum_view += $viewc; + $sum_couponc += $couponc; + $lists[] = array( + "id" => $cf_suid, + "uname" => $admin ? $admin['username'] : (0 == $cf_suid ? "其他" : ""), + "mobile" => $mobile, + "count" => $viewc, + "couponc" => $couponc, + ); + } + $lists[] = array("id" => "+", "uname" => "合计", "count" => $sum_view, "couponc" => $sum_couponc); + } + + $total = count($lists); + + $this->data['_title'] = '专题访问用户概况'; + $this->data['pager'] = array('count' => ceil($total / 20), 'curr' => 1, 'totle' => $total); + $this->data['lists'] = $lists; + $this->data['params'] = $params; + return $this->show_view('topics/lists_userc', true); + } + + /** + * 按天统计 + * @return bool + */ + public function lists_by_day() + { + $params = $this->input->get(); + $id = $params['id']; + $page = intval($params['page']) ?: 1; + $size = intval($params['size']) ?: 10; + + $where = array(); + $where['tid'] = $id; + if ($params['time']) { + list($s_time, $e_time) = explode(" ~ ", $params['time']); + $s_time = strtotime($s_time . ' 00:00:00'); + $e_time = strtotime($e_time . ' 23:59:59'); + $where["c_time > {$s_time}"] = null; + $where["c_time < {$e_time}"] = null; + } else { + $where['c_time > UNIX_TIMESTAMP(DATE_SUB(DATE_FORMAT(NOW(),\'%Y-%m-%d\'),INTERVAL 7 day))'] = null; + } + + $select = "tid, count(id) as doc_count, count(distinct app_uid) as doc_count_uid, FROM_UNIXTIME(c_time, '%Y-%m-%d') as date"; + $this->mdUserLog->db->group_by("FROM_UNIXTIME(c_time, '%Y-%m-%d')"); + $rows = $this->mdUserLog->select($where, "FROM_UNIXTIME(c_time, '%Y-%m-%d') desc", $page, $size, $select); + //debug_log("[debug] ".$this->mdUserLog->db->last_query(), __FUNCTION__ ); + $lists = array(); + //debug_log("[debug] ".var_export($rows,1), __FUNCTION__ ); + if ($rows) { + foreach ($rows as $v) { + $lists[] = array( + "date" => $v['date'], + "count" => intval($v['doc_count']), + "count_uid" => intval($v['doc_count_uid']), //访问用户数 + ); + } + } + + $this->mdUserLog->db->group_by("FROM_UNIXTIME(c_time, '%Y-%m-%d')"); + $countList = $this->mdUserLog->select($where, "FROM_UNIXTIME(c_time, '%Y-%m-%d') desc", 0, 0, $select); + if ($countList) { + $sum_view = 0; + $sum_view_uid = 0; + foreach ($countList as $v) { + $sum_view += intval($v['doc_count']); + $sum_view_uid += intval($v['doc_count_uid']); + } + $lists[] = array("date" => "合计", "count" => $sum_view, "count_uid" => $sum_view_uid); + } + $total = count($countList); + $topicInfo = $this->mdTopics->get(array('id' => $id), 'title'); + $this->data['_title'] = $topicInfo['title'] . '-按天统计'; + $this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total); + $this->data['lists'] = $lists; + $this->data['params'] = $params; + return $this->show_view('topics/lists_by_day', true); + } + + /** + * 访问用户列表 + * @return bool + */ + public function lists_user() + { + $params = $this->input->get(); + $id = $params['id']; + $page = $params['page'] = $params['page'] ? intval($params['page']) : 1; + $size = 20; + + $this->load->library('entity/user_entity'); + + $where = array('tid' => $id); + $lists = array(); + + $searchTpAry = array('uname' => '用户姓名', 'mobile' => '用户手机号', 'suid' => "源头用户ID", 'sname' => '源头用户姓名', "smobile" => "源头手机号"); + + $row_topic = $this->mdTopics->get(array('id' => $id)); + $app_id = $row_topic['app_id']; + $this->user_entity->init($app_id); + if ($params['search_tp'] && isset($params['title'])) { + $where_user = array(); + $where_admin = array(); + switch ($params['search_tp']) { + case "uname": + $where_user["uname like '%{$params['title']}%'"] = null; + break; + case "sname": + $where_admin["uname like '%{$params['title']}%'"] = null; + break; + case "mobile": + $where_user['mobile'] = $params['title']; + break; + case "smobile": + $where_admin['mobile'] = $params['title']; + break; + case "suid": + $where['cf_suid'] = $params['title']; + break; + } + + if ($where_user) { + $rows_user = $this->user_entity->select($where_user); + $ids_str = $rows_user ? implode(',', array_column($rows_user, 'id')) : "-1"; + $where["app_uid in ({$ids_str})"] = null; + } + if ($where_admin) { + $select = "id"; + $row_admin = $this->mdSysAdmin->select($where_admin, 'id desc', 0, 0, $select); + $ids_str = $row_admin ? implode(',', array_column($row_admin, 'id')) : "-1"; + $where["cf_suid in ({$ids_str})"] = null; + } + } + + if ($params['time']) { + list($s_time, $e_time) = explode(" ~ ", $params['time']); + $s_time = strtotime($s_time . ' 00:00:00'); + $e_time = strtotime($e_time . ' 23:59:59'); + $where["c_time > {$s_time}"] = null; + $where["c_time < {$e_time}"] = null; + } + $total = $this->mdUserLog->count($where); + if ($total) { + $select = "id, app_uid, cf_suid, c_time"; + $rows = $this->mdUserLog->select($where, 'id desc', $page, $size, $select); + $map_user = array(); + $map_admin = array(); + if ($rows) { + //获取用户信息 + $uids = array_column($rows, "app_uid"); + $uids = array_diff($uids, array(0)); + $uids && $uids = array_unique($uids); + if ($uids) { + $ids_str = implode(',', $uids); + $where_user = array("id in({$ids_str})" => null); + $select_u = "id, nickname as uname, mobile"; + if ($app_id == 2 || $app_id == 1 || $app_id == 5) { + $select_u = "id, uname, mobile"; + } + $map_user = $this->user_entity->map('id', "*", $where_user, 'id desc', 0, 0, $select_u); + } + //获取管理员信息 + $suids = array_column($rows, "cf_suid"); + $suids = array_diff($suids, array(0)); + $suids && $suids = array_unique($suids); + if ($suids) { + $ids_str = implode(',', $suids); + $where_admin = array("id in({$ids_str})" => null); + $select = "id, username, mobile"; + $map_admin = $this->mdSysAdmin->map('id', "*", $where_admin, 'id desc', 0, 0, $select); + } + foreach ($rows as $v) { + $user = $map_user[$v['app_uid']]; + $amdin = $map_admin[$v['cf_suid']]; + $mobile = $user ? $user['mobile'] : ""; + $smobile = $amdin ? $amdin['mobile'] : ""; + $smobile && 1 != $this->role && $smobile = substr_replace($smobile, "*****", 3, 5); + $lists[] = array( + "id" => $v['id'], + "uname" => $user ? $user['uname'] : "", + "mobile" => $mobile, + "suname" => $amdin ? $amdin['username'] : "", + "smobile" => $smobile, + "c_time" => date('Y-m-d H:i:s', $v['c_time']), + ); + } + } + + } + + $this->data['_title'] = '专题访问用户'; + $this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total); + $this->data['ary']['searchTpAry'] = $searchTpAry; + $this->data['lists'] = $lists; + $this->data['params'] = $params; + return $this->show_view('topics/lists_user', true); + } + + public function get() + { + $id = intval($this->input->get('id')); + $app_id = intval($this->input->get('app_id')); + !$app_id && $app_id = $this->app_id; + if ($id > 0) { + $re = $this->mdTopics->get(array('id' => $id)); + if (!$re || empty($re)) { + return $this->show_json(SYS_CODE_FAIL, '专题不存在!'); + } + $re['bg_img_url'] = build_qiniu_image_url($re['bg_img']); + $info = $re; + $json = $info['jsondata'] ? json_decode($info['jsondata'], true) : ''; + $info['cf_id'] = $json['cf_id'] ? $json['cf_id'] : ""; + $info['mp_app_id'] = $json['mp_app_id'] ? $json['mp_app_id'] : ""; + $info['ebiz'] = $json['ebiz'] ? $json['ebiz'] : ""; + $_title = '编辑专题'; + $edit_url = '/topics/topics/edit'; + } else { + $_title = '新增专题'; + $edit_url = '/topics/topics/add'; + $info['id'] = $id; + $info['app_id'] = $app_id; + $info['cf_id'] = ""; + $info['mp_app_id'] = ""; + $info['ebiz'] = 0; + } + $info['spm'] = $this->input->get('spm'); + $info['edit_url'] = $edit_url; + $info['moduleAry'] = $this->moduleAry; + $this->data['info'] = $info; + $this->data['_title'] = $_title; + return $this->show_view('topics/edit', true); + } + + public function add() + { + $app_id = $this->input->post('app_id'); + if (!$app_id) { + return $this->show_json(SYS_CODE_FAIL, '非法参数'); + } + $spm = $this->input->post('spm'); + $title = $this->input->post('title'); + if (!$title) { + return $this->show_json(SYS_CODE_FAIL, '请输入专题名称'); + } + $bg_color = $this->input->post('bg_color'); + $bg_img = $this->input->post('bg_img'); + + $dataItems['app_id'] = $app_id; + $dataItems['title'] = $title; + $dataItems['bg_color'] = $bg_color; + $dataItems['bg_img'] = $bg_img; + $dataItems['status'] = 1; + $dataItems['c_time'] = time(); + $id = $this->mdTopics->add($dataItems); + if (!$id) { + return $this->show_json(SYS_CODE_FAIL, '添加失败'); + } + return $this->show_json(SYS_CODE_SUCCESS, '添加成功!', '#/topics/topics/get?id=' . $id . '&spm=' . $spm); + } + + public function edit() + { + $id = $this->input->post('id'); + if (!$id) { + return $this->show_json(SYS_CODE_FAIL, '非法参数'); + } + $title = $this->input->post('title'); + if (!$title) { + return $this->show_json(SYS_CODE_FAIL, '请输入专题名称'); + } + $bg_color = $this->input->post('bg_color'); + $bg_img = $this->input->post('bg_img'); + $dataItems['title'] = $title; + $dataItems['bg_color'] = $bg_color; + $dataItems['bg_img'] = $bg_img; + $re = $this->mdTopics->update($dataItems, array('id' => $id)); + if (!$re) { + return $this->show_json(SYS_CODE_FAIL, '修改失败'); + } + return $this->show_json(SYS_CODE_SUCCESS, '修改成功!'); + } + + /** + * Notes:获取模块列表 + * Created on: 2020/2/10 19:01 + * Created by: dengbw + */ + public function get_module() + { + $page_id = $this->input->get('page_id'); + $moduleList = array(); + $re = $this->mdTopics->get(array('id' => $page_id), 'app_id,module_ids'); + if ($re['module_ids']) { + $where['status>-1'] = null; + $where['id in (' . $re['module_ids'] . ')'] = null; + $resM = $this->mdTopicModules->select($where, 'sort DESC', 0, 0, 'id,type,sort'); + foreach ($resM as $key => $value) { + $style = 'none';//none,block(隐藏,显示content富文本) + $title = $mdModule = ''; + switch ($value['type']) { + case "text": + $title = '文本模块'; + $mdModule = $this->mdModuleText; + $style = 'block'; + break; + case "ad": + $title = '广告模块'; + $mdModule = $this->mdModuleAd; + break; + case "enroll": + $title = '报名模块'; + $mdModule = $this->mdModuleEnroll; + $style = 'block'; + break; + default: + } + if ($mdModule) { + $re = $mdModule->get(array('module_id' => $value['id']), 'title'); + if ($re) { + $setValue['id'] = $value['id']; + $setValue['page_id'] = $page_id; + $setValue['name'] = $re['title'] ? $re['title'] : $title; + $setValue['tag'] = $value['type']; + $setValue['order_view'] = $value['sort']; + $setValue['style'] = $style; + $moduleList[] = $setValue; + } + } + } + } + $this->data = $moduleList; + return $this->show_json(SYS_CODE_SUCCESS, '获取成功!'); + } + + /** + * Notes:保存添加模块 + * Created on: 2020/2/10 18:06 + * Created by: dengbw + */ + public function edit_add_module() + { + $page_id = intval($this->input->post('page_id')); + $add_sys_shop_module = $this->input->post('add_sys_shop_module'); + $reT = $this->mdTopics->get(array('id' => $page_id), 'module_ids'); + if (!$reT) { + return $this->show_json(SYS_CODE_FAIL, '添加失败!'); + } + $module_ids = $reT['module_ids']; + $sort = 100; + if ($module_ids) { + $where['status>-1'] = null; + $where['id in (' . $module_ids . ')'] = null; + $reM = $this->mdTopicModules->min('sort', $where);//获取最小排序 + if ($reM['sort']) { + $sort = $reM['sort'] - 1; + } + } + $dataM['sort'] = $sort; + $dataM['type'] = $add_sys_shop_module['tag']; + $dataM['status'] = 1; + //添加模块 + $mid = $this->mdTopicModules->add($dataM); + if ($mid <= 0) { + return $this->show_json(SYS_CODE_FAIL, '添加失败!'); + } + //添加各模块 + $dataI['module_id'] = $mid; + $dataI['title'] = $add_sys_shop_module['name']; + if ($add_sys_shop_module['tag'] == 'text') { + $this->mdModuleText->add($dataI); + } else if ($add_sys_shop_module['tag'] == 'ad') { + $this->mdModuleAd->add($dataI); + } else if ($add_sys_shop_module['tag'] == 'enroll') { + $this->mdModuleEnroll->add($dataI); + } + //更新专题 + $module_ids = $module_ids ? $module_ids . ',' . $mid : $mid; + $this->mdTopics->update(array('module_ids' => $module_ids), array('id' => $page_id)); + return $this->show_json(SYS_CODE_SUCCESS, '添加成功!'); + } + + /** + * Notes:保存模块排序 + * Created on: 2020/2/21 15:59 + * Created by: dengbw + */ + public function edit_sort_module() + { + $module_list = $this->input->post('module_list'); + if (!$module_list) { + return $this->show_json(SYS_CODE_FAIL, '排序失败!'); + } + foreach ($module_list as $key => $value) { + $this->mdTopicModules->update(array('sort' => $value['order_view']), array('id' => $value['id'])); + } + return $this->show_json(SYS_CODE_SUCCESS, '保存成功!'); + } + + /** + * Notes:软删除已保存的模块 + * Created on: 2020/2/11 14:36 + * Created by: dengbw + */ + public function edit_delete_module() + { + $id = intval($this->input->post('id')); + if (!$id) { + return $this->show_json(SYS_CODE_FAIL, '非法参数!'); + } + $this->mdTopicModules->update(array('status' => -1), array('id' => $id)); + return $this->show_json(SYS_CODE_SUCCESS, '删除成功!'); + } + + /** + * Notes:获取文本模块信息 + * Created on: 2020/2/13 12:48 + * Created by: dengbw + */ + public function get_text_setting() + { + $module_id = intval($this->input->get('module_id')); + $re = $this->mdModuleText->get(array('module_id' => $module_id)); + $setting = array(); + $status = 0; + $module_title = $module_desc = $module_content = $bg_img = $bg_color = ""; + $title_img = $title_bgcolor = $title_color = $border_color = ""; + if ($re) { + $reM = $this->mdTopicModules->get(array('id' => $module_id), 'status, jsondata'); + $json_topic = json_decode($reM['jsondata'], true); + $status = $reM ? $reM['status'] : 0; + $module_title = $re['title']; + $module_desc = $re['descrip']; + $module_content = $re['content']; + $title_img = strval($json_topic['title_img']); + $title_bgcolor = strval($json_topic['title_bgcolor']); + $title_color = strval($json_topic['title_color']); + $bg_img = strval($json_topic['bg_img']); + $bg_color = strval($json_topic['bg_color']); + $border_color = strval($json_topic['border_color']); + } + $setting['status'] = $status; + $setting['module_title'] = $module_title; + $setting["module_title_img"] = strval($title_img); + $setting["module_title_img_url"] = $title_img ? build_qiniu_image_url($title_img) : ""; + $setting["module_title_bgcolor"] = strval($title_bgcolor); + $setting["module_title_color"] = strval($title_color); + $setting['module_desc'] = $module_desc; + $setting['module_content'] = $module_content; + $setting['module_bg_img'] = $bg_img; + $setting['module_bg_img_url'] = $bg_img ? build_qiniu_image_url($bg_img) : ""; + $setting['module_bg_color'] = $bg_color; + $setting["module_border_color"] = strval($border_color); + $this->data['setting'] = $setting; + return $this->show_json(SYS_CODE_SUCCESS, '获取成功!'); + } + + /** + * Notes:保存文本模块 + * Created on: 2020/2/13 12:35 + * Created by: dengbw + */ + public function edit_save_text() + { + $save_data = $this->input->post('save_data'); + if (!$save_data['module_id']) { + return $this->show_json(SYS_CODE_FAIL, '非法参数!'); + } + + $row_text = $this->mdModuleText->get(array('module_id' => $save_data['module_id'])); + + $dataI['title'] = $save_data['setting']['module_title']; + $dataI['descrip'] = $save_data['setting']['module_desc']; + $dataI['content'] = $save_data['setting']['module_content']; + $this->mdModuleText->update($dataI, array('module_id' => $save_data['module_id'])); + //更新其他参数 + $title_img = $save_data['setting']['module_title_img']; + $title_bgcolor = $save_data['setting']['module_title_bgcolor']; + $title_color = $save_data['setting']['module_title_color']; + $border_color = $save_data['setting']['module_border_color']; + $bg_img = $save_data['setting']['module_bg_img']; + $bg_color = $save_data['setting']['module_bg_color']; + $where = array('id' => $save_data['module_id']); + $row_topic = $this->mdTopicModules->get($where); + $json = json_decode($row_topic['jsondata'], true); + if ($title_img) { + $json['title_img'] = $title_img; + } else { + unset($json['title_img']); + } + if ($title_bgcolor) { + $json['title_bgcolor'] = $title_bgcolor; + } else { + unset($json['title_bgcolor']); + } + if ($title_color) { + $json['title_color'] = $title_color; + } else { + unset($json['title_color']); + } + if ($border_color) { + $json['border_color'] = $border_color; + } else { + unset($json['border_color']); + } + if ($bg_img) { + $json['bg_img'] = $bg_img; + } else { + unset($json['bg_img']); + } + if ($bg_color) { + $json['bg_color'] = $bg_color; + } else { + unset($json['bg_color']); + } + $upd = array('status' => $save_data['setting']['status'], "jsondata" => json_encode($json, JSON_UNESCAPED_UNICODE)); + $this->mdTopicModules->update($upd, $where); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功!'); + } + + /** + * Notes:获取广告信息 + * Created on: 2020/5/12 22:48 + * Created by: dengbw + */ + public function get_ad_setting() + { + $module_id = intval($this->input->get('module_id')); + $re = $this->mdModuleAd->get(array('module_id' => $module_id)); + $setting = $list = array(); + if ($re) { + $reM = $this->mdTopicModules->get(array('id' => $module_id), 'status, jsondata'); + $json_topic = json_decode($reM['jsondata'], true); + $setting = array( + "module_title_img" => strval($json_topic['title_img']), + "module_title_img_url" => $json_topic['title_img'] ? build_qiniu_image_url($json_topic['title_img']) : "", + "module_title_bgcolor" => strval($json_topic['title_bgcolor']), + "module_title_color" => strval($json_topic['title_color']), + "module_bg_img" => strval($json_topic['bg_img']), + "module_bg_img_url" => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "", + "module_bg_color" => strval($json_topic['bg_color']), + "module_border_color" => strval($json_topic['border_color']), + ); + $setting['status'] = $reM ? $reM['status'] : 0; + $setting['module_title'] = $re['title']; + $setting['module_desc'] = $re['descrip']; + $setting['style'] = $re['style']; + $img_json = $re['img_json'] ? json_decode($re['img_json'], true) : array(); + foreach ($img_json as $key => $value) { + $setValue = $value; + $setValue['img_url'] = build_qiniu_image_url($value['img'], 690, 390); + $setValue['order_view'] = $value['order_view'] ? $value['order_view'] : 50; + $setValue['jump_type'] = intval($value['jump_type']); + $list[] = $setValue; + } + } + $this->data['setting'] = $setting; + $this->data['ad_list'] = $list; + return $this->show_json(SYS_CODE_SUCCESS, '获取成功!'); + } + + /** + * Notes:保存广告模块 + * Created on: 2020/5/12 12:35 + * Created by: dengbw + */ + public function edit_save_ad() + { + $save_data = $this->input->post('save_data'); + if (!$save_data['module_id']) { + return $this->show_json(SYS_CODE_FAIL, '非法参数!'); + } + + $dataI['title'] = $save_data['setting']['module_title']; + $dataI['descrip'] = $save_data['setting']['module_desc']; + $dataI['style'] = $save_data['setting']['style']; + $dataI['img_json'] = $save_data['ads'] ? json_encode($save_data['ads'], JSON_UNESCAPED_UNICODE) : null; + $this->mdModuleAd->update($dataI, array('module_id' => $save_data['module_id'])); + + //更新其他参数 + $title_img = $save_data['setting']['module_title_img']; + $title_bgcolor = $save_data['setting']['module_title_bgcolor']; + $title_color = $save_data['setting']['module_title_color']; + $border_color = $save_data['setting']['module_border_color']; + $bg_img = $save_data['setting']['module_bg_img']; + $bg_color = $save_data['setting']['module_bg_color']; + $where = array('id' => $save_data['module_id']); + $row_topic = $this->mdTopicModules->get($where); + $json = json_decode($row_topic['jsondata'], true); + if ($title_img) { + $json['title_img'] = $title_img; + } else { + unset($json['title_img']); + } + if ($title_bgcolor) { + $json['title_bgcolor'] = $title_bgcolor; + } else { + unset($json['title_bgcolor']); + } + if ($title_color) { + $json['title_color'] = $title_color; + } else { + unset($json['title_color']); + } + if ($border_color) { + $json['border_color'] = $border_color; + } else { + unset($json['border_color']); + } + if ($bg_img) { + $json['bg_img'] = $bg_img; + } else { + unset($json['bg_img']); + } + if ($bg_color) { + $json['bg_color'] = $bg_color; + } else { + unset($json['bg_color']); + } + $upd = array('status' => $save_data['setting']['status'], "jsondata" => json_encode($json, JSON_UNESCAPED_UNICODE)); + $this->mdTopicModules->update($upd, $where); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功!'); + } + + /** + * Notes:获取报名信息 + * Created on: 2020/5/12 22:48 + * Created by: dengbw + */ + public function get_enroll_setting() + { + $module_id = intval($this->input->get('module_id')); + $re = $this->mdModuleEnroll->get(array('module_id' => $module_id)); + $setting = $list = array(); + if ($re) { + $reM = $this->mdTopicModules->get(array('id' => $module_id), 'status, jsondata'); + $json_topic = json_decode($reM['jsondata'], true); + $setting['status'] = $reM ? $reM['status'] : 0; + $setting['module_title'] = $re['title']; + $setting['module_desc'] = $re['descrip']; + $setting['module_banner'] = $re['banner']; + $setting['module_banner_url'] = $re['banner'] ? build_qiniu_image_url($re['banner']) : ''; + $setting['module_limit_num'] = $re['limit_num']; + $setting['module_type'] = $re['type']; + $setting['module_content'] = $re['content']; + $setting['module_title_img'] = strval($json_topic['title_img']); + $setting['module_title_img_url'] = $json_topic['title_img'] ? build_qiniu_image_url($json_topic['title_img']) : ""; + + //设置黑名单,风格 + $jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : array(); + $setting['user_black'] = intval($jsondata['user_black']); + $setting['style'] = intval($jsondata['style']); + $setting['show_type'] = intval($jsondata['show_type']); + $setting['if_code'] = intval($jsondata['if_code']); + $setting['if_module'] = intval($jsondata['if_module']); + $time = ''; + if ($re['type'] == 1) { + if ($re['as_time'] != '0000-00-00 00:00:00') { + $time = $re['as_time'] . " ~ " . $re['ae_time']; + } + $this->load->model('biz/biz_model', 'mdBiz'); + $ids = 0; + $resBiz = $this->mdModuleEnrollbiz->select(array('module_id' => $module_id), 'id desc', 0, 0, 'biz_id'); + $resBiz && $ids = implode(',', array_column($resBiz, 'biz_id')); + $where["id in ({$ids})"] = null; + $res = $this->mdBiz->select($where, ' field(id,' . $ids . ')', 0, 0, 'id,biz_name'); + if ($res) { + foreach ($res as $key => $value) { + $setValue = array(); + $setValue['id'] = $value['id']; + $setValue['name'] = $value['biz_name']; + $list[] = $setValue; + } + } + } + $etime = ''; + if ($re['es_time'] != '0000-00-00 00:00:00') { + $etime = $re['es_time'] . " ~ " . $re['ee_time']; + } + $setting['module_time'] = $time;//核销时间 + $setting['module_etime'] = $etime;//报名时间 + } + $this->data['setting'] = $setting; + $this->data['goods'] = $list; + return $this->show_json(SYS_CODE_SUCCESS, '获取成功!'); + } + + /** + * Notes:保存报名模块 + * Created on: 2020/5/12 12:35 + * Created by: dengbw + */ + public function edit_save_enroll() + { + $save_data = $this->input->post('save_data'); + $module_id = $save_data['module_id']; + if (!$module_id) { + return $this->show_json(SYS_CODE_FAIL, '非法参数!'); + } + $dataI['title'] = $save_data['setting']['module_title']; + $dataI['descrip'] = $save_data['setting']['module_desc']; + $dataI['banner'] = $save_data['setting']['module_banner']; + $dataI['content'] = $save_data['setting']['module_content']; + $dataI['limit_num'] = intval($save_data['setting']['module_limit_num']); + $dataI['type'] = $save_data['setting']['module_type']; + //报名时间 + $es_time = $ee_time = '0000-00-00 00:00:00'; + if ($save_data['setting']['module_etime']) { + $module_time = explode(' ~ ', $save_data['setting']['module_etime']); + $es_time = $module_time[0]; + $ee_time = $module_time[1]; + } + //核销时间 + $as_time = $ae_time = '0000-00-00 00:00:00'; + if ($save_data['setting']['module_time']) { + $module_time = explode(' ~ ', $save_data['setting']['module_time']); + $as_time = $module_time[0]; + $ae_time = $module_time[1]; + } + //核销商家 + if ($dataI['type'] == 1) { + $dataI['as_time'] = $as_time; + $dataI['ae_time'] = $ae_time; + $addBiz = array(); + if ($save_data['enrolls']) { + foreach ($save_data['enrolls'] as $key => $value) { + $setValue = array(); + $setValue['module_id'] = $module_id; + $setValue['biz_id'] = $value['id']; + $addBiz[] = $setValue; + } + } + $this->mdModuleEnrollbiz->delete(array("module_id" => $module_id)); + $addBiz && $this->mdModuleEnrollbiz->add_batch($addBiz); + } + $dataI['es_time'] = $es_time; + $dataI['ee_time'] = $ee_time; + + //jsondata + $row = $this->mdModuleEnroll->get(array('module_id' => $save_data['module_id'])); + $jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array(); + if (0 == $save_data['setting']['user_black']) {//不限制黑名单 + unset($jsondata['user_black']); + } else { + $jsondata['user_black'] = 1; + } + if (0 == $save_data['setting']['style']) { + unset($jsondata['style']); + } else { + $jsondata['style'] = 1; + } + $jsondata['show_type'] = $save_data['setting']['show_type']; + $jsondata['if_code'] = $save_data['setting']['if_code']; + $jsondata['if_module'] = $save_data['setting']['if_module']; + $dataI['jsondata'] = $jsondata ? json_encode($jsondata, JSON_UNESCAPED_UNICODE) : null; + + //更新其他参数 + $where = array('id' => $save_data['module_id']); + $row_topic = $this->mdTopicModules->get($where); + $json = json_decode($row_topic['jsondata'], true); + $title_img = $save_data['setting']['module_title_img']; + if ($title_img) { + $json['title_img'] = $title_img; + } else { + unset($json['title_img']); + } + + //$enroll_json['gender'] = array("name" => '性别', "field" => 'radio', "values" => array('男', '女')); + $enroll_json['remark'] = array("name" => '备注', "field" => 'textarea'); + $dataI['enroll_json'] = json_encode($enroll_json); + $this->mdModuleEnroll->update($dataI, array('module_id' => $save_data['module_id'])); + $this->mdTopicModules->update(array('status' => $save_data['setting']['status'], "jsondata" => json_encode($json, JSON_UNESCAPED_UNICODE) + ), array('id' => $save_data['module_id'])); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功!'); + } + + /** + * Notes:修改状态 0下架,1正常 + * Created on: 2019/12/3 15:48 + * Created by: dengbw + */ + public function edit_status() + { + $id = intval($this->input->post('id')); + $status = intval($this->input->post('status')); + $where['id'] = $id; + $data['status'] = $status; + $re = $this->mdTopics->update($data, $where); + if (!$re) { + return $this->show_json(SYS_CODE_FAIL, '修改失败'); + } + return $this->show_json(SYS_CODE_SUCCESS, '修改成功!'); + } + + public + function del() + { + // TODO: Implement del() method. + } + + + public + function batch() + { + } + + public + function export() + { + // TODO: Implement export() method. + } + +} \ No newline at end of file diff --git a/admin/views/topics/edit.php b/admin/views/topics/edit.php new file mode 100644 index 00000000..1626ffad --- /dev/null +++ b/admin/views/topics/edit.php @@ -0,0 +1,309 @@ + + + +
+
+ + + +
+ +
+
+
专题名称
+ +
+
+
+
+
背景色
+ +
+
+
+
+
+ + + +
+
+
+
+
+ +
+
+
+
+
+ 0) { ?> +
+
+ +
+
+ + + +
+
+
+
+
+ + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+ +
+ +
+
+ +
+
+
+ + 确定添加 +
+
+
+ +
+
+
+ +
+
+ + + + + + + + + + diff --git a/admin/views/topics/enroll/edit.php b/admin/views/topics/enroll/edit.php new file mode 100644 index 00000000..6f3ef68d --- /dev/null +++ b/admin/views/topics/enroll/edit.php @@ -0,0 +1,45 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
\ No newline at end of file diff --git a/admin/views/topics/enroll/lists.php b/admin/views/topics/enroll/lists.php new file mode 100644 index 00000000..e100d55d --- /dev/null +++ b/admin/views/topics/enroll/lists.php @@ -0,0 +1,176 @@ +
+ + \ No newline at end of file diff --git a/admin/views/topics/enroll/lists_module.php b/admin/views/topics/enroll/lists_module.php new file mode 100644 index 00000000..06a4f3c5 --- /dev/null +++ b/admin/views/topics/enroll/lists_module.php @@ -0,0 +1,97 @@ +
+ +
+ + + + + + + + + + + + + +
ID标题时间状态操作
+
+
+ +
+ +
+
+
+ \ No newline at end of file diff --git a/admin/views/topics/lists.php b/admin/views/topics/lists.php new file mode 100644 index 00000000..06b4213c --- /dev/null +++ b/admin/views/topics/lists.php @@ -0,0 +1,122 @@ +
+ + \ No newline at end of file diff --git a/admin/views/topics/lists_by_day.php b/admin/views/topics/lists_by_day.php new file mode 100644 index 00000000..ffd1a732 --- /dev/null +++ b/admin/views/topics/lists_by_day.php @@ -0,0 +1,110 @@ +
+ + +
+ + + + + + + + + + + +
日期访问次数访问用户数
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/admin/views/topics/lists_user.php b/admin/views/topics/lists_user.php new file mode 100644 index 00000000..82a41215 --- /dev/null +++ b/admin/views/topics/lists_user.php @@ -0,0 +1,127 @@ +
+ + \ No newline at end of file diff --git a/admin/views/topics/lists_userc.php b/admin/views/topics/lists_userc.php new file mode 100644 index 00000000..4f10897d --- /dev/null +++ b/admin/views/topics/lists_userc.php @@ -0,0 +1,114 @@ +
+ + +
+ + + + + + + + + + + + + + +
ID管理员姓名管理员手机号访问用户数领券用户数操作
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/admin/views/topics/module_ad.php b/admin/views/topics/module_ad.php new file mode 100644 index 00000000..761dde22 --- /dev/null +++ b/admin/views/topics/module_ad.php @@ -0,0 +1,409 @@ + + diff --git a/admin/views/topics/module_enroll.php b/admin/views/topics/module_enroll.php new file mode 100644 index 00000000..701bf063 --- /dev/null +++ b/admin/views/topics/module_enroll.php @@ -0,0 +1,658 @@ + + + + + + \ No newline at end of file diff --git a/admin/views/topics/module_text.php b/admin/views/topics/module_text.php new file mode 100644 index 00000000..db6b0f3e --- /dev/null +++ b/admin/views/topics/module_text.php @@ -0,0 +1,189 @@ + + \ No newline at end of file diff --git a/common/models/topics/Topic_module_ad_model.php b/common/models/topics/Topic_module_ad_model.php new file mode 100644 index 00000000..4ff4ca23 --- /dev/null +++ b/common/models/topics/Topic_module_ad_model.php @@ -0,0 +1,17 @@ +table_name, 'default'); + } +} \ No newline at end of file diff --git a/common/models/topics/Topic_module_enroll_model.php b/common/models/topics/Topic_module_enroll_model.php new file mode 100644 index 00000000..0bc486e2 --- /dev/null +++ b/common/models/topics/Topic_module_enroll_model.php @@ -0,0 +1,82 @@ +table_name, 'default'); + } + + /** + * 数量 + * @param array $where + * @param string $distinct + * @return mixed + */ + function count_status($where = array(), $distinct = ''){ + $this->db->from("hd_topic_module_enroll as m"); + $this->db->join("hd_topic_modules as j", "j.id=m.module_id and j.type='enroll'", 'left'); + + if($where) + { + $this->db->where($where); + } + + if($distinct) + { + $this->db->distinct(); + $this->db->select($distinct, false); + } + + return $this->db->count_all_results(); + } + + /** + * @param array $where + * @param string $order + * @param int $page + * @param int $page_size + * @param string $select + * @return mixed + */ + function select_status($where = array(), $order = '', $page = 0, $page_size = 20, $select = ''){ + $this->db->from("hd_topic_module_enroll as m"); + $this->db->join("hd_topic_modules as j", "j.id=m.module_id and j.type='enroll'", 'left'); + + if($select) + { + $this->db->select($select, false); + } + + if($where) + { + $this->db->where($where); + } + + if($order) + { + $this->db->order_by($order); + } + + if($page) + { + $offset = ($page - 1) * $page_size; + $limit = $page_size; + } + else + { + $offset = null; + $limit = null; + } + + return $this->db->get(null, $limit, $offset)->result_array(); + } +} \ No newline at end of file diff --git a/common/models/topics/Topic_module_enrolldata_model.php b/common/models/topics/Topic_module_enrolldata_model.php new file mode 100644 index 00000000..6a71f540 --- /dev/null +++ b/common/models/topics/Topic_module_enrolldata_model.php @@ -0,0 +1,17 @@ +table_name, 'default'); + } +} \ No newline at end of file diff --git a/common/models/topics/Topic_module_text_model.php b/common/models/topics/Topic_module_text_model.php new file mode 100644 index 00000000..d55a9770 --- /dev/null +++ b/common/models/topics/Topic_module_text_model.php @@ -0,0 +1,17 @@ +table_name, 'default'); + } +} \ No newline at end of file diff --git a/common/models/topics/Topic_modules_model.php b/common/models/topics/Topic_modules_model.php new file mode 100644 index 00000000..9f72f460 --- /dev/null +++ b/common/models/topics/Topic_modules_model.php @@ -0,0 +1,17 @@ +table_name, 'default'); + } +} \ No newline at end of file diff --git a/common/models/topics/Topic_user_log_model.php b/common/models/topics/Topic_user_log_model.php new file mode 100644 index 00000000..74ca4bf9 --- /dev/null +++ b/common/models/topics/Topic_user_log_model.php @@ -0,0 +1,60 @@ +table_name, 'default'); + } + + /** + * @param string $map_key + * @param string $map_value + * @param array $where + * @param string $select + * @param $groupby + * @return array + */ + public function map_groupby($map_key = 'id', $map_value = '', $where = array(), $select = '', $groupby){ + $map = array(); + if($select) + { + $this->db->select($select, false); + } + + if($where) + { + $this->db->where($where); + } + + $this->db->group_by($groupby); + + $list = $this->db->get($this->table_name)->result_array(); + + if($list) + { + foreach($list as $item) + { + if($map_value) + { + $map[$item[$map_key]] = $item[$map_value] ? $item[$map_value] : $item; + } + else + { + $map[$item[$map_key]][] = $item; + } + } + } + + return $map; + } + + +} \ No newline at end of file diff --git a/common/models/topics/Topics_model.php b/common/models/topics/Topics_model.php new file mode 100644 index 00000000..0fcca349 --- /dev/null +++ b/common/models/topics/Topics_model.php @@ -0,0 +1,17 @@ +table_name, 'default'); + } +} \ No newline at end of file