You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.1 KiB
63 lines
2.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
|
// +----------------------------------------------------------------------
|
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
namespace app\admin\model\wechat;
|
|
|
|
use traits\ModelTrait;
|
|
use basic\ModelBasic;
|
|
use app\admin\model\article\Article as ArticleModel;
|
|
|
|
/**
|
|
* 图文消息 model
|
|
* Class WechatNewsCategory
|
|
* @package app\admin\model\wechat
|
|
*/
|
|
class WechatNewsCategory extends ModelBasic
|
|
{
|
|
|
|
use ModelTrait;
|
|
|
|
/**
|
|
* 获取配置分类
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public static function getAll($where = array())
|
|
{
|
|
$model = new self;
|
|
if ($where['cate_name'] !== '') $model = $model->where('cate_name', 'LIKE', "%$where[cate_name]%");
|
|
$model = $model->where('status', 1);
|
|
return self::page($model, function ($item) {
|
|
$new = ArticleModel::where('id', 'in', $item['new_id'])->where('hide', 1)->select();
|
|
$item['new'] = $new;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 获取一条图文
|
|
* @param int $id
|
|
* @return array|false|\PDOStatement|string|\think\Model
|
|
*/
|
|
public static function getWechatNewsItem($id = 0)
|
|
{
|
|
if (!$id) return [];
|
|
$list = self::where('id', $id)->where('status', 1)->field('cate_name as title,new_id')->find();
|
|
if ($list) {
|
|
$list = $list->toArray();
|
|
$new = ArticleModel::where('id', 'in', $list['new_id'])->where('hide', 1)->select();
|
|
if ($new) $new = $new->toArray();
|
|
$list['new'] = $new;
|
|
}
|
|
return $list;
|
|
|
|
}
|
|
}
|
|
|