Compare commits

9 Commits
dev1 ... main

Author SHA1 Message Date
c77ef29846 refactor(shopro): 取消活动和比赛验证详情的token 2025-06-28 21:50:13 +08:00
349841a8a1 feat(zy): 添加访客记录功能
- 新增 zy_visitor 表,用于记录访客信息
- 调整签到活动逻辑,暂时注释掉活动状态检查
2025-06-28 21:42:42 +08:00
e30de5cc79 refactor: 备份现有addons/*/config.php文件 2025-06-19 09:06:13 +08:00
a00dd72640 fix(shopro): 修复周期性活动不能重复创建问题 2025-06-17 17:02:59 +08:00
db29a0f7c0 feat(zy): 完善签到设置功能 2025-06-17 16:20:22 +08:00
335c6a6c68 feat(sign): 完善签到功能送优惠卷功能 2025-06-17 15:11:19 +08:00
5227396484 feat(sign): 优化签到领券设置功能
- 添加优惠券选择器功能
- 优化签到天数和概率输入范围
- 更新签到状态为禁用/启用选项
- 调整表单布局和样式
- 优化数据表格显示
2025-06-17 11:19:12 +08:00
“publish”
9ba854cc76 .gitignore: add /public/storage 2025-06-17 06:45:28 +08:00
3ef8b70823 feat(database): 签到活动功能 2025-06-16 21:28:12 +08:00
30 changed files with 1464 additions and 8 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,6 @@
/runtime/* /runtime/*
/public/uploads/* /public/uploads/*
/public/storage/*
.DS_Store .DS_Store
.idea .idea
composer.lock composer.lock
@@ -15,3 +16,4 @@ addons/alisms/config.php
addons/address/config.php addons/address/config.php
addons/epay/config.php addons/epay/config.php
addons/hwobs/config.php addons/hwobs/config.php
addons/*/config.php

35
add.sql
View File

@@ -31,4 +31,37 @@ CREATE TABLE `zy_sign_set` (
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
KEY `type` (`last`) USING BTREE KEY `type` (`last`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到设置'; ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到设置';
-- 已执行 2025-06-16
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

View File

@@ -0,0 +1,132 @@
<?php
return [
[
'name' => 'maptype',
'title' => '默认地图类型',
'type' => 'radio',
'content' => [
'baidu' => '百度地图',
'amap' => '高德地图',
'tencent' => '腾讯地图',
],
'value' => 'amap',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'zoom',
'title' => '默认缩放级别',
'type' => 'string',
'content' => [],
'value' => '11',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'lat',
'title' => '默认Lat',
'type' => 'string',
'content' => [],
'value' => '23.002569',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'lng',
'title' => '默认Lng',
'type' => 'string',
'content' => [],
'value' => '113.752215',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'baidukey',
'title' => '百度地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'amapkey',
'title' => '高德地图KEY',
'type' => 'string',
'content' => [],
'value' => '78c9a922ba2d29f005eaa89e3f1b00bb',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'amapsecurityjscode',
'title' => '高德地图安全密钥',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'tencentkey',
'title' => '腾讯地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'coordtype',
'title' => '坐标系类型',
'type' => 'select',
'content' => [
'DEFAULT' => '默认(使用所选地图默认坐标系)',
'GCJ02' => 'GCJ-02',
'BD09' => 'BD-09',
],
'value' => 'DEFAULT',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => '__tips__',
'title' => '温馨提示',
'type' => '',
'content' => [],
'value' => '请先申请对应地图的Key配置后再使用',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => 'alert-danger-light',
],
];

View File

@@ -0,0 +1,77 @@
<?php
return array(
array(
'name' => 'key',
'title' => '应用key',
'type' => 'string',
'content' =>
array(),
'value' => 'your key',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
array(
'name' => 'secret',
'title' => '密钥secret',
'type' => 'string',
'content' =>
array(),
'value' => 'your secret',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
array(
'name' => 'sign',
'title' => '签名',
'type' => 'string',
'content' =>
array(),
'value' => 'your sign',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
array(
'name' => 'template',
'title' => '短信模板',
'type' => 'array',
'content' =>
array(),
'value' =>
array(
'register' => 'SMS_114000000',
'resetpwd' => 'SMS_114000000',
'changepwd' => 'SMS_114000000',
'changemobile' => 'SMS_114000000',
'profile' => 'SMS_114000000',
'notice' => 'SMS_114000000',
),
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
array(
'name' => '__tips__',
'title' => '温馨提示',
'type' => 'string',
'content' =>
array(),
'value' => '应用key和密钥你可以通过 https://ak-console.aliyun.com/?spm=a2c4g.11186623.2.13.fd315777PX3tjy#/accesskey 获取',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
);

View File

@@ -0,0 +1,4 @@
<?php
return [
];

View File

@@ -0,0 +1,72 @@
<?php
return [
[
'name' => 'version',
'title' => 'API版本(请勿修改该值)',
'type' => 'radio',
'content' => [],
'value' => 'v2',
'rule' => '',
'msg' => '',
'tip' => 'V2版本只支持微信支付V2密钥V3版本只支持微信支付V3密钥请勿修改该值',
'ok' => '',
'extend' => '',
],
[
'name' => 'wechat',
'title' => '微信',
'type' => 'array',
'content' => [],
'value' => [
'appid' => '',
'app_id' => '',
'app_secret' => '',
'miniapp_id' => '',
'mch_id' => '',
'key' => '',
'key_v3' => '',
'mode' => 'normal',
'sub_mch_id' => '',
'sub_appid' => '',
'sub_app_id' => '',
'sub_miniapp_id' => '',
'notify_url' => '',
'cert_client' => '/addons/epay/certs/apiclient_cert.pem',
'cert_key' => '/addons/epay/certs/apiclient_key.pem',
'log' => '1',
],
'rule' => 'required',
'msg' => '',
'tip' => '微信参数配置',
'ok' => '',
'extend' => '',
],
[
'name' => 'alipay',
'title' => '支付宝',
'type' => 'array',
'content' => [],
'value' => [
'app_id' => '',
'mode' => 'normal',
'notify_url' => '/addons/epay/api/notifyx/type/alipay',
'return_url' => '/addons/epay/api/returnx/type/alipay',
'private_key' => '',
'signtype' => 'cert',
'pid' => '',
'ali_public_key' => '',
'app_cert_public_key' => '',
'alipay_root_cert' => '',
'log' => '1',
'scanpay' => '0',
],
'rule' => 'required',
'msg' => '',
'tip' => '支付宝参数配置',
'ok' => '',
'extend' => '',
]
];

245
addons/hwobs/config.bak.php Normal file
View 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' => '',
],
];

View File

@@ -21,7 +21,7 @@ class Activity extends Base
{ {
use SkuPrice; use SkuPrice;
protected $noNeedLogin = ['index', 'test']; protected $noNeedLogin = ['index', 'view', 'test'];
public function __construct() public function __construct()
{ {

View File

@@ -19,6 +19,8 @@ use addons\shopro\service\order\OrderRefund;
class Game extends Base class Game extends Base
{ {
protected $noNeedLogin = ['view'];
public function __construct() public function __construct()
{ {

View File

@@ -2,19 +2,22 @@
namespace addons\shopro\controller\zy; namespace addons\shopro\controller\zy;
use think\Db; use think\Db;
use think\Exception; use think\Exception;
use app\admin\model\zy\Tags; use app\admin\model\zy\Tags;
use think\exception\PDOException; use think\exception\PDOException;
use app\admin\model\zy\sign\Record;
use app\admin\model\zy\link\Visitor; 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\shopro\user\User;
use app\admin\model\zy\circle\Circle; use app\admin\model\zy\circle\Circle;
use app\admin\model\zy\link\Complaint; use app\admin\model\zy\link\Complaint;
use think\exception\ValidateException; use think\exception\ValidateException;
use addons\shopro\library\activity\traits\GiveGift;
class Sys extends Base class Sys extends Base
{ {
use GiveGift;
public function index() public function index()
{ {
@@ -79,4 +82,76 @@ class Sys extends Base
$res = Visitor::where('type', $params['type'])->where('obj_id', $params['obj_id'])->paginate($params['pageSize'] ?? 10); $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()]); $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()]);
}
}

View File

@@ -89,9 +89,9 @@ class Test extends BaseJob
} }
$endTime = explode(' ', $act['endTime']); $endTime = explode(' ', $act['endTime']);
if (count($endTime) == 2) $act['endTime'] = $endTime[1]; if (count($endTime) == 2) $act['endTime'] = $endTime[1];
$query = (clone $_gameModel)::where('act_id', $act['id']); $query = (clone $_gameModel)::where('act_id', $act['id'])->where('public_time', $act['public_time']);
if ($act['type'] == 0) { //一次性活动 if ($act['type'] == 0) { //一次性活动
$query->where('public_time', $act['public_time'])->where('date', $act['date']); $query->where('date', $act['date']);
} }
$games = $query->select(); $games = $query->select();
if (!empty($games)) { if (!empty($games)) {

View File

@@ -70,7 +70,7 @@ trait CouponSend
foreach ($coupons as $coupon) { foreach ($coupons as $coupon) {
try { try {
$userCoupon = $this->send($user, $coupon); $userCoupon = $this->send($user, $coupon);
$success[] = $coupon->id; $success[] = $coupon->name;
} catch (HttpResponseException $e) { } catch (HttpResponseException $e) {
$data = $e->getResponse()->getData(); $data = $e->getResponse()->getData();
$message = $data ? ($data['msg'] ?? '') : $e->getMessage(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage();

View File

@@ -36,7 +36,9 @@ class Coupon extends Common
if (!$this->request->isAjax()) { if (!$this->request->isAjax()) {
return $this->view->fetch(); 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) { $coupons = $this->model->sheepFilter()->paginate($this->request->param('list_rows', 10))->each(function ($coupon) {
// 优惠券领取和使用数量 // 优惠券领取和使用数量
$coupon->get_num = $coupon->get_num; $coupon->get_num = $coupon->get_num;

View 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();
}
}

View 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();
}
}

View File

@@ -0,0 +1,11 @@
<?php
return [
'User_id' => '用户id',
'Date' => '签到日期',
'Last' => '已持续天数',
'Remark' => '获得礼物',
'Create_time' => '创建时间',
'Update_time' => '修改时间',
'User.username' => '用户名'
];

View 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' => '启用',
];

View 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);
}
}

View 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);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\zy\sign;
use think\Validate;
class Record extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\zy\sign;
use think\Validate;
class SignSet extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@@ -0,0 +1,39 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" min="0" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Date')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-date" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[date]" type="text" value="{:date('Y-m-d')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Last')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-last" data-rule="required" class="form-control" name="row[last]" type="number" value="1">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,39 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" min="0" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Date')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-date" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[date]" type="text" value="{$row.date}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Last')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-last" data-rule="required" class="form-control" name="row[last]" type="number" value="{$row.last|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.create_time}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.update_time}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,29 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('zy/sign/record/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('zy/sign/record/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('zy/sign/record/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> -->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('zy/sign/record/edit')}"
data-operate-del="{:$auth->check('zy/sign/record/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,69 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-10 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Last')}:</label>
<div class="col-xs-10 col-sm-8">
<input id="c-last" data-rule="required" class="form-control" name="row[last]" type="number" value="1"
min="1" max="100">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Chance1')}:</label>
<div class="col-xs-2 col-sm-2">
<input id="c-chance1" data-rule="required" class="form-control" name="row[chance1]" type="number" value="0"
min="0" max="100">
</div>
<label class="control-label col-xs-2 col-sm-1">{:__('Coupon1_id')}:</label>
<div class="col-xs-6 col-sm-5">
<input id="c-coupon1_id" data-rule="required" data-source="shopro/coupon/index"
class="form-control selectpage" name="row[coupon1_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Chance2')}:</label>
<div class="col-xs-2 col-sm-2">
<input id="c-chance2" class="form-control" name="row[chance2]" type="number" value="0"
min="0" max="100">
</div>
<label class="control-label col-xs-2 col-sm-1">{:__('Coupon2_id')}:</label>
<div class="col-xs-6 col-sm-5">
<input id="c-coupon2_id" data-source="shopro/coupon/index"
class="form-control selectpage" name="row[coupon2_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('BeginDate')}:</label>
<div class="col-xs-4 col-sm-3">
<input id="c-begin_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
data-use-current="true" name="row[begin_date]" type="text" value="">
</div>
<label class="control-label col-xs-2 col-sm-2">{:__('EndDate')}:</label>
<div class="col-xs-4 col-sm-3">
<input id="c-end_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
data-use-current="true" name="row[end_date]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-10 col-sm-8">
{:build_radios('row[status]', ['0'=>__('Status0'), '1'=>__('Status1')],1)}
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,83 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-10 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Last')}:</label>
<div class="col-xs-10 col-sm-8">
<input id="c-last" data-rule="required" class="form-control" name="row[last]" type="number" value="{$row.last|htmlentities}"
min="1" max="100">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Chance1')}:</label>
<div class="col-xs-2 col-sm-2">
<input id="c-chance1" data-rule="required" class="form-control" name="row[chance1]" type="number" value="{$row.chance1|htmlentities}"
min="0" max="100">
</div>
<label class="control-label col-xs-2 col-sm-1">{:__('Coupon1_id')}:</label>
<div class="col-xs-6 col-sm-5">
<input id="c-coupon1_id" data-rule="required" data-source="shopro/coupon/index"
class="form-control selectpage" name="row[coupon1_id]" type="text" value="{$row.coupon1_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('Chance2')}:</label>
<div class="col-xs-2 col-sm-2">
<input id="c-chance2" class="form-control" name="row[chance2]" type="number" value="{$row.chance2|htmlentities}"
min="0" max="100">
</div>
<label class="control-label col-xs-2 col-sm-1">{:__('Coupon2_id')}:</label>
<div class="col-xs-6 col-sm-5">
<input id="c-coupon2_id" data-source="shopro/coupon/index"
class="form-control selectpage" name="row[coupon2_id]" type="text" value="{$row.coupon2_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-2">{:__('BeginDate')}:</label>
<div class="col-xs-4 col-sm-3">
<input id="c-begin_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
data-use-current="true" name="row[begin_date]" type="text" value="{$row.begin_date|htmlentities}">
</div>
<label class="control-label col-xs-2 col-sm-2">{:__('EndDate')}:</label>
<div class="col-xs-4 col-sm-3">
<input id="c-end_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
data-use-current="true" name="row[end_date]" type="text" value="{$row.end_date|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[status]', ['0'=>__('Status0'), '1'=>__('Status1')],$row.status)}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-create_time" readonly class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.create_time}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-update_time" readonly class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.update_time}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,29 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('zy/sign/sign_set/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('zy/sign/sign_set/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('zy/sign/sign_set/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('zy/sign/sign_set/edit')}"
data-operate-del="{:$auth->check('zy/sign/sign_set/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,57 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'zy/sign/record/index' + location.search,
add_url: 'zy/sign/record/add',
edit_url: 'zy/sign/record/edit',
del_url: 'zy/sign/record/del',
multi_url: 'zy/sign/record/multi',
import_url: 'zy/sign/record/import',
table: 'zy_sign_record',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user_id', title: __('User_id')},
{field: 'user.username', title: __('User.username'), operate: 'LIKE'},
{field: 'date', title: __('Date')},
{field: 'last', title: __('Last')},
{field: 'remark', title: __('Remark')},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,62 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'zy/sign/sign_set/index' + location.search,
add_url: 'zy/sign/sign_set/add',
edit_url: 'zy/sign/sign_set/edit',
del_url: 'zy/sign/sign_set/del',
multi_url: 'zy/sign/sign_set/multi',
import_url: 'zy/sign/sign_set/import',
table: 'zy_sign_set',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{ checkbox: true },
{ field: 'id', title: __('Id') },
{ field: 'name', title: __('Name') },
{ field: 'last', title: __('Last') },
{ field: 'chance1', title: __('Chance1') },
{ field: 'coupon1.name', title: __('Coupon1.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
{ field: 'chance2', title: __('Chance2') },
{ field: 'coupon2.name', title: __('Coupon2.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
{field: 'begin_date', title: __('BeginDate')},
{field: 'end_date', title: __('EndDate')},
{field: 'intro', title: __('Intro')},
{ field: 'status', title: __('Status'), formatter: Table.api.formatter.label, searchList: { 0: __('Status0'), 1: __('Status1') } },
{ field: 'create_time', title: __('Create_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
{ field: 'update_time', title: __('Update_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
{ field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

0
runtime/.gitkeep Normal file → Executable file
View File