Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
u011369184
ShopXO
提交
f842cb42
ShopXO
项目概览
u011369184
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f842cb42
编写于
2月 14, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增用户登录赠送积分应用
上级
2044d963
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
481 addition
and
75 deletion
+481
-75
application/index/controller/Buy.php
application/index/controller/Buy.php
+1
-1
application/index/controller/Cart.php
application/index/controller/Cart.php
+1
-1
application/index/controller/Common.php
application/index/controller/Common.php
+3
-3
application/index/controller/Goods.php
application/index/controller/Goods.php
+1
-1
application/index/controller/Message.php
application/index/controller/Message.php
+1
-1
application/index/controller/Order.php
application/index/controller/Order.php
+1
-1
application/index/controller/Personal.php
application/index/controller/Personal.php
+1
-1
application/index/controller/Safety.php
application/index/controller/Safety.php
+1
-1
application/index/controller/User.php
application/index/controller/User.php
+3
-3
application/index/controller/Useraddress.php
application/index/controller/Useraddress.php
+1
-1
application/index/controller/Userfavor.php
application/index/controller/Userfavor.php
+1
-1
application/index/controller/Usergoodsbrowse.php
application/index/controller/Usergoodsbrowse.php
+1
-1
application/index/controller/Userintegral.php
application/index/controller/Userintegral.php
+1
-1
application/plugins/commontopmaxpicture/Hook.php
application/plugins/commontopmaxpicture/Hook.php
+2
-2
application/plugins/commontopnotice/Hook.php
application/plugins/commontopnotice/Hook.php
+2
-2
application/plugins/usercentertopnotice/Hook.php
application/plugins/usercentertopnotice/Hook.php
+2
-2
application/plugins/userlogingiveintegral/Admin.php
application/plugins/userlogingiveintegral/Admin.php
+90
-0
application/plugins/userlogingiveintegral/Hook.php
application/plugins/userlogingiveintegral/Hook.php
+137
-0
application/plugins/userlogingiveintegral/config.json
application/plugins/userlogingiveintegral/config.json
+24
-0
application/plugins/view/commontopnotice/admin/saveinfo.html
application/plugins/view/commontopnotice/admin/saveinfo.html
+1
-1
application/plugins/view/usercentertopnotice/admin/saveinfo.html
...tion/plugins/view/usercentertopnotice/admin/saveinfo.html
+1
-1
application/plugins/view/userlogingiveintegral/admin/index.html
...ation/plugins/view/userlogingiveintegral/admin/index.html
+55
-0
application/plugins/view/userlogingiveintegral/admin/saveinfo.html
...on/plugins/view/userlogingiveintegral/admin/saveinfo.html
+49
-0
application/service/PluginsAdminService.php
application/service/PluginsAdminService.php
+40
-36
application/service/UserService.php
application/service/UserService.php
+16
-1
application/tags.php
application/tags.php
+4
-0
config/shopxo.php
config/shopxo.php
+1
-1
config/shopxo.sql
config/shopxo.sql
+17
-12
public/static/plugins/css/userlogingiveintegral/admin.css
public/static/plugins/css/userlogingiveintegral/admin.css
+23
-0
public/static/upload/images/plugins_userlogingiveintegral/2019/02/14/1550151082834629.png
...ins_userlogingiveintegral/2019/02/14/1550151082834629.png
+0
-0
未找到文件。
application/index/controller/Buy.php
浏览文件 @
f842cb42
...
...
@@ -37,7 +37,7 @@ class Buy extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Cart.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class Cart extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Common.php
浏览文件 @
f842cb42
...
...
@@ -81,7 +81,7 @@ class Common extends Controller
private
function
CommonPluginsInit
()
{
// 公共顶部钩子
$this
->
assign
(
'plugins_common_top_data'
,
Hook
::
listen
(
'plugins_common_top'
));
$this
->
assign
(
'plugins_common_top_data'
,
Hook
::
listen
(
'plugins_common_top'
,
[
'hook_name'
=>
'plugins_common_top'
,
'is_control'
=>
false
]
));
}
/**
...
...
@@ -105,13 +105,13 @@ class Common extends Controller
}
/**
* [Is
_
Login 登录校验]
* [IsLogin 登录校验]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-03-09T11:43:48+0800
*/
protected
function
Is
_
Login
()
protected
function
IsLogin
()
{
if
(
session
(
'user'
)
==
null
)
{
...
...
application/index/controller/Goods.php
浏览文件 @
f842cb42
...
...
@@ -120,7 +120,7 @@ class Goods extends Common
public
function
Favor
()
{
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
// 开始处理
$params
=
input
(
'post.'
);
...
...
application/index/controller/Message.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class Message extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Order.php
浏览文件 @
f842cb42
...
...
@@ -35,7 +35,7 @@ class Order extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Personal.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class Personal extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Safety.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class Safety extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/User.php
浏览文件 @
f842cb42
...
...
@@ -74,7 +74,7 @@ class User extends Common
public
function
Index
()
{
// 登录校验
$this
->
Is
_
Login
();
$this
->
IsLogin
();
// 订单总数
$where
=
[
'user_id'
=>
$this
->
user
[
'id'
],
'is_delete_time'
=>
0
,
'user_is_delete_time'
=>
0
];
...
...
@@ -137,7 +137,7 @@ class User extends Common
$this
->
assign
(
'goods_browse_list'
,
$data
[
'data'
]);
// 用户中心顶部钩子
$this
->
assign
(
'plugins_user_center_top_data'
,
Hook
::
listen
(
'plugins_user_center_top'
));
$this
->
assign
(
'plugins_user_center_top_data'
,
Hook
::
listen
(
'plugins_user_center_top'
,
[
'hook_name'
=>
'plugins_user_center_top'
,
'is_control'
=>
false
]
));
return
$this
->
fetch
();
}
...
...
@@ -434,7 +434,7 @@ class User extends Common
}
// 登录校验
$this
->
Is
_
Login
();
$this
->
IsLogin
();
$params
=
$_POST
;
$params
[
'user'
]
=
$this
->
user
;
...
...
application/index/controller/Useraddress.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class UserAddress extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Userfavor.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class UserFavor extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Usergoodsbrowse.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class UserGoodsBrowse extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/index/controller/Userintegral.php
浏览文件 @
f842cb42
...
...
@@ -34,7 +34,7 @@ class UserIntegral extends Common
parent
::
_initialize
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/plugins/commontopmaxpicture/Hook.php
浏览文件 @
f842cb42
...
...
@@ -32,9 +32,9 @@ class Hook
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
)
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
])
)
{
return
[]
;
return
DataReturn
(
'无需处理'
,
0
)
;
// 默认返回视图
}
else
{
...
...
application/plugins/commontopnotice/Hook.php
浏览文件 @
f842cb42
...
...
@@ -32,9 +32,9 @@ class Hook
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
)
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
])
)
{
return
[]
;
return
DataReturn
(
'无需处理'
,
0
)
;
// 默认返回视图
}
else
{
...
...
application/plugins/usercentertopnotice/Hook.php
浏览文件 @
f842cb42
...
...
@@ -32,9 +32,9 @@ class Hook
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
)
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
])
)
{
return
[]
;
return
DataReturn
(
'无需处理'
,
0
)
;
// 默认返回视图
}
else
{
...
...
application/plugins/userlogingiveintegral/Admin.php
0 → 100644
浏览文件 @
f842cb42
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\plugins\userlogingiveintegral
;
use
app\service\PluginsService
;
/**
* 登录赠送积分 - 后台管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Admin
{
/**
* 首页
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
index
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'userlogingiveintegral'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 数组组装
$data
=
[
'data'
=>
$ret
[
'data'
],
];
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
else
{
return
$ret
;
}
}
/**
* 编辑页面
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
saveinfo
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'userlogingiveintegral'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 是否
$is_whether_list
=
[
0
=>
array
(
'id'
=>
0
,
'name'
=>
'否'
),
1
=>
array
(
'id'
=>
1
,
'name'
=>
'是'
,
'checked'
=>
true
),
];
// 数组组装
$data
=
[
'is_whether_list'
=>
$is_whether_list
,
'data'
=>
$ret
[
'data'
],
];
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
else
{
return
$ret
;
}
}
/**
* 数据保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
save
(
$params
=
[])
{
return
PluginsService
::
PluginsDataSave
([
'plugins'
=>
'userlogingiveintegral'
,
'data'
=>
$params
]);
}
}
?>
\ No newline at end of file
application/plugins/userlogingiveintegral/Hook.php
0 → 100644
浏览文件 @
f842cb42
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\plugins\userlogingiveintegral
;
use
think\Db
;
use
app\service\PluginsService
;
use
app\service\IntegralService
;
use
app\service\UserService
;
/**
* 登录赠送积分 - 钩子入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Hook
{
/**
* 应用响应入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-09T14:25:44+0800
* @param [array] $params [输入参数]
*/
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
if
(
!
empty
(
$params
[
'user'
]))
{
switch
(
$params
[
'hook_name'
])
{
// 用户登录成功后赠送积分
case
'plugins_user_login_end'
:
$ret
=
$this
->
LoginGiveIntegral
(
$params
);
break
;
default
:
$ret
=
DataReturn
(
'无需处理'
,
0
);
}
return
$ret
;
}
else
{
return
DataReturn
(
'钩子传入参数有误'
,
-
600
);
}
// 默认返回视图
}
else
{
return
''
;
}
}
/**
* 赠送积分
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-14T22:19:08+0800
* @param [array] $params [参数]
*/
private
function
LoginGiveIntegral
(
$params
)
{
// 获取应用数据
$ret
=
PluginsService
::
PluginsData
(
'userlogingiveintegral'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 限制时间是否已结束
if
(
!
empty
(
$ret
[
'data'
][
'time_start'
]))
{
// 是否已开始
if
(
strtotime
(
$ret
[
'data'
][
'time_start'
])
>
time
())
{
return
DataReturn
(
'不在限制时间范围、无需处理'
,
0
);
}
}
if
(
!
empty
(
$ret
[
'data'
][
'time_end'
]))
{
// 是否已结束
if
(
strtotime
(
$ret
[
'data'
][
'time_end'
])
<
time
())
{
return
DataReturn
(
'不在限制时间范围、无需处理'
,
0
);
}
}
// 是否日一次限制
if
(
isset
(
$ret
[
'data'
][
'is_day_once'
])
&&
$ret
[
'data'
][
'is_day_once'
]
==
1
)
{
$where
=
[
[
'user_id'
,
'='
,
$params
[
'user'
][
'id'
]],
[
'add_time'
,
'>='
,
strtotime
(
date
(
'Y-m-d 00:00:00'
))],
[
'type'
,
'='
,
1
],
[
'msg'
,
'='
,
'登录赠送积分'
],
];
$log
=
Db
::
name
(
'UserIntegralLog'
)
->
where
(
$where
)
->
find
();
if
(
!
empty
(
$log
))
{
return
DataReturn
(
'今日已赠送、无需处理'
,
0
);
}
}
// 获取用户积分
$give_integral
=
empty
(
$ret
[
'data'
][
'give_integral'
])
?
0
:
intval
(
$ret
[
'data'
][
'give_integral'
]);
if
(
!
empty
(
$give_integral
))
{
// 用户积分添加
$user_integral
=
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$params
[
'user'
][
'id'
]])
->
value
(
'integral'
);
if
(
!
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$params
[
'user'
][
'id'
]])
->
setInc
(
'integral'
,
$give_integral
))
{
return
DataReturn
(
'登录赠送积分失败'
,
-
10
);
}
// 积分日志
IntegralService
::
UserIntegralLogAdd
(
$params
[
'user'
][
'id'
],
$user_integral
,
$user_integral
+
$give_integral
,
'登录赠送积分'
,
1
);
// 更新用户登录缓存数据
UserService
::
UserLoginRecord
(
$params
[
'user'
][
'id'
]);
return
DataReturn
(
'登录赠送积分成功'
,
0
);
}
else
{
return
DataReturn
(
'登录赠送积分应用配置有误'
,
-
600
);
}
}
else
{
return
$ret
;
}
}
}
?>
\ No newline at end of file
application/plugins/userlogingiveintegral/config.json
0 → 100644
浏览文件 @
f842cb42
{
"base"
:{
"plugins"
:
"userlogingiveintegral"
,
"name"
:
"登录赠送积分"
,
"logo"
:
"
\/
static
\/
upload
\/
images
\/
plugins_userlogingiveintegral
\/
2019
\/
02
\/
14
\/
1550151082834629.png"
,
"author"
:
"Devil"
,
"author_url"
:
"https:
\/\/
shopxo.net
\/
"
,
"version"
:
"1.0.0"
,
"desc"
:
"用户登录后赠送积分"
,
"apply_terminal"
:[
"pc"
,
"h5"
],
"apply_version"
:[
"1.3.0"
],
"is_home"
:
false
},
"hook"
:{
"plugins_user_login_end"
:[
"app
\\
plugins
\\
userlogingiveintegral
\\
Hook"
]
}
}
\ No newline at end of file
application/plugins/view/commontopnotice/admin/saveinfo.html
浏览文件 @
f842cb42
...
...
@@ -12,7 +12,7 @@
<div
class=
"am-form-group am-form-file"
>
<label
class=
"block"
>
公告内容
<span
class=
"fs-12 fw-100 cr-999"
>
(空则不显示)
</span></label>
<textarea
rows=
"3"
name=
"content"
class=
"am-radius am-field-valid"
placeholder=
"
商城公告
"
data-validation-message=
"请填写公告内容"
>
{{if !empty($data['content'])}}{{$data.content}}{{/if}}
</textarea>
<textarea
rows=
"3"
name=
"content"
class=
"am-radius am-field-valid"
placeholder=
"
公告内容
"
data-validation-message=
"请填写公告内容"
>
{{if !empty($data['content'])}}{{$data.content}}{{/if}}
</textarea>
</div>
<div
class=
"am-form-group"
>
...
...
application/plugins/view/usercentertopnotice/admin/saveinfo.html
浏览文件 @
f842cb42
...
...
@@ -12,7 +12,7 @@
<div
class=
"am-form-group am-form-file"
>
<label
class=
"block"
>
公告内容
<span
class=
"fs-12 fw-100 cr-999"
>
(空则不显示)
</span></label>
<textarea
rows=
"3"
name=
"content"
class=
"am-radius am-field-valid"
placeholder=
"
商城公告
"
data-validation-message=
"请填写公告内容"
>
{{if !empty($data['content'])}}{{$data.content}}{{/if}}
</textarea>
<textarea
rows=
"3"
name=
"content"
class=
"am-radius am-field-valid"
placeholder=
"
公告内容
"
data-validation-message=
"请填写公告内容"
>
{{if !empty($data['content'])}}{{$data.content}}{{/if}}
</textarea>
</div>
<div
class=
"am-form-group"
>
...
...
application/plugins/view/userlogingiveintegral/admin/index.html
0 → 100644
浏览文件 @
f842cb42
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<legend>
<span
class=
"fs-16"
>
登录赠送积分
</span>
<a
href=
"{{:MyUrl('admin/pluginsadmin/index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"userlogingiveintegral-content"
>
<div
class=
"items"
>
<label>
赠送积分
</label>
<div>
{{if !empty($data['give_integral'])}}
{{$data.give_integral}}
{{else /}}
0
{{/if}}
积分
</div>
</div>
<div
class=
"items"
>
<label>
是否日/次
</label>
<div>
{{if isset($data['is_day_once']) and $data['is_day_once'] eq 1}}
是
{{else /}}
否
{{/if}}
</div>
</div>
<div
class=
"items"
>
<label>
有效时间
</label>
<div>
{{if !empty($data['time_start']) and !empty($data['time_end'])}}
{{$data.time_start}} ~ {{$data.time_end}}
{{elseif !empty($data['time_start']) and empty($data['time_end'])}}
{{$data.time_start}} ~ 长期有效
{{elseif empty($data['time_start']) and !empty($data['time_end'])}}
立即生效 ~ {{$data.time_end}}
{{else /}}
无限制
{{/if}}
</div>
</div>
<a
href=
"{{:PluginsAdminUrl('userlogingiveintegral', 'admin', 'saveinfo')}}"
class=
"am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block edit-submit"
>
编辑
</a>
</div>
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/plugins/view/userlogingiveintegral/admin/saveinfo.html
0 → 100644
浏览文件 @
f842cb42
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:PluginsAdminUrl('userlogingiveintegral', 'admin', 'save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:PluginsAdminUrl('userlogingiveintegral', 'admin', 'index')}}"
enctype=
"multipart/form-data"
>
<legend>
<span
class=
"fs-16"
>
登录赠送积分
</span>
<a
href=
"{{:PluginsAdminUrl('userlogingiveintegral', 'admin', 'index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"am-form-group"
>
<label>
赠送积分
</label>
<input
type=
"number"
name=
"give_integral"
placeholder=
"赠送积分"
min=
"1"
max=
"100000000"
data-validation-message=
"赠送积分 1~100000000"
class=
"am-radius"
value=
"{{if empty($data)}}1{{else /}}{{$data.give_integral}}{{/if}}"
required
/>
</div>
<div
class=
"am-form-group"
>
<label>
是否日/次
<span
class=
"fs-12 fw-100 cr-999"
>
(默认当日只赠送一次)
</span></label>
<div>
{{foreach $is_whether_list as $v}}
<label
class=
"am-radio-inline m-r-10"
>
<input
type=
"radio"
name=
"is_day_once"
value=
"{{$v.id}}"
{{
if
isset
($
data
['
is_day_once
'])
and
$
data
['
is_day_once
']
eq
$
v
['
id
']}}
checked=
"checked"
{{
else
/}}{{
if
!
isset
($
data
['
is_day_once
'])
and
isset
($
v
['
checked
'])
and
$
v
['
checked
']
eq
true
}}
checked=
"checked"
{{/
if
}}{{/
if
}}
data-am-ucheck
/>
{{$v.name}}
</label>
{{/foreach}}
</div>
</div>
<div
class=
"am-form-group"
>
<label>
有效时间
<span
class=
"fs-12 fw-100 cr-999"
>
(留空则不限制)
</span></label>
<div
class=
"form-date"
>
<input
type=
"text"
autocomplete=
"off"
name=
"time_start"
class=
"Wdate am-radius"
placeholder=
"起始时间"
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
{{
if
!
empty
($
data
['
time_start
'])}}
value=
"{{$data.time_start}}"
{{/
if
}}
/>
<span>
~
</span>
<input
type=
"text"
autocomplete=
"off"
class=
"Wdate am-radius"
placeholder=
"结束时间"
name=
"time_end"
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
{{
if
!
empty
($
data
['
time_end
'])}}
value=
"{{$data.time_end}}"
{{/
if
}}
/>
</div>
</div>
<div
class=
"am-form-group"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
<!-- form end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/service/PluginsAdminService.php
浏览文件 @
f842cb42
...
...
@@ -461,13 +461,10 @@ class PluginsAdminService
}
// 应用主文件生成
if
(
empty
(
$params
[
'id'
]))
$ret
=
self
::
PluginsApplicationCreated
(
$params
,
$app_dir
);
if
(
$ret
[
'code'
]
!=
0
)
{
$ret
=
self
::
PluginsApplicationCreated
(
$params
,
$app_dir
);
if
(
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
return
$ret
;
}
return
DataReturn
(
empty
(
$params
[
'id'
])
?
'创建成功'
:
'更新成功'
,
0
);
...
...
@@ -530,9 +527,14 @@ class Hook
public function run(\$params = [])
{
// 是否控制器钩子
if(isset(\$params['is_control']) && \$params['is_control'] === true)
// is_control 当前为控制器业务处理
// hook_name 钩子名称
if(isset(\$params['is_control']) && \$params['is_control'] === true && !empty(\$params['hook_name']))
{
return [];
// 参数一 描述
// 参数二 0 为处理成功, 负数为失败
// 参数三 返回数据
return DataReturn('返回描述', 0);
// 默认返回视图
} else {
...
...
@@ -641,40 +643,42 @@ h1 {
color: #4CAF50;
}
php;
// 创建文件
if
(
@
file_put_contents
(
$app_dir
.
DS
.
'Admin.php'
,
$admin
)
===
false
)
{
return
DataReturn
(
'应用文件创建失败[admin]'
,
-
11
);
}
if
(
@
file_put_contents
(
$app_dir
.
DS
.
'Hook.php'
,
$hook
)
===
false
)
{
return
DataReturn
(
'应用文件创建失败[hook]'
,
-
11
);
}
if
(
@
file_put_contents
(
$app_dir
.
DS
.
'Hook.php'
,
$hook
)
===
false
)
{
return
DataReturn
(
'应用文件创建失败[admin-view]'
,
-
11
);
}
// 应用后台视图目录不存在则创建
$app_view_admin_dir
=
APP_PATH
.
'plugins'
.
DS
.
'view'
.
DS
.
trim
(
$params
[
'plugins'
])
.
DS
.
'admin'
;
if
(
\
base\FileUtil
::
CreateDir
(
$app_view_admin_dir
)
!==
true
)
{
return
DataReturn
(
'应用视图目录创建失败[admin]'
,
-
10
);
}
if
(
@
file_put_contents
(
$app_view_admin_dir
.
DS
.
'index.html'
,
$admin_view
)
===
false
)
{
return
DataReturn
(
'应用视图文件创建失败[admin-view]'
,
-
11
);
}
// css创建
// 静态文件目录
$app_static_css_dir
=
ROOT
.
'public'
.
DS
.
'static'
.
DS
.
'plugins'
.
DS
.
'css'
.
DS
.
trim
(
$params
[
'plugins'
]);
if
(
\
base\FileUtil
::
CreateDir
(
$app_static_css_dir
)
!==
true
)
{
return
DataReturn
(
'应用静态目录创建失败[css]'
,
-
10
);
}
if
(
@
file_put_contents
(
$app_static_css_dir
.
DS
.
'admin.css'
,
$admin_css
)
===
false
)
// 编辑模式下不生成后端文件
if
(
empty
(
$params
[
'id'
]))
{
return
DataReturn
(
'应用静态文件创建失败[admin-css]'
,
-
11
);
// 创建文件
if
(
@
file_put_contents
(
$app_dir
.
DS
.
'Admin.php'
,
$admin
)
===
false
)
{
return
DataReturn
(
'应用文件创建失败[admin]'
,
-
11
);
}
if
(
@
file_put_contents
(
$app_dir
.
DS
.
'Hook.php'
,
$hook
)
===
false
)
{
return
DataReturn
(
'应用文件创建失败[hook]'
,
-
11
);
}
// 应用后台视图目录不存在则创建
$app_view_admin_dir
=
APP_PATH
.
'plugins'
.
DS
.
'view'
.
DS
.
trim
(
$params
[
'plugins'
])
.
DS
.
'admin'
;
if
(
\
base\FileUtil
::
CreateDir
(
$app_view_admin_dir
)
!==
true
)
{
return
DataReturn
(
'应用视图目录创建失败[admin]'
,
-
10
);
}
if
(
@
file_put_contents
(
$app_view_admin_dir
.
DS
.
'index.html'
,
$admin_view
)
===
false
)
{
return
DataReturn
(
'应用视图文件创建失败[admin-view]'
,
-
11
);
}
// css创建
if
(
@
file_put_contents
(
$app_static_css_dir
.
DS
.
'admin.css'
,
$admin_css
)
===
false
)
{
return
DataReturn
(
'应用静态文件创建失败[admin-css]'
,
-
11
);
}
}
...
...
application/service/UserService.php
浏览文件 @
f842cb42
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\Db
;
use
think\facade\Hook
;
use
app\service\RegionService
;
/**
...
...
@@ -793,7 +794,7 @@ class UserService
// 获取用户账户信息
$where
=
array
(
'mobile|email'
=>
$params
[
'accounts'
],
'is_delete_time'
=>
0
);
$user
=
Db
::
name
(
'User'
)
->
field
(
array
(
'id'
,
'pwd'
,
'salt'
,
'status'
)
)
->
where
(
$where
)
->
find
();
$user
=
Db
::
name
(
'User'
)
->
field
(
'id,pwd,salt,status'
)
->
where
(
$where
)
->
find
();
if
(
empty
(
$user
))
{
return
DataReturn
(
'帐号不存在'
,
-
3
);
...
...
@@ -810,6 +811,13 @@ class UserService
return
DataReturn
(
'密码错误'
,
-
4
);
}
// 用户登录前钩子
$ret
=
Hook
::
listen
(
'plugins_user_login_begin'
,
[
'hook_name'
=>
'plugins_user_login_begin'
,
'is_control'
=>
true
,
'params'
=>
$params
,
'user'
=>
$user
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
// 更新用户密码
$salt
=
GetNumberCode
(
6
);
$data
=
array
(
...
...
@@ -822,6 +830,13 @@ class UserService
// 登录记录
if
(
self
::
UserLoginRecord
(
$user
[
'id'
]))
{
// 用户登录后钩子
$ret
=
Hook
::
listen
(
'plugins_user_login_end'
,
[
'hook_name'
=>
'plugins_user_login_end'
,
'is_control'
=>
true
,
'params'
=>
$params
,
'user'
=>
$user
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
return
DataReturn
(
'登录成功'
,
0
);
}
}
...
...
application/tags.php
浏览文件 @
f842cb42
...
...
@@ -41,5 +41,9 @@ return array (
array
(
0
=>
'app\\plugins\\usercentertopnotice\\Hook'
,
),
'plugins_user_login_end'
=>
array
(
0
=>
'app\\plugins\\userlogingiveintegral\\Hook'
,
),
);
?>
\ No newline at end of file
config/shopxo.php
浏览文件 @
f842cb42
...
...
@@ -15,7 +15,7 @@
return
[
// 开发模式
'is_develop'
=>
fals
e
,
'is_develop'
=>
tru
e
,
// 默认编码
'default_charset'
=>
'utf-8'
,
...
...
config/shopxo.sql
浏览文件 @
f842cb42
/*
Navicat
Premium
Data Transfer
Navicat
MySQL
Data Transfer
Source Server : 本机
Source Server Type : MySQL
Source Server Version : 50722
Source Server Version : 50716
Source Host : localhost
Source Database : shopxo_t
es
t
Source Database : shopxo_t
t
t
Target Server Type : MySQL
Target Server Version : 50722
Target Server Version : 50716
File Encoding : utf-8
Date: 02/14/2019
11:31:38 A
M
Date: 02/14/2019
23:05:39 P
M
*/
SET NAMES utf8
mb4
;
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
...
...
@@ -588,7 +586,14 @@ CREATE TABLE `s_message` (
`add_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='消息';
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='消息';
-- ----------------------------
-- Records of `s_message`
-- ----------------------------
BEGIN;
INSERT INTO `s_message` VALUES ('4', '90', '积分变动', '登录赠送积分积分增加3', '0', '0', '0', '1', '0', '0', '1550155205'), ('5', '90', '积分变动', '登录赠送积分积分增加3', '0', '0', '0', '1', '0', '0', '1550155448'), ('6', '90', '积分变动', '登录赠送积分积分增加3', '0', '0', '0', '1', '0', '0', '1550155950'), ('7', '90', '积分变动', '登录赠送积分积分增加3', '0', '0', '0', '1', '0', '0', '1550156005'), ('8', '90', '积分变动', '登录赠送积分积分增加3', '0', '0', '0', '1', '0', '0', '1550156016'), ('9', '90', '积分变动', '登录赠送积分积分增加5', '0', '0', '0', '1', '0', '0', '1550156516');
COMMIT;
-- ----------------------------
-- Table structure for `s_navigation`
...
...
@@ -818,13 +823,13 @@ CREATE TABLE `s_plugins` (
PRIMARY KEY (`id`),
UNIQUE KEY `plugins` (`plugins`),
KEY `is_enable` (`is_enable`)
) ENGINE=InnoDB AUTO_INCREMENT=1
4
DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='应用';
) ENGINE=InnoDB AUTO_INCREMENT=1
5
DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='应用';
-- ----------------------------
-- Records of `s_plugins`
-- ----------------------------
BEGIN;
INSERT INTO `s_plugins` VALUES ('1', 'commontopmaxpicture', '{\"images\":\"http:\\/\\/tp5-dev.com\\/static\\/upload\\/images\\/plugins_commontopmaxpicture\\/2019\\/02\\/09\\/1549671733978860.jpg\",\"bg_color\":\"#ce0000\",\"url\":\"https:\\/\\/shopxo.net\",\"is_new_window_open\":\"1\",\"is_overall\":\"1\",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"commontopmaxpicture\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '0', '1550049324'), ('2', 'commontopnotice', '{\"content\":\"\\u6b22\\u8fce\\u6765\\u5230ShopXO\\u4f01\\u4e1a\\u7ea7B2C\\u5f00\\u6e90\\u7535\\u5546\\u7cfb\\u7edf\\u3001\\u6f14\\u793a\\u7ad9\\u70b9\\u8bf7\\u52ff\\u53d1\\u8d77\\u652f\\u4ed8\\u3001\\u4ee5\\u514d\\u7ed9\\u60a8\\u5e26\\u6765\\u4e0d\\u5fc5\\u8981\\u7684\\u8d22\\u4ea7\\u635f\\u5931\\u3002\",\"is_overall\":\"1\",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"commontopnotice\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '0', '1550049314'), ('3', 'usercentertopnotice', '{\"content\":\"\\u7528\\u6237\\u4e2d\\u5fc3\\u516c\\u544a\
\u6587\\u5b57\\uff0c\\u540e\\u53f0\\u914d\\u7f6e\\u4fee\\u6539\\u3002\",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"usercentertopnotice\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '0', '155004932
3');
INSERT INTO `s_plugins` VALUES ('1', 'commontopmaxpicture', '{\"images\":\"http:\\/\\/tp5-dev.com\\/static\\/upload\\/images\\/plugins_commontopmaxpicture\\/2019\\/02\\/09\\/1549671733978860.jpg\",\"bg_color\":\"#ce0000\",\"url\":\"https:\\/\\/shopxo.net\",\"is_new_window_open\":\"1\",\"is_overall\":\"1\",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"commontopmaxpicture\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '0', '1550049324'), ('2', 'commontopnotice', '{\"content\":\"\\u6b22\\u8fce\\u6765\\u5230ShopXO\\u4f01\\u4e1a\\u7ea7B2C\\u5f00\\u6e90\\u7535\\u5546\\u7cfb\\u7edf\\u3001\\u6f14\\u793a\\u7ad9\\u70b9\\u8bf7\\u52ff\\u53d1\\u8d77\\u652f\\u4ed8\\u3001\\u4ee5\\u514d\\u7ed9\\u60a8\\u5e26\\u6765\\u4e0d\\u5fc5\\u8981\\u7684\\u8d22\\u4ea7\\u635f\\u5931\\u3002\",\"is_overall\":\"1\",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"commontopnotice\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '0', '1550049314'), ('3', 'usercentertopnotice', '{\"content\":\"\\u7528\\u6237\\u4e2d\\u5fc3\\u516c\\u544a\
",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"usercentertopnotice\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '0', '1550152363'), ('14', 'userlogingiveintegral', '{\"give_integral\":\"5\",\"is_day_once\":\"1\",\"time_start\":\"\",\"time_end\":\"\",\"pluginsname\":\"userlogingiveintegral\",\"pluginscontrol\":\"admin\",\"pluginsaction\":\"save\"}', '1', '1550151175', '155015651
3');
COMMIT;
-- ----------------------------
...
...
@@ -1075,7 +1080,7 @@ CREATE TABLE `s_user` (
-- Records of `s_user`
-- ----------------------------
BEGIN;
INSERT INTO `s_user` VALUES ('77', '2088502175420842-', '', '', '0', '255773', '70da5937905ce1d1a8c6a8a4ab5c72b3', '', '龚哥哥', '13250814883', 'fuxiang.gong@qq.com', '2', 'https://tfs.alipayobjects.com/images/partner/T10d8lXm4dXXXXXXXX', '上海', '上海市', '1540915200', '', '967', '0', '0', '0', '0', '1545099005'), ('90', '2088502175420842', '', '', '0', '
437481', '89e01b6059ab8151c32a1c6358a2f1cf', '', '魔鬼', '17602128368', '', '2', '', '上海', '上海市', '666201600', '', '0', '0', '0', '0', '1539167253', '1550048957
');
INSERT INTO `s_user` VALUES ('77', '2088502175420842-', '', '', '0', '255773', '70da5937905ce1d1a8c6a8a4ab5c72b3', '', '龚哥哥', '13250814883', 'fuxiang.gong@qq.com', '2', 'https://tfs.alipayobjects.com/images/partner/T10d8lXm4dXXXXXXXX', '上海', '上海市', '1540915200', '', '967', '0', '0', '0', '0', '1545099005'), ('90', '2088502175420842', '', '', '0', '
548064', '3428ab57b8303e93c2d0190c1c99ddf0', '', '魔鬼', '17602128368', '', '2', '', '上海', '上海市', '666201600', '', '20', '0', '0', '0', '1539167253', '1550156516
');
COMMIT;
-- ----------------------------
public/static/plugins/css/userlogingiveintegral/admin.css
0 → 100644
浏览文件 @
f842cb42
/**
* 首页
*/
.userlogingiveintegral-content
.items
{
margin
:
10px
0
20px
0
;
border-bottom
:
1px
dashed
#f1f1f1
;
padding-bottom
:
20px
;
}
.userlogingiveintegral-content
.edit-submit
{
margin-bottom
:
20px
;
}
/**
* 编辑页面
*/
.form-date
input
{
width
:
30%
!important
;
display
:
-webkit-inline-box
!important
;
}
.form-date
span
{
vertical-align
:
middle
;
}
\ No newline at end of file
public/static/upload/images/plugins_userlogingiveintegral/2019/02/14/1550151082834629.png
0 → 100644
浏览文件 @
f842cb42
8.9 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录