login_white = '';// $this->check_status = array();//用户状态校验 $this->check_mobile = array();//需要手机号 $this->check_headimg = array();//授权微信信息 $this->majia_white = array('get');//超级管理员披上马甲可操作权限 $this->load->model('app/material/Material_template_model', 'mdTemplate'); $this->load->model('app/material/Material_biz_model', 'mdMaterialBiz'); $this->load->model('app/material/Material_biz_statistics_model', 'mdBizStatistics'); $this->app_id == 1 && $this->app_id = 2;//获取狸车宝数据 } /** * Notes:专题首页 * Created on: 2021/10/12 11:47 * Created by: dengbw * @return array * @throws Exception */ protected function get() { $id = intval($this->input_param('id')); $biz_id = intval($this->input_param('biz_id')); $re = $this->mdTemplate->get(array('id' => $id, 'status' => 1)); if (!$re || empty($re)) { throw new Hd_exception('专题不存在', API_CODE_FAIL); } if ($biz_id) { $re_biz = $this->mdMaterialBiz->get(array('app_id' => $this->app_id, 't_id' => $id, 'biz_id' => $biz_id)); if (!$re_biz || empty($re_biz)) { throw new Hd_exception('门店还未创建专题', API_CODE_FAIL); } //加店铺专题浏览 $where_s = ['app_id' => $this->app_id, 'biz_id' => $biz_id, 't_id' => $id, 'day' => date('Y-m-d')]; $re_s = $this->mdBizStatistics->get($where_s); if ($re_s) { $this->mdBizStatistics->update(['browse_num = browse_num+1' => null], $where_s); } else { $where_s['browse_num'] = 1; $this->mdBizStatistics->add($where_s); } } $lists = array(); if ($re['json_data']) { $json_data = json_decode($re['json_data'], true); foreach ($json_data['lists'] as $key => $value) { $setValue = array(); $setValue['title'] = $value['title']; if ($re['type'] == 1) { $setValue['video_type'] = intval($value['video_type']); if ($value['video_type'] == 1) { $setValue['video'] = $value['video'] ? build_qiniu_image_url($value['video'], 0, 0, 'video') : ''; $setValue['video_cover'] = $value['video'] ? $value['video'] . '?vframe/jpg/offset/1' : ''; $setValue['width'] = $value['width'] ? $value['width'] : 16; $setValue['height'] = $value['height'] ? $value['height'] : 9; } else { $setValue['img'] = $value['img'] ? build_qiniu_image_url($value['img']) : ''; $setValue['link'] = $value['link']; } } else { $setValue['img'] = $value['img'] ? build_qiniu_image_url($value['img']) : ''; $setValue['link'] = $value['link']; } $lists[] = $setValue; } } $this->data['id'] = $id; $this->data['type'] = $re['type']; $this->data['sign_up'] = 1; $this->data['lists'] = $lists; return $this->data; } }