Compare commits
62 Commits
0bd7421371
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c77ef29846 | |||
| 349841a8a1 | |||
| e30de5cc79 | |||
| a00dd72640 | |||
| db29a0f7c0 | |||
| 335c6a6c68 | |||
| 5227396484 | |||
|
|
9ba854cc76 | ||
| 3ef8b70823 | |||
| 601dd0abd6 | |||
| 055521dc8e | |||
| 0432965b88 | |||
| 70baaa2fd5 | |||
| c9a8b9d5e8 | |||
| d788227ff1 | |||
| 9223c1b127 | |||
| 582c52e3a1 | |||
| 19bfe5e992 | |||
| 3feb90619c | |||
| 8fe0a460cd | |||
| 1b63962bff | |||
| 35725ffd2d | |||
| 2a1cec7909 | |||
| 681af2a1ca | |||
| a44f364914 | |||
| be7ee40690 | |||
| 6e655c6121 | |||
| 94a540ac96 | |||
| b7023e7ab3 | |||
| d48daea477 | |||
| 185578aa6a | |||
| ac0777e34b | |||
| 8481d8ef0c | |||
| c3b0a47e6d | |||
| 55af3cb570 | |||
| 6c4fc6bff6 | |||
| e420668a44 | |||
| 751c742726 | |||
| 8a68fb84af | |||
| c2478c1aea | |||
| 1dc3d9c516 | |||
| 1bd66c30ba | |||
| 6a5d81badc | |||
| 7934afeb04 | |||
| 4ff29bed97 | |||
| b7002e3e2a | |||
| 12adc51eeb | |||
| e0e42e3ecc | |||
| 1c53b73614 | |||
| c76019416a | |||
| 98eda4e5ff | |||
| 207e6b8a5d | |||
| 7101db7e5c | |||
| 6b3c4782a1 | |||
| 20a6248fb6 | |||
| 0304dc7494 | |||
| 9622062509 | |||
| 5765cb21d5 | |||
| 3213a01287 | |||
| 2886c4162b | |||
| 08a6dfdb6e | |||
| abfbb8d1ee |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
/runtime/*
|
||||
/public/uploads/*
|
||||
/public/storage/*
|
||||
.DS_Store
|
||||
.idea
|
||||
composer.lock
|
||||
@@ -11,3 +12,8 @@ composer.lock
|
||||
.vscode
|
||||
node_modules
|
||||
.user.ini
|
||||
addons/alisms/config.php
|
||||
addons/address/config.php
|
||||
addons/epay/config.php
|
||||
addons/hwobs/config.php
|
||||
addons/*/config.php
|
||||
|
||||
94
README.md
94
README.md
@@ -1,93 +1,5 @@
|
||||
FastAdmin是一款基于ThinkPHP+Bootstrap的极速后台开发框架。
|
||||
|
||||
|
||||
## 主要特性
|
||||
|
||||
* 基于`Auth`验证的权限管理系统
|
||||
* 支持无限级父子级权限继承,父级的管理员可任意增删改子级管理员及权限设置
|
||||
* 支持单管理员多角色
|
||||
* 支持管理子级数据或个人数据
|
||||
* 强大的一键生成功能
|
||||
* 一键生成CRUD,包括控制器、模型、视图、JS、语言包、菜单、回收站等
|
||||
* 一键压缩打包JS和CSS文件,一键CDN静态资源部署
|
||||
* 一键生成控制器菜单和规则
|
||||
* 一键生成API接口文档
|
||||
* 完善的前端功能组件开发
|
||||
* 基于`AdminLTE`二次开发
|
||||
* 基于`Bootstrap`开发,自适应手机、平板、PC
|
||||
* 基于`RequireJS`进行JS模块管理,按需加载
|
||||
* 基于`Less`进行样式开发
|
||||
* 强大的插件扩展功能,在线安装卸载升级插件
|
||||
* 通用的会员模块和API模块
|
||||
* 共用同一账号体系的Web端会员中心权限验证和API接口会员权限验证
|
||||
* 二级域名部署支持,同时域名支持绑定到应用插件
|
||||
* 多语言支持,服务端及客户端支持
|
||||
* 支持大文件分片上传、剪切板粘贴上传、拖拽上传,进度条显示,图片上传前压缩
|
||||
* 支持表格固定列、固定表头、跨页选择、Excel导出、模板渲染等功能
|
||||
* 强大的第三方应用模块支持([CMS](https://www.fastadmin.net/store/cms.html)、[CRM](https://www.fastadmin.net/store/facrm.html)、[企业网站管理系统](https://www.fastadmin.net/store/ldcms.html)、[知识库文档系统](https://www.fastadmin.net/store/knowbase.html)、[在线投票系统](https://www.fastadmin.net/store/vote.html)、[B2C商城](https://www.fastadmin.net/store/shopro.html)、[B2B2C商城](https://www.fastadmin.net/store/wanlshop.html))
|
||||
* 整合第三方短信接口(阿里云、腾讯云短信)
|
||||
* 无缝整合第三方云存储(七牛云、阿里云OSS、腾讯云存储、又拍云)功能,支持云储存分片上传
|
||||
* 第三方富文本编辑器支持(Summernote、百度编辑器)
|
||||
* 第三方登录(QQ、微信、微博)整合
|
||||
* 第三方支付(微信、支付宝)无缝整合,微信支持PC端扫码支付
|
||||
* 丰富的插件应用市场
|
||||
|
||||
## 安装使用
|
||||
|
||||
https://doc.fastadmin.net
|
||||
|
||||
## 在线演示
|
||||
|
||||
https://demo.fastadmin.net
|
||||
|
||||
用户名:admin
|
||||
|
||||
密 码:123456
|
||||
|
||||
提 示:演示站数据无法进行修改,请下载源码安装体验全部功能
|
||||
|
||||
## 界面截图
|
||||

|
||||
|
||||
## 问题反馈
|
||||
|
||||
在使用中有任何问题,请使用以下联系方式联系我们
|
||||
|
||||
问答社区: https://ask.fastadmin.net
|
||||
|
||||
Github: https://github.com/fastadminnet/fastadmin
|
||||
|
||||
Gitee: https://gitee.com/fastadminnet/fastadmin
|
||||
|
||||
## 特别鸣谢
|
||||
|
||||
感谢以下的项目,排名不分先后
|
||||
|
||||
ThinkPHP:http://www.thinkphp.cn
|
||||
|
||||
AdminLTE:https://adminlte.io
|
||||
|
||||
Bootstrap:http://getbootstrap.com
|
||||
|
||||
jQuery:http://jquery.com
|
||||
|
||||
Bootstrap-table:https://github.com/wenzhixin/bootstrap-table
|
||||
|
||||
Nice-validator: https://validator.niceue.com
|
||||
|
||||
SelectPage: https://github.com/TerryZ/SelectPage
|
||||
|
||||
Layer: https://layuion.com/layer/
|
||||
|
||||
DropzoneJS: https://www.dropzonejs.com
|
||||
|
||||
|
||||
## 版权信息
|
||||
|
||||
FastAdmin遵循Apache2开源协议发布,并提供免费使用。
|
||||
|
||||
本项目包含的第三方源码和二进制文件之版权信息另行标注。
|
||||
|
||||
版权所有Copyright © 2017-2024 by FastAdmin (https://www.fastadmin.net)
|
||||
|
||||
All rights reserved。
|
||||
### 队列启动命令
|
||||
- php think queue:work --daemon --queue shopro
|
||||
- php think queue:work --daemon --queue shopro-high
|
||||
67
add.sql
Normal file
67
add.sql
Normal file
@@ -0,0 +1,67 @@
|
||||
ALTER TABLE `zy_club` ADD COLUMN `intro` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '介绍' AFTER `blurb`;
|
||||
ALTER TABLE `zy_club` ADD COLUMN `contect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系方式' AFTER `img`;
|
||||
ALTER TABLE `zy_club` ADD COLUMN `attention` int(11) NOT NULL DEFAULT 0 COMMENT '关注人数' AFTER `contect`;
|
||||
-- 已执行 2025-05-18
|
||||
|
||||
ALTER TABLE `zy_circle` ADD COLUMN `top` int NOT NULL DEFAULT 0 COMMENT '置顶' AFTER `status`;
|
||||
-- 已执行 2025-05-31
|
||||
|
||||
|
||||
CREATE TABLE `zy_sign_record` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '用户id',
|
||||
`date` date NOT NULL DEFAULT current_timestamp() COMMENT '签到日期',
|
||||
`last` int(11) NOT NULL DEFAULT 1 COMMENT '已持续天数',
|
||||
`create_time` datetime NOT NULL DEFAULT current_timestamp() COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `user_id` (`user_id`,`last`) USING BTREE,
|
||||
KEY `date` (`date`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到记录';
|
||||
|
||||
CREATE TABLE `zy_sign_set` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`last` tinyint(4) NOT NULL DEFAULT 1 COMMENT '连续天数',
|
||||
`chance1` tinyint(4) NOT NULL DEFAULT 0 COMMENT '概率1',
|
||||
`coupon1_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '券1',
|
||||
`chance2` tinyint(4) NOT NULL DEFAULT 0 COMMENT '概率2',
|
||||
`coupon2_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '券2',
|
||||
`create_time` datetime NOT NULL DEFAULT current_timestamp() COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `type` (`last`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到设置';
|
||||
|
||||
ALTER TABLE `zy_sign_set`
|
||||
ADD COLUMN `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0禁用,1启用)' AFTER `coupon2_id`;
|
||||
|
||||
DROP TABLE IF EXISTS `zy_sign`;
|
||||
-- 已执行 2025-06-16
|
||||
|
||||
|
||||
ALTER TABLE `zy_sign_record`
|
||||
ADD COLUMN `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '获得礼物备注' AFTER `last`;
|
||||
|
||||
ALTER TABLE `zy_sign_set`
|
||||
ADD COLUMN `name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称' AFTER `status`,
|
||||
ADD COLUMN `begin_date` date NULL DEFAULT NULL COMMENT '有效期开始' AFTER `name`,
|
||||
ADD COLUMN `end_date` date NULL DEFAULT NULL COMMENT '有效期结束' AFTER `begin_date`,
|
||||
ADD COLUMN `intro` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明' AFTER `end_date`;
|
||||
-- 已执行 2025-06-17
|
||||
|
||||
CREATE TABLE `zy_visitor` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '类型(0俱乐部/1球馆/2用户)',
|
||||
`obj_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '对象id',
|
||||
`user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id',
|
||||
`nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '昵称',
|
||||
`avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '头像',
|
||||
`gender` tinyint(4) NOT NULL DEFAULT 0 COMMENT '性别(0女,1男)',
|
||||
`times` int(11) NOT NULL DEFAULT 0 COMMENT '次数',
|
||||
`create_time` datetime NOT NULL DEFAULT current_timestamp() COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `type` (`type`) USING BTREE,
|
||||
KEY `obj_id` (`obj_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='标签';
|
||||
-- 已执行 2025-06-28
|
||||
4
addons/command/config.bak.php
Normal file
4
addons/command/config.bak.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
];
|
||||
@@ -68,3 +68,5 @@ return [
|
||||
'extend' => '',
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"files":["public\\assets\\addons\\hwobs\\js\\spark.js"],"license":"regular","licenseto":"34485","licensekey":"kaCpXL6B57yO89Rv h7EIXhuMw6+sCcUldTSJoQ==","domains":["localhost"],"licensecodes":[],"validations":["757319b447175b6ca1882635b132a594"]}
|
||||
{"files":["public\\assets\\addons\\hwobs\\js\\spark.js"],"license":"regular","licenseto":"34485","licensekey":"fE1oqlUNvPsVy07I LHfdNbd7Yb6AD1LjzKfdIA==","domains":[],"licensecodes":[],"validations":[]}
|
||||
245
addons/hwobs/config.bak.php
Normal file
245
addons/hwobs/config.bak.php
Normal file
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'accessKey',
|
||||
'title' => 'Access Key',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'HPUA3H63YULC0YUCFE5J',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'secretKey',
|
||||
'title' => 'Secret Key',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'B2Obu8P3Er23EwzcoH8pPhbWBk0GOxpFrlwwRgSh',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'bucket',
|
||||
'title' => '存储桶名称',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'doxixi',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '存储桶名称',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'endpoint',
|
||||
'title' => 'Endpoint',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'obs.cn-south-1.myhuaweicloud.com',
|
||||
'rule' => 'required;endpoint',
|
||||
'msg' => '',
|
||||
'tip' => '请输入你的Endpoint',
|
||||
'ok' => '',
|
||||
'extend' => 'data-rule-endpoint="[/^(?!http(s)?:\\/\\/).*$/, \'不能以http(s)://开头\']"',
|
||||
],
|
||||
[
|
||||
'name' => 'uploadurl',
|
||||
'title' => '上传接口地址',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'https://doxixi.obs.cn-south-1.myhuaweicloud.com',
|
||||
'rule' => 'required;uploadurl',
|
||||
'msg' => '',
|
||||
'tip' => '请使用存储桶->基本信息->访问域名的值,并在前面加上http://或https://',
|
||||
'ok' => '',
|
||||
'extend' => 'data-rule-uploadurl="[/^http(s)?:\\/\\/.*$/, \'必需以http(s)://开头\']"',
|
||||
],
|
||||
[
|
||||
'name' => 'cdnurl',
|
||||
'title' => 'CDN地址',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'https://doxixi.obs.cn-south-1.myhuaweicloud.com',
|
||||
'rule' => 'required;cdnurl',
|
||||
'msg' => '',
|
||||
'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名',
|
||||
'ok' => '',
|
||||
'extend' => 'data-rule-cdnurl="[/^http(s)?:\\/\\/.*$/, \'必需以http(s)://开头\']"',
|
||||
],
|
||||
[
|
||||
'name' => 'uploadmode',
|
||||
'title' => '上传模式',
|
||||
'type' => 'select',
|
||||
'content' => [
|
||||
'client' => '客户端直传(速度快,无备份)',
|
||||
'server' => '服务器中转(占用服务器带宽,有备份)',
|
||||
],
|
||||
'value' => 'client',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'serverbackup',
|
||||
'title' => '服务器中转模式备份',
|
||||
'type' => 'radio',
|
||||
'content' => [
|
||||
1 => '备份(附件管理将产生2条记录)',
|
||||
0 => '不备份',
|
||||
],
|
||||
'value' => '0',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '服务器中转模式下是否备份文件',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'savekey',
|
||||
'title' => '保存文件名',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '/uploads/{year}{mon}{day}/{filemd5}{.suffix}',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'expire',
|
||||
'title' => '上传有效时长',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '600',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '用户停留页面上传有效时长,单位秒',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'maxsize',
|
||||
'title' => '最大可上传',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '10M',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'mimetype',
|
||||
'title' => '可上传后缀格式',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'multiple',
|
||||
'title' => '多文件上传',
|
||||
'type' => 'bool',
|
||||
'content' => [],
|
||||
'value' => '1',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'thumbstyle',
|
||||
'title' => '缩略图样式',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '用于后台列表缩略图样式,可使用:?x-image-process=image/resize,m_fixed,h_90,w_120或?x-image-process=style/样式名称',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'chunking',
|
||||
'title' => '分片上传',
|
||||
'type' => 'radio',
|
||||
'content' => [
|
||||
1 => '开启',
|
||||
0 => '关闭',
|
||||
],
|
||||
'value' => '1',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'chunksize',
|
||||
'title' => '分片大小',
|
||||
'type' => 'number',
|
||||
'content' => [],
|
||||
'value' => '4194304',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'syncdelete',
|
||||
'title' => '附件删除时是否同步删除云存储文件',
|
||||
'type' => 'bool',
|
||||
'content' => [],
|
||||
'value' => '0',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'apiupload',
|
||||
'title' => 'API接口使用云存储',
|
||||
'type' => 'bool',
|
||||
'content' => [],
|
||||
'value' => '0',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'noneedlogin',
|
||||
'title' => '免登录上传',
|
||||
'type' => 'checkbox',
|
||||
'content' => [
|
||||
'api' => 'API',
|
||||
'index' => '前台',
|
||||
'admin' => '后台',
|
||||
],
|
||||
'value' => 'api,index',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
];
|
||||
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'accessKey',
|
||||
'title' => 'Access Key',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'secretKey',
|
||||
'title' => 'Secret Key',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'bucket',
|
||||
'title' => '存储桶名称',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'yourbucket',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '存储桶名称',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'endpoint',
|
||||
'title' => 'Endpoint',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'obs.cn-south-1.myhuaweicloud.com',
|
||||
'rule' => 'required;endpoint',
|
||||
'msg' => '',
|
||||
'tip' => '请输入你的Endpoint',
|
||||
'ok' => '',
|
||||
'extend' => 'data-rule-endpoint="[/^(?!http(s)?:\/\/).*$/, \'不能以http(s)://开头\']"',
|
||||
],
|
||||
[
|
||||
'name' => 'uploadurl',
|
||||
'title' => '上传接口地址',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'https://yourbucket.obs.cn-south-1.myhuaweicloud.com',
|
||||
'rule' => 'required;uploadurl',
|
||||
'msg' => '',
|
||||
'tip' => '请使用存储桶->基本信息->访问域名的值,并在前面加上http://或https://',
|
||||
'ok' => '',
|
||||
'extend' => 'data-rule-uploadurl="[/^http(s)?:\/\/.*$/, \'必需以http(s)://开头\']"',
|
||||
],
|
||||
[
|
||||
'name' => 'cdnurl',
|
||||
'title' => 'CDN地址',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'https://yourbucket.obs.cn-south-1.myhuaweicloud.com',
|
||||
'rule' => 'required;cdnurl',
|
||||
'msg' => '',
|
||||
'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名',
|
||||
'ok' => '',
|
||||
'extend' => 'data-rule-cdnurl="[/^http(s)?:\/\/.*$/, \'必需以http(s)://开头\']"',
|
||||
],
|
||||
[
|
||||
'name' => 'uploadmode',
|
||||
'title' => '上传模式',
|
||||
'type' => 'select',
|
||||
'content' => [
|
||||
'client' => '客户端直传(速度快,无备份)',
|
||||
'server' => '服务器中转(占用服务器带宽,有备份)',
|
||||
],
|
||||
'value' => 'server',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'serverbackup',
|
||||
'title' => '服务器中转模式备份',
|
||||
'type' => 'radio',
|
||||
'content' => [
|
||||
1 => '备份(附件管理将产生2条记录)',
|
||||
0 => '不备份',
|
||||
],
|
||||
'value' => '1',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '服务器中转模式下是否备份文件',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'savekey',
|
||||
'title' => '保存文件名',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '/uploads/{year}{mon}{day}/{filemd5}{.suffix}',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'expire',
|
||||
'title' => '上传有效时长',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '600',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '用户停留页面上传有效时长,单位秒',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'maxsize',
|
||||
'title' => '最大可上传',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '10M',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'mimetype',
|
||||
'title' => '可上传后缀格式',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => 'jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'multiple',
|
||||
'title' => '多文件上传',
|
||||
'type' => 'bool',
|
||||
'content' => [],
|
||||
'value' => '0',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'thumbstyle',
|
||||
'title' => '缩略图样式',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '用于后台列表缩略图样式,可使用:?x-image-process=image/resize,m_fixed,h_90,w_120或?x-image-process=style/样式名称',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'chunking',
|
||||
'title' => '分片上传',
|
||||
'type' => 'radio',
|
||||
'content' => [
|
||||
1 => '开启',
|
||||
0 => '关闭',
|
||||
],
|
||||
'value' => '0',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'chunksize',
|
||||
'title' => '分片大小',
|
||||
'type' => 'number',
|
||||
'content' => [],
|
||||
'value' => '4194304',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'syncdelete',
|
||||
'title' => '附件删除时是否同步删除云存储文件',
|
||||
'type' => 'bool',
|
||||
'content' => [],
|
||||
'value' => '0',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'apiupload',
|
||||
'title' => 'API接口使用云存储',
|
||||
'type' => 'bool',
|
||||
'content' => [],
|
||||
'value' => '0',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'noneedlogin',
|
||||
'title' => '免登录上传',
|
||||
'type' => 'checkbox',
|
||||
'content' => [
|
||||
'api' => 'API',
|
||||
'index' => '前台',
|
||||
'admin' => '后台',
|
||||
],
|
||||
'value' => '',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
];
|
||||
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace addons\hwobs\controller;
|
||||
|
||||
use addons\hwobs\library\Auth;
|
||||
use addons\hwobs\library\Signer;
|
||||
use app\common\exception\UploadException;
|
||||
use app\common\library\Upload;
|
||||
use app\common\model\Attachment;
|
||||
use Obs\Internal\Common\Model;
|
||||
use Obs\Internal\Signature\DefaultSignature;
|
||||
use Obs\ObsClient;
|
||||
use think\addons\Controller;
|
||||
use think\Config;
|
||||
use Obs\ObsClient;
|
||||
use addons\hwobs\Hwobs;
|
||||
use think\addons\Controller;
|
||||
use addons\hwobs\library\Auth;
|
||||
use app\common\library\Upload;
|
||||
use Obs\Internal\Common\Model;
|
||||
use addons\hwobs\library\Signer;
|
||||
use app\common\model\Attachment;
|
||||
use app\common\exception\UploadException;
|
||||
use Obs\Internal\Signature\DefaultSignature;
|
||||
|
||||
class Index extends Controller
|
||||
{
|
||||
@@ -31,6 +32,13 @@ class Index extends Controller
|
||||
$this->error("当前插件暂无前台页面");
|
||||
}
|
||||
|
||||
public function config()
|
||||
{
|
||||
$upload = [];
|
||||
(new Hwobs)->uploadConfigInit($upload);
|
||||
$this->success('', null, $upload);
|
||||
}
|
||||
|
||||
public function params()
|
||||
{
|
||||
$this->check();
|
||||
@@ -39,6 +47,14 @@ class Index extends Controller
|
||||
$name = $this->request->post('name');
|
||||
$md5 = $this->request->post('md5');
|
||||
$chunk = $this->request->post('chunk');
|
||||
$name = xss_clean($name);
|
||||
|
||||
// 检查文件后缀
|
||||
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
|
||||
$allowedExtensions = explode(',', strtolower($config['mimetype']));
|
||||
if (!in_array($extension, $allowedExtensions) || in_array($extension, ['php', 'html', 'htm', 'phar', 'phtml']) || preg_match("/^php(.*)/i", $extension)) {
|
||||
$this->error('不允许的文件类型');
|
||||
}
|
||||
|
||||
$key = (new Upload())->getSavekey($config['savekey'], $name, $md5);
|
||||
$key = ltrim($key, "/");
|
||||
@@ -75,8 +91,7 @@ class Index extends Controller
|
||||
$signature = $obs->createPostSignature([
|
||||
'Bucket' => $config['bucket'],
|
||||
'Key' => $key,
|
||||
'FormParams' => [
|
||||
]
|
||||
'FormParams' => []
|
||||
]);
|
||||
$params['key'] = $key;
|
||||
$params['AccessKeyId'] = $config['accessKey'];
|
||||
@@ -86,7 +101,6 @@ class Index extends Controller
|
||||
$params['headers'] = $headers;
|
||||
$params['date'] = $date;
|
||||
$this->success('', null, $params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,5 +335,4 @@ class Index extends Controller
|
||||
$this->error("请求已经超时");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ title = 华为OBS云储存
|
||||
intro = 使用华为OBS作为默认云储存
|
||||
author = FastAdmin
|
||||
website = https://www.fastadmin.net
|
||||
version = 1.2.9
|
||||
version = 1.2.10
|
||||
state = 1
|
||||
url = /addons/hwobs
|
||||
license = regular
|
||||
|
||||
@@ -28,17 +28,17 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
||||
{
|
||||
protected $data;
|
||||
|
||||
public function __construct(array $data = [])
|
||||
public function __construct(?array $data = [])
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->data);
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
return new \ArrayIterator($this->data);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAll(array $keys = null)
|
||||
public function getAll(?array $keys = null)
|
||||
{
|
||||
return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
||||
return array_search($value, $this->data);
|
||||
}
|
||||
|
||||
public function replace(array $data)
|
||||
public function replace(?array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
|
||||
@@ -148,7 +148,7 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function map(\Closure $closure, array $context = [], $static = true)
|
||||
public function map(\Closure $closure, ?array $context = [], $static = true)
|
||||
{
|
||||
$collection = $static ? new static() : new self();
|
||||
foreach ($this as $key => $value) {
|
||||
@@ -170,22 +170,22 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->data[$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
public function offsetGet($offset): mixed
|
||||
{
|
||||
return isset($this->data[$offset]) ? $this->data[$offset] : null;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
$this->data[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->data[$offset]);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
$this->maxHandles = $maxHandles;
|
||||
}
|
||||
|
||||
public function create(RequestInterface $request, array $options): EasyHandle
|
||||
public function create(?RequestInterface $request, ?array $options): EasyHandle
|
||||
{
|
||||
if (isset($options['curl']['body_as_string'])) {
|
||||
$options['_body_as_string'] = $options['curl']['body_as_string'];
|
||||
@@ -85,7 +85,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function release(EasyHandle $easy): void
|
||||
public function release(?EasyHandle $easy): void
|
||||
{
|
||||
$resource = $easy->handle;
|
||||
unset($easy->handle);
|
||||
@@ -102,7 +102,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function getDefaultConf(EasyHandle $easy)
|
||||
private function getDefaultConf(?EasyHandle $easy)
|
||||
{
|
||||
$conf = [
|
||||
'_headers' => $easy->request->getHeaders(),
|
||||
@@ -129,7 +129,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
return $conf;
|
||||
}
|
||||
|
||||
private function applyMethod(EasyHandle $easy, array &$conf)
|
||||
private function applyMethod(?EasyHandle $easy, ?array &$conf)
|
||||
{
|
||||
$body = $easy->request->getBody();
|
||||
$size = $body->getSize();
|
||||
@@ -155,7 +155,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function applyBody(RequestInterface $request, array $options, array &$conf)
|
||||
private function applyBody(?RequestInterface $request, ?array $options, ?array &$conf)
|
||||
{
|
||||
$size = $request->hasHeader('Content-Length')
|
||||
? (int) $request->getHeaderLine('Content-Length')
|
||||
@@ -209,7 +209,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function applyHeaders(EasyHandle $easy, array &$conf)
|
||||
private function applyHeaders(?EasyHandle $easy, ?array &$conf)
|
||||
{
|
||||
foreach ($conf['_headers'] as $name => $values) {
|
||||
foreach ($values as $value) {
|
||||
@@ -223,7 +223,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function removeHeader($name, array &$options)
|
||||
private function removeHeader($name, ?array &$options)
|
||||
{
|
||||
foreach (array_keys($options['_headers']) as $key) {
|
||||
if (!strcasecmp($key, $name)) {
|
||||
@@ -233,7 +233,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function applyHandlerOptions(EasyHandle $easy, array &$conf)
|
||||
private function applyHandlerOptions(?EasyHandle $easy, ?array &$conf)
|
||||
{
|
||||
$options = $easy->options;
|
||||
if (isset($options['verify'])) {
|
||||
@@ -381,7 +381,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
||||
}
|
||||
|
||||
|
||||
private function createHeaderFn(EasyHandle $easy)
|
||||
private function createHeaderFn(?EasyHandle $easy)
|
||||
{
|
||||
if (isset($easy->options['on_headers'])) {
|
||||
$onHeaders = $easy->options['on_headers'];
|
||||
|
||||
@@ -38,7 +38,7 @@ class SdkStreamHandler
|
||||
{
|
||||
private $lastHeaders = [];
|
||||
|
||||
public function __invoke(RequestInterface $request, array $options)
|
||||
public function __invoke(?RequestInterface $request, ?array $options)
|
||||
{
|
||||
if (isset($options['delay'])) {
|
||||
usleep($options['delay'] * 1000);
|
||||
@@ -77,10 +77,10 @@ class SdkStreamHandler
|
||||
}
|
||||
|
||||
private function invokeStats(
|
||||
array $options,
|
||||
RequestInterface $request,
|
||||
?array $options,
|
||||
?RequestInterface $request,
|
||||
$startTime,
|
||||
ResponseInterface $response = null,
|
||||
?ResponseInterface $response = null,
|
||||
$error = null
|
||||
) {
|
||||
if (isset($options['on_stats'])) {
|
||||
@@ -96,8 +96,8 @@ class SdkStreamHandler
|
||||
}
|
||||
|
||||
private function createResponse(
|
||||
RequestInterface $request,
|
||||
array $options,
|
||||
?RequestInterface $request,
|
||||
?array $options,
|
||||
$stream,
|
||||
$startTime
|
||||
) {
|
||||
@@ -141,7 +141,7 @@ class SdkStreamHandler
|
||||
return new FulfilledPromise($response);
|
||||
}
|
||||
|
||||
private function createSink(StreamInterface $stream, array $options)
|
||||
private function createSink(StreamInterface $stream, ?array $options)
|
||||
{
|
||||
if (!empty($options['stream'])) {
|
||||
return $stream;
|
||||
@@ -156,7 +156,7 @@ class SdkStreamHandler
|
||||
: \GuzzleHttp\Psr7\Utils::streamFor($sink);
|
||||
}
|
||||
|
||||
private function checkDecode(array $options, array $headers, $stream)
|
||||
private function checkDecode(?array $options, ?array $headers, $stream)
|
||||
{
|
||||
if (!empty($options['decode_content'])) {
|
||||
$normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
|
||||
@@ -232,7 +232,7 @@ class SdkStreamHandler
|
||||
return $resource;
|
||||
}
|
||||
|
||||
private function createStream(RequestInterface $request, array $options)
|
||||
private function createStream(?RequestInterface $request, ?array $options)
|
||||
{
|
||||
static $methods;
|
||||
if (!$methods) {
|
||||
@@ -309,7 +309,7 @@ class SdkStreamHandler
|
||||
);
|
||||
}
|
||||
|
||||
private function resolveHost(RequestInterface $request, array $options)
|
||||
private function resolveHost(?RequestInterface $request, ?array $options)
|
||||
{
|
||||
$uri = $request->getUri();
|
||||
|
||||
@@ -332,7 +332,7 @@ class SdkStreamHandler
|
||||
return $uri;
|
||||
}
|
||||
|
||||
private function getDefaultContext(RequestInterface $request)
|
||||
private function getDefaultContext(?RequestInterface $request)
|
||||
{
|
||||
$headers = '';
|
||||
foreach ($request->getHeaders() as $name => $value) {
|
||||
@@ -365,7 +365,7 @@ class SdkStreamHandler
|
||||
return $context;
|
||||
}
|
||||
|
||||
private function add_proxy(RequestInterface $request, &$options, $value, &$params)
|
||||
private function add_proxy(?RequestInterface $request, &$options, $value, &$params)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
$options['http']['proxy'] = $value;
|
||||
@@ -384,14 +384,14 @@ class SdkStreamHandler
|
||||
}
|
||||
}
|
||||
|
||||
private function add_timeout(RequestInterface $request, &$options, $value, &$params)
|
||||
private function add_timeout(?RequestInterface $request, &$options, $value, &$params)
|
||||
{
|
||||
if ($value > 0) {
|
||||
$options['http']['timeout'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
private function add_verify(RequestInterface $request, &$options, $value, &$params)
|
||||
private function add_verify(?RequestInterface $request, &$options, $value, &$params)
|
||||
{
|
||||
if ($value === true) {
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
@@ -415,7 +415,7 @@ class SdkStreamHandler
|
||||
$options['ssl']['allow_self_signed'] = false;
|
||||
}
|
||||
|
||||
private function add_cert(RequestInterface $request, &$options, $value, &$params)
|
||||
private function add_cert(?RequestInterface $request, &$options, $value, &$params)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$options['ssl']['passphrase'] = $value[1];
|
||||
@@ -429,7 +429,7 @@ class SdkStreamHandler
|
||||
$options['ssl']['local_cert'] = $value;
|
||||
}
|
||||
|
||||
private function add_progress(RequestInterface $request, &$options, $value, &$params)
|
||||
private function add_progress(?RequestInterface $request, &$options, $value, &$params)
|
||||
{
|
||||
$this->addNotification(
|
||||
$params,
|
||||
@@ -441,7 +441,7 @@ class SdkStreamHandler
|
||||
);
|
||||
}
|
||||
|
||||
private function add_debug(RequestInterface $request, &$options, $value, &$params)
|
||||
private function add_debug(?RequestInterface $request, &$options, $value, &$params)
|
||||
{
|
||||
if ($value === false) {
|
||||
return;
|
||||
@@ -478,7 +478,7 @@ class SdkStreamHandler
|
||||
);
|
||||
}
|
||||
|
||||
private function addNotification(array &$params, callable $notify)
|
||||
private function addNotification(?array &$params, callable $notify)
|
||||
{
|
||||
if (!isset($params['notification'])) {
|
||||
$params['notification'] = $notify;
|
||||
@@ -490,7 +490,7 @@ class SdkStreamHandler
|
||||
}
|
||||
}
|
||||
|
||||
private function callArray(array $functions)
|
||||
private function callArray(?array $functions)
|
||||
{
|
||||
return function () use ($functions) {
|
||||
$args = func_get_args();
|
||||
|
||||
@@ -16,7 +16,7 @@ class Command extends BaseCommand
|
||||
/**
|
||||
* 执行帮助命令
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
protected function execute(?Input $input, ?Output $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->output = $output;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ShoproChat extends Command
|
||||
/**
|
||||
* 执行帮助命令
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
protected function execute(?Input $input, ?Output $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->output = $output;
|
||||
|
||||
@@ -2,14 +2,24 @@
|
||||
|
||||
namespace addons\shopro\controller\user;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\common\library\Sms;
|
||||
use app\admin\model\zy\Club;
|
||||
use app\admin\model\zy\Menber;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\zy\link\Apply;
|
||||
use addons\shopro\controller\Common;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\link\Visitor;
|
||||
use app\admin\model\zy\link\Relation;
|
||||
use app\admin\model\shopro\ThirdOauth;
|
||||
use think\exception\ValidateException;
|
||||
use addons\shopro\service\user\UserAuth;
|
||||
use app\admin\model\shopro\user\User as UserModel;
|
||||
use app\admin\model\shopro\user\Coupon as UserCouponModel;
|
||||
use app\admin\model\shopro\order\Order as OrderModel;
|
||||
use app\admin\model\shopro\user\Coupon as UserCouponModel;
|
||||
use app\admin\model\shopro\order\Aftersale as AftersaleModel;
|
||||
use app\admin\model\shopro\ThirdOauth;
|
||||
|
||||
class User extends Common
|
||||
{
|
||||
@@ -76,11 +86,41 @@ class User extends Common
|
||||
public function profile()
|
||||
{
|
||||
//TODO @ldh: 1.账号被禁用 2.连表查group
|
||||
$user = auth_user(true);
|
||||
|
||||
$user = UserModel::with(['parent_user', 'third_oauth'])->where('id', $user->id)->find();
|
||||
$self = auth_user(true); //自己
|
||||
$user_id = $self->id;
|
||||
$params = $this->request->param();
|
||||
if (!empty($params['user_id'])) {
|
||||
$user_id = $params['user_id'];
|
||||
$relation = Relation::where('user_id', $self->id)->where('target_id', $user_id)->find();
|
||||
$content = json_decode($relation->content ?? '', true);
|
||||
$visitor = Visitor::where('type', 2)->where('obj_id', $user_id)->where('user_id', $self->id)->find();
|
||||
if (empty($visitor)) {
|
||||
$visitor = new Visitor;
|
||||
}
|
||||
$visitor->allowField(true)->save([
|
||||
'type' => 2,
|
||||
'obj_id' => $user_id,
|
||||
'user_id' => $self->id,
|
||||
'nickname' => $self['nickname'],
|
||||
'avatar' => $self['avatar'],
|
||||
'gender' => $self['gender'],
|
||||
'times' => empty($visitor->times) ? 1 : $visitor->times + 1
|
||||
]);
|
||||
}
|
||||
$user = UserModel::with(['parent_user', 'third_oauth'])->where('id', $user_id)->find();
|
||||
|
||||
$user->hidden(['password', 'salt', 'createtime', 'updatetime', 'deletetime', 'remember_token', 'login_fail', 'login_ip', 'login_time']);
|
||||
$user = $user->toArray();
|
||||
$user['msg_num'] = Message::where('user_id', $user['id'])->where('status', 0)->count();
|
||||
$user['club_list'] = Menber::alias('m')->join([Club::$tableName => 'c'], 'c.id=m.club_id')->field('m.*,c.name')->where('user_id', $user['id'])->where('role', '>', 0)->select();
|
||||
$user['club_num'] = count($user['club_list']);
|
||||
$user['card_num'] = 0;
|
||||
if (isset($content)) {
|
||||
if (empty($content['phone'])) $user['mobile'] = ''; //手机查看权限
|
||||
if (empty($content['wechat'])) $user['wechat'] = ''; //微信查看权限
|
||||
if (empty($content['qq'])) $user['qq'] = ''; //qq查看权限
|
||||
$user['content'] = $content; //权限
|
||||
}
|
||||
|
||||
$this->success('个人详情', $user);
|
||||
}
|
||||
@@ -92,7 +132,7 @@ class User extends Common
|
||||
{
|
||||
$user = auth_user();
|
||||
|
||||
$params = $this->request->only(['avatar', 'nickname', 'gender']);
|
||||
$params = $this->request->only(['avatar', 'nickname', 'mobile', 'gender', 'qq', 'wechat', 'years', 'bio']);
|
||||
$this->svalidate($params);
|
||||
|
||||
$user->save($params);
|
||||
@@ -302,4 +342,279 @@ class User extends Common
|
||||
|
||||
$this->success('注销成功');
|
||||
}
|
||||
|
||||
// 发送用户消息
|
||||
public function sendMsg()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if ($params['user_id'] == $this->auth->id) {
|
||||
$this->error('不能发送给自己');
|
||||
}
|
||||
$user = auth_user();
|
||||
$target = UserModel::get($params['user_id']);
|
||||
if (empty($target)) {
|
||||
$this->error('用户不存在');
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = (new Message())->allowField(true)->save([
|
||||
'type' => 2,
|
||||
'name' => $user['nickname'],
|
||||
'avatar' => $user['avatar'],
|
||||
'from_id' => $user['id'],
|
||||
'user_id' => $params['user_id'],
|
||||
'content' => json_encode([
|
||||
'topic' => '好友消息',
|
||||
'time' => date('Y-m-d H:i:s'),
|
||||
'content' => $params['content']
|
||||
]),
|
||||
'status' => 0
|
||||
]);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 分类消息
|
||||
public function msgGroup()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$member = Menber::where('user_id', $this->auth->id)->where('role', '>', 1)->column('club_id');
|
||||
if (!empty($member)) {
|
||||
$query1 = Message::field('*,count(*) as num')->where(function ($q1) use ($member) {
|
||||
$q1->where('user_id', $this->auth->id)
|
||||
->whereOr(function ($q2) use ($member) {
|
||||
$q2->where('type', 3)->whereIn('from_id', $member);
|
||||
});
|
||||
});
|
||||
$query2 = Message::field('*,count(*) as num')->where(function ($q1) use ($member) {
|
||||
$q1->where('user_id', $this->auth->id)
|
||||
->whereOr(function ($q2) use ($member) {
|
||||
$q2->where('type', 3)->whereIn('from_id', $member);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$query1 = Message::field('*,count(*) as num')->where('user_id', $this->auth->id);
|
||||
$query2 = Message::field('*,count(*) as num')->where('user_id', $this->auth->id);
|
||||
}
|
||||
if (isset($params['type'])) {
|
||||
$query1->where('type', $params['type']);
|
||||
$query2->where('type', $params['type']);
|
||||
}
|
||||
$query1->group('from_id')->order('update_time', 'desc');
|
||||
$query2->group('from_id')->order('update_time', 'desc');
|
||||
$num = $query2->where('status', 0)->column('count(*) as num', 'from_id');
|
||||
$res = $query1->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$r) {
|
||||
$r['content'] = json_decode($r['content'], true);
|
||||
$r['num'] = $num[$r['from_id']] ?? 0;
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
// 用户消息
|
||||
public function msg()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$member = Menber::where('user_id', $this->auth->id)->where('role', '>', 1)->column('club_id');
|
||||
if (!empty($member)) {
|
||||
$query = Message::where(function ($q1) use ($member) {
|
||||
$q1->where('user_id', $this->auth->id) //用户消息
|
||||
->whereOr(function ($q2) use ($member) { //俱乐部消息
|
||||
$q2->where('type', 3)->whereIn('from_id', $member);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$query = Message::where('user_id', $this->auth->id);
|
||||
}
|
||||
if (isset($params['type'])) {
|
||||
$query->where('type', $params['type']);
|
||||
}
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$r) {
|
||||
$r['content'] = json_decode($r['content'], true);
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
// 消息读取
|
||||
public function msgRead()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = Message::get($params['msg_id'] ?? NULL);
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$model->save(['status' => 1]); //已读
|
||||
$model['content'] = json_decode($model['content'], true);
|
||||
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
|
||||
// 申请联系信息
|
||||
public function apply()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if (empty($params['content'])) {
|
||||
return $this->error('申请内容不能为空');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$fromUser = auth_user();
|
||||
$user = UserModel::get($params['user_id'] ?? NULL);
|
||||
if (empty($user)) {
|
||||
return $this->error('用户不存在');
|
||||
}
|
||||
$apply = (new Apply);
|
||||
if ($apply::get(['type' => 2, 'user_id' => $fromUser->id, 'target_id' => $user->id, 'status' => 1])) {
|
||||
return $this->error('申请处理中');
|
||||
}
|
||||
$apply->allowField(true)->save([ // 记录申请
|
||||
'type' => 2,
|
||||
'user_id' => $fromUser->id,
|
||||
'target_id' => $user->id,
|
||||
'content' => $params['content'],
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'status' => 1
|
||||
]);
|
||||
// (new Message())->allowField(true)->save([ // 消息通知
|
||||
// 'type' => 2,
|
||||
// 'name' => $fromUser->nickname,
|
||||
// 'avatar' => $fromUser->avatar,
|
||||
// 'from_id' => $fromUser->id,
|
||||
// 'user_id' => $user->id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '申请联系信息',
|
||||
// '申请人' => $fromUser->nickname,
|
||||
// '申请时间' => date('Y-m-d H:i:s'),
|
||||
// 'reason' => $params['reason'] ?? '',
|
||||
// 'apply_id' => $apply->id
|
||||
// ])
|
||||
// ]);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('已邀请,请等候审核');
|
||||
}
|
||||
|
||||
// 获取申请列表
|
||||
public function applyList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = Apply::where('type', 2)->where('target_id', $this->auth->id);
|
||||
if (isset($params['status'])) {
|
||||
$query->where('status', $params['status']);
|
||||
}
|
||||
$applyList = $query->select();
|
||||
$this->success('Success', $applyList);
|
||||
}
|
||||
|
||||
// 处理申请
|
||||
public function handle()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$apply = Apply::get(['id' => $params['apply_id'], 'user_id' => $this->auth->id, 'status' => 1]);
|
||||
if (empty($apply)) {
|
||||
return $this->error('申请记录不存在');
|
||||
}
|
||||
if ($params['status'] == 2) { //同意
|
||||
$relation = Relation::get(['user_id' => $apply['user_id'], 'target_id' => $apply['user_id']]);
|
||||
if (empty($relation)) {
|
||||
$relation = new Relation;
|
||||
}
|
||||
$relation->allowField(true)->save([
|
||||
'target_id' => $apply['user_id'],
|
||||
'user_id' => $apply['target_id'],
|
||||
'status' => 1,
|
||||
'content' => $params['content'],
|
||||
]);
|
||||
}
|
||||
$apply->save([
|
||||
'status' => $params['status'],
|
||||
'reply' => $params['reply'] ?? ''
|
||||
]);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 好友关系
|
||||
public function relation()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if (!isset($params['status'])) {
|
||||
$this->error('缺少参数:status');
|
||||
}
|
||||
$ids = explode(',', $params['user_id']);
|
||||
if (empty($ids)) {
|
||||
$this->error('缺少参数:user_id');
|
||||
}
|
||||
foreach ($ids as $id) {
|
||||
if ($id == $this->auth->id) {
|
||||
$this->error('不能设置与自己的好友关系');
|
||||
}
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$dbUserId = UserModel::where('id', 'IN', $ids)->column('id');
|
||||
if (!empty($diffId = array_diff($ids, $dbUserId))) {
|
||||
return $this->error('用户不存在:' . implode(',', $diffId));
|
||||
}
|
||||
$res = Relation::where('user_id', $this->auth->id)->where('target_id', 'IN', $ids)->update(['status' => $params['status']]);
|
||||
if ($res < count($ids)) {
|
||||
$target = Relation::where('user_id', $this->auth->id)->where('target_id', 'IN', $ids)->column("target_id");
|
||||
$_relationModel = new Relation;
|
||||
foreach ((array_diff($ids, $target)) as $id) {
|
||||
(clone $_relationModel)->allowField(true)->save([
|
||||
'user_id' => $this->auth->id,
|
||||
'target_id' => $id,
|
||||
'status' => $params['status'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 获取关系列表
|
||||
public function list()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = Relation::alias('r')
|
||||
->join([UserModel::$tableName => 'u'], 'u.id=r.target_id')
|
||||
->field('r.*,u.avatar,u.gender,u.nickname')
|
||||
->where('user_id', $this->auth->id);
|
||||
if (isset($params['status'])) {
|
||||
$query->where('r.status', $params['status']);
|
||||
} else {
|
||||
$query->where('r.status', '<>', 0);
|
||||
}
|
||||
$list = $query->select();
|
||||
foreach ($list as &$l) {
|
||||
$l['content'] = json_decode($l['content'] ?? '[]', true);
|
||||
}
|
||||
|
||||
$this->success('Success', $list);
|
||||
}
|
||||
}
|
||||
|
||||
282
addons/shopro/controller/zy/Activity.php
Normal file
282
addons/shopro/controller/zy/Activity.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Club;
|
||||
use app\admin\model\zy\Stadium;
|
||||
use app\admin\model\zy\game\Game;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\shopro\Category;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\game\GameJoin;
|
||||
use think\exception\ValidateException;
|
||||
use app\admin\model\shopro\goods\Goods;
|
||||
use app\admin\model\zy\game\Participant;
|
||||
use addons\shopro\service\order\OrderCreate;
|
||||
use app\admin\controller\shopro\traits\SkuPrice;
|
||||
|
||||
class Activity extends Base
|
||||
{
|
||||
use SkuPrice;
|
||||
|
||||
protected $noNeedLogin = ['index', 'view', 'test'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new \app\admin\model\zy\game\Activity;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = $this->model->alias('a')
|
||||
->join([Stadium::$tableName => 's'], 's.id = a.gym_id', 'LEFT')
|
||||
->join([Club::$tableName => 'c'], 'c.id = a.club_id', 'LEFT')
|
||||
->field('a.*, s.name as gym_name, c.name as club_name');
|
||||
if (isset($params['name'])) {
|
||||
$query->where('a.name', 'like', '%' . $params['name'] . '%');
|
||||
}
|
||||
if (isset($params['gym_id'])) {
|
||||
$query->where('a.gym_id', $params['gym_id']);
|
||||
}
|
||||
if (isset($params['club_id'])) {
|
||||
$query->where('a.club_id', $params['club_id']);
|
||||
}
|
||||
if (isset($params['week'])) {
|
||||
$query->where('week', $params['week']);
|
||||
}
|
||||
if (isset($params['pid'])) {
|
||||
$query->where('pid', $params['pid']);
|
||||
} else {
|
||||
$query->where('pid', 0);
|
||||
}
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$v) {
|
||||
$v['public_time'] = json_decode($v['public_time'] ?? '[]', true);
|
||||
$v['join_start_time'] = json_decode($v['join_start_time'] ?? '[]', true);
|
||||
$v['join_end_time'] = json_decode($v['join_end_time'] ?? '[]', true);
|
||||
$v['quit_time'] = json_decode($v['quit_time'] ?? '[]', true);
|
||||
$v['cost'] = json_decode($v['cost'] ?? '[]', true);
|
||||
$v['referee'] = explode(',', $v['referee'] ?? '');
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = $this->model->get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
|
||||
$model['public_time'] = json_decode($model['public_time'] ?? '[]', true);
|
||||
$model['join_start_time'] = json_decode($model['join_start_time'] ?? '[]', true);
|
||||
$model['join_end_time'] = json_decode($model['join_end_time'] ?? '[]', true);
|
||||
$model['quit_time'] = json_decode($model['quit_time'] ?? '[]', true);
|
||||
$model['cost'] = json_decode($model['cost'] ?? '[]', true);
|
||||
$model['referee'] = explode(',', $model['referee'] ?? '');
|
||||
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$category = new Category;
|
||||
$category->name = $params['name'];
|
||||
$category->parent_id = 157;
|
||||
$category->description = '报名费商品';
|
||||
$category->save();
|
||||
foreach ($this->model->costKey as $key => $val) {
|
||||
if (isset($params['cost'][$key])) {
|
||||
$goods = new Goods;
|
||||
$goods->category_ids = $category->id;
|
||||
$goods->subtitle = $key;
|
||||
$goods->title = $val;
|
||||
$goods->type = 'virtual';
|
||||
$goods->limit_type = 'none';
|
||||
$goods->dispatch_type = 'autosend';
|
||||
$goods->dispatch_id = 2;
|
||||
$goods->is_sku = 0;
|
||||
$goods->original_price = $params['cost'][$key];
|
||||
$goods->price = $params['cost'][$key];
|
||||
$goods->save();
|
||||
$this->zySku($goods, 'add');
|
||||
} else {
|
||||
throw new Exception('请填写' . $val);
|
||||
}
|
||||
}
|
||||
$params['public_time'] = json_encode($params['public_time'] ?? []);
|
||||
$params['join_start_time'] = json_encode($params['join_start_time'] ?? []);
|
||||
$params['join_end_time'] = json_encode($params['join_end_time'] ?? []);
|
||||
$params['quit_time'] = json_encode($params['quit_time'] ?? []);
|
||||
$params['cost']['goods_category_id'] = $category->id;
|
||||
$params['cost'] = json_encode($params['cost'] ?? []);
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (empty($result)) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = $this->model->get($params['id']);
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$cost = json_decode($model->cost, true);
|
||||
$goods = Goods::where('category_ids', $cost['goods_category_id'])->select();
|
||||
foreach ($this->model->costKey as $key => $val) {
|
||||
if (isset($params['cost'][$key])) {
|
||||
foreach ($goods as $g) { //更新报名费价格
|
||||
if ($g['title'] == $val && $g['price'] != $params['cost'][$key]) {
|
||||
$g->save(['price' => $params['cost'][$key]]);
|
||||
$this->zySku($g, 'edit');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception('请填写' . $val);
|
||||
}
|
||||
}
|
||||
$params['public_time'] = json_encode($params['public_time'] ?? []);
|
||||
$params['join_start_time'] = json_encode($params['join_start_time'] ?? []);
|
||||
$params['join_end_time'] = json_encode($params['join_end_time'] ?? []);
|
||||
$params['quit_time'] = json_encode($params['quit_time'] ?? []);
|
||||
$params['cost']['goods_category_id'] = $cost['goods_category_id'];
|
||||
$params['cost'] = json_encode($params['cost'] ?? []);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = $model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (empty($result)) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 启动周期性活动创建比赛任务
|
||||
public function test()
|
||||
{
|
||||
if (!\think\Cache::has('addons\shopro\job\Test@zy')) {
|
||||
$res = \think\Queue::push('\addons\shopro\job\Test@zy', time(), 'shopro');
|
||||
\think\Cache::set('addons\shopro\job\Test@zy', $res);
|
||||
$this->success('Success', $res);
|
||||
}
|
||||
$this->success('Success', '任务已存在');
|
||||
}
|
||||
|
||||
// 比赛报名
|
||||
public function gameJoin()
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
if (isset($params['game_id'])) {
|
||||
$game = Game::get($params['game_id']);
|
||||
} else {
|
||||
$game = Game::where('id', $params['act_id'] ?? NULL)
|
||||
->where('week', $params['week'] ?? NULL)
|
||||
->where('date', $params['date'] ?? NULL)
|
||||
->find();
|
||||
}
|
||||
if (empty($game)) {
|
||||
$this->error('活动不存在');
|
||||
}
|
||||
$currentTime = date('Y-m-d H:i:s');
|
||||
if ($game['join_start_time'] > $currentTime || $game['join_end_time'] < $currentTime) {
|
||||
$this->error('不在报名时间');
|
||||
}
|
||||
if (empty($params['users']) || !is_array($params['users']) || empty($params['goods_list']) || !is_array($params['goods_list'])) {
|
||||
$this->error('请核对报名人员');
|
||||
}
|
||||
$join = GameJoin::where(['game_id' => $game['id'], 'user_id' => $this->auth->id])->where('status', '>', -1)->find();
|
||||
if (!empty($join)) {
|
||||
$this->error('您已报名此活动');
|
||||
}
|
||||
$order = GameJoin::where('game_id', $game['id'])->count();
|
||||
$gender = ['man' => 0, 'woman' => 0];
|
||||
$user = auth_user();
|
||||
$participant = $msgs = [];
|
||||
foreach ($params['users'] as $u) {
|
||||
$order++;
|
||||
$participant[] = [
|
||||
'user_id' => $u['user_id'],
|
||||
'gender' => $u['gender'],
|
||||
'avatar' => $u['avatar'],
|
||||
'name' => $u['nickname'],
|
||||
'game_id' => $game['id'],
|
||||
'signin' => 0,
|
||||
'order' => $order,
|
||||
'status' => ($order > $game['limit_num']) ? 0 : 1, //超过报名人数为候补
|
||||
];
|
||||
if ($u['gender'] == 0) {
|
||||
$gender['woman'] += 1;
|
||||
} else {
|
||||
$gender['man'] += 1;
|
||||
}
|
||||
$msgs[] = [
|
||||
'type' => 1,
|
||||
'name' => '系统消息',
|
||||
'avatar' => '',
|
||||
'from_id' => 0,
|
||||
'user_id' => $u['user_id'],
|
||||
'content' => json_encode([
|
||||
'msgType' => 1,
|
||||
'content' => $user['nickname'] . ' 帮你报名了组球',
|
||||
'game_id' => $game['id'],
|
||||
'act_id' => $game['act_id'],
|
||||
])
|
||||
];
|
||||
}
|
||||
foreach ($gender as $k => $v) {
|
||||
if ($params['goods_list'][$k]['goods_num'] != $v) {
|
||||
$this->error('报名人数错误');
|
||||
}
|
||||
}
|
||||
$cost = json_decode($game['cost'], true);
|
||||
if (!empty($cost['type']) && ($cost['type'] == 10 || $cost['type'] == 30)) {
|
||||
$orderCreate = new OrderCreate($params);
|
||||
$result = $orderCreate->calc('create');
|
||||
$order = $orderCreate->create($result);
|
||||
$join = new GameJoin;
|
||||
$join->allowField(true)->save([
|
||||
'act_id' => $game['act_id'],
|
||||
'game_id' => $game['id'],
|
||||
'user_id' => $this->auth->id,
|
||||
'order_id' => $order['id'],
|
||||
'status' => 0, //待支付
|
||||
'users' => json_encode($params['users'] ?? [])
|
||||
]);
|
||||
}
|
||||
foreach ($participant as &$p) {
|
||||
$p['game_join_id'] = $join->id;
|
||||
}
|
||||
(new Participant)->insertAll($participant);
|
||||
(new Message())->insertAll($msgs);
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
$this->success('Success', $order ?? []);
|
||||
}
|
||||
}
|
||||
73
addons/shopro/controller/zy/Base.php
Normal file
73
addons/shopro/controller/zy/Base.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\exception\PDOException;
|
||||
use addons\shopro\controller\Common;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
class Base extends Common
|
||||
{
|
||||
protected $noNeedLogin = ['index'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
protected $model;
|
||||
protected $user;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->user = auth_user();
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
$model = $this->model->get($params['id']);
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = $model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = $this->model->get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
}
|
||||
289
addons/shopro/controller/zy/Circle.php
Normal file
289
addons/shopro/controller/zy/Circle.php
Normal file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Club;
|
||||
use app\admin\model\zy\Menber;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\zy\circle\Likes;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\link\Relation;
|
||||
use app\admin\model\zy\circle\Comment;
|
||||
use think\exception\ValidateException;
|
||||
use app\admin\model\zy\circle\Circle as CircleModel;
|
||||
|
||||
class Circle extends Base
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
|
||||
$sub = CircleModel::alias('c')
|
||||
->join([Likes::$tableName => 'l'], 'c.id = l.circle_id', 'LEFT')
|
||||
->field("c.*,JSON_ARRAYAGG(JSON_OBJECT(
|
||||
'id', l.id,
|
||||
'user_id', l.user_id,
|
||||
'nickname', l.nickname,
|
||||
'avatar', l.avatar,
|
||||
'gender', l.gender
|
||||
)) AS likes")->group('c.id')->buildSql();
|
||||
$query = Comment::alias('m')
|
||||
->join([$sub => 'c'], 'c.id = m.circle_id', 'RIGHT')
|
||||
->field("c.*,
|
||||
JSON_ARRAYAGG(JSON_OBJECT(
|
||||
'id', m.id,
|
||||
'pid', m.pid,
|
||||
'puser_id', m.puser_id,
|
||||
'pnickname', m.pnickname,
|
||||
'user_id', m.user_id,
|
||||
'nickname', m.nickname,
|
||||
'avatar', m.avatar,
|
||||
'gender', m.gender,
|
||||
'content', m.content,
|
||||
'create_time', m.create_time
|
||||
)) AS comment")->group('c.id');
|
||||
if (isset($params['status'])) {
|
||||
$query->where('c.status', $params['status']);
|
||||
} else {
|
||||
$query->where('c.status', 1);
|
||||
}
|
||||
if (isset($params['club_id'])) {
|
||||
$query->where('c.club_id', $params['club_id']);
|
||||
}
|
||||
if (isset($params['user_id'])) {
|
||||
$query->where('c.user_id', $params['user_id']);
|
||||
}
|
||||
if (isset($params['friend'])) {
|
||||
$friend = Relation::where('user_id', $this->auth->id)->where('status', 'IN', explode(',', $params['friend']))->column('target_id');
|
||||
$query->where('c.user_id', 'IN', $friend);
|
||||
}
|
||||
$query->order(['c.top' => 'desc', 'c.create_time' => 'desc']);
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$r) {
|
||||
$r['likes'] = json_decode($r['likes'], true);
|
||||
if (count($r['likes']) == 1 && empty($r['likes'][0]['id'])) $r['likes'] = [];
|
||||
$r['comment'] = buildTree(json_decode($r['comment'], true));
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = CircleModel::get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if (empty($params['content'])) {
|
||||
$this->error('内容不能为空');
|
||||
}
|
||||
$user = auth_user();
|
||||
$club = Menber::alias('m')->join([Club::$tableName => 'c'], 'm.club_id=c.id')
|
||||
->field('c.name')
|
||||
->where(['m.club_id' => $params['club_id'], 'm.user_id' => $user['id']])
|
||||
->where('m.role', '>', 0)->find();
|
||||
if (empty($club)) {
|
||||
$this->error('你无权在此俱乐部发布');
|
||||
}
|
||||
$params['user_id'] = $user['id'];
|
||||
$params['nickname'] = $user['nickname'];
|
||||
$params['avatar'] = $user['avatar'];
|
||||
$params['gender'] = $user['gender'];
|
||||
$params['club_name'] = $club['name'];
|
||||
$params['status'] = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = (new CircleModel)->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 点赞
|
||||
public function like()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$circle = CircleModel::get($params['circle_id']);
|
||||
if (empty($circle)) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
$user = auth_user();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$like = Likes::get(['circle_id' => $params['circle_id'], 'user_id' => $user['id']]);
|
||||
if (empty($like)) { // 点赞
|
||||
(new Likes)->allowField(true)->save([
|
||||
'circle_id' => $params['circle_id'],
|
||||
'user_id' => $user['id'],
|
||||
'nickname' => $user['nickname'],
|
||||
'avatar' => $user['avatar'],
|
||||
'gender' => $user['gender'],
|
||||
]);
|
||||
// (new Message())->allowField(true)->save([ // 消息通知
|
||||
// 'type' => 1,
|
||||
// 'name' => '互动消息',
|
||||
// 'avatar' => '',
|
||||
// 'from_id' => 0,
|
||||
// 'user_id' => $circle->user_id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '点赞',
|
||||
// 'content' => $user['nickname'] . '点赞了你的帖子',
|
||||
// 'circle_id' => $circle->id
|
||||
// ])
|
||||
// ]);
|
||||
} else { // 取消点赞
|
||||
$like->delete();
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 评论
|
||||
public function comment()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$circle = CircleModel::get($params['circle_id']);
|
||||
if (empty($circle)) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
if (empty($params['content'])) {
|
||||
$this->error('内容不能为空');
|
||||
}
|
||||
$pcomment = Comment::get($params['pid']);
|
||||
if (!empty($params['pid']) && empty($pcomment)) {
|
||||
$this->error('回复的评论不存在');
|
||||
}
|
||||
$user = auth_user();
|
||||
Db::startTrans();
|
||||
try {
|
||||
(new Comment)->allowField(true)->save([
|
||||
'circle_id' => $params['circle_id'],
|
||||
'pid' => $params['pid'],
|
||||
'puser_id' => $pcomment['user_id'] ?? 0,
|
||||
'pnickname' => $pcomment['nickname'] ?? '',
|
||||
'user_id' => $user['id'],
|
||||
'nickname' => $user['nickname'],
|
||||
'avatar' => $user['avatar'],
|
||||
'gender' => $user['gender'],
|
||||
'content' => $params['content'],
|
||||
]);
|
||||
// (new Message())->allowField(true)->save([ // 消息通知
|
||||
// 'type' => 1,
|
||||
// 'name' => '互动消息',
|
||||
// 'avatar' => '',
|
||||
// 'from_id' => 0,
|
||||
// 'target_id' => $circle->user_id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '评论',
|
||||
// 'content' => $user['nickname'] . '评论了你的帖子',
|
||||
// 'circle_id' => $circle->id
|
||||
// ])
|
||||
// ]);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
public function approve()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$ids = explode(',', $params['ids'] ?? '');
|
||||
if (empty($ids) || empty($params['club_id'])) {
|
||||
$this->error('参数错误');
|
||||
}
|
||||
if (empty($params['status']) || ($params['status'] != -1 && $params['status'] != 1)) {
|
||||
$this->error('status:参数错误');
|
||||
}
|
||||
$member = Menber::get(['club_id' => $params['club_id'], 'user_id' => $this->auth->id]);
|
||||
if (empty($member) || $member->role < 2) {
|
||||
$this->error('无权审核');
|
||||
}
|
||||
$models = CircleModel::where('id', 'IN', $ids)->where('club_id', $params['club_id'])->select();
|
||||
if (empty($models)) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($models as $model) {
|
||||
if ($model->status != 0) {
|
||||
throw new Exception($model->id . ' 此记录不在待审核状态');
|
||||
}
|
||||
$model->save(['status' => $params['status']]);
|
||||
// (new Message())->allowField(true)->save([ // 消息通知
|
||||
// 'type' => 3,
|
||||
// 'name' => '通知消息',
|
||||
// 'avatar' => '',
|
||||
// 'from_id' => 1,
|
||||
// 'user_id' => $model->user_id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '影圈审核',
|
||||
// 'result' => ($params['status'] == 1) ? '通过' : '不通过',
|
||||
// 'circle_id' => $model->id
|
||||
// ])
|
||||
// ]);
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success('Success', count($models));
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$ids = explode(',', $params['ids'] ?? '');
|
||||
if (empty($ids) || empty($params['club_id'])) {
|
||||
$this->error('参数错误');
|
||||
}
|
||||
$member = Menber::get(['club_id' => $params['club_id'], 'user_id' => $this->auth->id]);
|
||||
if (empty($member) || $member->role < 2) {
|
||||
$this->error('无权删除');
|
||||
}
|
||||
$result = CircleModel::where('id', 'IN', $ids)->where('club_id', $params['club_id'])->delete();
|
||||
|
||||
$this->success('Success', $result);
|
||||
}
|
||||
|
||||
|
||||
public function top()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = CircleModel::get($params['id'] ?? null);
|
||||
if (empty($model)) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
$member = Menber::get(['club_id' => $model['club_id'], 'user_id' => $this->auth->id]);
|
||||
if (empty($member) || $member->role < 2) {
|
||||
$this->error('无权操作');
|
||||
}
|
||||
$result = CircleModel::where('club_id', $model['club_id'])->column('max(top) as top');
|
||||
$model->save(['top' => $result[0] + 1]);
|
||||
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
}
|
||||
429
addons/shopro/controller/zy/Club.php
Normal file
429
addons/shopro/controller/zy/Club.php
Normal file
@@ -0,0 +1,429 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Menber;
|
||||
use app\admin\model\zy\Stadium;
|
||||
use app\admin\model\zy\game\Game;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\zy\link\Apply;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\link\Visitor;
|
||||
use app\admin\model\shopro\user\User;
|
||||
use app\admin\model\zy\game\Activity;
|
||||
use think\exception\ValidateException;
|
||||
use app\admin\model\zy\game\Participant;
|
||||
use app\admin\model\zy\link\Relation;
|
||||
|
||||
class Club extends Base
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new \app\admin\model\zy\Club;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$sub = Game::alias('g')
|
||||
->join([Participant::$tableName => 'p'], 'p.game_id=g.id', 'LEFT')
|
||||
->field('g.id,g.pid,g.club_id,g.act_id,g.date,g.name,g.start_time,g.end_time,g.cost,JSON_ARRAYAGG(p.avatar) as avatar,count(p.id) as join_num')
|
||||
->where('g.date', '>=', date('Y-m-d'))
|
||||
->order('g.date', 'asc')->group('g.id')->buildSql();
|
||||
$query = $this->model->alias('c')
|
||||
->join([Stadium::$tableName => 's'], 's.id = c.gym_id', 'LEFT')
|
||||
->join([$sub => 'g'], 'g.club_id = c.id', 'LEFT')
|
||||
->field("c.*, s.position,s.name as gym_name,JSON_ARRAYAGG(JSON_OBJECT(
|
||||
'id', g.id,
|
||||
'pid', g.pid,
|
||||
'act_id', g.act_id,
|
||||
'date', g.date,
|
||||
'name', g.name,
|
||||
'start_time', g.start_time,
|
||||
'end_time', g.end_time,
|
||||
'join_num', g.join_num,
|
||||
'avatar', g.avatar,
|
||||
'cost', g.cost
|
||||
)) AS games")->group('c.id');
|
||||
if (isset($params['name'])) {
|
||||
$query->where('c.name', 'like', '%' . $params['name'] . '%');
|
||||
}
|
||||
if (isset($params['tag'])) {
|
||||
$query->where('c.tags', 'like', '%' . $params['tag'] . '%');
|
||||
}
|
||||
if (isset($params['gym_id'])) {
|
||||
$query->where('c.gym_id', $params['gym_id']);
|
||||
}
|
||||
if (isset($params['order'])) {
|
||||
$query->order($params['order'], $params['sort'] ?? NULL);
|
||||
}
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$l) {
|
||||
$games = json_decode($l['games'], true);
|
||||
if (count($games) == 1 && empty($games[0]['id'])) $games = [];
|
||||
foreach ($games as &$g) {
|
||||
$g['cost'] = json_decode($g['cost'], true);
|
||||
}
|
||||
$l['games'] = $games;
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = $this->model->get($this->request->param('id'))->toarray();
|
||||
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$menber = Menber::alias('m')
|
||||
->join([User::$tableName => 'u'], 'u.id = m.user_id')
|
||||
->where('club_id', $model['id'])->field('gender,count(*) as num')->group('u.gender')
|
||||
->column('count(*) as num', 'gender');
|
||||
$model['gender0'] = $menber[0] ?? 0;
|
||||
$model['gender1'] = $menber[1] ?? 0;
|
||||
$this->model->where('id', $model['id'])->setInc('attention');
|
||||
$user = auth_user();
|
||||
$visitor = Visitor::where('type', 0)->where('obj_id', $model['id'])->where('user_id', $user['id'])->find();
|
||||
if (empty($visitor)) {
|
||||
$visitor = new Visitor;
|
||||
}
|
||||
$visitor->allowField(true)->save([
|
||||
'type' => 0,
|
||||
'obj_id' => $model['id'],
|
||||
'user_id' => $user['id'],
|
||||
'nickname' => $user['nickname'],
|
||||
'avatar' => $user['avatar'],
|
||||
'gender' => $user['gender'],
|
||||
'times' => empty($visitor->times) ? 1 : $visitor->times + 1
|
||||
]);
|
||||
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$params['president'] = $this->auth->id;
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
$menber = new Menber;
|
||||
$menber->allowField(true)->save([
|
||||
'club_id' => $this->model->id,
|
||||
'user_id' => $this->auth->id,
|
||||
'role' => 3
|
||||
]);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success', $result);
|
||||
}
|
||||
|
||||
// 获取俱乐部成员
|
||||
public function menber()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$sub = Relation::field('user_id,target_id,content')->where('user_id', $this->auth->id)->buildSql();
|
||||
$query = Db::table(Menber::$tableName)->alias('m')
|
||||
->join([User::$tableName => 'u'], 'u.id = m.user_id', 'LEFT')
|
||||
->join([$sub => 'r'], 'r.target_id = m.user_id', 'LEFT')
|
||||
->field('m.*,u.avatar,u.gender,u.nickname,u.wechat,u.qq,u.mobile,r.content');
|
||||
if (empty($params['id'])) {
|
||||
return $this->error('参数错误');
|
||||
}
|
||||
$query->where('club_id', $params['id']);
|
||||
if (isset($params['role'])) {
|
||||
$query->where('role', 'IN', explode(',', $params['role']));
|
||||
} else {
|
||||
$query->where('role', '>', 0);
|
||||
}
|
||||
if (isset($params['nickname'])) {
|
||||
$query->where('nickname', 'LIKE', '%' . $params['nickname'] . '%');
|
||||
}
|
||||
if (isset($params['order'])) {
|
||||
$query->order($params['order'], $params['sort'] ?? NULL);
|
||||
}
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$l) {
|
||||
$l['content'] = json_decode($l['content'] ?? '[]', true);
|
||||
}
|
||||
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
// 获取俱乐部活动
|
||||
public function activity()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = Db::table(Activity::$tableName)
|
||||
->where('pid', 0) //主活动
|
||||
->field('');
|
||||
if (isset($params['club_id'])) {
|
||||
$query->where('club_id', $params['club_id']);
|
||||
}
|
||||
if (isset($params['week'])) {
|
||||
$query->where('week', $params['week']);
|
||||
}
|
||||
$res = $query->select();
|
||||
|
||||
$this->success('Success', $res);
|
||||
}
|
||||
|
||||
// 申请加入俱乐部
|
||||
public function apply()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$club = $this->model->get($params['club_id']);
|
||||
if (empty($club)) {
|
||||
return $this->error('俱乐部不存在');
|
||||
}
|
||||
if ($club['join_type'] > 1) {
|
||||
$this->error('该俱乐部不允许申请');
|
||||
}
|
||||
$user = Menber::get(['club_id' => $club->id, 'user_id' => $this->auth->id]);
|
||||
if (empty($user)) {
|
||||
$user = new Menber;
|
||||
} else {
|
||||
if ($user['role'] > 0) {
|
||||
$this->error('您已经是俱乐部成员,无需重复申请');
|
||||
} else if ($user['role'] == -1) {
|
||||
$this->error('您已被管理员拉黑');
|
||||
}
|
||||
}
|
||||
if ($club['join_type'] == 0) {
|
||||
$user->allowField(true)->save([
|
||||
'club_id' => $club->id,
|
||||
'user_id' => $this->auth->id,
|
||||
'role' => 1
|
||||
]);
|
||||
} else {
|
||||
if (Apply::get(['type' => 1, 'user_id' => $this->auth->id, 'target_id' => $club->id, 'status' => 1])) {
|
||||
return $this->error('申请审核中');
|
||||
}
|
||||
$apply = new Apply;
|
||||
$apply->allowField(true)->save([ // 记录申请
|
||||
'type' => 1,
|
||||
'user_id' => $this->auth->id,
|
||||
'target_id' => $club->id,
|
||||
'content' => json_encode(['reason' => $params['reason'] ?? '']),
|
||||
'reason' => $params['reason'],
|
||||
'status' => 1
|
||||
]);
|
||||
// (new Message())->allowField(true)->save([ // 消息通知
|
||||
// 'type' => 3,
|
||||
// 'name' => $club->name,
|
||||
// 'avatar' => $club->logo,
|
||||
// 'from_id' => $club->id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '俱乐部加入申请',
|
||||
// '俱乐部名称' => $club->name,
|
||||
// '申请人' => $this->user->nickname,
|
||||
// '申请时间' => date('Y-m-d H:i:s'),
|
||||
// 'reason' => $params['reason'] ?? '',
|
||||
// 'apply_id' => $apply->id
|
||||
// ])
|
||||
// ]);
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
//join_type 0:'开放加入,无需审核',1:'开放申请,审核加入',2:'会员邀请,无需审核',3:'会员邀请,审核加入',4:'仅管理员邀请,无需审核'
|
||||
|
||||
// 邀请加入俱乐部
|
||||
public function invite()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$club = $this->model->get($params['club_id']);
|
||||
if (empty($club)) {
|
||||
return $this->error('俱乐部不存在');
|
||||
}
|
||||
$user = User::get($params['user_id']);
|
||||
if (empty($user)) {
|
||||
return $this->error('用户不存在');
|
||||
}
|
||||
$menber = Menber::where('club_id', $params['club_id'])
|
||||
->where('user_id', $this->auth->id)
|
||||
->where('role', '>', 0)->find();
|
||||
if (empty($menber)) {
|
||||
$this->error('您无权邀请加入俱乐部');
|
||||
}
|
||||
$invate = Menber::get(['user_id' => $params['user_id'], 'club_id' => $params['club_id']]);
|
||||
if (empty($invate)) {
|
||||
$invate = new Menber;
|
||||
} else {
|
||||
if ($invate['role'] > 0) {
|
||||
$this->error('用户已在俱乐部');
|
||||
} else if ($invate['role'] == -1) {
|
||||
$this->error('用户已被管理员拉黑');
|
||||
}
|
||||
}
|
||||
if ($menber['role'] > 1 || $club['join_type'] == 0 || $club['join_type'] == 2) { // 管理员或者开放加入
|
||||
$invate->allowField(true)->save([
|
||||
'club_id' => $club->id,
|
||||
'user_id' => $user->id,
|
||||
'role' => 1
|
||||
]);
|
||||
} else {
|
||||
if (Apply::get(['type' => 1, 'user_id' => $this->auth->id, 'target_id' => $user->id, 'status' => 1])) {
|
||||
return $this->error('申请审核中');
|
||||
}
|
||||
$apply = new Apply;
|
||||
$apply->allowField(true)->save([ // 记录申请
|
||||
'type' => 1,
|
||||
'user_id' => $user->id,
|
||||
'target_id' => $club->id,
|
||||
'content' => json_encode(['reason' => $params['reason'] ?? '']),
|
||||
'reason' => $params['reason'],
|
||||
'status' => 1
|
||||
]);
|
||||
// (new Message())->allowField(true)->save([ // 消息通知
|
||||
// 'type' => 3,
|
||||
// 'name' => $club->name,
|
||||
// 'avatar' => $club->logo,
|
||||
// 'from_id' => $club->id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '俱乐部加入申请',
|
||||
// '俱乐部名称' => $club->name,
|
||||
// '申请人' => $user->nickname,
|
||||
// '申请时间' => date('Y-m-d H:i:s'),
|
||||
// 'reason' => $params['reason'] ?? '',
|
||||
// 'apply_id' => $apply->id,
|
||||
// ])
|
||||
// ]);
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 获取申请列表
|
||||
public function applyList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$club = $this->model->get($params['club_id']);
|
||||
if (empty($club)) {
|
||||
return $this->error('俱乐部不存在');
|
||||
}
|
||||
$menber = Menber::where('club_id', $params['club_id'])
|
||||
->where('user_id', $this->auth->id)
|
||||
->where('role', '>', 1)->find();
|
||||
if (empty($menber)) {
|
||||
$this->error('您无权处理申请');
|
||||
}
|
||||
$query = Apply::where('type', 1)->where('target_id', $params['club_id']);
|
||||
if (isset($params['status'])) {
|
||||
$query->where('status', $params['status']);
|
||||
}
|
||||
$applyList = $query->select();
|
||||
$this->success('Success', $applyList);
|
||||
}
|
||||
|
||||
// 处理申请
|
||||
public function handle()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$apply = Apply::get(['id' => $params['apply_id'], 'status' => 1]);
|
||||
if (empty($apply)) {
|
||||
return $this->error('申请记录不存在');
|
||||
}
|
||||
$menber = Menber::where('club_id', $apply['target_id'])
|
||||
->where('user_id', $this->auth->id)
|
||||
->where('role', '>', 1)->find();
|
||||
if (empty($menber)) {
|
||||
$this->error('您无权处理申请');
|
||||
}
|
||||
if ($apply['status'] != 1) {
|
||||
return $this->error('该申请已处理');
|
||||
}
|
||||
if ($params['status'] == 2) {
|
||||
(new Menber)->allowField(true)->save([
|
||||
'club_id' => $apply['target_id'],
|
||||
'user_id' => $apply['user_id'],
|
||||
'role' => 1
|
||||
]);
|
||||
}
|
||||
$apply->allowField(true)->save([
|
||||
'status' => $params['status'],
|
||||
'reply' => $params['reply'] ?? ''
|
||||
]);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 设置成员角色
|
||||
public function setmember()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$user = Menber::where('club_id', $params['club_id'])
|
||||
->where('user_id', $this->auth->id)
|
||||
->where('role', '>', 1)->find();
|
||||
if (empty($user)) {
|
||||
$this->error('无权限');
|
||||
}
|
||||
if (isset($params['role']) && ($params['role'] < -1 || $params['role'] > 2)) {
|
||||
$this->error('非法角色');
|
||||
}
|
||||
$user_ids = explode(',', $params['user_id'] ?? '');
|
||||
$menber = Menber::where('club_id', $params['club_id'])->where('user_id', 'IN', $user_ids)->select();
|
||||
if (empty($menber)) {
|
||||
$this->error('成员不存在');
|
||||
}
|
||||
if ($user['role'] != 3) {
|
||||
if (isset($params['role']) && $params['role'] > 1) {
|
||||
$this->error('只有会长才能设置管理员');
|
||||
}
|
||||
foreach ($menber as $m) {
|
||||
if ($m['role'] > 1) $this->error('只有会长才能修改管理员');
|
||||
}
|
||||
} else {
|
||||
foreach ($menber as $m) {
|
||||
if ($m['role'] == 3 && isset($params['role'])) {
|
||||
$this->error('不可修改会长角色');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$update = [];
|
||||
if (isset($params['role'])) $update['role'] = $params['role'];
|
||||
if (isset($params['remark'])) $update['remark'] = $params['remark'];
|
||||
if (isset($params['tags'])) $update['tags'] = $params['tags'];
|
||||
Db::startTrans();
|
||||
try {
|
||||
Menber::where('club_id', $params['club_id'])->where('user_id', 'IN', $user_ids)->update($update);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
}
|
||||
495
addons/shopro/controller/zy/Game.php
Normal file
495
addons/shopro/controller/zy/Game.php
Normal file
@@ -0,0 +1,495 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Club;
|
||||
use app\admin\model\zy\Menber;
|
||||
use app\admin\model\zy\Stadium;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\zy\link\Message;
|
||||
use app\admin\model\zy\game\Activity;
|
||||
use app\admin\model\zy\game\GameJoin;
|
||||
use app\admin\model\zy\game\GameMatch;
|
||||
use think\exception\ValidateException;
|
||||
use app\admin\model\zy\game\Participant;
|
||||
use addons\shopro\service\order\OrderRefund;
|
||||
|
||||
|
||||
class Game extends Base
|
||||
{
|
||||
protected $noNeedLogin = ['view'];
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new \app\admin\model\zy\game\Game;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = $this->model->alias('g')
|
||||
->join([Participant::$tableName => 'p'], 'p.game_id=g.id', 'LEFT')
|
||||
->join([Activity::$tableName => 'a'], 'a.id=g.act_id', 'LEFT')
|
||||
->join([Stadium::$tableName => 's'], 's.id = g.gym_id', 'LEFT')
|
||||
->join([Club::$tableName => 'c'], 'c.id = g.club_id', 'LEFT')
|
||||
->field('g.*,a.type,s.name as gym_name,c.name as club_name,JSON_ARRAYAGG(p.avatar) as avatar,count(p.id) as join_num');
|
||||
if (isset($params['name'])) {
|
||||
$query->where('g.name', 'like', '%' . $params['name'] . '%');
|
||||
}
|
||||
if (isset($params['club_id'])) {
|
||||
$query->where('g.club_id', $params['club_id']);
|
||||
}
|
||||
if (isset($params['week'])) {
|
||||
$query->where('g.week', $params['week']);
|
||||
}
|
||||
if (isset($params['pid'])) {
|
||||
$query->where('g.pid', $params['pid']);
|
||||
} else {
|
||||
$query->where('g.pid', 0);
|
||||
}
|
||||
if (isset($params['public_time'])) {
|
||||
$query->where('g.public_time', $params['public_time']);
|
||||
} else {
|
||||
$query->where('g.public_time', '<=', date('Y-m-d H:i:s'));
|
||||
}
|
||||
if (isset($params['page'])) {
|
||||
$pageSize = intval($params['pageSize'] ?? 10);
|
||||
$offeset = (intval($params['page']) - 1) * $pageSize;
|
||||
$query->limit($offeset, $pageSize);
|
||||
}
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$v) {
|
||||
$v['cost'] = json_decode($v['cost'] ?? '[]', true);
|
||||
$v['avatar'] = json_decode($v['avatar'] ?? '[]', true);
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = $this->model->get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
|
||||
$this->model->where('id', $model['id'])->setInc('attention');
|
||||
$model['cost'] = json_decode($model['cost'] ?? '[]', true);
|
||||
$model['referee'] = explode(',', $model['referee'] ?? '');
|
||||
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
// 退坑
|
||||
public function quit()
|
||||
{
|
||||
$model = $this->model->get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
if ($model['status'] > 1) {
|
||||
$this->error('活动已开始或结束,不能退出');
|
||||
}
|
||||
if ($model['status'] == -1) {
|
||||
$this->error('活动已取消');
|
||||
}
|
||||
$join = GameJoin::where('user_id', $this->auth->id)->find();
|
||||
if (empty($join) || $join['status'] == -1) {
|
||||
$this->error('未报名或已取消');
|
||||
}
|
||||
if (date('Y-m-d H:i:s') >= $model['quit_time']) {
|
||||
$this->error('已超过免费退出时间');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$join->save(['status' => -1]);
|
||||
if ($join['status'] == 1) {
|
||||
$order = $this->model->paid()->where('id', $join->order_id)->lock(true)->find();
|
||||
if (!$order) {
|
||||
$this->error('订单不存在或不可退款');
|
||||
}
|
||||
$orderRefund = new OrderRefund($order);
|
||||
$orderRefund->fullRefund(NULL, [
|
||||
'refund_type' => 'back',
|
||||
'remark' => '用户自行退出活动'
|
||||
]);
|
||||
}
|
||||
// (new Message())->save([
|
||||
// 'type' => 1,
|
||||
// 'name' => '系统消息',
|
||||
// 'avatar' => '',
|
||||
// 'from_id' => 0,
|
||||
// 'user_id' => $join->user_id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '退出',
|
||||
// 'content' => '已退出 ' . $model['name'] . ' 活动',
|
||||
// 'game_id' => $model->id
|
||||
// ])
|
||||
// ]);
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 取消活动
|
||||
public function cancle()
|
||||
{
|
||||
$model = $this->model->get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$member = Menber::get(['club_id' => $model->club_id, 'user_id' => $this->auth->id]);
|
||||
if (empty($member) || $member->role < 2) {
|
||||
$this->error('无权取消活动');
|
||||
}
|
||||
if ($model['pid'] != 0) {
|
||||
$this->error('不能取消子活动');
|
||||
}
|
||||
if ($model['status'] > 1) {
|
||||
$this->error('活动已开始或结束,不能取消');
|
||||
}
|
||||
if ($model['status'] == -1) {
|
||||
$this->error('活动已取消');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$model->save(['status' => -1]);
|
||||
(new \app\admin\model\zy\game\Game)->where('pid', $model->id)->update(['status' => -1]);
|
||||
//取消成功,进入退款流程并通知用户
|
||||
$join = GameJoin::where('game_id', $model['id'])->select();
|
||||
$msgs = [];
|
||||
foreach ($join as $j) {
|
||||
$j->save(['status' => -1]);
|
||||
if ($j['status'] == 1) {
|
||||
$order = $this->model->paid()->where('id', $j->order_id)->lock(true)->find();
|
||||
if (!$order) {
|
||||
$this->error('订单不存在或不可退款');
|
||||
}
|
||||
$orderRefund = new OrderRefund($order);
|
||||
$orderRefund->fullRefund(NULL, [
|
||||
'refund_type' => 'back',
|
||||
'remark' => '活动取消,全额退款'
|
||||
]);
|
||||
}
|
||||
// $msgs[] = [
|
||||
// 'type' => 1,
|
||||
// 'name' => '系统消息',
|
||||
// 'avatar' => '',
|
||||
// 'from_id' => 0,
|
||||
// 'user_id' => $j->user_id,
|
||||
// 'content' => json_encode([
|
||||
// 'topic' => '评论',
|
||||
// 'content' => $model['name'] . ' 活动已取消',
|
||||
// 'game_id' => $model->id
|
||||
// ])
|
||||
// ];
|
||||
}
|
||||
|
||||
// (new Message())->insertAll($msgs);;
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 赛制说明
|
||||
public function describe()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$game = $this->model->get($params['id'] ?? NULL);
|
||||
if (empty($game)) {
|
||||
$this->error('比赛不存在');
|
||||
}
|
||||
$gameClass = 'format\\Game' . $game['team_type'] . $game['rule_type'];
|
||||
if (!class_exists($gameClass)) {
|
||||
throw new Exception("赛制文件不存在,请联系管理人员: {$gameClass}");
|
||||
}
|
||||
$format = new $gameClass;
|
||||
if (!$format instanceof \format\GameInterface) {
|
||||
throw new Exception("赛制配置错误,请联系管理人员: {$gameClass}");
|
||||
}
|
||||
$describe = $format->describe();
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
$this->success('Success', $describe);
|
||||
}
|
||||
|
||||
//参与人员列表
|
||||
public function participant()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = Participant::where('game_id', $params['game_id']);
|
||||
if (isset($params['game_join_id'])) {
|
||||
$query->where('game_join_id', $params['game_join_id']);
|
||||
}
|
||||
if (isset($params['status'])) {
|
||||
$query->where('status', $params['status']);
|
||||
} else {
|
||||
$query->where('status', 1);
|
||||
}
|
||||
if (isset($params['gender'])) {
|
||||
$query->where('gender', $params['gender']);
|
||||
}
|
||||
if (isset($params['order'])) {
|
||||
$query->order($params['order'], $params['sort'] ?? NULL);
|
||||
}
|
||||
|
||||
$this->success('Success', $query->select());
|
||||
}
|
||||
|
||||
// 用户
|
||||
public function setUser()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$user = Participant::get($params['id'] ?? NULL);
|
||||
if (empty($user)) {
|
||||
$this->error('用户不存在');
|
||||
}
|
||||
$game = $this->model->get($user['game_id']);
|
||||
$referee = explode(',', $game['referee'] ?? ''); //裁判
|
||||
$menber = Menber::where(['club_id' => $game['club_id'], 'user_id' => $this->auth->id])->where('role', '>', 1)->find();
|
||||
if (empty($menber) && !in_array($this->auth->id, $referee)) {
|
||||
$this->error('您没有权限');
|
||||
}
|
||||
$update['status'] = intval($params['status']);
|
||||
if ($update['status'] > 1 || $update['status'] < -1) {
|
||||
$this->error('status错误');
|
||||
}
|
||||
if (!empty($params['mark'])) {
|
||||
$update['mark'] = $params['mark'];
|
||||
}
|
||||
$user->save($update);
|
||||
$this->success('修改成功');
|
||||
}
|
||||
|
||||
// 获取比赛匹配列表
|
||||
public function macthList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$game = $this->model->get($params['game_id'] ?? NULL);
|
||||
if (empty($game)) {
|
||||
$this->error('比赛不存在');
|
||||
}
|
||||
$dataTime = date('Y-m-d H:i:s');
|
||||
$startTime = $game['date'] . ' ' . $game['start_time'];
|
||||
if ($dataTime < $startTime) {
|
||||
$this->error('比赛时间未开始');
|
||||
}
|
||||
$endTime = $game['date'] . ' ' . $game['end_time'];
|
||||
if ($dataTime > $endTime) {
|
||||
$this->error('比赛时间已结束');
|
||||
}
|
||||
$matchs = GameMatch::where('game_id', $game['id'])->select();
|
||||
if (empty($matchs)) {
|
||||
$participant = Participant::where('game_id', $game['id'])->where('status', 1)->select();
|
||||
$gameClass = 'format\\Game' . $game['team_type'] . $game['rule_type'];
|
||||
if (!class_exists($gameClass)) {
|
||||
throw new Exception("赛制文件不存在,请联系管理人员: {$gameClass}");
|
||||
}
|
||||
$format = new $gameClass;
|
||||
if (!$format instanceof \format\GameInterface) {
|
||||
throw new Exception("赛制配置错误,请联系管理人员: {$gameClass}");
|
||||
}
|
||||
$matchs = $format->match($game, $participant);
|
||||
$res = (new GameMatch)->insertAll($matchs);
|
||||
$matchs = GameMatch::where('game_id', $game['id'])->select();
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage(), $e);
|
||||
}
|
||||
foreach ($matchs as $k => &$m) {
|
||||
if (!empty($params['level']) && $params['level'] != $m['level']) {
|
||||
unset($matchs[$k]);
|
||||
continue;
|
||||
}
|
||||
$m['teamA'] = json_decode($m['teamA'], true);
|
||||
$m['teamB'] = json_decode($m['teamB'], true);
|
||||
}
|
||||
$this->success('Success', $matchs);
|
||||
}
|
||||
|
||||
public function getMacth()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$m = GameMatch::get($params['id'] ?? NULL);
|
||||
if (empty($m)) {
|
||||
$this->error('对阵记录不存在');
|
||||
}
|
||||
$m['teamA'] = json_decode($m['teamA'] ?? '[]', true);
|
||||
$m['teamB'] = json_decode($m['teamB'] ?? '[]', true);
|
||||
$m['round1'] = json_decode($m['round1'] ?? '[]', true);
|
||||
$m['round2'] = json_decode($m['round2'] ?? '[]', true);
|
||||
$m['round3'] = json_decode($m['round3'] ?? '[]', true);
|
||||
$m['winner'] = json_decode($m['winner'] ?? '[]', true);
|
||||
return $this->success('Success', $m);
|
||||
}
|
||||
|
||||
public function scoring()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$match = GameMatch::get($params['id'] ?? NULL);
|
||||
if (empty($match)) {
|
||||
$this->error('对阵记录不存在');
|
||||
}
|
||||
$game = $this->model->get($match['game_id']);
|
||||
$referee = explode(',', $game['referee']?? '');
|
||||
if (empty($referee)) {
|
||||
$this->error('请先设置裁判');
|
||||
}
|
||||
if (!in_array($this->auth->id, $referee)) {
|
||||
$this->error('不是裁判无权计分');
|
||||
}
|
||||
if (empty($params['round']) || ($params['round'] != 1 && $params['round'] != 2 && $params['round'] != 3)) {
|
||||
$this->error('回合(局)数错误');
|
||||
}
|
||||
$round = 'round' . $params['round'];
|
||||
if (!empty($match->$round)) {
|
||||
$this->error('请勿重复提交');
|
||||
}
|
||||
$match->$round = json_encode([
|
||||
'addedA' => $params['addedA'], //队伍B让分
|
||||
'addedB' => $params['addedB'], //队伍A让分
|
||||
'scoreA' => $params['scoreA'], //队伍A得分
|
||||
'scoreB' => $params['scoreB'], //队伍B得分
|
||||
]);
|
||||
$totalA = $params['scoreA'] + $params['addedA'];
|
||||
$totalB = $params['scoreB'] + $params['addedB'];
|
||||
if ($totalA > $totalB) {
|
||||
$match->scoreA = $match->scoreA + 1; //队伍A回合得分加1
|
||||
} else if ($totalA < $totalB) {
|
||||
$match->scoreB = $match->scoreB + 1; //队伍B回合得分加1
|
||||
} else {
|
||||
$this->error('回合(局)内分数不能相等');
|
||||
}
|
||||
if (!empty($match->round1) && !empty($match->round2) && !empty($match->round3)) { //3局结束
|
||||
$match->winner = $match->scoreA > $match->scoreB ? $match->teamA : $match->teamB;
|
||||
}
|
||||
$match->save();
|
||||
// 更新用户得分
|
||||
$teamA = json_decode($match->teamA, true);
|
||||
|
||||
$teamAuser = Participant::where('game_id', $game['id'])
|
||||
->where('user_id', 'IN', array_column($teamA['user'], 'user_id'))
|
||||
->where('status', '>', -1)->select();
|
||||
// dd($teamAuser);
|
||||
foreach ($teamAuser as $u) {
|
||||
$u->team = $teamA['name']; //队伍名
|
||||
$u->score = $totalA; //得分
|
||||
$u->net_score = $params['scoreA']; //净得分
|
||||
$u->save();
|
||||
}
|
||||
$teamB = json_decode($match->teamB, true);
|
||||
$teamBuser = Participant::where('game_id', $game['id'])->where('user_id', 'IN', array_column($teamB['user'], 'user_id'))->select();
|
||||
foreach ($teamBuser as $u) {
|
||||
$u->team = $teamB['name']; //队伍名
|
||||
$u->score = $totalA; //得分
|
||||
$u->net_score = $params['scoreA']; //净得分
|
||||
$u->save();
|
||||
}
|
||||
$undone = GameMatch::where('level', $match['level'])->where('winner', null)->count();
|
||||
if ($undone == 0) { //所有比赛完成,开启下一轮比赛
|
||||
$gameClass = 'format\\Game' . $game['team_type'] . $game['rule_type'];
|
||||
if (!class_exists($gameClass)) {
|
||||
throw new Exception("赛制文件不存在,请联系管理人员: {$gameClass}");
|
||||
}
|
||||
$format = new $gameClass;
|
||||
if (!$format instanceof \format\GameInterface) {
|
||||
throw new Exception("赛制配置错误,请联系管理人员: {$gameClass}");
|
||||
}
|
||||
$done = GameMatch::where('level', $match['level'])->where('winner', '!=', '')->select();
|
||||
$matchs = $format->nextLevel($game, $done, $match['level'] + 1);
|
||||
if (!empty($matchs)) {
|
||||
(new GameMatch)->insertAll($matchs);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
// 团队排名
|
||||
public function teamRank()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$game = $this->model->get($params['game_id']) ?? null;
|
||||
if (empty($game)) {
|
||||
$this->error('比赛不存在');
|
||||
}
|
||||
$match = GameMatch::field('*,GREATEST(scoreA,scoreB) as score')->where('game_id', $game['id'])->order(['level' => 'desc', 'score' => 'desc'])->select();
|
||||
$teams = [];
|
||||
$rank = 1;
|
||||
foreach ($match as $m) {
|
||||
$win = json_decode($m['winner'] ?? '', true);
|
||||
if (empty($win)) { // 未决出胜负的按暂时得分 高的队伍排名靠前
|
||||
$teamA = json_decode($m['teamA'] ?? '', true);
|
||||
$teamB = json_decode($m['teamB'] ?? '', true);
|
||||
if (($m['scoreA'] >= $m['scoreB'])) {
|
||||
$teamA['rank'] = $rank;
|
||||
$teamB['rank'] = $rank + 1;
|
||||
$teams[] = $teamA;
|
||||
$teams[] = $teamB;
|
||||
$rank += 2;
|
||||
} else {
|
||||
$teamB['rank'] = $rank;
|
||||
$teamA['rank'] = $rank + 1;
|
||||
$teams[] = $teamB;
|
||||
$teams[] = $teamA;
|
||||
$rank += 2;
|
||||
}
|
||||
} else {
|
||||
$win['rank'] = $rank;
|
||||
$rank++;
|
||||
$teams[] = $win;
|
||||
}
|
||||
}
|
||||
|
||||
$this->success('Success', $teams);
|
||||
}
|
||||
|
||||
// 个人排名
|
||||
public function rank()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$game = $this->model->get($params['game_id']) ?? null;
|
||||
if (empty($game)) {
|
||||
$this->error('比赛不存在');
|
||||
}
|
||||
|
||||
$list = Participant::where('game_id', $game['id'])->where('status', '>', -1)->order('score', 'desc')->select();
|
||||
$rank = 1;
|
||||
foreach ($list as &$l) {
|
||||
$l['rank'] = $rank;
|
||||
$rank += 1;
|
||||
}
|
||||
|
||||
$this->success('Success', $list);
|
||||
}
|
||||
}
|
||||
@@ -2,79 +2,52 @@
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Stadium;
|
||||
use think\exception\PDOException;
|
||||
use addons\shopro\controller\Common;
|
||||
use think\exception\ValidateException;
|
||||
use app\admin\model\zy\link\Visitor;
|
||||
|
||||
class Gym extends Common
|
||||
|
||||
|
||||
class Gym extends Base
|
||||
{
|
||||
|
||||
// protected $noNeedLogin = ['index'];
|
||||
protected $noNeedLogin = ['*'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new \app\admin\model\zy\Stadium;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = Stadium::where('status', 1);
|
||||
$query = $this->model->where('status', 1);
|
||||
if (isset($params['name'])) {
|
||||
$model->where('name', 'like', '%' . $params['name'] . '%');
|
||||
$query->where('name', 'like', '%' . $params['name'] . '%');
|
||||
}
|
||||
$res = $model->select();
|
||||
|
||||
|
||||
$this->success('获取成功', $res);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = (new Stadium)->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
$model = Stadium::get($params['id']);
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = $model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$this->success('Success', ['list' => $res->items(), 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = Stadium::get($this->request->param('id'));
|
||||
$model = $this->model->get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$this->success($model);
|
||||
$user = auth_user();
|
||||
$visitor = Visitor::where('type', 1)->where('obj_id', $model['id'])->where('user_id', $user['id'])->find();
|
||||
if (empty($visitor)) {
|
||||
$visitor = new Visitor;
|
||||
}
|
||||
$visitor->allowField(true)->save([
|
||||
'type' => 1,
|
||||
'obj_id' => $model['id'],
|
||||
'user_id' => $user['id'],
|
||||
'nickname' => $user['nickname'],
|
||||
'avatar' => $user['avatar'],
|
||||
'gender' => $user['gender'],
|
||||
'times' => empty($visitor->times) ? 1 : $visitor->times + 1
|
||||
]);
|
||||
|
||||
$this->success('Success', $model);
|
||||
}
|
||||
}
|
||||
|
||||
157
addons/shopro/controller/zy/Sys.php
Normal file
157
addons/shopro/controller/zy/Sys.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Tags;
|
||||
use think\exception\PDOException;
|
||||
use app\admin\model\zy\sign\Record;
|
||||
use app\admin\model\zy\link\Visitor;
|
||||
use app\admin\model\zy\sign\SignSet;
|
||||
use app\admin\model\shopro\user\User;
|
||||
use app\admin\model\zy\circle\Circle;
|
||||
use app\admin\model\zy\link\Complaint;
|
||||
use think\exception\ValidateException;
|
||||
use addons\shopro\library\activity\traits\GiveGift;
|
||||
|
||||
class Sys extends Base
|
||||
{
|
||||
use GiveGift;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = new Tags();
|
||||
if (isset($params['type'])) {
|
||||
$model->where('type', $params['type']);
|
||||
}
|
||||
if (isset($params['group'])) {
|
||||
$model->where('group', $params['group']);
|
||||
}
|
||||
$res = $model->select();
|
||||
|
||||
$this->success('Success', $res);
|
||||
}
|
||||
|
||||
// 举报投诉
|
||||
public function complain()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if ($params['type'] == 3) { //用户举报
|
||||
$target = User::get($params['target_id']);
|
||||
} elseif ($params['type'] == 2) { //影圈举报
|
||||
$target = Circle::get($params['target_id']);
|
||||
} elseif ($params['type'] == 1) {
|
||||
$target = ['id' => 0];
|
||||
$params['target_id'] = 0;
|
||||
} else {
|
||||
$this->error('type 类型错误');
|
||||
}
|
||||
if (empty($target)) {
|
||||
$this->error('举报对象不存在');
|
||||
}
|
||||
if (empty($params['content'])) {
|
||||
$this->error('举报内容不能为空');
|
||||
}
|
||||
$user = auth_user();
|
||||
$res = Complaint::get(['user_id' => $user['id'], 'target_id' => $params['target_id'], 'type' => $params['type'], 'status' => 0]);
|
||||
if ($res) {
|
||||
$this->error('您已举报过该对象');
|
||||
}
|
||||
$params['status'] = 0;
|
||||
$params['user_id'] = $user['id'];
|
||||
$params['username'] = $params['username'] ?? $user['username'];
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = (new Complaint)->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error('操作失败');
|
||||
}
|
||||
$this->success('Success');
|
||||
}
|
||||
|
||||
public function visitor()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$res = Visitor::where('type', $params['type'])->where('obj_id', $params['obj_id'])->paginate($params['pageSize'] ?? 10);
|
||||
$this->success('Success', ['list' => $res->items(), 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function signin()
|
||||
{
|
||||
$signSet = SignSet::where('status', 1)->select();
|
||||
// if (empty($signSet)) {
|
||||
// $this->error('没有签到活动');
|
||||
// }
|
||||
Db::startTrans();
|
||||
try {
|
||||
$user = auth_user();
|
||||
$newRecord = new Record;
|
||||
$newRecord->user_id = $user->id;
|
||||
$newRecord->date = date('Y-m-d');
|
||||
$newRecord->last = 1;
|
||||
$record = Record::where('user_id', $user->id)->order('id', 'desc')->find();
|
||||
if (!empty($record)) {
|
||||
if ($newRecord->date == $record->date) {
|
||||
$this->error('您今天已签到,请勿重复签到');
|
||||
}
|
||||
if ($record['date'] == date('Y-m-d', strtotime('-1 day'))) {
|
||||
$newRecord->last = $record->last + 1; //连续签到
|
||||
}
|
||||
}
|
||||
$newRecord->remark = '';
|
||||
foreach ($signSet as $set) {
|
||||
if ($newRecord->last >= $set['last']) { // 达成连续签到天数
|
||||
if ($set['chance1'] > 0 && rand(0, 100) <= $set['chance1']) {
|
||||
$res1 = $this->giveCoupons($user, $set['coupon1_id']);
|
||||
if ($res1['errors']) $this->error('优惠券赠送失败,请联系管理员', $res1);
|
||||
$newRecord->remark .= '获得【' . implode(',', $res1['success']) . '】;';
|
||||
}
|
||||
if ($set['chance2'] > 0 && mt_rand(0, 100) <= $set['chance2']) {
|
||||
$res2 = $this->giveCoupons($user, $set['coupon2_id']);
|
||||
if ($res2['errors']) $this->error('优惠券赠送失败,请联系管理员', $res2);
|
||||
$newRecord->remark .= '获得【' . implode(',', $res2['success']) . '】;';
|
||||
}
|
||||
}
|
||||
}
|
||||
$newRecord->save();
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('Success', $newRecord);
|
||||
}
|
||||
|
||||
public function signList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$query = Record::where('user_id', $this->auth->id)->order('id', 'desc');
|
||||
if (!empty($params['date_begin'])) {
|
||||
$query->where('date', '>=', $params['date_begin']);
|
||||
}
|
||||
if (!empty($params['date_end'])) {
|
||||
$query->where('date', '<=', $params['date_end']);
|
||||
}
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$this->success('Success', ['list' => $res->items(), 'count' => $res->total()]);
|
||||
}
|
||||
|
||||
public function task()
|
||||
{
|
||||
$record = Record::where('user_id', $this->auth->id)->where('date', date('Y-m-d'))->find();
|
||||
$query = SignSet::field('name,begin_date,end_date,intro')->where('status', 1);
|
||||
$res = $query->paginate($params['pageSize'] ?? 10);
|
||||
$list = $res->items();
|
||||
foreach ($list as &$val) {
|
||||
$val['progress'] = empty($record) ? '今日未完成' : '今日已完成';
|
||||
}
|
||||
$this->success('Success', ['list' => $list, 'count' => $res->total()]);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use app\admin\model\zy\Tags as TagsModel;
|
||||
use addons\shopro\controller\Common;
|
||||
|
||||
class Tags extends Common
|
||||
{
|
||||
|
||||
// protected $noNeedLogin = ['index'];
|
||||
protected $noNeedLogin = ['*'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = new TagsModel();
|
||||
if (isset($params['type'])) {
|
||||
$model->where('type', $params['type']);
|
||||
}
|
||||
if (isset($params['group'])) {
|
||||
$model->where('group', $params['group']);
|
||||
}
|
||||
$res = $model->select();
|
||||
foreach ($res as &$value) {
|
||||
$value['content_json'] = array_values(json_decode($value['content_json'] ?? '[]', true));
|
||||
}
|
||||
|
||||
$this->success('获取成功', $res);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,11 @@
|
||||
|
||||
namespace addons\shopro\job;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\queue\Job;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
class Test extends BaseJob
|
||||
{
|
||||
@@ -48,4 +52,88 @@ class Test extends BaseJob
|
||||
@mkdir($dir, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 周期性活动创建比赛
|
||||
*/
|
||||
public function zy(Job $job, $data)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$_actModel = new \app\admin\model\zy\game\Activity();
|
||||
$_gameModel = new \app\admin\model\zy\game\Game();
|
||||
$dateTime = date('Y-m-d H:i:s'); //当前星期
|
||||
$week = date('w'); //当前星期
|
||||
$current = time(); //当前时间
|
||||
$activity = (clone $_actModel)::where('pid', 0)->select(); //周期性主活动
|
||||
foreach ($activity as $act) {
|
||||
$act = $act->toArray();
|
||||
$publicTime = json_decode($act['public_time'] ?? '[]', true);
|
||||
$publicBefore = intval($publicTime['before'] ?? 0); //提前几天
|
||||
$PublicWeek = $act['week'] - $publicBefore; //设定应该发布的星期
|
||||
if ($PublicWeek != $week && ($PublicWeek + 7) != $week) {
|
||||
print_r('星期不对');
|
||||
continue; // 星期不对
|
||||
}
|
||||
$public_time = strtotime($publicTime['time']); //设定的时间
|
||||
if ($current < $public_time) {
|
||||
print_r('时间未到');
|
||||
continue; //时间未到
|
||||
}
|
||||
$act['public_time'] = date('Y-m-d H:i:s', $public_time - $publicBefore * 86400); //设定的时间
|
||||
$act['date'] = date('Y-m-d', $public_time - $publicBefore * 86400); //设定的日期
|
||||
$startTime = explode(' ', $act['startTime']);
|
||||
if (count($startTime) == 2) {
|
||||
$act['date'] = $startTime[0];
|
||||
$act['startTime'] = $startTime[1];
|
||||
}
|
||||
$endTime = explode(' ', $act['endTime']);
|
||||
if (count($endTime) == 2) $act['endTime'] = $endTime[1];
|
||||
$query = (clone $_gameModel)::where('act_id', $act['id'])->where('public_time', $act['public_time']);
|
||||
if ($act['type'] == 0) { //一次性活动
|
||||
$query->where('date', $act['date']);
|
||||
}
|
||||
$games = $query->select();
|
||||
if (!empty($games)) {
|
||||
print_r('已存在');
|
||||
continue; // 已存在
|
||||
}
|
||||
$joinStartTime = json_decode($act['join_start_time'] ?? '[]', true);
|
||||
$act['join_start_time'] = date('Y-m-d H:i:s', strtotime($joinStartTime['time']) - intval($joinStartTime['before']) * 86400);
|
||||
$joinEndTime = json_decode($act['join_end_time'] ?? '[]', true);
|
||||
$act['join_end_time'] = date('Y-m-d H:i:s', strtotime($joinEndTime['time']) - intval($joinEndTime['before']) * 86400);
|
||||
$quitTime = json_decode($act['quit_time'] ?? '[]', true);
|
||||
$act['quit_time'] = date('Y-m-d H:i:s', strtotime($quitTime['time']) - intval($quitTime['before']) * 86400);
|
||||
$act['act_id'] = $act['id'];
|
||||
unset($act['id']);
|
||||
$res = (clone $_gameModel)->allowField(true)->save($act);
|
||||
$subs = (clone $_actModel)::where('pid', $act['act_id'])->select();
|
||||
foreach ($subs as $sub) { //存在子活动
|
||||
$sub = $sub->toArray();
|
||||
$sub['public_time'] = $act['public_time'];
|
||||
$sub['join_start_time'] = $act['join_start_time'];
|
||||
$sub['join_end_time'] = $act['join_end_time'];
|
||||
$sub['quit_time'] = $act['quit_time'];
|
||||
$sub['act_id'] = $act['act_id'];
|
||||
$sub['date'] = $act['date'];
|
||||
unset($sub['id']);
|
||||
$res = (clone $_gameModel)->allowField(true)->save($sub);
|
||||
}
|
||||
}
|
||||
//处理已生成的比赛
|
||||
$games = (clone $_gameModel)::where('join_start_time', '>=', $dateTime)->where('status', '<', 2)->select();
|
||||
foreach ($games as $g) {
|
||||
if ($g['join_start_time'] <= $dateTime && $g['join_end_time'] > $dateTime) {
|
||||
$g->save(['status' => 1]); //开始报名
|
||||
} elseif ($g['join_end_time'] <= $dateTime) {
|
||||
$g->save(['status' => 2]); //报名截止,活动进行中
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
format_log_error($e, 'zy.activity create game');
|
||||
}
|
||||
$job->release(600); //$delay为延迟时间
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class Tree
|
||||
* @param \Closure $resultCb 用来处理每一次查询的结果 比如要取出树中的所有 name
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTree($items = 0, \Closure $resultCb = null)
|
||||
public function getTree($items = 0, ?\Closure $resultCb = null)
|
||||
{
|
||||
if (!is_array($items) && !$items instanceof Collection) {
|
||||
$items = $this->getQuery()->where('parent_id', $items)->select();
|
||||
@@ -48,7 +48,7 @@ class Tree
|
||||
* @param \Closure $resultCb 用来处理每一次查询的结果 比如要取出树中的所有 name
|
||||
* @return Collection
|
||||
*/
|
||||
public function getChildren($id, \Closure $resultCb = null)
|
||||
public function getChildren($id, ?\Closure $resultCb = null)
|
||||
{
|
||||
$self = $this->getQuery()->where('id', $id)->select();
|
||||
if(!$self) {
|
||||
|
||||
@@ -2,30 +2,32 @@
|
||||
|
||||
namespace addons\shopro\listener;
|
||||
|
||||
use addons\shopro\library\notify\Notify;
|
||||
use addons\shopro\library\Pipeline;
|
||||
use addons\shopro\service\order\OrderThrough;
|
||||
use app\admin\model\shopro\user\User;
|
||||
use app\admin\model\shopro\Admin;
|
||||
use addons\shopro\facade\Wechat;
|
||||
use app\admin\model\shopro\Cart;
|
||||
use app\admin\model\shopro\user\Coupon;
|
||||
use app\admin\model\shopro\order\Order as OrderModel;
|
||||
use app\admin\model\shopro\order\OrderItem;
|
||||
use app\admin\model\shopro\order\Invoice as OrderInvoiceModel;
|
||||
use app\admin\model\shopro\order\Express as OrderExpressModel;
|
||||
use app\admin\model\shopro\order\Action;
|
||||
use app\admin\model\shopro\order\Invoice;
|
||||
use app\admin\model\shopro\Admin;
|
||||
use app\admin\model\shopro\Config;
|
||||
use addons\shopro\library\Pipeline;
|
||||
use addons\shopro\service\StockSale;
|
||||
use addons\shopro\traits\CouponSend;
|
||||
use addons\shopro\service\order\OrderRefund;
|
||||
use app\admin\model\shopro\user\User;
|
||||
use app\admin\model\zy\game\GameJoin;
|
||||
use addons\shopro\service\pay\PayOper;
|
||||
use app\admin\model\shopro\user\Coupon;
|
||||
use addons\shopro\library\notify\Notify;
|
||||
use app\admin\model\shopro\order\Action;
|
||||
use app\admin\model\zy\game\Participant;
|
||||
use app\admin\model\shopro\order\Invoice;
|
||||
use addons\shopro\service\order\OrderOper;
|
||||
use addons\shopro\service\user\User as UserService;
|
||||
use app\admin\model\shopro\order\OrderItem;
|
||||
use addons\shopro\service\order\OrderRefund;
|
||||
use addons\shopro\service\order\OrderThrough;
|
||||
use addons\shopro\service\order\OrderDispatch;
|
||||
use addons\shopro\library\activity\traits\GiveGift;
|
||||
use addons\shopro\service\user\User as UserService;
|
||||
use addons\shopro\facade\Activity as ActivityFacade;
|
||||
use addons\shopro\facade\Wechat;
|
||||
use app\admin\model\shopro\order\Order as OrderModel;
|
||||
use app\admin\model\shopro\order\Express as OrderExpressModel;
|
||||
use app\admin\model\shopro\order\Invoice as OrderInvoiceModel;
|
||||
use addons\shopro\library\easywechatPlus\WechatMiniProgramShop;
|
||||
|
||||
class Order
|
||||
@@ -252,6 +254,9 @@ class Order
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
// zy体育报名处理
|
||||
GameJoin::where('order_id', $order->id)->update(['status' => 1]);
|
||||
}
|
||||
|
||||
|
||||
@@ -348,6 +353,14 @@ class Order
|
||||
}
|
||||
}
|
||||
|
||||
//ZY比赛开始时自动确认收货。
|
||||
$join = GameJoin::get('order_id', $order->id);
|
||||
if (!empty($join)) {
|
||||
$later = strtotime($join->quit_time) - time();
|
||||
if ($later > 0) {
|
||||
\think\Queue::later(($later), '\addons\shopro\job\OrderAutoOper@autoConfirm', $params, 'shopro');
|
||||
}
|
||||
} else {
|
||||
// 添加自动确认收货队列,这个队列只自动确认 本次发货的 items
|
||||
$confirm_days = Config::getConfigField('shop.order.auto_confirm');
|
||||
$confirm_days = $confirm_days > 0 ? $confirm_days : 0;
|
||||
@@ -356,6 +369,7 @@ class Order
|
||||
\think\Queue::later(($confirm_days * 86400), '\addons\shopro\job\OrderAutoOper@autoConfirm', $params, 'shopro');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$user = User::where('id', $order['user_id'])->find();
|
||||
$user && $user->notify(
|
||||
@@ -599,6 +613,13 @@ class Order
|
||||
// 将开票信息取消
|
||||
$this->cancelInvoice($order, 'invalid');
|
||||
|
||||
// zy体育报名处理(未支付,自动退坑)
|
||||
$join = GameJoin::where('order_id', $order->id)->find();
|
||||
if (!empty($join)) {
|
||||
$join->save(['status' => -1]);
|
||||
Participant::where('game_join_id', $join['id'])->update(['status' => -1]);
|
||||
}
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ trait CouponSend
|
||||
foreach ($coupons as $coupon) {
|
||||
try {
|
||||
$userCoupon = $this->send($user, $coupon);
|
||||
$success[] = $coupon->id;
|
||||
$success[] = $coupon->name;
|
||||
} catch (HttpResponseException $e) {
|
||||
$data = $e->getResponse()->getData();
|
||||
$message = $data ? ($data['msg'] ?? '') : $e->getMessage();
|
||||
|
||||
@@ -195,7 +195,7 @@ trait StockWarning
|
||||
$stockWarning = new StockLogModel();
|
||||
|
||||
$stockWarning->goods_id = $goodsSkuPrice['goods_id'];
|
||||
$stockWarning->admin_id = $admin['id'];
|
||||
$stockWarning->admin_id = $admin['id'] ?? 0;
|
||||
$stockWarning->goods_sku_price_id = $goodsSkuPrice['id'];
|
||||
$stockWarning->goods_sku_text = is_array($goodsSkuPrice['goods_sku_text']) ? join(',', $goodsSkuPrice['goods_sku_text']) : $goodsSkuPrice['goods_sku_text'];
|
||||
$stockWarning->before = $before;
|
||||
|
||||
@@ -36,7 +36,9 @@ class Coupon extends Common
|
||||
if (!$this->request->isAjax()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
$coupons = $this->model->sheepFilter()->paginate($this->request->param('list_rows', 10))->each(function ($coupon) {
|
||||
// 优惠券领取和使用数量
|
||||
$coupon->get_num = $coupon->get_num;
|
||||
|
||||
@@ -40,7 +40,13 @@ trait SkuPrice
|
||||
protected function editSimSku($goods, $type = 'add')
|
||||
{
|
||||
$params = $this->request->only([
|
||||
'stock', 'stock_warning', 'sn', 'weight', 'cost_price', 'original_price', 'price'
|
||||
'stock',
|
||||
'stock_warning',
|
||||
'sn',
|
||||
'weight',
|
||||
'cost_price',
|
||||
'original_price',
|
||||
'price'
|
||||
]);
|
||||
|
||||
$data = [
|
||||
@@ -83,7 +89,36 @@ trait SkuPrice
|
||||
// 检测库存预警
|
||||
$this->checkStockWarning($skuPrice, $type);
|
||||
}
|
||||
}
|
||||
|
||||
// 中羿体育项目报名费sku处理
|
||||
private function zySku($goods, $type)
|
||||
{
|
||||
$data = [
|
||||
'goods_id' => $goods->id,
|
||||
'stock' => 999,
|
||||
'cost_price' => 0,
|
||||
'original_price' => 0,
|
||||
'price' => $goods['price'][0] ?? 0,
|
||||
'original_price' => $goods['price'][0] ?? 0,
|
||||
'stock_warning' => null
|
||||
];
|
||||
if ($type == 'edit') {
|
||||
$skuPrice = SkuPriceModel::where('goods_id', $goods->id)->order('id', 'asc')->find();
|
||||
if ($skuPrice) {
|
||||
SkuPriceModel::where('goods_id', $goods->id)->where('id', '<>', $skuPrice->id)->delete();
|
||||
SkuModel::where('goods_id', $goods->id)->delete();
|
||||
}
|
||||
unset($data['stock']);
|
||||
}
|
||||
if (!isset($skuPrice) || !$skuPrice) {
|
||||
$skuPrice = new SkuPriceModel();
|
||||
}
|
||||
$skuPrice->save($data);
|
||||
if ($type == 'add') {
|
||||
$this->addStockLog($skuPrice, 0, $data['stock'], $type);
|
||||
$this->checkStockWarning($skuPrice, $type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +132,8 @@ trait SkuPrice
|
||||
protected function editMultSku($goods, $type = 'add')
|
||||
{
|
||||
$params = $this->request->only([
|
||||
'skus', 'sku_prices'
|
||||
'skus',
|
||||
'sku_prices'
|
||||
]);
|
||||
$skus = $params['skus'] ?? [];
|
||||
$skuPrices = $params['sku_prices'] ?? [];
|
||||
|
||||
71
application/admin/controller/zy/Club.php
Normal file
71
application/admin/controller/zy/Club.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 俱乐部
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Club extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Club模型对象
|
||||
* @var \app\admin\model\zy\Club
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\Club;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
72
application/admin/controller/zy/Menber.php
Normal file
72
application/admin/controller/zy/Menber.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 俱乐部成员
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Menber extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Menber模型对象
|
||||
* @var \app\admin\model\zy\Menber
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\Menber;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['club','user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('club')->visible(['name']);
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
72
application/admin/controller/zy/circle/Circle.php
Normal file
72
application/admin/controller/zy/circle/Circle.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\circle;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 影圈
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Circle extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Circle模型对象
|
||||
* @var \app\admin\model\zy\circle\Circle
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\circle\Circle;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['club','user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('club')->visible(['name']);
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
71
application/admin/controller/zy/circle/Comment.php
Normal file
71
application/admin/controller/zy/circle/Comment.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\circle;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 影圈评论/回复
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Comment extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Comment模型对象
|
||||
* @var \app\admin\model\zy\circle\Comment
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\circle\Comment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['circle'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('circle')->visible(['id']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
72
application/admin/controller/zy/circle/Likes.php
Normal file
72
application/admin/controller/zy/circle/Likes.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\circle;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 影圈点赞
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Likes extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Likes模型对象
|
||||
* @var \app\admin\model\zy\circle\Likes
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\circle\Likes;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['circle','user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('circle')->visible(['id']);
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
73
application/admin/controller/zy/game/Activity.php
Normal file
73
application/admin/controller/zy/game/Activity.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\game;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 球局
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Activity extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Activity模型对象
|
||||
* @var \app\admin\model\zy\Activity
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\game\Activity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['stadium','club','user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('stadium')->visible(['name']);
|
||||
$row->getRelation('club')->visible(['name']);
|
||||
$row->getRelation('user')->visible(['username']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
74
application/admin/controller/zy/game/Game.php
Normal file
74
application/admin/controller/zy/game/Game.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\game;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 赛事
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Game extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Game模型对象
|
||||
* @var \app\admin\model\zy\Game
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\game\Game;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['activity','stadium','club','user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('activity')->visible(['name']);
|
||||
$row->getRelation('stadium')->visible(['name']);
|
||||
$row->getRelation('club')->visible(['name']);
|
||||
$row->getRelation('user')->visible(['username']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
74
application/admin/controller/zy/game/GameJoin.php
Normal file
74
application/admin/controller/zy/game/GameJoin.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\game;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 比赛报名
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class GameJoin extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* GameJoin模型对象
|
||||
* @var \app\admin\model\zy\GameJoin
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\game\GameJoin;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['activity','game','user','order'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('activity')->visible(['name']);
|
||||
$row->getRelation('game')->visible(['name']);
|
||||
$row->getRelation('user')->visible(['username']);
|
||||
$row->getRelation('order')->visible(['order_sn']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
74
application/admin/controller/zy/game/GameMatch.php
Normal file
74
application/admin/controller/zy/game/GameMatch.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\game;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 匹配对阵
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class GameMatch extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* GameMatch模型对象
|
||||
* @var \app\admin\model\zy\GameMatch
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\game\GameMatch;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['stadium','club','activity','game'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('stadium')->visible(['name']);
|
||||
$row->getRelation('club')->visible(['name']);
|
||||
$row->getRelation('activity')->visible(['name']);
|
||||
$row->getRelation('game')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
73
application/admin/controller/zy/game/Participant.php
Normal file
73
application/admin/controller/zy/game/Participant.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\game;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 参加人员
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Participant extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Participant模型对象
|
||||
* @var \app\admin\model\zy\Participant
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\game\Participant;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user','join','game'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['username']);
|
||||
$row->getRelation('join')->visible(['id']);
|
||||
$row->getRelation('game')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
72
application/admin/controller/zy/link/Apply.php
Normal file
72
application/admin/controller/zy/link/Apply.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\link;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 申请
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Apply extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Apply模型对象
|
||||
* @var \app\admin\model\zy\link\Apply
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\link\Apply;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user','club'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
$row->getRelation('club')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
72
application/admin/controller/zy/link/Complaint.php
Normal file
72
application/admin/controller/zy/link/Complaint.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\link;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 投诉举报
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Complaint extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Complaint模型对象
|
||||
* @var \app\admin\model\zy\link\Complaint
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\link\Complaint;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user','circle'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
$row->getRelation('circle')->visible(['id']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
71
application/admin/controller/zy/link/Message.php
Normal file
71
application/admin/controller/zy/link/Message.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\link;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 消息管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Message extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Message模型对象
|
||||
* @var \app\admin\model\zy\link\Message
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\link\Message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
71
application/admin/controller/zy/link/Relation.php
Normal file
71
application/admin/controller/zy/link/Relation.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\link;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 关系
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Relation extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Relation模型对象
|
||||
* @var \app\admin\model\zy\link\Relation
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\link\Relation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
71
application/admin/controller/zy/link/Visitor.php
Normal file
71
application/admin/controller/zy/link/Visitor.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\link;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Visitor extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Visitor模型对象
|
||||
* @var \app\admin\model\zy\link\Visitor
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\link\Visitor;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['nickname']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
71
application/admin/controller/zy/sign/Record.php
Normal file
71
application/admin/controller/zy/sign/Record.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\sign;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 签到记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Record extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Record模型对象
|
||||
* @var \app\admin\model\zy\sign\Record
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\sign\Record;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['username']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
154
application/admin/controller/zy/sign/SignSet.php
Normal file
154
application/admin/controller/zy/sign/SignSet.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy\sign;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\exception\PDOException;
|
||||
use app\common\controller\Backend;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 签到设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class SignSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* SignSet模型对象
|
||||
* @var \app\admin\model\zy\sign\SignSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\sign\SignSet;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['coupon1','coupon2'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('coupon1')->visible(['name']);
|
||||
$row->getRelation('coupon2')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
if (empty($params['begin_date'])) $params['begin_date'] = NULL;
|
||||
if (empty($params['end_date'])) $params['end_date'] = NULL;
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
if (empty($params['begin_date'])) $params['begin_date'] = NULL;
|
||||
if (empty($params['end_date'])) $params['end_date'] = NULL;
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (false === $result) {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
}
|
||||
26
application/admin/lang/zh-cn/zy/circle/circle.php
Normal file
26
application/admin/lang/zh-cn/zy/circle/circle.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Club_id' => '俱乐部',
|
||||
'User_id' => '用户',
|
||||
'Nickname' => '昵称',
|
||||
'Avatar' => '头像',
|
||||
'Gender' => '性别',
|
||||
'Club_name' => '俱乐部名称',
|
||||
'Content' => '内容',
|
||||
'Imgs' => '图片',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Club.name' => '俱乐部名称',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
|
||||
'Gender1' => '男',
|
||||
'Gender0' => '女',
|
||||
|
||||
'Status-1' => '审核不通过',
|
||||
'Status0' => '待审核',
|
||||
'Status1' => '审核通过',
|
||||
|
||||
];
|
||||
17
application/admin/lang/zh-cn/zy/circle/comment.php
Normal file
17
application/admin/lang/zh-cn/zy/circle/comment.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Circle_id' => '影圈id',
|
||||
'Pid' => '评论id',
|
||||
'User_id' => '用户',
|
||||
'Nickname' => '昵称',
|
||||
'Avatar' => '用户头像',
|
||||
'Gender' => '性别',
|
||||
'Content' => '评论或回复内容',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
|
||||
'Male' => '男',
|
||||
'Female' => '女',
|
||||
];
|
||||
15
application/admin/lang/zh-cn/zy/circle/likes.php
Normal file
15
application/admin/lang/zh-cn/zy/circle/likes.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Circle_id' => '影圈id',
|
||||
'User_id' => '用户',
|
||||
'Nickname' => '昵称',
|
||||
'Avatar' => '用户头像',
|
||||
'Gender' => '性别',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
'Male' => '男',
|
||||
'Female' => '女',
|
||||
];
|
||||
29
application/admin/lang/zh-cn/zy/club.php
Normal file
29
application/admin/lang/zh-cn/zy/club.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Gym_id' => '球馆',
|
||||
'Name' => '俱乐部名称',
|
||||
'Sub_name' => '简称',
|
||||
'Logo' => 'logo',
|
||||
'Contect' => '联系方式',
|
||||
'City' => '常住地',
|
||||
'Blurb' => '简介',
|
||||
'Intro' => '详细介绍',
|
||||
'Join_type' => '入会方式',
|
||||
'Img' => '图片',
|
||||
'President' => '会长',
|
||||
'Admin_ids' => '管理员',
|
||||
'Tags' => '标签',
|
||||
'attention' => '关注数',
|
||||
'Is_public' => '是否公开',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
|
||||
'Join_type0' => '开放加入,无需审核',
|
||||
'Join_type1' => '开放申请,审核加入',
|
||||
'Join_type2' => '会员邀请,无需审核',
|
||||
'Join_type3' => '会员邀请,审核加入',
|
||||
'Join_type4' => '仅管理员邀请,无需审核',
|
||||
'Is_public0' => '否',
|
||||
'Is_public1' => '是',
|
||||
];
|
||||
82
application/admin/lang/zh-cn/zy/game/activity.php
Normal file
82
application/admin/lang/zh-cn/zy/game/activity.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Pid' => '所属活动',
|
||||
'Gym_id' => '球馆',
|
||||
'Club_id' => '俱乐部',
|
||||
'Name' => '活动名称',
|
||||
'Address' => '地点',
|
||||
'Field' => '场地号',
|
||||
'Is_public' => '是否公开',
|
||||
'Team_type' => '队伍类型',
|
||||
'Rule_type' => '规则类型',
|
||||
'Type' => '周期类型',
|
||||
'Week' => '每周几',
|
||||
'Start_time' => '开始时间',
|
||||
'End_time' => '结束时间',
|
||||
'Public_time' => '公布时间',
|
||||
'Join_start_time' => '报名开始时间',
|
||||
'Join_end_time' => '报名截止时间',
|
||||
'Quit_time' => '免费退坑时间',
|
||||
'Game_time' => '比赛时长(时)',
|
||||
'Position' => '经纬度',
|
||||
'Cost' => '报名费用',
|
||||
'Limit_num' => '报名限制人数',
|
||||
'Describe' => '活动介绍',
|
||||
'Img' => '图片',
|
||||
'Game_rule' => '比赛规则',
|
||||
'Is_bring' => '可否带人',
|
||||
'Bring_num' => '可带人数',
|
||||
'Referee' => '裁判',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Stadium.name' => '球馆名称',
|
||||
'Club.name' => '俱乐部名称',
|
||||
'User.username' => '用户名',
|
||||
|
||||
'Is_public0' => '否',
|
||||
'Is_public1' => '是',
|
||||
|
||||
'Is_bring0' => '否',
|
||||
'Is_bring1' => '是',
|
||||
|
||||
'Team_type1' => '双打',
|
||||
'Team_type2' => '单打',
|
||||
'Team_type3' => '团队',
|
||||
|
||||
'Rule_type1' => '八人转',
|
||||
'Rule_type2' => '超八转',
|
||||
'Rule_type3' => '混双转',
|
||||
'Rule_type4' => '固搭转',
|
||||
'Rule_type5' => '固定擂',
|
||||
'Rule_type6' => '活动擂',
|
||||
'Rule_type7' => '转转',
|
||||
'Rule_type8' => '分区转',
|
||||
'Rule_type9' => '擂台赛',
|
||||
'Rule_type10' => '守擂赛',
|
||||
'Rule_type11' => '追分赛',
|
||||
'Rule_type12' => '固搭追分赛',
|
||||
'Rule_type13' => '大循环群内赛',
|
||||
'Rule_type14' => '两队PK赛',
|
||||
'Rule_type15' => '战队淘汰赛',
|
||||
'Rule_type16' => '单项淘汰赛',
|
||||
'Rule_type17' => '分区循环淘汰赛',
|
||||
|
||||
'Type0' => '一次性',
|
||||
'Type1' => '周期性',
|
||||
|
||||
'Status0' => '发布',
|
||||
'Status1' => '报名中',
|
||||
'Status2' => '比赛中',
|
||||
'Status3' => '结束',
|
||||
|
||||
'Week0' => '周日',
|
||||
'Week1' => '周一',
|
||||
'Week2' => '周二',
|
||||
'Week3' => '周三',
|
||||
'Week4' => '周四',
|
||||
'Week5' => '周五',
|
||||
'Week6' => '周六',
|
||||
|
||||
];
|
||||
90
application/admin/lang/zh-cn/zy/game/game.php
Normal file
90
application/admin/lang/zh-cn/zy/game/game.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Pid' => '主活动比赛',
|
||||
'Act_id' => '球局活动',
|
||||
'Gym_id' => '球馆',
|
||||
'Club_id' => '俱乐部',
|
||||
'Name' => '赛事名称',
|
||||
'Team_type' => '队伍类型',
|
||||
'Rule_type' => '规则类型',
|
||||
'Date' => '比赛日期',
|
||||
'Week' => '星期几',
|
||||
'Start_time' => '开始时间',
|
||||
'End_time' => '结束时间',
|
||||
'Public_time' => '发布时间',
|
||||
'Join_start_time' => '报名开始时间',
|
||||
'Join_end_time' => '报名截止时间',
|
||||
'Quit_time' => '免费退坑时间',
|
||||
'Game_time' => '比赛时长(时)',
|
||||
'Address' => '地点',
|
||||
'Field' => '场地号',
|
||||
'Position' => '经纬度',
|
||||
'Cost' => '报名费用',
|
||||
'Limit_num' => '报名限制人数',
|
||||
'Join_num' => '报名人数',
|
||||
'Attention' => '关注人数',
|
||||
'Status' => '状态',
|
||||
'Describe' => '比赛介绍',
|
||||
'Img' => '图片',
|
||||
'Game_rule' => '比赛规则',
|
||||
'Is_public' => '是否公开',
|
||||
'Bring_num' => '可带人数',
|
||||
'Is_bring' => '可否带人',
|
||||
'Referee' => '裁判',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Activity.name' => '名称',
|
||||
'Stadium.name' => '球馆名称',
|
||||
'Club.name' => '俱乐部名称',
|
||||
'User.username' => '用户名',
|
||||
|
||||
|
||||
'Is_public0' => '否',
|
||||
'Is_public1' => '是',
|
||||
|
||||
'Is_bring0' => '否',
|
||||
'Is_bring1' => '是',
|
||||
|
||||
'Team_type1' => '双打',
|
||||
'Team_type2' => '单打',
|
||||
'Team_type3' => '团队',
|
||||
|
||||
'Rule_type1' => '八人转',
|
||||
'Rule_type2' => '超八转',
|
||||
'Rule_type3' => '混双转',
|
||||
'Rule_type4' => '固搭转',
|
||||
'Rule_type5' => '固定擂',
|
||||
'Rule_type6' => '活动擂',
|
||||
'Rule_type7' => '转转',
|
||||
'Rule_type8' => '分区转',
|
||||
'Rule_type9' => '擂台赛',
|
||||
'Rule_type10' => '守擂赛',
|
||||
'Rule_type11' => '追分赛',
|
||||
'Rule_type12' => '固搭追分赛',
|
||||
'Rule_type13' => '大循环群内赛',
|
||||
'Rule_type14' => '两队PK赛',
|
||||
'Rule_type15' => '战队淘汰赛',
|
||||
'Rule_type16' => '单项淘汰赛',
|
||||
'Rule_type17' => '分区循环淘汰赛',
|
||||
|
||||
|
||||
'Type0' => '一次性',
|
||||
'Type1' => '周期性',
|
||||
|
||||
'Status-1' => '取消',
|
||||
'Status0' => '未开始',
|
||||
'Status1' => '报名中',
|
||||
'Status2' => '进行中',
|
||||
'Status3' => '已结束',
|
||||
|
||||
'Week0' => '周日',
|
||||
'Week1' => '周一',
|
||||
'Week2' => '周二',
|
||||
'Week3' => '周三',
|
||||
'Week4' => '周四',
|
||||
'Week5' => '周五',
|
||||
'Week6' => '周六',
|
||||
|
||||
|
||||
];
|
||||
28
application/admin/lang/zh-cn/zy/game/game_join.php
Normal file
28
application/admin/lang/zh-cn/zy/game/game_join.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Act_id' => '活动id',
|
||||
'Game_id' => '赛事id',
|
||||
'User_id' => '用户id',
|
||||
'Order_id' => '订单id',
|
||||
'Users' => '参与用户',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Activity.name' => '活动名称',
|
||||
'Game.name' => '赛事名称',
|
||||
'User.username' => '用户名',
|
||||
'Order.order_sn' => '订单号',
|
||||
|
||||
'Status-1' => '取消',
|
||||
'Status0' => '待支付',
|
||||
'Status1' => '已支付',
|
||||
|
||||
'Cost10' => '报名时收取',
|
||||
'Cost21' => '活动后收取:固定',
|
||||
'Cost22' => '活动后收取:AA',
|
||||
'Cost23' => '活动后收取:女固定男AA',
|
||||
'Cost24' => '活动后收取:AA,男比女高X元',
|
||||
'Cost25' => '活动后收取:AA,男比女高X%',
|
||||
'Cost30' => '多退少补',
|
||||
];
|
||||
25
application/admin/lang/zh-cn/zy/game/game_match.php
Normal file
25
application/admin/lang/zh-cn/zy/game/game_match.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Gym_id' => '球馆',
|
||||
'Club_id' => '俱乐部',
|
||||
'Act_id' => '活动',
|
||||
'Game_id' => '比赛',
|
||||
'Level' => '轮次',
|
||||
'Turn' => '场次',
|
||||
'TeamA' => '甲方队员',
|
||||
'TeamB' => '乙方队员',
|
||||
'Round1' => '第一局比分
|
||||
',
|
||||
'Round2' => '第二局比分',
|
||||
'Round3' => '第三局比分',
|
||||
'ScoreA' => '甲方总得分',
|
||||
'ScoreB' => '乙方总得分',
|
||||
'Winner' => '胜队',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Stadium.name' => '球馆名称',
|
||||
'Club.name' => '俱乐部名称',
|
||||
'Activity.name' => '活动名称',
|
||||
'Game.name' => '赛事名称'
|
||||
];
|
||||
30
application/admin/lang/zh-cn/zy/game/participant.php
Normal file
30
application/admin/lang/zh-cn/zy/game/participant.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'User_id' => '用户id',
|
||||
'Name' => '用户名',
|
||||
'Avatar' => '头像',
|
||||
'Gender' => '性别',
|
||||
'Game_join_id' => '报名id',
|
||||
'Game_id' => '赛事id',
|
||||
'Team' => '战队',
|
||||
'Order' => '排序',
|
||||
'Rank' => '排名',
|
||||
'Mark' => '说明/备注',
|
||||
'Status' => '状态',
|
||||
'Signin' => '签到状态',
|
||||
'Score' => '得分',
|
||||
'Net_score' => '净得分',
|
||||
'Win' => '胜局',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.username' => '用户名',
|
||||
'Game.name' => '赛事名称',
|
||||
|
||||
'Status-1' => '退坑',
|
||||
'Status0' => '候补',
|
||||
'Status1' => '正常',
|
||||
|
||||
'Signin0' => '未签到',
|
||||
'Signin1' => '已签到',
|
||||
];
|
||||
23
application/admin/lang/zh-cn/zy/link/apply.php
Normal file
23
application/admin/lang/zh-cn/zy/link/apply.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Type' => '申请类型',
|
||||
'User_id' => '用户id',
|
||||
'Target_id' => '目标id',
|
||||
'Content' => '内容',
|
||||
'Status' => '状态',
|
||||
'Reason' => '申请理由',
|
||||
'Reply' => '审核理由',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
'Club.name' => '俱乐部名称',
|
||||
|
||||
'Type1' => '入会申请',
|
||||
'Type2' => '好友申请',
|
||||
'Type3' => '报名邀请',
|
||||
|
||||
'Status-1' => '拒绝',
|
||||
'Status1' => '发起',
|
||||
'Status2' => '通过'
|
||||
];
|
||||
23
application/admin/lang/zh-cn/zy/link/complaint.php
Normal file
23
application/admin/lang/zh-cn/zy/link/complaint.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Type' => '投诉类型',
|
||||
'Target_id' => '投诉对象',
|
||||
'Name' => '投诉名称',
|
||||
'User_id' => '用户',
|
||||
'Username' => '称呼',
|
||||
'Phone' => '手机号',
|
||||
'Imgs' => '图片',
|
||||
'Content' => '投诉内容',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
'Type1' => '系统投诉',
|
||||
'Type2' => '影圈举报',
|
||||
'Type3' => '用户举报',
|
||||
|
||||
'Status0' => '待处理',
|
||||
'Status1' => '已处理'
|
||||
];
|
||||
20
application/admin/lang/zh-cn/zy/link/message.php
Normal file
20
application/admin/lang/zh-cn/zy/link/message.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Type' => '消息类型',
|
||||
'From_id' => '来源id',
|
||||
'User_id' => '目标用户',
|
||||
'Content' => '消息内容',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
'Type0' => '系统消息',
|
||||
'Type1' => '通知消息',
|
||||
'Type2' => '用户消息',
|
||||
'Type3' => '俱乐部消息',
|
||||
|
||||
'Status0' => '未读',
|
||||
'Status1' => '已读'
|
||||
];
|
||||
21
application/admin/lang/zh-cn/zy/link/relation.php
Normal file
21
application/admin/lang/zh-cn/zy/link/relation.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'User_id' => '用户id',
|
||||
'Target_id' => '目标id',
|
||||
'Status' => '关系',
|
||||
'Content' => '开放权限',
|
||||
'Remark' => '备注名称',
|
||||
'Look' => '让看',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
'Status-1' => '拉黑',
|
||||
'Status0' => '取关',
|
||||
'Status1' => '关注',
|
||||
'Status2' => '特别关注',
|
||||
|
||||
'Look0' => '不让看',
|
||||
'Look1' => '让看'
|
||||
];
|
||||
21
application/admin/lang/zh-cn/zy/link/visitor.php
Normal file
21
application/admin/lang/zh-cn/zy/link/visitor.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Type' => '访问类型',
|
||||
'Obj_id' => '访问对象id',
|
||||
'User_id' => '用户id',
|
||||
'Nickname' => '昵称',
|
||||
'Avatar' => '头像',
|
||||
'Gender' => '性别',
|
||||
'Times' => '次数',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
'Type0' => '俱乐部',
|
||||
'Type1' => '球馆',
|
||||
'Type2' => '用户',
|
||||
|
||||
'Gender0' => '女',
|
||||
'Gender1' => '男',
|
||||
];
|
||||
23
application/admin/lang/zh-cn/zy/menber.php
Normal file
23
application/admin/lang/zh-cn/zy/menber.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Club_id' => '俱乐部',
|
||||
'User_id' => '用户',
|
||||
'Role' => '角色',
|
||||
'Remark' => '备注',
|
||||
'Activity' => '组球次数',
|
||||
'Game' => '比赛次数',
|
||||
'Plane' => '飞机次数',
|
||||
'Tags' => '标签',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Club.name' => '俱乐部名称',
|
||||
'User.nickname' => '昵称',
|
||||
|
||||
'Role0' => '退出',
|
||||
'Role1' => '成员',
|
||||
'Role2' => '管理员',
|
||||
'Role3' => '会长',
|
||||
'Role-1' => '黑名单'
|
||||
|
||||
];
|
||||
11
application/admin/lang/zh-cn/zy/sign/record.php
Normal file
11
application/admin/lang/zh-cn/zy/sign/record.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'User_id' => '用户id',
|
||||
'Date' => '签到日期',
|
||||
'Last' => '已持续天数',
|
||||
'Remark' => '获得礼物',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.username' => '用户名'
|
||||
];
|
||||
21
application/admin/lang/zh-cn/zy/sign/sign_set.php
Normal file
21
application/admin/lang/zh-cn/zy/sign/sign_set.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Last' => '连续签到(a)',
|
||||
'Name' => '名称',
|
||||
'Chance1' => '概率(b)',
|
||||
'Coupon1_id' => '券(c)',
|
||||
'Chance2' => '概率(d)',
|
||||
'Coupon2_id' => '券(e)',
|
||||
'BeginDate' => '有效开始日期',
|
||||
'EndDate' => '有效结束日期',
|
||||
'Intro' => '内容介绍',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'Coupon1.name' => '券(c)名称',
|
||||
'Coupon2.name' => '券(e)名称',
|
||||
|
||||
'Status0' => '禁用',
|
||||
'Status1' => '启用',
|
||||
];
|
||||
@@ -3,7 +3,7 @@
|
||||
return [
|
||||
'Type' => '标签类型',
|
||||
'Group' => '标签分组',
|
||||
'Content_json' => '标签内容',
|
||||
'Content' => '标签内容',
|
||||
'Choose' => '选择方式',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
|
||||
@@ -10,6 +10,7 @@ class User extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'user';
|
||||
protected $name = 'user';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
@@ -12,6 +12,7 @@ class User extends Common
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
public static $tableName = 'user';
|
||||
protected $name = 'user';
|
||||
|
||||
protected $type = [
|
||||
|
||||
45
application/admin/model/zy/Club.php
Normal file
45
application/admin/model/zy/Club.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Club extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_club';
|
||||
protected $table = 'zy_club';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'president', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
51
application/admin/model/zy/Menber.php
Normal file
51
application/admin/model/zy/Menber.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Menber extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_menber';
|
||||
public static $tableName = 'zy_menber';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo('Club', 'club_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ class Stadium extends Model
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_stadium';
|
||||
protected $table = 'zy_stadium';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
|
||||
51
application/admin/model/zy/circle/Circle.php
Normal file
51
application/admin/model/zy/circle/Circle.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\circle;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Circle extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_circle';
|
||||
protected $table = 'zy_circle';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Club', 'club_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
45
application/admin/model/zy/circle/Comment.php
Normal file
45
application/admin/model/zy/circle/Comment.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\circle;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_circle_comment';
|
||||
protected $table = 'zy_circle_comment';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function circle()
|
||||
{
|
||||
return $this->belongsTo('Circle', 'circle_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
51
application/admin/model/zy/circle/Likes.php
Normal file
51
application/admin/model/zy/circle/Likes.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\circle;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Likes extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_circle_likes';
|
||||
protected $table = 'zy_circle_likes';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function circle()
|
||||
{
|
||||
return $this->belongsTo('Circle', 'circle_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
53
application/admin/model/zy/game/Activity.php
Normal file
53
application/admin/model/zy/game/Activity.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\game;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Activity extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_activity';
|
||||
public static $tableName = 'zy_activity';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [];
|
||||
|
||||
|
||||
|
||||
public $costKey = ['pay_type' => '支付方式', 'male' => '男费用', 'woman' => '女费用', 'extra' => '附加费', 'server' => '服务费'];
|
||||
|
||||
|
||||
|
||||
|
||||
public function stadium()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Stadium', 'gym_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Club', 'club_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'referee', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
63
application/admin/model/zy/game/Game.php
Normal file
63
application/admin/model/zy/game/Game.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\game;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Game extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_game';
|
||||
protected $table = 'zy_game';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function activity()
|
||||
{
|
||||
return $this->belongsTo('Activity', 'act_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function stadium()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Stadium', 'gym_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Club', 'club_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'referee', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
63
application/admin/model/zy/game/GameJoin.php
Normal file
63
application/admin/model/zy/game/GameJoin.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\game;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class GameJoin extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_game_join';
|
||||
protected $table = 'zy_game_join';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function activity()
|
||||
{
|
||||
return $this->belongsTo('Activity', 'act_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function game()
|
||||
{
|
||||
return $this->belongsTo('Game', 'game_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\shopro\order\Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
62
application/admin/model/zy/game/GameMatch.php
Normal file
62
application/admin/model/zy/game/GameMatch.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\game;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class GameMatch extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_game_match';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function stadium()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Stadium', 'gym_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Club', 'club_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function activity()
|
||||
{
|
||||
return $this->belongsTo('Activity', 'act_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function game()
|
||||
{
|
||||
return $this->belongsTo('Game', 'game_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
57
application/admin/model/zy/game/Participant.php
Normal file
57
application/admin/model/zy/game/Participant.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\game;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Participant extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_participant';
|
||||
protected $table = 'zy_participant';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function join()
|
||||
{
|
||||
return $this->belongsTo('GameJoin', 'game_join_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function game()
|
||||
{
|
||||
return $this->belongsTo('Game', 'game_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
50
application/admin/model/zy/link/Apply.php
Normal file
50
application/admin/model/zy/link/Apply.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\link;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Apply extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_apply';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\Club', 'target_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
50
application/admin/model/zy/link/Complaint.php
Normal file
50
application/admin/model/zy/link/Complaint.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\link;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Complaint extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_complaint';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function circle()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\zy\circle\Circle', 'target_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
45
application/admin/model/zy/link/Message.php
Normal file
45
application/admin/model/zy/link/Message.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\link;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Message extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_message';
|
||||
protected $table = 'zy_message';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
45
application/admin/model/zy/link/Relation.php
Normal file
45
application/admin/model/zy/link/Relation.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\link;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Relation extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_relation';
|
||||
protected $table = 'zy_relation';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
45
application/admin/model/zy/link/Visitor.php
Normal file
45
application/admin/model/zy/link/Visitor.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\link;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Visitor extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
public static $tableName = 'zy_visitor';
|
||||
protected $table = 'zy_visitor';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
44
application/admin/model/zy/sign/Record.php
Normal file
44
application/admin/model/zy/sign/Record.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\sign;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Record extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_sign_record';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
50
application/admin/model/zy/sign/SignSet.php
Normal file
50
application/admin/model/zy/sign/SignSet.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy\sign;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class SignSet extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_sign_set';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function coupon1()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\shopro\Coupon', 'coupon1_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function coupon2()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\shopro\Coupon', 'coupon2_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
27
application/admin/validate/zy/Club.php
Normal file
27
application/admin/validate/zy/Club.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Club extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/Menber.php
Normal file
27
application/admin/validate/zy/Menber.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Menber extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/circle/Circle.php
Normal file
27
application/admin/validate/zy/circle/Circle.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\circle;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Circle extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/circle/Comment.php
Normal file
27
application/admin/validate/zy/circle/Comment.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\circle;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Comment extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/circle/Likes.php
Normal file
27
application/admin/validate/zy/circle/Likes.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\circle;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Likes extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
28
application/admin/validate/zy/game/Activity.php
Normal file
28
application/admin/validate/zy/game/Activity.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\game;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Activity extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
'week' => 'number|between:0,6',
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/game/Game.php
Normal file
27
application/admin/validate/zy/game/Game.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\game;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Game extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/game/GameJoin.php
Normal file
27
application/admin/validate/zy/game/GameJoin.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\game;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class GameJoin extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/game/GameMatch.php
Normal file
27
application/admin/validate/zy/game/GameMatch.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\game;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class GameMatch extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/game/Participant.php
Normal file
27
application/admin/validate/zy/game/Participant.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\game;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Participant extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/link/Apply.php
Normal file
27
application/admin/validate/zy/link/Apply.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\link;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Apply extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/link/Complaint.php
Normal file
27
application/admin/validate/zy/link/Complaint.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy\link;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Complaint extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user