Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
52a93edb
Commit
52a93edb
authored
Mar 11, 2019
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
活动添加修改获取
parent
f467d9aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
7 deletions
+75
-7
ActivityService.php
application/api/service/ActivityService.php
+2
-2
Activity.php
application/index/controller/Activity.php
+6
-4
Basic.php
application/index/extend/Basic.php
+3
-1
ActivityValidate.php
application/index/validate/ActivityValidate.php
+64
-0
No files found.
application/api/service/ActivityService.php
View file @
52a93edb
...
@@ -54,10 +54,10 @@ class ActivityService
...
@@ -54,10 +54,10 @@ class ActivityService
$arr
[
"return_action"
]
=
$return_action
;
$arr
[
"return_action"
]
=
$return_action
;
}
}
if
(
!
empty
(
$activity_start_time
))
{
if
(
!
empty
(
$activity_start_time
))
{
$arr
[
"activity_start_time"
]
=
$activity_start_time
;
$arr
[
"activity_start_time"
]
=
date
(
"Y-m-d H:i:s"
,
$activity_start_time
)
;
}
}
if
(
!
empty
(
$activity_end_time
))
{
if
(
!
empty
(
$activity_end_time
))
{
$arr
[
"activity_end_time"
]
=
$activity_end_time
;
$arr
[
"activity_end_time"
]
=
date
(
"Y-m-d H:i:s"
,
$activity_end_time
)
;
}
}
if
(
!
empty
(
$use_period
))
{
if
(
!
empty
(
$use_period
))
{
$arr
[
"use_period"
]
=
$use_period
;
$arr
[
"use_period"
]
=
$use_period
;
...
...
application/index/controller/Activity.php
View file @
52a93edb
...
@@ -25,13 +25,14 @@ class Activity extends Basic
...
@@ -25,13 +25,14 @@ class Activity extends Basic
/**
/**
* 新增or修改活动
* 新增or修改活动
* doc url :http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=817
* @return \think\Response
* @return \think\Response
*/
*/
public
function
saveActivity
()
public
function
saveActivity
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/*
$params = array(
/*
$params = array(
'id' => 1,
//
'id' => 1,
'title' => '活动1',
'title' => '活动1',
'return_type' => '1',
'return_type' => '1',
'money' => '1121',
'money' => '1121',
...
@@ -43,7 +44,7 @@ class Activity extends Basic
...
@@ -43,7 +44,7 @@ class Activity extends Basic
'available' => 1,
'available' => 1,
'activity_rule' => '加拉时间的发送去问问人情味',
'activity_rule' => '加拉时间的发送去问问人情味',
);*/
);*/
$checkResult
=
$this
->
validate
(
$params
,
"ActivityValidate.
editor
"
);
$checkResult
=
$this
->
validate
(
$params
,
"ActivityValidate.
create
"
);
if
(
true
!==
$checkResult
)
{
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
return
$this
->
response
(
"101"
,
$checkResult
);
}
}
...
@@ -62,7 +63,7 @@ class Activity extends Basic
...
@@ -62,7 +63,7 @@ class Activity extends Basic
if
(
!
empty
(
$params
[
"id"
])
&&
isset
(
$params
[
"id"
]))
{
if
(
!
empty
(
$params
[
"id"
])
&&
isset
(
$params
[
"id"
]))
{
$id
=
$params
[
"id"
];
$id
=
$params
[
"id"
];
}
else
{
}
else
{
if
(
$activity_start_time
<
=
time
()
||
$activity_end_time
<
time
())
{
if
(
$activity_start_time
<
time
()
||
$activity_end_time
<
time
())
{
return
$this
->
response
(
"101"
,
"活动开始时间和结束时间不能小于当前时间"
);
return
$this
->
response
(
"101"
,
"活动开始时间和结束时间不能小于当前时间"
);
}
}
}
}
...
@@ -79,6 +80,7 @@ class Activity extends Basic
...
@@ -79,6 +80,7 @@ class Activity extends Basic
/**
/**
* 获取活动列表
* 获取活动列表
* doc url :http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=818
* @return \think\Response
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
...
...
application/index/extend/Basic.php
View file @
52a93edb
...
@@ -82,7 +82,9 @@ class Basic extends Controller
...
@@ -82,7 +82,9 @@ class Basic extends Controller
'index/uploadEditor'
,
'index/uploadEditor'
,
'index/downloadFile'
,
'index/downloadFile'
,
'index/getStoreRandKingListByAgentId'
,
'index/getStoreRandKingListByAgentId'
,
'index/getRandKingListByAgentId'
'index/getRandKingListByAgentId'
,
'index/saveActivity'
,
'index/getActivityList'
,
);
);
/**
/**
...
...
application/index/validate/ActivityValidate.php
0 → 100644
View file @
52a93edb
<?php
namespace
app\index\validate
;
use
think\Validate
;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 9:49
*/
class
ActivityValidate
extends
Validate
{
protected
$rule
=
[
'id'
=>
'require'
,
'title'
=>
'require|length:1,80'
,
'return_type'
=>
'require|in:0,1'
,
'money'
=>
'require|number|gt:0|lt:5000'
,
'return_action'
=>
'require|in:0,1,2'
,
'activity_start_time'
=>
'require'
,
'activity_end_time'
=>
'require'
,
'use_period'
=>
'require|number'
,
'total'
=>
'require|number'
,
'available'
=>
'require|number'
,
'get_number'
=>
'require|number|gt:0'
,
'activity_rule'
=>
'require'
,
'status'
=>
'require|number|in:0,1,2,3,4,5'
,
];
protected
$message
=
[
'id.require'
=>
'活动id不能为空'
,
'title.length:1,80'
=>
'活动标题字数必须1-80'
,
'return_type.require'
=>
'奖励类型为必须字段'
,
'return_type.in'
=>
'奖励类型错误'
,
'money.require'
=>
'奖励金额为必填'
,
'money.number'
=>
'奖励金额必须是数字'
,
'money.gt'
=>
'奖励金额必须大于0'
,
'money.lt'
=>
'奖励金额不能大于5000'
,
'return_action.require'
=>
'奖励动作为必填'
,
'return_action.in'
=>
'奖励动作值错误'
,
'activity_start_time.require'
=>
'活动开始时间为必填'
,
'activity_end_time.require'
=>
'活动结束时间为必填'
,
'use_period.require'
=>
'使用有效期为必须字段'
,
'use_period.number'
=>
'使用有效期必须是数字'
,
'total.require'
=>
'可发放总数为必须字段'
,
'total.number'
=>
'可发放总数必须是数字'
,
'available.require'
=>
'用户可领数为必须字段'
,
'available.number'
=>
'用户可领数必须是数字'
,
'get_number.require'
=>
'已领数不能为空'
,
'get_number.number'
=>
'已领数只能是数字'
,
'get_number.gt'
=>
'已领数必须大于0'
,
'activity_rule.require'
=>
'活动规则为必填'
,
'status.require'
=>
'活动状态为必填'
,
'status.number'
=>
'活动状态必须为数字'
,
'status.in'
=>
'活动状态值错误'
,
];
protected
$scene
=
[
'create'
=>
[
'title'
,
'return_type'
,
'money'
,
'return_action'
,
'activity_start_time'
,
'activity_end_time'
,
'use_period'
,
'total'
,
'available'
,
'activity_rule'
],
];
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment