First commit
This commit is contained in:
68
app/admin/model/Admin.php
Executable file
68
app/admin/model/Admin.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Admin extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_admin';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//权限关联
|
||||
public function role(){
|
||||
return $this->hasOne('Role' , 'role_id' ,'role_id');
|
||||
}
|
||||
//公司关联
|
||||
public function company() {
|
||||
return $this->hasOne('Company' ,'company_id' ,'company_id');
|
||||
}
|
||||
//创建admin
|
||||
public function createAdmin($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
|
||||
//修改admin
|
||||
public function updateAdmin($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
|
||||
//删除admin
|
||||
public function delAdmin($filter) {
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
|
||||
//获取admin详情
|
||||
public function getAdmin($filter) {
|
||||
$data = $this->with(['company' => function($query) {
|
||||
$query->where(['deleted' => 0 ,'status' => 1])->field('company_name ,is_top');
|
||||
}])
|
||||
->where($filter)
|
||||
->find();
|
||||
if(!empty($data)) $data = $data->toArray();
|
||||
// $data = Db::name($this->name)
|
||||
// ->alias('admin')
|
||||
// ->leftJoin('user' ,'admin.user_id = user.user_id')
|
||||
// ->where(['admin.account' => 'admin'])
|
||||
// ->find();
|
||||
return $data;
|
||||
}
|
||||
|
||||
//获取admin列表
|
||||
public function listAdmin($filter ,$page_config) {
|
||||
|
||||
}
|
||||
|
||||
//获取admin总数
|
||||
public function listAdminCount($filter) {
|
||||
|
||||
}
|
||||
|
||||
//获取所有admin
|
||||
public function listAdminAll($filter) {
|
||||
|
||||
}
|
||||
}
|
||||
32
app/admin/model/AdminRole.php
Executable file
32
app/admin/model/AdminRole.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class AdminRole extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_admin_role';
|
||||
protected $pk = 'ur_id';
|
||||
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init(){
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
//创建用户权限
|
||||
public function createUserRole($data){
|
||||
$data['ur_id'] = uuid();
|
||||
$data['create_time'] = $this->time();
|
||||
return $this->save($data);
|
||||
}
|
||||
//删除用户权限
|
||||
public function delUserRole($filter){
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
|
||||
}
|
||||
83
app/admin/model/AppConfig.php
Executable file
83
app/admin/model/AppConfig.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
|
||||
class AppConfig extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_config';
|
||||
|
||||
|
||||
protected static function init ()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
|
||||
public function initConfig ($uniacid)
|
||||
{
|
||||
return self::create( [ 'uniacid' => $uniacid, ] );
|
||||
}
|
||||
|
||||
public function getConfig ($uniacid)
|
||||
{
|
||||
$key = 'longbing_card_config_';
|
||||
|
||||
$cacheData = getCache($key, $uniacid);
|
||||
|
||||
// 暂时关闭缓存
|
||||
$cacheData = false;
|
||||
|
||||
if ($cacheData)
|
||||
{
|
||||
$cacheData['fromCache'] = 1;
|
||||
return $cacheData;
|
||||
}
|
||||
|
||||
$data = self::where( [ [ 'uniacid', '=', $uniacid ] ] )
|
||||
->find();
|
||||
|
||||
if ( !$data )
|
||||
{
|
||||
$data = $this->initConfig($uniacid);
|
||||
}
|
||||
|
||||
$data = $data->toArray();
|
||||
|
||||
|
||||
$data = transImagesOne( $data, [ 'vr_cover', 'default_video', 'default_voice', 'appoint_pic', 'click_copy_show_img',
|
||||
'shop_carousel_more', 'copyright', 'default_video_cover' ], $uniacid
|
||||
);
|
||||
setCache( $key, $data, 36000, $uniacid );
|
||||
|
||||
return $data;
|
||||
}
|
||||
//获取
|
||||
public function getConfigByUniacid($uniacid)
|
||||
{
|
||||
$result = $this->where(['uniacid' => $uniacid])->find();
|
||||
if(!empty($result)){
|
||||
$result = $result->toArray();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//创建
|
||||
public function createConfig($data)
|
||||
{
|
||||
$data['create_time'] = time();
|
||||
$result = $this->save($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//更新
|
||||
public function updateConfig($filter ,$data)
|
||||
{
|
||||
$data['update_time'] = time();
|
||||
$result = $this->where($filter)->update($data);
|
||||
return !empty($result);
|
||||
}
|
||||
}
|
||||
52
app/admin/model/AppTabbar.php
Executable file
52
app/admin/model/AppTabbar.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
//底部菜单
|
||||
class AppTabbar extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_tabbar';
|
||||
|
||||
//创建
|
||||
public function createTabbar($data)
|
||||
{
|
||||
$data['create_time'] = time();
|
||||
$result = $this->save($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//获取
|
||||
public function getTabbar($filter)
|
||||
{
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//修改
|
||||
public function updateTabbar($filter ,$data)
|
||||
{
|
||||
$data['update_time'] = time();
|
||||
$result = $this->where($filter)->update($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delTabbar($filter)
|
||||
{
|
||||
$result = $this->destoryTabbar($filter);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//删除(真删除)
|
||||
public function destoryTabbar($filter)
|
||||
{
|
||||
$result = $this->where($filter)->delete() ;
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
}
|
||||
69
app/admin/model/AttachmentGroup.php
Executable file
69
app/admin/model/AttachmentGroup.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class AttachmentGroup extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_attachment_group';
|
||||
//查询器
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
$query->where('name','like', '%' . $value . '%');
|
||||
}
|
||||
|
||||
|
||||
//创建
|
||||
function createGroup($data)
|
||||
{
|
||||
$result = $this->save($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//更新
|
||||
function updateGroup($filter ,$data)
|
||||
{
|
||||
$result = $this->where($filter)->update($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//获取列表
|
||||
// function listGroup($filter)
|
||||
// {
|
||||
// $result = $this->where($filter)->select();
|
||||
// if(!empty($result)) $result = $result->toArray();
|
||||
// return $result;
|
||||
// }
|
||||
|
||||
//获取列表
|
||||
function listGroup($filter)
|
||||
{
|
||||
$result = $this->withSearch(['name'] ,$filter)->where('uniacid','=',$filter['uniacid'])
|
||||
->order('id')
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取单个数据
|
||||
function getGroup($filter)
|
||||
{
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//删除
|
||||
function delGroup($filter)
|
||||
{
|
||||
return $this->destoryGroup($filter);
|
||||
}
|
||||
|
||||
//删除(真删除)
|
||||
function destoryGroup($filter)
|
||||
{
|
||||
$result = $this->where($filter)->delete();
|
||||
return !empty($result);
|
||||
}
|
||||
}
|
||||
20
app/admin/model/CardUser.php
Executable file
20
app/admin/model/CardUser.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CardUser extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_user';
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
public function username($idlist){
|
||||
return $this->whereIn('id',$idlist)->field('id,avatarUrl')->select();
|
||||
}
|
||||
}
|
||||
69
app/admin/model/Company.php
Executable file
69
app/admin/model/Company.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Company extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_company';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//创建公司信息
|
||||
function createCompany($data) {
|
||||
$data['create_time'] = $this->time;
|
||||
return $this->createRow($data);
|
||||
}
|
||||
|
||||
//修改公司信息
|
||||
function updateCompany($filter ,$data) {
|
||||
$filter['deleted'] = 0;
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
|
||||
//删除公司信息
|
||||
function delCompany($filter){
|
||||
$filter['deleted'] = 0;
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
|
||||
//获取公司详情
|
||||
function getCompany($filter) {
|
||||
$filter['company.deleted'] = 0;
|
||||
$company = $this
|
||||
->alias('company')
|
||||
->leftJoin('user user' ,'company.creator_id = user.user_id')
|
||||
->where($filter)
|
||||
->field(['company.*' ,'user.user_name as creator_name'])
|
||||
->find();
|
||||
return $company;
|
||||
}
|
||||
|
||||
//获取公司列表
|
||||
function listCompany($filter ,$page_config) {
|
||||
$filter['user.deleted'] = 0;
|
||||
$companys = $this
|
||||
->alias('company')
|
||||
->leftJoin('user user' ,'company.creator_id = user.user_id')
|
||||
->where($filter)
|
||||
->field(['company.*' ,'user.user_name as creator_name'])
|
||||
->page($page_config['page'] ,$page_config['page_count'])
|
||||
->select();
|
||||
return $companys;
|
||||
}
|
||||
|
||||
//获取公司总数
|
||||
function listCompanyCount($filter) {
|
||||
$filter['user.deleted'] = 0;
|
||||
$count = $this
|
||||
->alias('company')
|
||||
->leftJoin('user user' ,'company.creator_id = user.user_id')
|
||||
->field(['company.company_id'])
|
||||
->where($filter)
|
||||
->count();
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
89
app/admin/model/CoreAttachment.php
Executable file
89
app/admin/model/CoreAttachment.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class CoreAttachment extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_attachment';
|
||||
|
||||
//查询器
|
||||
public function searchIdsAttr($query, $ids, $data)
|
||||
{
|
||||
$query->where('id','in' ,$ids);
|
||||
}
|
||||
//创建
|
||||
public function createAttach($data)
|
||||
{
|
||||
$data['module_upload_dir'] = 0;
|
||||
$data['displayorder'] = 0;
|
||||
$data['group_id'] = !empty($data['group_id'])?$data['group_id']:0;
|
||||
$result = $this->save($data);
|
||||
$result = !empty($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
//更新
|
||||
public function updateAttach($filter ,$data)
|
||||
{
|
||||
$result = $this->where($filter)->update($data);
|
||||
$result = !empty($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取列表
|
||||
public function listAttach($filter ,$page_config)
|
||||
{
|
||||
$start_row = ($page_config['page'] - 1) * $page_config['page_count'];
|
||||
$end_row = $page_config['page_count'];
|
||||
$result = $this->where($filter)
|
||||
->order('createtime' ,'desc')
|
||||
->limit($start_row ,$end_row)
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取数据总数
|
||||
public function listAttachCount($filter)
|
||||
{
|
||||
$result = $this->where($filter)
|
||||
->count();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
//创建
|
||||
public function addAttach($data)
|
||||
{
|
||||
$data['module_upload_dir'] = 0;
|
||||
|
||||
$result = $this->insert($data);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取
|
||||
public function getAttach($filter)
|
||||
{
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delAttach($filter)
|
||||
{
|
||||
return $this->destoryAttach($filter);
|
||||
}
|
||||
|
||||
//删除(真删除)
|
||||
public function destoryAttach($filter)
|
||||
{
|
||||
//return $this->where($filter)->delete();
|
||||
$result = $this->withSearch(['ids'] ,$filter)->delete();
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
}
|
||||
107
app/admin/model/Coupon.php
Executable file
107
app/admin/model/Coupon.php
Executable file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Coupon extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_coupon';
|
||||
|
||||
|
||||
// protected static function init()
|
||||
// {
|
||||
// //TODO:初始化内容
|
||||
// }
|
||||
/**
|
||||
* @var array
|
||||
* 查询器
|
||||
*/
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'type_text'
|
||||
];
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 状态
|
||||
*/
|
||||
public function getStatusTextAttr($value,$data){
|
||||
$status = [-1=>'已删除',0=>'未发布',1=>'已发布'];
|
||||
return $status[$data['status']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 类型
|
||||
*/
|
||||
public function getTypeTextAttr($value,$data){
|
||||
$type = [1=>'线上',2=>'线下'];
|
||||
return $type[$data['type']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return false|string
|
||||
* 到期时间
|
||||
*/
|
||||
public function getEndTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$data['end_time']);
|
||||
}
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return false|string
|
||||
* 创建时间
|
||||
*/
|
||||
public function getCreateTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$data['create_time']);
|
||||
}
|
||||
|
||||
/*获取福包列表
|
||||
*/
|
||||
public function couponList($dis,$page=10){
|
||||
|
||||
$data = self::where($dis)->order('top desc')->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改福包
|
||||
*/
|
||||
|
||||
public function couponUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = Db::name($this->name)->where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加福包
|
||||
*/
|
||||
|
||||
public function couponAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = Db::name($this->name)->insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取福包详情
|
||||
*/
|
||||
|
||||
public function couponInfo($dis){
|
||||
$data = Db::name($this->name)->where($dis)->find();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
56
app/admin/model/Department.php
Executable file
56
app/admin/model/Department.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Department extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'department';
|
||||
protected $pk = 'department_id';
|
||||
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
//新建部门
|
||||
public function createDepartment($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
//更新部门信息
|
||||
public function updateDepartment($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
//删除部门信息
|
||||
public function delDepartment($filter) {
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
//获取部门信息
|
||||
public function getDepartment($filter) {
|
||||
return $this->getRow($filter);
|
||||
}
|
||||
//获取部门列表信息
|
||||
public function listDepartment($filter ,$page_config = ['page' => 1 ,'page_count' => 20]) {
|
||||
$filter['deleted'] = 0;
|
||||
$result = Db::name($this->name)
|
||||
->where($filter)
|
||||
->page($page_congig['page'] ,$page_config['page_count'])
|
||||
->select();
|
||||
}
|
||||
//获取部门列表总数
|
||||
public function listDepartmentCount($filter) {
|
||||
$filter['deleted'] = 0;
|
||||
$result = Db::name($this->name)
|
||||
->where($filter)
|
||||
->count();
|
||||
}
|
||||
//获取所有部门列表信息
|
||||
public function listDepartmentAll($filter) {
|
||||
return $this->listRow($filter);
|
||||
}
|
||||
}
|
||||
68
app/admin/model/Goods.php
Executable file
68
app/admin/model/Goods.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Goods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_goods';
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
public function goodList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品
|
||||
*/
|
||||
|
||||
public function goodsUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加商品
|
||||
*/
|
||||
|
||||
public function goodsAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = self::insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
*/
|
||||
|
||||
public function goodsInfo($dis){
|
||||
$data = self::where($dis)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有分类
|
||||
*/
|
||||
public function goodsSelect($dis){
|
||||
$data = self::where($dis)->select();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
23
app/admin/model/Menu.php
Executable file
23
app/admin/model/Menu.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Menu extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_menu';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//获取菜单列表
|
||||
function listMenu($filter) {
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
54
app/admin/model/Module.php
Executable file
54
app/admin/model/Module.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Module extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_module';
|
||||
//pk
|
||||
protected $pk = 'module_id';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//权限关联
|
||||
public function menu()
|
||||
{
|
||||
return $this->hasMany('menu' , 'module_id' ,'module_id');
|
||||
}
|
||||
//模块与app之间的关系
|
||||
public function moduleApp()
|
||||
{
|
||||
return $this->hasOne('moduleApp' ,'module_id' ,'module_id');
|
||||
}
|
||||
//获取模块列表
|
||||
public function listModuleAll($filter ,$uniacid = '7777')
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->with(['moduleApp' => function($query) use ($uniacid) {
|
||||
$query->where(['deleted' => 0 ,'uniacid' => $uniacid]);
|
||||
}])
|
||||
->where($filter)
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
public function getModule($filter ,$uniacid = '7777')
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->with(['moduleApp' => function($query) use ($uniacid) {
|
||||
$query->where(['deleted' => 0 ,'uniacid' => $uniacid]);
|
||||
}])
|
||||
->where($filter)
|
||||
->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
//获取模块列表(分页)
|
||||
public function listModule() {
|
||||
|
||||
}
|
||||
}
|
||||
67
app/admin/model/OssConfig.php
Executable file
67
app/admin/model/OssConfig.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class OssConfig extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_oos_config';
|
||||
|
||||
//创建
|
||||
public function createConfig($data)
|
||||
{
|
||||
$data['create_time'] = time();
|
||||
$data['open_oss'] = 0;
|
||||
$result = $this->save($data);
|
||||
if(empty($result)) return false;
|
||||
return true;
|
||||
}
|
||||
//修改
|
||||
public function updateConfig($filter ,$data)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$data['update_time'] = time();
|
||||
$result = $this->where($filter)->update($data);
|
||||
if(empty($result)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//获取列表
|
||||
public function listConfig($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)->select();
|
||||
if(!empty($result)) $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
//获取总数
|
||||
public function listConfigCount($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)->count();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取单条数据
|
||||
public function getConfig($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delConfig($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
return $this->updateConfig($filter ,['deleted' => 0 ,'delete_time' => time()]);
|
||||
}
|
||||
//删除(真删除)
|
||||
public function destoryConfig($filter)
|
||||
{
|
||||
return $this->where($filter)->delete();
|
||||
}
|
||||
|
||||
}
|
||||
58
app/admin/model/Role.php
Executable file
58
app/admin/model/Role.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
|
||||
class Role extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'role';
|
||||
protected $pk = 'role_id';
|
||||
protected $schema = [
|
||||
'role_id' => 'string',
|
||||
'role_name' => 'string',
|
||||
'is_system' => 'int',
|
||||
'description' => 'string',
|
||||
'create_time' => 'int',
|
||||
'uniacid' => 'int',
|
||||
'update_time' => 'int',
|
||||
'deleted' => 'int'
|
||||
];
|
||||
protected $resultSetType = 'array';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
//用户关联绑定
|
||||
public function user() {
|
||||
return $this->belongsTo('AdminUser' ,'role_id' ,'role_id');
|
||||
}
|
||||
|
||||
|
||||
//获取权限信息
|
||||
public function getRole($filter) {
|
||||
return $this->getRow($filter);
|
||||
}
|
||||
//获取权限列表
|
||||
public function listRoleAll($filter) {
|
||||
// return $this->select($filter);
|
||||
return $this->listRow($filter ,['role_id' ,'role_name' ,'is_system' ,'description' ,'deleted']);
|
||||
}
|
||||
//创建权限
|
||||
public function createRole($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
//更新权限
|
||||
public function updateRole($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
//删除权限
|
||||
public function deleteRole($filter) {
|
||||
return $this->deleteRow($filter);
|
||||
}
|
||||
}
|
||||
51
app/admin/model/SellingProfit.php
Executable file
51
app/admin/model/SellingProfit.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
|
||||
class SellingProfit extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_selling_profit';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取分销列表
|
||||
*/
|
||||
public function profitList($dis,$page = 10) {
|
||||
$data = Db::name($this->name)
|
||||
->alias('a')
|
||||
->leftJoin('longbing_card_user b' ,'a.user_id = b.id')
|
||||
->leftJoin('longbing_card_user_info c' ,'a.user_id = c.fans_id')
|
||||
->where($dis)
|
||||
->field(['a.*' ,'b.nickName','c.name'])
|
||||
->order('a.total_profit desc','a.id decs')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改商城配置
|
||||
*/
|
||||
public function configUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
68
app/admin/model/ShopBanner.php
Executable file
68
app/admin/model/ShopBanner.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class ShopBanner extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_carousel';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取商城轮播图列表
|
||||
*/
|
||||
public function bannerList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改商城轮播图
|
||||
*/
|
||||
public function bannerUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* 添加商城轮播图
|
||||
*/
|
||||
public function bannerAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = self::insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dis
|
||||
* 删除商城轮播图
|
||||
*/
|
||||
|
||||
public function bannerDel($dis){
|
||||
$res = self::where($dis)->delete();
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dis
|
||||
* 轮播图详情
|
||||
*/
|
||||
public function bannerInfo($dis){
|
||||
$data = self::where($dis)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
73
app/admin/model/ShopOrder.php
Executable file
73
app/admin/model/ShopOrder.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
|
||||
|
||||
|
||||
class ShopOrder extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_order';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
protected $append = [
|
||||
'goods_text',
|
||||
];
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 查询器 获取子订单
|
||||
*/
|
||||
public function getGoodsTextAttr($value,$data)
|
||||
{
|
||||
$orer_goods = new ShopOrderGoods();
|
||||
$dis['order_id'] = $data['id'];
|
||||
return $orer_goods->orderGoodsInfo($dis);
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取订单列表
|
||||
*/
|
||||
public function orderList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改订单
|
||||
*/
|
||||
|
||||
public function orderUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dis
|
||||
* @return mixed
|
||||
* 获取订单详情
|
||||
*/
|
||||
|
||||
public function orderInfo($dis,$field='*'){
|
||||
$data = self::where($dis)->field($field)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
|
||||
//查询公司的金额
|
||||
public function getCompanyPrice($company_id,$start,$end){
|
||||
return $this->whereIn('company_id',$company_id)->whereBetween('create_time',[$start,$end])->where('pay_status',1)->where('order_status',3)->sum('total_price');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
33
app/admin/model/ShopOrderGoods.php
Executable file
33
app/admin/model/ShopOrderGoods.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class ShopOrderGoods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_order_item';
|
||||
|
||||
//初始化
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取自订单详情
|
||||
*/
|
||||
public function orderGoodsInfo($dis){
|
||||
return self::where($dis)->select()->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
94
app/admin/model/ShopOrderRefund.php
Executable file
94
app/admin/model/ShopOrderRefund.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\admin\model\ShopOrder;
|
||||
|
||||
|
||||
|
||||
class ShopOrderRefund extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'card_shop_order_refund';
|
||||
protected $orer_goods_model;
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
protected $append = [
|
||||
'goods_text',
|
||||
'order_text'
|
||||
];
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 获取器 获取子订单
|
||||
*/
|
||||
public function getGoodsTextAttr($value,$data){
|
||||
$orer_goods_model = new ShopOrderGoods();
|
||||
$dis = !empty($data['order_goods_id'])?['id'=>$data['order_goods_id']]:['order_id'=>$data['order_id']];
|
||||
return $orer_goods_model->orderGoodsInfo($dis);
|
||||
}
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 获取器 获取订单
|
||||
*/
|
||||
public function getOrderTextAttr($value,$data){
|
||||
$orer_model = new ShopOrder();
|
||||
$dis['id'] = $data['order_id'];
|
||||
// $field = ''
|
||||
return $orer_model->orderInfo($dis);
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取订单列表
|
||||
*/
|
||||
public function refundList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
$data['data'] = $this->changeInfo($data['data']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
*/
|
||||
|
||||
public function refundUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = Db::name($this->name)->where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
|
||||
public function refundInfo($dis){
|
||||
$data = self::where($dis)->find()->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* 转换数据
|
||||
*/
|
||||
public function changeInfo($data){
|
||||
if(!empty($data)){
|
||||
foreach ($data as &$v){
|
||||
$v['price'] = empty($v['price'])?$v['order_text']['price']:$v['price'];
|
||||
$v['goods_text'][0]['number'] = !empty($v['number'])?$v['number']:$v['goods_text'][0]['number'];
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
43
app/admin/model/ShopSetting.php
Executable file
43
app/admin/model/ShopSetting.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
|
||||
class ShopSetting extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_config';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取商城配置
|
||||
*/
|
||||
public function configInfo($dis){
|
||||
$data = self::where($dis)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改商城配置
|
||||
*/
|
||||
public function configUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
101
app/admin/model/ShopType.php
Executable file
101
app/admin/model/ShopType.php
Executable file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class ShopType extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_type';
|
||||
// protected $pk = 'role_id';
|
||||
protected $schema = [
|
||||
|
||||
];
|
||||
protected $resultSetType = 'array';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
public function cateList($dis,$page=10){
|
||||
$data = Db::name($this->name)->where($dis)->paginate($page)->toArray();
|
||||
return $this->getTree($data['data'],0);
|
||||
}
|
||||
/**
|
||||
* @param $data
|
||||
* @param $pId
|
||||
* @return array
|
||||
* 递归无限极
|
||||
*/
|
||||
public function getTree($data, $pId){
|
||||
$tree = array();
|
||||
if(!empty($data)){
|
||||
foreach($data as $k => $v) {
|
||||
if($v['pid'] == $pId) {
|
||||
$v[''] = $this->getTree($data, $v['id']);
|
||||
$tree[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类
|
||||
*/
|
||||
public function cateUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = Db::name($this->name)->where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加分类
|
||||
*/
|
||||
|
||||
public function cateAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = Db::name($this->name)->insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类详情
|
||||
*/
|
||||
|
||||
public function cateInfo($dis){
|
||||
$data = Db::name($this->name)->where($dis)->find();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询分类
|
||||
*/
|
||||
public function catSelect($dis=array()){
|
||||
$data = Db::name($this->name)->where($dis)->select();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序好的分类
|
||||
*/
|
||||
|
||||
public function catSortSelect($dis=array()){
|
||||
$data = Db::name($this->name)->where($dis)->select();
|
||||
return $this->getTree($data,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
101
app/admin/model/User.php
Executable file
101
app/admin/model/User.php
Executable file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class User extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'user';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//权限关联
|
||||
public function role()
|
||||
{
|
||||
return $this->hasOne('Role' , 'role_id' ,'role_id');
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
public function getUser($filter) {
|
||||
$user = Db::name($this->name)
|
||||
->where(['deleted' => 0])
|
||||
->where($filter)
|
||||
->find();
|
||||
if(isset($user['user_id'])){
|
||||
$user['role'] = Db::name('user_role')
|
||||
->alias('ur')
|
||||
->leftJoin('role role' ,'ur.role_id = role.role_id')
|
||||
->where(['role.deleted' => 0 ,'ur.deleted' => 0])
|
||||
->where(['ur.user_id' => $user['user_id']])
|
||||
->field(['role.role_name' ,'role.role_id'])
|
||||
->select();
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
//获取所有用户
|
||||
public function listUserAll($filter) {
|
||||
$users = Db::name($this->name)
|
||||
->alias('user')
|
||||
->leftJoin('department dp' ,'user.department_id = dp.department_id')
|
||||
->where(['user.deleted' => 0 ,'dp.deleted' => 0])
|
||||
->where($filter)
|
||||
->field(['user.*' ,'dp.department_name'])
|
||||
->select();
|
||||
// ->leftJoin('role role' ,'user.role_id = role.role_id')
|
||||
// ->where(['user.deleted' => 0 ,'role.deleted' => 0])
|
||||
// ->where($filter)
|
||||
// ->field(['user.*' ,'role.role_name'])
|
||||
// ->select();
|
||||
return $users;
|
||||
}
|
||||
//获取用户列表
|
||||
public function listUser($filter ,$page_config = ['page' => 1 ,'page_count' => 10]) {
|
||||
// $start_row = ($page_config['page'] - 1) * $page_config['page_count'];
|
||||
// $end_row = $page_config['page'] * $page_config['page_count'];
|
||||
$users = Db::name($this->name)
|
||||
->alias('user')
|
||||
// ->leftJoin('role role' ,'user.role_id = role.role_id')
|
||||
// ->where(['user.deleted' => 0 ,'role.deleted' => 0])
|
||||
// ->where($filter)
|
||||
// ->field(['user.*' ,'role.role_name'])
|
||||
->leftJoin('department dp' ,'user.department_id = dp.department_id')
|
||||
->where(['user.deleted' => 0 ,'dp.deleted' => 0])
|
||||
->where($filter)
|
||||
->field(['user.id' ,'dp.department_name'])
|
||||
->page($page_config['page'] ,$page_config['page_count'])
|
||||
->select();
|
||||
return $users;
|
||||
}
|
||||
//获取用户总数
|
||||
public function listUserCount($filter) {
|
||||
return $users = Db::name($this->name)
|
||||
->alias('user')
|
||||
// ->leftJoin('role role' ,'user.role_id = role.role_id')
|
||||
// ->where(['user.deleted' => 0 ,'role.deleted' => 0])
|
||||
// ->where($filter)
|
||||
// ->field(['user.*' ,'role.role_name'])
|
||||
->leftJoin('department dp' ,'user.department_id = dp.department_id')
|
||||
->where(['user.deleted' => 0 ,'dp.deleted' => 0])
|
||||
->where($filter)
|
||||
->field(['user.id'])
|
||||
->count();
|
||||
}
|
||||
|
||||
//创建用户
|
||||
public function createUser($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
|
||||
//修改用户
|
||||
public function updateUser($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
|
||||
//删除用户
|
||||
public function delUser($filter) {
|
||||
return $this->deleteRow($filter);
|
||||
}
|
||||
}
|
||||
66
app/admin/model/WxUpload.php
Executable file
66
app/admin/model/WxUpload.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
|
||||
class WxUpload extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_wx_upload';
|
||||
|
||||
protected $resultSetType = 'collection';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-03-18 12:23
|
||||
* @功能说明:查找配置
|
||||
*/
|
||||
public function settingInfo($dis,$field='*'){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->insert($dis);
|
||||
}
|
||||
|
||||
return $this->where($dis)->field($field)->find()->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-06-08 18:49
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function settingAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-03-18 12:24
|
||||
* @功能说明:配置编辑
|
||||
*/
|
||||
public function settingUpdate($dis,$data){
|
||||
|
||||
$data['app_id'] = !empty($data['app_id'])?implode(',',$data['app_id']):'';
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
19
app/admin/model/moduleApp.php
Executable file
19
app/admin/model/moduleApp.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class ModuleApp extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_module_app';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//关联信息
|
||||
public function Module(){
|
||||
return $this->belongsTo('Module' ,'module_id' ,'module_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user