修改基础模型依赖

This commit is contained in:
邹景立 2021-09-13 15:25:42 +08:00
parent dfcb91ca6d
commit 26ccb807b8
3 changed files with 9 additions and 10 deletions

View File

@ -45,11 +45,9 @@ class Data extends Controller
*/
public function getNotify()
{
$query = $this->_query(BaseUserMessage::class)->where(['status' => 1, 'deleted' => 0]);
$result = $query->equal('id')->order('sort desc,id desc')->page(true, false, false, 20);
if (($id = input('id')) > 0) {
BaseUserMessage::mk()->where(['id' => $id])->inc('num_read')->update([]);
}
$model = BaseUserMessage::mQuery()->where(['status' => 1, 'deleted' => 0]);
$result = $model->equal('id')->order('sort desc,id desc')->page(true, false, false, 20);
if (($id = input('id')) > 0) BaseUserMessage::mk()->where(['id' => $id])->inc('num_read')->update([]);
$this->success('获取系统通知', $result);
}
}

View File

@ -45,7 +45,7 @@ class Goods extends Controller
$map = $this->_vali(['code.default' => '']);
if ($map['code']) ShopGoods::mk()->where($map)->inc('num_read')->update([]);
// 商品数据处理
$query = $this->_query(ShopGoods::class)->like('name,marks,cateids,payment')->equal('code,vip_entry');
$query = ShopGoods::mQuery()->like('name,marks,cateids,payment')->equal('code,vip_entry');
$result = $query->where(['deleted' => 0, 'status' => 1])->order('sort desc,id desc')->page(true, false, false, 10);
if (count($result['list']) > 0) GoodsService::instance()->bindData($result['list']);
$this->success('获取商品数据', $result);

View File

@ -3,6 +3,7 @@
namespace app\data\controller\api;
use app\data\model\DataNewsItem;
use app\data\model\DataNewsMark;
use app\data\model\DataNewsXCollect;
use app\data\service\NewsService;
use think\admin\Controller;
@ -22,7 +23,7 @@ class News extends Controller
*/
public function getMark()
{
$query = $this->_query('DataNewsMark')->like('name');
$query = DataNewsMark::mQuery()->like('name');
$query->where(['status' => 1, 'deleted' => 0])->withoutField('sort,status,deleted');
$this->success('获取文章标签', $query->order('sort desc,id desc')->page(false, false));
}
@ -36,14 +37,14 @@ class News extends Controller
public function getItem()
{
if ($code = input('code', '')) {
DataNewsItem::mk()->where(['code' => $code])->inc('num_read')->update();
DataNewsItem::mk()->where(['code' => $code])->inc('num_read')->update([]);
if (($uuid = input('uuid', 0)) > 0) {
$data = ['uuid' => $uuid, 'code' => $code, 'type' => 3, 'status' => 2];
DataNewsXCollect::mk()->where($data)->delete();
DataNewsXCollect::mk()->insert($data);
}
}
$query = $this->_query(DataNewsItem::class)->like('name,mark')->equal('id,code');
$query = DataNewsItem::mQuery()->like('name,mark')->equal('id,code');
$query->where(['deleted' => 0, 'status' => 1])->withoutField('sort,status,deleted');
$result = $query->order('sort desc,id desc')->page(true, false, false, 15);
NewsService::instance()->buildData($result['list'], input('uuid', 0));
@ -59,7 +60,7 @@ class News extends Controller
public function getComment()
{
$map = $this->_vali(['code.require' => '文章不能为空!']);
$query = $this->_query(DataNewsXCollect::class)->where(['type' => 4, 'status' => 2]);
$query = DataNewsXCollect::mQuery()->where(['type' => 4, 'status' => 2]);
$result = $query->where($map)->order('id desc')->page(true, false, false, 15);
NewsService::instance()->buildListByUidAndCode($result['list']);
$this->success('获取评论成功', $result);