更新目录结构
This commit is contained in:
@@ -10,6 +10,7 @@ namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
use think\facade\Config;
|
||||
use think\facade\Env;
|
||||
use think\facade\Db;
|
||||
|
||||
class BaseModel extends Model{
|
||||
@@ -18,22 +19,32 @@ class BaseModel extends Model{
|
||||
$auth = request()->auth();
|
||||
$uid = request()->user['uid'];
|
||||
$map = [];
|
||||
if(!in_array($uid, Config::get('auth.admin_root'))){
|
||||
if($uid != Env::get('admin')){
|
||||
$subMap = [];
|
||||
if($auth['data_range'] == 2){
|
||||
$subMap[] = ['department_id', 'IN', getDepartmentChild($auth['department_id'])];
|
||||
}elseif($auth['data_range'] == 3){
|
||||
$subMap[] = ['department_id', 'IN', $auth['department_id']];
|
||||
}elseif($auth['data_range'] == 4){
|
||||
$map[] = ['uid', '=', $uid];
|
||||
$map[] = ['user_id', '=', $uid];
|
||||
}else{
|
||||
$m = [['user_id', '=', $uid], ['user_id', '=', 0]];
|
||||
$query->where(function($q) use($m){
|
||||
$q->whereOr($m);
|
||||
});
|
||||
}
|
||||
if(!empty($subMap)){
|
||||
$subsql = Db::name('users')->where($subMap)->field('uid')->buildSql();
|
||||
$subsql = str_replace(" AS thinkphp) AS T1 )", "", $subsql);
|
||||
$subsql = str_replace("SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (", "", $subsql);
|
||||
$map[] = ['uid', 'IN', Db::raw($subsql)];
|
||||
$map[] = ['user_id', 'IN', Db::raw($subsql)];
|
||||
}
|
||||
}
|
||||
$query->where($where)->where($map);
|
||||
if(!empty($map)){
|
||||
$query->where($map);
|
||||
}
|
||||
if(!empty($where)){
|
||||
$query->where($where);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model\customer;
|
||||
|
||||
use app\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Company extends BaseModel{
|
||||
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
|
||||
public $insertFieldAlis = [
|
||||
'企业编号' => ['name' => 'org_code', 'table' => 'company'],
|
||||
'公司名称' => ['name' => 'name', 'table' => 'company'],
|
||||
'网址' => ['name' => 'web_site', 'table' => 'company'],
|
||||
'一级行业' => ['name' => 'industry', 'table' => 'company'],
|
||||
'二级行业' => ['name' => 'industry_sub', 'table' => 'company'],
|
||||
'三级行业' => ['name' => 'industry_three', 'table' => 'company'],
|
||||
'省份' => ['name' => 'province', 'table' => 'company'],
|
||||
'城市' => ['name' => 'city', 'table' => 'company'],
|
||||
'区县' => ['name' => 'area', 'table' => 'company'],
|
||||
'年营业额' => ['name' => 'turnover_text', 'table' => 'company',],
|
||||
'员工人数' => ['name' => 'staff_num_text', 'table' => 'company'],
|
||||
'注册资金' => ['name' => 'reg_capital', 'table' => 'company'],
|
||||
'资金类型' => ['name' => 'reg_capital_type', 'table' => 'company'],
|
||||
'PC数量' => ['name' => 'pc_num_text', 'table' => 'company'],
|
||||
'营收规模' => ['name' => 'turnover', 'table' => 'company'],
|
||||
'社保人数' => ['name' => 'social_insurance', 'table' => 'company'],
|
||||
'企业性质' => ['name' => 'company_type', 'table' => 'company'],
|
||||
'是否上市' => ['name' => 'is_ipo_text', 'table' => 'company'],
|
||||
'融资信息' => ['name' => 'finance_info', 'table' => 'company'],
|
||||
'企业标签' => ['name' => 'tags', 'table' => 'company'],
|
||||
'企业状态' => ['name' => 'status', 'table' => 'company'],
|
||||
'成立时间' => ['name' => 'reg_date', 'table' => 'company'],
|
||||
'注册地址' => ['name' => 'reg_address', 'table' => 'company'],
|
||||
'联系人' => ['name' => 'name', 'table' => 'contact'],
|
||||
'岗位' => ['name' => 'job','table' => 'contact'],
|
||||
'固定电话' => ['name' => 'phone', 'table' => 'contact'],
|
||||
'手机号码' => ['name' => 'mobile', 'table' => 'contact'],
|
||||
'邮箱' => ['name' => 'email', 'table' => 'contact'],
|
||||
'是否法人' => ['name' => 'is_faren', 'table' => 'contact']
|
||||
];
|
||||
|
||||
public function getAreaTAttr($value, $data){
|
||||
$text = [$data['province'], $data['city'], $data['area']];
|
||||
return implode(",", array_filter($text));
|
||||
}
|
||||
|
||||
public function getIndustryTAttr($value, $data){
|
||||
$text = [$data['industry'], $data['industry_sub'], $data['industry_three']];
|
||||
return implode(",", array_filter($text));
|
||||
}
|
||||
|
||||
public function contact(){
|
||||
return $this->hasMany(Contact::class);
|
||||
}
|
||||
}
|
||||
37
app/model/operate/Ads.php
Normal file
37
app/model/operate/Ads.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model\operate;
|
||||
|
||||
use app\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Ads extends BaseModel{
|
||||
|
||||
protected function getStatusTextAttr($value, $data){
|
||||
$status = ['禁用', '启用'];
|
||||
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||
}
|
||||
|
||||
public function getPhotoAttr($value, $data){
|
||||
if($data['photo_list']){
|
||||
if($data['type'] == 1){
|
||||
return explode(",", $data['photo_list']);
|
||||
}else{
|
||||
return $data['photo_list'];
|
||||
}
|
||||
}else{
|
||||
if($data['type'] == 1){
|
||||
return [];
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
app/model/operate/Client.php
Normal file
25
app/model/operate/Client.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model\operate;
|
||||
|
||||
use app\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Client extends BaseModel{
|
||||
|
||||
protected function getStatusTextAttr($value, $data){
|
||||
$status = ['禁用', '启用'];
|
||||
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||
}
|
||||
|
||||
public function setting(){
|
||||
return $this->hasMany(ClientConfig::class, 'client_id', 'id');
|
||||
}
|
||||
}
|
||||
21
app/model/operate/ClientConfig.php
Normal file
21
app/model/operate/ClientConfig.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model\operate;
|
||||
|
||||
use app\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\facade\Cache;
|
||||
|
||||
class ClientConfig extends BaseModel{
|
||||
|
||||
protected function getStatusTextAttr($value, $data){
|
||||
$status = ['禁用', '启用'];
|
||||
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,16 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model\customer;
|
||||
namespace app\model\operate;
|
||||
|
||||
use app\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Contact extends BaseModel{
|
||||
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
protected $defaultSoftDelete = 0;
|
||||
protected $name = "company_contact";
|
||||
class ClientMenu extends BaseModel{
|
||||
|
||||
protected function getStatusTextAttr($value, $data){
|
||||
$status = ['禁用', '启用'];
|
||||
return isset($status[$data['status']]) ? $status[$data['status']] : '';
|
||||
}
|
||||
}
|
||||
@@ -16,5 +16,4 @@ class Dictionary extends BaseModel{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user