Compare commits

...

11 Commits

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
601dd0abd6 feat(database): 添加签到功能相关表结构
- 新增 zy_sign_record 表,用于记录用户签到信息
- 新增 zy_sign_set 表,用于配置签到奖励设置
2025-06-16 11:16:31 +08:00
055521dc8e chore: 删除已废弃的配置文件
- 删除了多个已废弃的配置文件,包括:
  - address/config.php
  - alisms/config.php
  - epay/config.php
  - hwobs/config.php
- 这些配置文件可能属于已不再使用的插件或功能
- 删除这些文件有助于清理代码库,减少潜在的混淆和维护成本
2025-06-16 11:09:01 +08:00
30 changed files with 971 additions and 8 deletions

6
.gitignore vendored
View File

@@ -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

60
add.sql
View File

@@ -5,3 +5,63 @@ ALTER TABLE `zy_club` ADD COLUMN `attention` int(11) NOT NULL DEFAULT 0 COMMENT
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

View File

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

View File

@@ -68,3 +68,5 @@ return [
'extend' => '',
]
];

View File

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

View File

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

View File

@@ -2,19 +2,22 @@
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()
{
@@ -79,4 +82,76 @@ class Sys extends Base
$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()]);
}
}

View File

@@ -89,9 +89,9 @@ class Test extends BaseJob
}
$endTime = explode(' ', $act['endTime']);
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) { //一次性活动
$query->where('public_time', $act['public_time'])->where('date', $act['date']);
$query->where('date', $act['date']);
}
$games = $query->select();
if (!empty($games)) {

View File

@@ -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();

View File

@@ -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;

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