作者 lyh

gx

... ... @@ -6,9 +6,8 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Http\Requests\Aside\Domain\DomainInfoRequest;
use App\Models\Aside\Domain\DomainInfo;
use App\Models\Domain\DomainInfo;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Storage;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
... ...
... ... @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Aside\Domain;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Aside\Domain\DomainInfoLog;
use App\Models\Domain\DomainInfoLog;
use Illuminate\Http\Request;
class DomainInfoLogController extends BaseController
... ...
... ... @@ -3,21 +3,12 @@
namespace App\Http\Logic\Aside\Domain;
use App\Enums\Common\Code;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Http\Logic\Aside\BaseLogic;
use App\Http\Logic\Aside\Devops\ServerInformationLogic;
use App\Models\Aside\Domain\DomainInfo;
use App\Models\Aside\Domain\DomainInfoLog;
use App\Models\Domain\DomainInfo;
use App\Models\Project\Project;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class DomainInfoLogic extends BaseLogic
{
... ...
<?php
namespace App\Models\Aside;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ManageHrLogModel extends Model
{
protected $table = 'gl_manage_hr_log';
use HasFactory;
}
<?php
namespace App\Models\Aside;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Base;
class ManageHrModel extends Base
{
protected $table = 'gl_manage_hrs';
//use HasFactory;
protected $guarded = ['updated_at'];
/**
* 归属小组
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function belongGroup()
{
return [
1 => 'KA组',
2 => 'A组',
3 => 'B组',
4 => 'C组',
5 => 'D组',
6 => 'E组',
7 => 'F组',
8 => 'G组',
9 => 'H组',
10 => 'GA组',
11=> 'GB组',
12 => 'GC组',
13 => '前端组',
14 => '后端组',
15 => '黑格组',
16 => '售后组',
0 => '其他',
];
}
/**
* 学历
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function education()
{
return [
1 => '专科',
2 => '本科',
3 => '研究生及以上',
0 => '其他',
];
}
/**
* 入职岗位
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function entryPosition()
{
return [
1 => '优化师',
2 => '优化师助理',
3 => '优化顾问',
4 => '项目经理',
5 => '平面设计',
6 => '技术经理',
7 => '技术主管',
8 => '技术总监',
9 => '渠道经理',
10 => '前端研发',
11=> '后端研发',
12 => '行政财务',
13 => '品牌营销',
14 => '销售经理',
15 => '销售主管',
16 => '售后技术',
17 => '售后服务',
18 => '外贸销售',
19 => '渠道助理',
20 => '黑格运营',
21 => '运营',
22 => '短视频剪辑师',
23 => '人事',
24 => '采购',
0 => '其他',
];
}
/**
* 级别序列
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function pLevel()
{
return [
0 => '实习期/试用期(P0)',
1 => '初级(P1)',
2 => '初级(P2)',
3 => '初级(P3)',
4 => '中级(P4)',
5 => '中级(P5)',
6 => '中级(P6)',
7 => '高级(P7)',
8 => '高级(P8)',
9 => '高级(P9)',
10 => '高级(P10)',
11=> '职务初级(M1)',
12 => '职务初级(M2)',
13 => '职务初级(M3)',
14 => '职务中级(M4)',
15 => '职务中级(M5)',
16 => '职务中级(M6)',
17 => '职务高级(M7)',
18 => '职务高级(M8)',
19 => '职务高级(M9)',
20 => '职务高级(M10)',
];
}
/**
* 是否党员
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function dangyuan()
{
return [
0 => '群众',
1 => '预备党员',
2 => '正式党员',
];
}
/**
* 是否有党支部
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function dangzhibu()
{
return [
0 => '无',
1 => '是',
2 => '否',
];
}
}
<?php
namespace App\Models\Aside;
use App\Models\Base;
/**
* 模板 头部底部 对所有 客户
* @author:dc
* @time 2023/4/26 11:21
* Class TemplateHeaderFooter
* @package App\Models\Aside
*/
class TemplateHeaderFooter extends Base
{
protected $table = 'gl_aside_template_header_footer';
}
<?php
namespace App\Models\Bside\Statistics;
use App\Models\Base;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\Bside\Statistics\TrafficStatistics
*
* @property int $id
* @property int|null $type 类型:
* 1 - 访问来源
* 2 - 地域分布
* 3 - 受访页面
* 4 - 访问终端
* 5 - 流量趋势
* @property int|null $year 年
* @property int|null $month 月
* @property string|null $top 访问来源|国家|页面TOP15 - 百分比 - json格式
* @property int|null $innum 询盘量
* @property float|null $conversion 询盘转化率
* @property int|null $pvnum 浏览量
* @property int|null $ipnum 访客量
* @property int|null $pcnum PC端访问量
* @property int|null $mbnum 移动端访问量
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static Builder|TrafficStatistics newModelQuery()
* @method static Builder|TrafficStatistics newQuery()
* @method static Builder|TrafficStatistics query()
* @method static Builder|TrafficStatistics whereConversion($value)
* @method static Builder|TrafficStatistics whereCreatedAt($value)
* @method static Builder|TrafficStatistics whereId($value)
* @method static Builder|TrafficStatistics whereInnum($value)
* @method static Builder|TrafficStatistics whereIpnum($value)
* @method static Builder|TrafficStatistics whereMbnum($value)
* @method static Builder|TrafficStatistics whereMonth($value)
* @method static Builder|TrafficStatistics wherePageview($value)
* @method static Builder|TrafficStatistics wherePcnum($value)
* @method static Builder|TrafficStatistics wherePvnum($value)
* @method static Builder|TrafficStatistics whereTop($value)
* @method static Builder|TrafficStatistics whereType($value)
* @method static Builder|TrafficStatistics whereUpdatedAt($value)
* @method static Builder|TrafficStatistics whereUserSessions($value)
* @method static Builder|TrafficStatistics whereYear($value)
* @mixin \Eloquent
*/
class TrafficStatistics extends Base
{
protected $table = 'gl_traffic_statistics';
/** @var int 访问来源 */
const TYPE_SOURCE = 1;
/** @var int 地域分布 */
const TYPE_DISTRIBUTION = 2;
/** @var int 受访页面 */
const TYPE_PAGE = 3;
/** @var int 访问终端 */
const TYPE_TERMINAL = 4;
/** @var int 流量趋势 */
const TYPE_TREND = 5;
/** @var string[] 类型对应字段 */
const FIELDS = [
self::TYPE_SOURCE => ['pvnum', 'ipnum', 'top'],
self::TYPE_DISTRIBUTION => ['pvnum', 'ipnum', 'top'],
self::TYPE_PAGE => ['pvnum', 'ipnum', 'top'],
self::TYPE_TERMINAL => ['pvnum', 'ipnum', 'top', 'pcnum', 'mbnum'],
self::TYPE_TREND => ['pvnum', 'ipnum', 'top', 'innum'],
];
/** @var string[] 数据库字段对应返回字段 */
const KEY_VALUE = [
'pvnum' => 'pv_count',
'ipnum' => 'ip_count',
'pcnum' => 'pc_count',
'mbnum' => 'mobile_count',
'innum' => 'in_count',
'top' => 'lists'
];
/**
* 根据类型获取字段
* @param int $type
* @return string[]
*/
public function selectFields(int $type = self::TYPE_SOURCE)
{
return self::FIELDS[$type] ?? [];
}
/**
* 根据类型获取月份列表数据
* @param int $type
* @param $date
* @return TrafficStatistics[]|Builder[]|Collection
*/
public function getMonthsLists(int $type = self::TYPE_SOURCE, $date = null)
{
$query = $this->query()->where('type', $type);
if ($date != null) {
if (is_array($date)) {
$years = $months = [];
foreach ($date as $value) {
$dd = explode('-', $value);
$year = $dd[0];
$month = $dd[1];
if (!in_array($year, $years)) {
$years[] = $year;
}
if (!in_array($month, $months)) {
$months[] = $month;
}
}
$query->whereIn('year', $years)
->whereIn('month', $months);
} else {
$dd = explode('-', $date);
$year = $dd[0];
$month = $dd[1];
$query->where('year', $year)
->where('month', $month);
}
} else {
$query->where('year', date('Y'))
->where('month', date('m'));
}
return $query->get();
}
/**
* 根据类型获取单条月份数据
* @param int $type
* @param $year
* @param $month
* @return TrafficStatistics|Builder|Model|object|null
*/
public function getMonth(int $type = self::TYPE_SOURCE, $year = null, $month = null)
{
$year = $year ?? date('Y');
$month = $month ?? date('m');
return $this->query()->where('type', $type)
->where('year', $year)
->where('month', $month)
->first();
}
/**
* 根据类型获取数据
* @param int $type
* @param null $year
* @param null $month
* @return TrafficStatistics|Builder|Model|object|null
*/
public function getData(int $type = self::TYPE_SOURCE, $year = null, $month = null)
{
$key_value = self::KEY_VALUE;
$field_arr = [];
foreach ($this->selectFields($type) as $field) {
$field_arr[] = "{$field} as {$key_value[$field]}";
}
$query = $this->query();
if ($field_arr) {
$query->selectRaw(implode(',', $field_arr));
}
return $query->where('type', $type)
->where('year', $year)
->where('month', $month)
->first();
}
/**
* 格式化数据
* @param $value
* @return mixed
*/
public function getListsAttribute($value)
{
return json_decode($value);
}
}
<?php
namespace App\Models\Bside\Statistics;
use App\Models\Base;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\Bside\Statistics\TrafficTrends
*
* @property int $id
* @property string|null $day 统计当天日期
* @property int|null $pvnum 当天的访问次数PV
* @property int|null $ipnum 当天的独立访问IP数量
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static Builder|TrafficTrends newModelQuery()
* @method static Builder|TrafficTrends newQuery()
* @method static Builder|TrafficTrends query()
* @method static Builder|TrafficTrends whereCreatedAt($value)
* @method static Builder|TrafficTrends whereDay($value)
* @method static Builder|TrafficTrends whereId($value)
* @method static Builder|TrafficTrends whereIpnum($value)
* @method static Builder|TrafficTrends wherePvnum($value)
* @method static Builder|TrafficTrends whereUpdatedAt($value)
* @mixin \Eloquent
*/
class TrafficTrends extends Base
{
protected $table = 'gl_traffic_trends';
/**
* 根据时间获取数据
* @param string|null $date 日期,格式:Y-m-d
* @return TrafficTrends[]|Builder[]|Collection
*/
public function getDaysLists(string $date = null)
{
$query = $this->query();
if ($date != null && is_array($date)) {
$query->whereIn('day', $date);
} else {
$query->where('day', $date);
}
return $query->get();
}
/**
* @param string|null $date 日期,格式:Y-m-d
* @return TrafficTrends|Builder|Model|object|null
*/
public function getDay(string $date = null)
{
return $this->query()->where('day', $date ?? date('Y-m-d'))->first();
}
/**
* 获取当月的IP|PV数量
* @param string|null $date 日期,格式:Y-m
* @return Builder[]|Collection
*/
public function getMonthsLists(string $date = null)
{
if (!is_null($date)) {
$dd = explode('-', $date);
$year = $dd[0];
$month = $dd[1];
} else {
$year = date('Y');
$month = date('m');
}
return $this->query()
->selectRaw('day as date, pvnum as pv_count, ipnum as ip_count')
->whereYear('day', '=', $year)
->whereMonth('day', '=', $month)
->orderBy('day', 'asc')
->get();
}
}
<?php
namespace App\Models\Aside\Domain;
namespace App\Models\Domain;
use App\Models\Base;
... ...
<?php
namespace App\Models\Aside\Domain;
namespace App\Models\Domain;
use Illuminate\Database\Eloquent\Model;
... ...
... ... @@ -16,5 +16,146 @@ class ManageHr extends Base
public static function specieField(){
return ['photo_gallery','id_card_gallery','certificate_gallery','career_history','learning_history'];
}
/**
* 归属小组
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function belongGroup()
{
return [
1 => 'KA组',
2 => 'A组',
3 => 'B组',
4 => 'C组',
5 => 'D组',
6 => 'E组',
7 => 'F组',
8 => 'G组',
9 => 'H组',
10 => 'GA组',
11=> 'GB组',
12 => 'GC组',
13 => '前端组',
14 => '后端组',
15 => '黑格组',
16 => '售后组',
0 => '其他',
];
}
/**
* 学历
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function education()
{
return [
1 => '专科',
2 => '本科',
3 => '研究生及以上',
0 => '其他',
];
}
/**
* 入职岗位
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function entryPosition()
{
return [
1 => '优化师',
2 => '优化师助理',
3 => '优化顾问',
4 => '项目经理',
5 => '平面设计',
6 => '技术经理',
7 => '技术主管',
8 => '技术总监',
9 => '渠道经理',
10 => '前端研发',
11=> '后端研发',
12 => '行政财务',
13 => '品牌营销',
14 => '销售经理',
15 => '销售主管',
16 => '售后技术',
17 => '售后服务',
18 => '外贸销售',
19 => '渠道助理',
20 => '黑格运营',
21 => '运营',
22 => '短视频剪辑师',
23 => '人事',
24 => '采购',
0 => '其他',
];
}
/**
* 级别序列
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function pLevel()
{
return [
0 => '实习期/试用期(P0)',
1 => '初级(P1)',
2 => '初级(P2)',
3 => '初级(P3)',
4 => '中级(P4)',
5 => '中级(P5)',
6 => '中级(P6)',
7 => '高级(P7)',
8 => '高级(P8)',
9 => '高级(P9)',
10 => '高级(P10)',
11=> '职务初级(M1)',
12 => '职务初级(M2)',
13 => '职务初级(M3)',
14 => '职务中级(M4)',
15 => '职务中级(M5)',
16 => '职务中级(M6)',
17 => '职务高级(M7)',
18 => '职务高级(M8)',
19 => '职务高级(M9)',
20 => '职务高级(M10)',
];
}
/**
* 是否党员
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function dangyuan()
{
return [
0 => '群众',
1 => '预备党员',
2 => '正式党员',
];
}
/**
* 是否有党支部
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function dangzhibu()
{
return [
0 => '无',
1 => '是',
2 => '否',
];
}
}
... ...