admin_material_1018

This commit is contained in:
dengbw
2021-10-18 14:08:10 +08:00
committed by lccsw
parent 329c3d18e4
commit bc93710f5f
2 changed files with 60 additions and 5 deletions
+59 -4
View File
@@ -24,6 +24,7 @@ class Home extends Wxapp
$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('auto/auto_brand_model', 'mdAutoBrand');
$this->load->model("biz/biz_model", 'mdBiz');
$this->biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
$this->app_id == 1 && $this->app_id = 2;//获取狸车宝数据
@@ -38,22 +39,76 @@ class Home extends Wxapp
protected function get_tabs()
{
$list = array();
foreach ($this->mdTemplate->typeAry() as $key => $value) {
$list[] = array('id' => $key, 'name' => $value);
//根据品牌做分类
$brand_ids = 0;
if ($this->biz_id) {//查找门店授权品牌
$re_b = $this->mdBiz->get(array('id' => $this->biz_id, 'status' => 1));
if ($re_b['jsondata']) {
$jsondata = json_decode($re_b['jsondata'], true);
$jsondata['auto_brands'] && $brand_ids = implode($jsondata['auto_brands'], ',');
}
}
$brand_ids && $list = $this->mdAutoBrand->select(array("id in ({$brand_ids})" => null, 'status' => 1), "id desc", 0, 0, 'id,name');
// foreach ($this->mdTemplate->typeAry() as $key => $value) {
//// $list[] = array('id' => $key, 'name' => $value);
//// }
$this->data['title'] = '推广素材';
$this->data['list'] = $list;
return $list;
}
/**
* Notes:推广素材_list
* Notes:获取品牌素材_lists
* Created on: 2021/10/18 11:51
* Created by: dengbw
* @return array
* @throws Hd_exception
*/
protected function get_lists()
{
$page = $this->input_param('page');
$size = $this->input_param('size');
$brand_id = intval($this->input_param('type'));
if (!$brand_id) {
throw new Hd_exception('参数错误', API_CODE_FAIL);
}
!$page && $page = 1;
!$size && $size = 10;
$brand_id = $brand_id . ',';
$lists = array();
$where = array('app_id' => $this->app_id, 'type in(4,1)' => null, "brand_ids like '%{$brand_id}%'" => null, 'status' => 1);
$total = $this->mdTemplate->count($where);
$fileds = 'id,title,cover,json_data';
$res = $this->mdTemplate->select($where, "id desc", $page, $size, $fileds);
foreach ($res as $key2 => $value2) {
$setValue = array();
$moments = '';
$re_biz = $this->mdMaterialBiz->get(array('app_id' => $this->app_id, 't_id' => $value2['id'], 'biz_id' => $this->biz_id));
$setValue['id'] = intval($value2['id']);
$setValue['title'] = $value2['title'];
$setValue['cover'] = $value2['cover'] ? build_qiniu_image_url($value2['cover']) : '';
$setValue['if_add'] = $re_biz ? 1 : 0;
if ($value2['json_data']) {
$json_data = json_decode($value2['json_data'], true);
$json_data['moments'] && $moments = $json_data['moments'];
}
$setValue['moments'] = $moments;
$lists[] = $setValue;
}
$this->data['show'] = 'image';
$this->data['list'] = $lists;
$this->data['total'] = $total;
return $this->data;
}
/**
* Notes:获取分类素材_lists
* Created on: 2021/10/11 11:47
* Created by: dengbw
* @return array
* @throws Exception
*/
protected function get_lists()
protected function get_type_lists()
{
$page = $this->input_param('page');
$size = $this->input_param('size');
@@ -24,7 +24,7 @@ class Material_template_model extends HD_Model
public function typeAry()
{
return array(4 => '朋友圈蓄客海报', 1 => '朋友圈蓄客视频');
//return array(4 => '图片海报', 1 => '推广视频', 2 => '朋友圈海报', 3 => '朋友圈文案');
//return array(4 => '朋友圈蓄客海报', 1 => '朋友圈蓄客视频', 2 => '朋友圈蓄客轮播海报', 3 => '朋友圈蓄客文案');
}
/**