切换导航条
此项目
正在载入...
登录
李忠强
/
temporaryfood
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
李忠强
3 years ago
提交
b535997d60b3e6baae31cdf28c8a7be4651259c1
1 个父辈
b44be1f5
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
12 个修改的文件
包含
130 行增加
和
187 行删除
application/admin/controller/litestore/Litestorecategory.php
application/admin/lang/zh-cn/litestore/litestorecategory.php
application/admin/model/litestore/Litestorecategory.php
application/admin/view/litestore/litestorecategory/add.html
application/admin/view/litestore/litestorecategory/edit.html
application/admin/view/litestore/litestorecategory/index.html
application/api/controller/Index.php
application/api/controller/User.php
application/api/model/Category.php
application/api/model/News.php
application/extra/site.php
public/assets/js/backend/litestore/litestorecategory.js
application/admin/controller/litestore/Litestorecategory.php
查看文件 @
b535997
...
...
@@ -14,7 +14,7 @@ class Litestorecategory extends Backend
/**
* Litestorecategory模型对象
* @var \app\admin\model\Litestorecategory
* @var \app\admin\model\
litestore\
Litestorecategory
*/
protected
$model
=
null
;
protected
$categorylist
=
[];
...
...
@@ -32,7 +32,7 @@ class Litestorecategory extends Backend
{
$categorydata
[
$v
[
'id'
]]
=
$v
;
}
$this
->
view
->
assign
(
"
parentList"
,
$categorydata
);
$this
->
view
->
assign
(
"
isindexList"
,
$this
->
model
->
getIsIndexList
()
);
}
/**
...
...
application/admin/lang/zh-cn/litestore/litestorecategory.php
查看文件 @
b535997
...
...
@@ -6,6 +6,9 @@ return [
'Name'
=>
'分类名称'
,
'Image'
=>
'图片'
,
'Weigh'
=>
'权重'
,
'Is_index'
=>
'是否首页展示'
,
'Is_index 0'
=>
'否'
,
'Is_index 1'
=>
'是'
,
'Createtime'
=>
'创建时间'
,
'Updatetime'
=>
'更新时间'
];
...
...
application/admin/model/litestore/Litestorecategory.php
查看文件 @
b535997
...
...
@@ -30,6 +30,11 @@ class Litestorecategory extends Model
});
}
public
function
getIsIndexList
()
{
return
[
'0'
=>
__
(
'Is_index 0'
),
'1'
=>
__
(
'Is_index 1'
)];
}
...
...
application/admin/view/litestore/litestorecategory/add.html
查看文件 @
b535997
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
for=
"c-pid"
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Pid')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-pid"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[pid]"
>
{foreach name="parentList" item="vo"}
<option
data-type=
"{$vo.name}"
value=
"{$key}"
{
in
name=
"key"
value=
""
}
selected
{/
in
}
>
{$vo.name}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
...
...
application/admin/view/litestore/litestorecategory/edit.html
查看文件 @
b535997
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
for=
"c-pid"
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Pid
')}:
</label>
<label
for=
"c-pid"
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Is_index
')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-pid"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[pid]"
>
{foreach name="parentList" item="vo"}
<option
data-type=
"{$vo.name}"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.pid"
}
selected
{/
in
}
>
{$vo.name}
</option>
{foreach name="isindexList" item="vo"}
<option
data-type=
"{$vo}"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.pid"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
...
...
application/admin/view/litestore/litestorecategory/index.html
查看文件 @
b535997
...
...
@@ -10,15 +10,15 @@
<a
href=
"javascript:;"
class=
"btn btn-success btn-add {:$auth->check('litestore/litestorecategory/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('litestore/litestorecategory/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('litestore/litestorecategory/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-import {:$auth->check('litestore/litestorecategory/import')?'':'hide'}"
title=
"{:__('Import')}"
id=
"btn-import-file"
data-url=
"ajax/upload"
data-mimetype=
"csv,xls,xlsx"
data-multiple=
"false"
><i
class=
"fa fa-upload"
></i>
{:__('Import')}
</a
>
<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('litestore/litestorecategory/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--
>
<div
class=
"dropdown btn-group {:$auth->check('litestore/litestorecategory/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-cog"
></i>
{:__('More')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=normal"
><i
class=
"fa fa-eye"
></i>
{:__('Set to normal')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=hidden"
><i
class=
"fa fa-eye-slash"
></i>
{:__('Set to hidden')}
</a></li>
</ul>
</div>
<!-- <div class="dropdown btn-group {:$auth->check('litestore/litestorecategory/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('litestore/litestorecategory/edit')}"
...
...
application/api/controller/Index.php
查看文件 @
b535997
...
...
@@ -2,6 +2,7 @@
namespace
app\api\controller
;
use
app\api\model\News
;
use
app\common\controller\Api
;
/**
...
...
@@ -13,11 +14,38 @@ class Index extends Api
protected
$noNeedRight
=
[
'*'
];
/**
* 首页
*
* @ApiTitle (首页轮播图)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
'data':'轮播图数组'
})
*/
public
function
index
()
public
function
banner
()
{
$this
->
success
(
'请求成功'
);
$model
=
new
News
();
$list
=
$model
->
where
(
'status'
,
'normal'
)
->
column
(
'image'
);
$this
->
success
(
'banner'
,
$list
);
}
/**
* @ApiTitle (首页分类)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
'data':'轮播图数组'
})
*/
public
function
category
()
{
$model
=
new
Cat
();
$list
=
$model
->
where
(
'status'
,
'normal'
)
->
column
(
'image'
);
$this
->
success
(
'banner'
,
$list
);
}
}
...
...
application/api/controller/User.php
查看文件 @
b535997
...
...
@@ -37,107 +37,6 @@ class User extends Api
}
/**
* 会员登录
*
* @ApiMethod (POST)
* @param string $account 账号
* @param string $password 密码
*/
public
function
login
()
{
$account
=
$this
->
request
->
post
(
'account'
);
$password
=
$this
->
request
->
post
(
'password'
);
if
(
!
$account
||
!
$password
)
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
$ret
=
$this
->
auth
->
login
(
$account
,
$password
);
if
(
$ret
)
{
$data
=
[
'userinfo'
=>
$this
->
auth
->
getUserinfo
()];
$this
->
success
(
__
(
'Logged in successful'
),
$data
);
}
else
{
$this
->
error
(
$this
->
auth
->
getError
());
}
}
/**
* 手机验证码登录
*
* @ApiMethod (POST)
* @param string $mobile 手机号
* @param string $captcha 验证码
*/
public
function
mobilelogin
()
{
$mobile
=
$this
->
request
->
post
(
'mobile'
);
$captcha
=
$this
->
request
->
post
(
'captcha'
);
if
(
!
$mobile
||
!
$captcha
)
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
if
(
!
Validate
::
regex
(
$mobile
,
"^1\d
{
10
}
$"
))
{
$this
->
error
(
__
(
'Mobile is incorrect'
));
}
if
(
!
Sms
::
check
(
$mobile
,
$captcha
,
'mobilelogin'
))
{
$this
->
error
(
__
(
'Captcha is incorrect'
));
}
$user
=
\app\common\model\User
::
getByMobile
(
$mobile
);
if
(
$user
)
{
if
(
$user
->
status
!=
'normal'
)
{
$this
->
error
(
__
(
'Account is locked'
));
}
//如果已经有账号则直接登录
$ret
=
$this
->
auth
->
direct
(
$user
->
id
);
}
else
{
$ret
=
$this
->
auth
->
register
(
$mobile
,
Random
::
alnum
(),
''
,
$mobile
,
[]);
}
if
(
$ret
)
{
Sms
::
flush
(
$mobile
,
'mobilelogin'
);
$data
=
[
'userinfo'
=>
$this
->
auth
->
getUserinfo
()];
$this
->
success
(
__
(
'Logged in successful'
),
$data
);
}
else
{
$this
->
error
(
$this
->
auth
->
getError
());
}
}
/**
* 注册会员
*
* @ApiMethod (POST)
* @param string $username 用户名
* @param string $password 密码
* @param string $email 邮箱
* @param string $mobile 手机号
* @param string $code 验证码
*/
public
function
register
()
{
$username
=
$this
->
request
->
post
(
'username'
);
$password
=
$this
->
request
->
post
(
'password'
);
$email
=
$this
->
request
->
post
(
'email'
);
$mobile
=
$this
->
request
->
post
(
'mobile'
);
$code
=
$this
->
request
->
post
(
'code'
);
if
(
!
$username
||
!
$password
)
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
if
(
$email
&&
!
Validate
::
is
(
$email
,
"email"
))
{
$this
->
error
(
__
(
'Email is incorrect'
));
}
if
(
$mobile
&&
!
Validate
::
regex
(
$mobile
,
"^1\d
{
10
}
$"
))
{
$this
->
error
(
__
(
'Mobile is incorrect'
));
}
$ret
=
Sms
::
check
(
$mobile
,
$code
,
'register'
);
if
(
!
$ret
)
{
$this
->
error
(
__
(
'Captcha is incorrect'
));
}
$ret
=
$this
->
auth
->
register
(
$username
,
$password
,
$email
,
$mobile
,
[]);
if
(
$ret
)
{
$data
=
[
'userinfo'
=>
$this
->
auth
->
getUserinfo
()];
$this
->
success
(
__
(
'Sign up successful'
),
$data
);
}
else
{
$this
->
error
(
$this
->
auth
->
getError
());
}
}
/**
* 退出登录
* @ApiMethod (POST)
*/
...
...
@@ -299,57 +198,30 @@ class User extends Api
}
/**
* 重置密码
*
* @ApiMethod (POST)
* @param string $mobile 手机号
* @param string $newpassword 新密码
* @param string $captcha 验证码
* @ApiTitle (用户协议)
* @ApiMethod (POST)
* @ApiReturn ({
'code':'1',
'msg':'用户协议'
'data':'富文本'
})
*/
public
function
resetpwd
()
public
function
userAgreement
()
{
$type
=
$this
->
request
->
post
(
"type"
);
$mobile
=
$this
->
request
->
post
(
"mobile"
);
$email
=
$this
->
request
->
post
(
"email"
);
$newpassword
=
$this
->
request
->
post
(
"newpassword"
);
$captcha
=
$this
->
request
->
post
(
"captcha"
);
if
(
!
$newpassword
||
!
$captcha
)
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
if
(
$type
==
'mobile'
)
{
if
(
!
Validate
::
regex
(
$mobile
,
"^1\d
{
10
}
$"
))
{
$this
->
error
(
__
(
'Mobile is incorrect'
));
}
$user
=
\app\common\model\User
::
getByMobile
(
$mobile
);
if
(
!
$user
)
{
$this
->
error
(
__
(
'User not found'
));
}
$ret
=
Sms
::
check
(
$mobile
,
$captcha
,
'resetpwd'
);
if
(
!
$ret
)
{
$this
->
error
(
__
(
'Captcha is incorrect'
));
}
Sms
::
flush
(
$mobile
,
'resetpwd'
);
}
else
{
if
(
!
Validate
::
is
(
$email
,
"email"
))
{
$this
->
error
(
__
(
'Email is incorrect'
));
}
$user
=
\app\common\model\User
::
getByEmail
(
$email
);
if
(
!
$user
)
{
$this
->
error
(
__
(
'User not found'
));
}
$ret
=
Ems
::
check
(
$email
,
$captcha
,
'resetpwd'
);
if
(
!
$ret
)
{
$this
->
error
(
__
(
'Captcha is incorrect'
));
}
Ems
::
flush
(
$email
,
'resetpwd'
);
}
//模拟一次登录
$this
->
auth
->
direct
(
$user
->
id
);
$ret
=
$this
->
auth
->
changepwd
(
$newpassword
,
''
,
true
);
if
(
$ret
)
{
$this
->
success
(
__
(
'Reset password successful'
));
}
else
{
$this
->
error
(
$this
->
auth
->
getError
());
}
$this
->
success
(
'用户协议'
,
Config
::
get
(
'site.user_agreement'
));
}
/**
* @ApiTitle (隐私协议)
* @ApiMethod (POST)
* @ApiReturn ({
'code':'1',
'msg':'隐私协议'
'data':'富文本'
})
*/
public
function
privacyAgreement
()
{
$this
->
success
(
'隐私协议'
,
Config
::
get
(
'site.privacy_agreement'
));
}
}
...
...
application/api/model/Category.php
0 → 100644
查看文件 @
b535997
<?php
namespace
app\api\model
;
use
think\Model
;
class
Category
extends
Model
{
protected
$name
=
'litestore_category'
;
protected
$append
=
[
'image_text'
];
public
function
getImageTextAttr
(
$value
,
$data
)
{
$value
=
empty
(
$data
[
'image'
])
?
''
:
cdnurl
(
$data
[
'image'
],
true
);
return
$value
;
}
}
\ No newline at end of file
...
...
application/api/model/News.php
0 → 100644
查看文件 @
b535997
<?php
namespace
app\api\model
;
use
think\Model
;
class
News
extends
Model
{
protected
$name
=
'litestore_news'
;
protected
$append
=
[
'image_text'
];
public
function
getImageTextAttr
(
$value
,
$data
)
{
$value
=
!
empty
(
$data
[
'image'
])
?
cdnurl
(
$data
[
'image'
],
true
)
:
''
;
return
$value
;
}
}
\ No newline at end of file
...
...
application/extra/site.php
查看文件 @
b535997
...
...
@@ -28,12 +28,6 @@ return array (
'user'
=>
'User'
,
'example'
=>
'Example'
,
),
'attachmentcategory'
=>
array
(
'category1'
=>
'Category1'
,
'category2'
=>
'Category2'
,
'custom'
=>
'Custom'
,
),
'mail_type'
=>
'1'
,
'mail_smtp_host'
=>
'smtp.qq.com'
,
'mail_smtp_port'
=>
'465'
,
...
...
@@ -41,4 +35,12 @@ return array (
'mail_smtp_pass'
=>
'password'
,
'mail_verify_type'
=>
'2'
,
'mail_from'
=>
'10000@qq.com'
,
'attachmentcategory'
=>
array
(
'category1'
=>
'Category1'
,
'category2'
=>
'Category2'
,
'custom'
=>
'Custom'
,
),
'user_agreement'
=>
'<p>64645646564公开警告</p><p>;回来了框架</p>'
,
'privacy_agreement'
=>
'<p>45315448</p><p>他房间后</p>'
,
);
...
...
public/assets/js/backend/litestore/litestorecategory.js
查看文件 @
b535997
...
...
@@ -24,15 +24,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
sortName
:
'weigh'
,
pagination
:
false
,
commonSearch
:
false
,
search
:
false
,
showExport
:
false
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'pid'
,
title
:
__
(
'Pid'
)},
//{field: 'name', title: __('Name')},
// {field: 'pid', title: __('Pid')},
{
field
:
'name'
,
title
:
__
(
'Name'
),
align
:
'left'
},
{
field
:
'image'
,
title
:
__
(
'Image'
),
formatter
:
Table
.
api
.
formatter
.
image
},
{
field
:
'weigh'
,
title
:
__
(
'Weigh'
)},
{
field
:
'is_index'
,
title
:
__
(
'Is_index'
),
formatter
:
Table
.
api
.
formatter
.
status
,
searchList
:
{
0
:
__
(
'Is_index 0'
),
1
:
__
(
'Is_index 1'
)}},
{
field
:
'createtime'
,
title
:
__
(
'Createtime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'updatetime'
,
title
:
__
(
'Updatetime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
...
...
请
注册
或
登录
后发表评论