This commit is contained in:
Gitea
2022-01-24 10:43:35 +08:00
commit 15dfc6576b
786 changed files with 219240 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
<?php
/**
* @copyright (C)2016-2099 Hnaoyun Inc.
* @author XingMeng
* @email hnxsh@foxmail.com
* @date 2020年06月27日
* 文章评论模型类
*/
namespace app\admin\model\member;
use core\basic\Model;
class MemberCommentModel extends Model
{
// 获取列表
public function getList()
{
$field = array(
'a.*',
'b.title',
'c.username',
'c.nickname',
'c.headpic'
);
$join = array(
array(
'ay_content b',
'a.contentid=b.id',
'LEFT'
),
array(
'ay_member c',
'a.uid=c.id',
'LEFT'
)
);
return parent::table('ay_member_comment a')->field($field)
->join($join)
->order('a.id desc')
->page()
->select();
}
// 查找
public function findComment($field, $keyword)
{
$fields = array(
'a.*',
'b.title',
'c.username',
'c.nickname',
'c.headpic'
);
$join = array(
array(
'ay_content b',
'a.contentid=b.id',
'LEFT'
),
array(
'ay_member c',
'a.uid=c.id',
'LEFT'
)
);
return parent::table('ay_member_comment a')->field($fields)
->join($join)
->like($field, $keyword)
->order('a.id desc')
->page()
->select();
}
// 获取详情
public function getComment($id)
{
$field = array(
'a.*',
'b.title',
'c.username',
'c.nickname',
'c.headpic',
'd.username as pusername',
'd.nickname as pnickname'
);
$join = array(
array(
'ay_content b',
'a.contentid=b.id',
'LEFT'
),
array(
'ay_member c',
'a.uid=c.id',
'LEFT'
),
array(
'ay_member d',
'a.puid=d.id',
'LEFT'
)
);
return parent::table('ay_member_comment a')->field($field)
->join($join)
->where("a.id=$id")
->find();
}
// 删除
public function delComment($id)
{
return parent::table('ay_member_comment')->where("id=$id")->delete();
}
// 删除多个
public function delCommentList($ids)
{
return parent::table('ay_member_comment')->delete($ids);
}
// 修改
public function modComment($id, $data)
{
return parent::table('ay_member_comment')->where("id=$id")
->autoTime()
->update($data);
}
// 修改多个
public function modCommentList($ids, $data)
{
return parent::table('ay_member_comment')->in('id', $ids)->update($data);
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* @copyright (C)2016-2099 Hnaoyun Inc.
* @author XingMeng
* @email hnxsh@foxmail.com
* @date 2020年06月25日
* 会员字段模型类
*/
namespace app\admin\model\member;
use core\basic\Model;
class MemberFieldModel extends Model
{
// 获取会员字段列表
public function getList()
{
return parent::table('ay_member_field')->order('sorting asc,id asc')
->page()
->select();
}
// 查找会员字段
public function findField($field, $keyword)
{
return parent::table('ay_member_field')->like($field, $keyword)
->order('sorting asc,id asc')
->page()
->select();
}
// 检查会员字段
public function checkField($name)
{
return parent::table('ay_member_field')->where("name='$name'")->find();
}
// 获取会员字段详情
public function getField($id)
{
return parent::table('ay_member_field')->where("id=$id")->find();
}
// 获取会员字段名称
public function getFieldName($id)
{
return parent::table('ay_member_field')->where("id=$id")->value('name');
}
// 添加会员字段
public function addField(array $data)
{
return parent::table('ay_member_field')->autoTime()->insert($data);
}
// 删除会员字段
public function delField($id)
{
return parent::table('ay_member_field')->where("id=$id")->delete();
}
// 修改会员字段
public function modField($id, $data)
{
return parent::table('ay_member_field')->where("id=$id")->update($data);
}
// 判断字段是否存在
public function isExistField($field)
{
$fields = parent::tableFields('ay_member');
if (in_array($field, $fields)) {
return true;
} else {
return false;
}
}
}

View File

@@ -0,0 +1,98 @@
<?php
/**
* @copyright (C)2016-2099 Hnaoyun Inc.
* @author XingMeng
* @email hnxsh@foxmail.com
* @date 2020年06月25日
* 会员等级模型类
*/
namespace app\admin\model\member;
use core\basic\Model;
class MemberGroupModel extends Model
{
// 获取会员等级列表
public function getList()
{
return parent::table('ay_member_group')->order('gcode,id')
->page()
->select();
}
// 查找会员等级
public function findGroup($field, $keyword)
{
return parent::table('ay_member_group')->like($field, $keyword)
->order('gcode,id')
->page()
->select();
}
// 获取最后一个code
public function getLastGid()
{
return parent::table('ay_member_group')->order('id DESC')->value('gcode');
}
// 获取等级选择列表
public function getSelect()
{
return parent::table('ay_member_group')->field('id,gcode,gname')
->order('gcode,id')
->select();
}
// 获取会员等级详情
public function getGroup($id)
{
return parent::table('ay_member_group')->where("id=$id")->find();
}
// 获取会员等级名称
public function getGroupName($id)
{
return parent::table('ay_member_group')->where("id=$id")->value('gname');
}
// 添加会员等级
public function addGroup(array $data)
{
return parent::table('ay_member_group')->autoTime()->insert($data);
}
// 删除会员等级
public function delGroup($id)
{
return parent::table('ay_member_group')->where("id=$id")->delete();
}
// 修改会员等级
public function modGroup($id, $data)
{
return parent::table('ay_member_group')->where("id=$id")->update($data);
}
// 查找等级下会员是否存在
public function findGroupUser($id)
{
return parent::table('ay_member')->field('id')
->where("gid=$id")
->find();
}
// 查找等级编号
public function findGroupCode($gcode, $id = null)
{
if ($id) {
return parent::table('ay_member_group')->field('id')
->where("gcode='$gcode' and id<>$id")
->find();
} else {
return parent::table('ay_member_group')->field('id')
->where("gcode='$gcode'")
->find();
}
}
}

View File

@@ -0,0 +1,122 @@
<?php
/**
* @copyright (C)2016-2099 Hnaoyun Inc.
* @author XingMeng
* @email hnxsh@foxmail.com
* @date 2019年10月05日
* 会员模型类
*/
namespace app\admin\model\member;
use core\basic\Model;
class MemberModel extends Model
{
// 获取会员列表
public function getList()
{
$field = array(
'a.*',
'b.gname'
);
$join = array(
'ay_member_group b',
'a.gid=b.id',
'LEFT'
);
return parent::table('ay_member a')->field($field)
->join($join)
->order('a.id desc')
->page()
->select();
}
// 查找会员
public function findMember($field, $keyword)
{
$fields = array(
'a.*',
'b.gname'
);
$join = array(
'ay_member_group b',
'a.gid=b.id',
'LEFT'
);
return parent::table('ay_member a')->field($fields)
->join($join)
->like($field, $keyword)
->order('a.id desc')
->page()
->select();
}
// 检查会员
public function checkMember($where)
{
return parent::table('ay_member')->where($where)->find();
}
// 获取最后一个code
public function getLastCode()
{
return parent::table('ay_member')->order('id DESC')->value('ucode');
}
// 获取会员详情
public function getMember($id)
{
$field = array(
'a.*',
'b.gname'
);
$join = array(
'ay_member_group b',
'a.gid=b.id',
'LEFT'
);
return parent::table('ay_member a')->field($field)
->join($join)
->where("a.id=$id")
->find();
}
// 添加会员
public function addMember(array $data)
{
return parent::table('ay_member')->insert($data);
}
// 删除会员
public function delMember($id)
{
return parent::table('ay_member')->where("id=$id")->delete();
}
// 删除会员
public function delMemberList($ids)
{
return parent::table('ay_member')->delete($ids);
}
// 修改会员
public function modMember($id, $data)
{
return parent::table('ay_member')->where("id=$id")->update($data);
}
// 修改会员
public function modMemberList($ids, $data)
{
return parent::table('ay_member')->in('id', $ids)->update($data);
}
// 会员字段
public function getFields()
{
return parent::table('ay_member_field')->where('status=1')
->order('sorting')
->select();
}
}