Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
2936ddf9
ShopXO
项目概览
jcy2004x
/
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,体验更适合开发者的 AI 搜索 >>
提交
2936ddf9
编写于
4月 12, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
应用开发
上级
e3df7fff
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
480 addition
and
59 deletion
+480
-59
application/index/view/default/personal/save_info.html
application/index/view/default/personal/save_info.html
+1
-1
application/plugins/petscms/Pets.php
application/plugins/petscms/Pets.php
+48
-3
application/plugins/petscms/Service.php
application/plugins/petscms/Service.php
+223
-4
application/plugins/view/petscms/pets/index.html
application/plugins/view/petscms/pets/index.html
+24
-9
application/plugins/view/petscms/pets/saveinfo.html
application/plugins/view/petscms/pets/saveinfo.html
+8
-9
application/service/ArticleService.php
application/service/ArticleService.php
+2
-3
application/service/CustomViewService.php
application/service/CustomViewService.php
+2
-3
application/service/GoodsService.php
application/service/GoodsService.php
+2
-2
config/shopxo.sql
config/shopxo.sql
+32
-25
extend/base/Age.php
extend/base/Age.php
+138
-0
未找到文件。
application/index/view/default/personal/save_info.html
浏览文件 @
2936ddf9
...
...
@@ -35,7 +35,7 @@
{{include file="lib/gender" /}}
<div
class=
"am-form-group"
>
<label>
生日
</label>
<input
type=
"text"
name=
"birthday"
class=
"am-form-field am-radius Wdate"
placeholder=
"生日"
data-validation-message=
"生日格式有误"
{{
if
!
empty
($
data
)}}
value=
"{{$data.birthday_text}}"
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
{{/
if
}}
autocomplete=
"off"
/>
<input
type=
"text"
name=
"birthday"
class=
"am-form-field am-radius Wdate"
placeholder=
"生日"
data-validation-message=
"生日格式有误"
{{
if
!
empty
($
data
)}}
value=
"{{$data.birthday_text}}"
{{/
if
}}
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
autocomplete=
"off"
/>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
...
...
application/plugins/petscms/Pets.php
浏览文件 @
2936ddf9
...
...
@@ -13,6 +13,7 @@ namespace app\plugins\petscms;
use
think\Controller
;
use
app\plugins\petscms\Service
;
use
app\service\PluginsService
;
use
app\service\UserService
;
/**
* 宠物管理系统 - 用户宠物管理
...
...
@@ -23,6 +24,8 @@ use app\service\PluginsService;
*/
class
Pets
extends
Controller
{
private
$user
;
/**
* 构造方法
* @author Devil
...
...
@@ -34,6 +37,8 @@ class Pets extends Controller
public
function
__construct
()
{
parent
::
__construct
();
$this
->
user
=
UserService
::
LoginUserInfo
();
}
/**
...
...
@@ -46,6 +51,40 @@ class Pets extends Controller
*/
public
function
index
(
$params
=
[])
{
// 参数
$params
=
input
();
$params
[
'user'
]
=
$this
->
user
;
// 分页
$number
=
10
;
// 条件
$where
=
Service
::
PetsListWhere
(
$params
);
// 获取总数
$total
=
Service
::
PetsTotal
(
$where
);
// 分页
$page_params
=
array
(
'number'
=>
$number
,
'total'
=>
$total
,
'where'
=>
$params
,
'page'
=>
isset
(
$params
[
'page'
])
?
intval
(
$params
[
'page'
])
:
1
,
'url'
=>
PluginsHomeUrl
(
'petscms'
,
'pets'
,
'index'
),
);
$page
=
new
\
base\Page
(
$page_params
);
$this
->
assign
(
'page_html'
,
$page
->
GetPageHtml
());
// 获取列表
$data_params
=
array
(
'm'
=>
$page
->
GetPageStarNumber
(),
'n'
=>
$number
,
'where'
=>
$where
,
);
$data
=
Service
::
PetsList
(
$data_params
);
$this
->
assign
(
'data_list'
,
$data
[
'data'
]);
//print_r($data['data']);
$this
->
assign
(
'pets_attribute_is_text_list'
,
Service
::
$pets_attribute_is_text_list
);
$this
->
assign
(
'pets_attribute_gender_list'
,
Service
::
$pets_attribute_gender_list
);
$this
->
assign
(
'pets_attribute_type_list'
,
Service
::
$pets_attribute_type_list
);
...
...
@@ -79,9 +118,15 @@ class Pets extends Controller
*/
public
function
save
(
$params
=
[])
{
$ret
=
Service
::
PestSave
(
$params
);
print_r
(
$ret
);
die
;
// 是否ajax请求
if
(
!
IS_AJAX
)
{
return
$this
->
error
(
'非法访问'
);
}
// 用户
$params
[
'user'
]
=
$this
->
user
;
return
Service
::
PestSave
(
$params
);
}
}
?>
\ No newline at end of file
application/plugins/petscms/Service.php
浏览文件 @
2936ddf9
...
...
@@ -41,6 +41,162 @@ class Service
1
=>
[
'value'
=>
1
,
'name'
=>
'母'
],
];
/**
* 宠物列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
PetsList
(
$params
=
[])
{
$where
=
empty
(
$params
[
'where'
])
?
[]
:
$params
[
'where'
];
$m
=
isset
(
$params
[
'm'
])
?
intval
(
$params
[
'm'
])
:
0
;
$n
=
isset
(
$params
[
'n'
])
?
intval
(
$params
[
'n'
])
:
10
;
$order_by
=
empty
(
$params
[
'order_by'
])
?
'id desc'
:
$params
[
'order_by'
];
// 获取数据列表
$data
=
Db
::
name
(
'PluginsPetscmsPets'
)
->
where
(
$where
)
->
limit
(
$m
,
$n
)
->
order
(
$order_by
)
->
select
();
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
&
$v
)
{
// 类型
$v
[
'type_name'
]
=
self
::
$pets_attribute_type_list
[
$v
[
'type'
]][
'name'
];
// 性别
$v
[
'gender_name'
]
=
self
::
$pets_attribute_gender_list
[
$v
[
'gender'
]][
'name'
];
// 是否绝育
$v
[
'sterilization_name'
]
=
self
::
$pets_attribute_is_text_list
[
$v
[
'sterilization'
]][
'name'
];
// 是否疫苗
$v
[
'vaccine_name'
]
=
self
::
$pets_attribute_is_text_list
[
$v
[
'vaccine'
]][
'name'
];
// 生日/年龄
if
(
empty
(
$v
[
'birthday'
]))
{
$v
[
'birthday_name'
]
=
null
;
$v
[
'age'
]
=
'0岁'
;
}
else
{
$v
[
'birthday_name'
]
=
date
(
'Y-m-d'
,
$v
[
'birthday'
]);
$age
=
\
base\Age
::
CalAge
(
$v
[
'birthday_name'
]);
$v
[
'age'
]
=
$age
[
'year'
]
.
'年'
.
$age
[
'month'
]
.
'月'
.
$age
[
'day'
]
.
'天'
;
}
// 内容
$v
[
'content'
]
=
ResourcesService
::
ContentStaticReplace
(
$v
[
'content'
],
'get'
);
// 相册
$v
[
'photo'
]
=
empty
(
$v
[
'photo'
])
?
null
:
self
::
GetPestPhotoHandle
(
$v
[
'photo'
]);
// 时间
$v
[
'add_time_time'
]
=
date
(
'Y-m-d H:i:s'
,
$v
[
'add_time'
]);
$v
[
'add_time_date'
]
=
date
(
'Y-m-d'
,
$v
[
'add_time'
]);
$v
[
'upd_time_time'
]
=
empty
(
$v
[
'upd_time'
])
?
''
:
date
(
'Y-m-d H:i:s'
,
$v
[
'upd_time'
]);
$v
[
'upd_time_date'
]
=
empty
(
$v
[
'upd_time'
])
?
''
:
date
(
'Y-m-d'
,
$v
[
'upd_time'
]);
}
}
//print_r($data);
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
/**
* 宠物相册获取处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-11T22:56:49+0800
* @param [array] $photo [相册数据]
*/
private
static
function
GetPestPhotoHandle
(
$photo
)
{
$result
=
[];
if
(
!
empty
(
$photo
)
&&
is_array
(
$photo
))
{
foreach
(
$photo
as
&
$v
)
{
$result
[]
=
[
'images_old'
=>
$v
,
'images'
=>
ResourcesService
::
AttachmentPathViewHandle
(
$v
),
];
}
}
return
$result
;
}
/**
* 宠物列表条件
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
PetsListWhere
(
$params
=
[])
{
// 条件初始化
$where
=
[];
// 用户id
if
(
!
empty
(
$params
[
'user'
]))
{
$where
[]
=
[
'user_id'
,
'='
,
$params
[
'user'
][
'id'
]];
}
// 关键字
if
(
!
empty
(
$params
[
'keywords'
]))
{
$where
[]
=
[
'title|detail'
,
'like'
,
'%'
.
$params
[
'keywords'
]
.
'%'
];
}
// 是否更多条件
if
(
isset
(
$params
[
'is_more'
])
&&
$params
[
'is_more'
]
==
1
)
{
// 等值
if
(
!
empty
(
$params
[
'type'
]))
{
$where
[]
=
[
'type'
,
'='
,
$params
[
'type'
]];
}
if
(
isset
(
$params
[
'gender'
])
&&
$params
[
'gender'
]
>
-
1
)
{
$where
[]
=
[
'gender'
,
'='
,
intval
(
$params
[
'gender'
])];
}
if
(
isset
(
$params
[
'sterilization'
])
&&
$params
[
'sterilization'
]
>
-
1
)
{
$where
[]
=
[
'sterilization'
,
'='
,
intval
(
$params
[
'sterilization'
])];
}
if
(
!
empty
(
$params
[
'time_start'
]))
{
$where
[]
=
[
'add_time'
,
'>'
,
strtotime
(
$params
[
'time_start'
])];
}
if
(
!
empty
(
$params
[
'time_end'
]))
{
$where
[]
=
[
'add_time'
,
'<'
,
strtotime
(
$params
[
'time_end'
])];
}
}
return
$where
;
}
/**
* 宠物总数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $where [条件]
*/
public
static
function
PetsTotal
(
$where
=
[])
{
return
(
int
)
Db
::
name
(
'PluginsPetscmsPets'
)
->
where
(
$where
)
->
count
();
}
/**
* 宠物保存
* @author Devil
...
...
@@ -77,7 +233,7 @@ class Service
[
'checked_type'
=>
'in'
,
'key_name'
=>
'type'
,
'checked_data'
=>
array_column
(
$pets_attribute_type_list
,
'value'
),
'checked_data'
=>
array_column
(
self
::
$pets_attribute_type_list
,
'value'
),
'is_checked'
=>
2
,
'error_msg'
=>
'宠物类型有误'
,
],
...
...
@@ -91,14 +247,14 @@ class Service
[
'checked_type'
=>
'in'
,
'key_name'
=>
'gender'
,
'checked_data'
=>
array_column
(
$pets_attribute_gender_list
,
'value'
),
'checked_data'
=>
array_column
(
self
::
$pets_attribute_gender_list
,
'value'
),
'is_checked'
=>
2
,
'error_msg'
=>
'宠物性别有误'
,
],
[
'checked_type'
=>
'in'
,
'key_name'
=>
'sterilization'
,
'checked_data'
=>
array_column
(
$pets_attribute_gender_list
,
'value'
),
'checked_data'
=>
array_column
(
self
::
$pets_attribute_gender_list
,
'value'
),
'is_checked'
=>
2
,
'error_msg'
=>
'宠物是否绝育有误'
,
],
...
...
@@ -143,10 +299,73 @@ class Service
return
DataReturn
(
$ret
,
-
1
);
}
// 相册
$photo
=
self
::
GetFormPetsPhotoParams
(
$params
);
if
(
$photo
[
'code'
]
!=
0
)
{
return
$photo
;
}
// 编辑器内容
$content
=
empty
(
$params
[
'content'
])
?
''
:
ResourcesService
::
ContentStaticReplace
(
htmlspecialchars_decode
(
$params
[
'content'
]),
'add'
);
// 宠物数据
$data
=
[
'user_id'
=>
isset
(
$params
[
'user'
][
'id'
])
?
intval
(
$params
[
'user'
][
'id'
])
:
0
,
'title'
=>
isset
(
$params
[
'title'
])
?
$params
[
'title'
]
:
''
,
'name'
=>
isset
(
$params
[
'name'
])
?
$params
[
'name'
]
:
''
,
'birthday'
=>
empty
(
$params
[
'birthday'
])
?
0
:
strtotime
(
$params
[
'birthday'
]),
'type'
=>
isset
(
$params
[
'type'
])
?
$params
[
'type'
]
:
''
,
'varieties'
=>
isset
(
$params
[
'varieties'
])
?
$params
[
'varieties'
]
:
''
,
'gender'
=>
isset
(
$params
[
'gender'
])
?
intval
(
$params
[
'gender'
])
:
0
,
'sterilization'
=>
isset
(
$params
[
'sterilization'
])
?
intval
(
$params
[
'sterilization'
])
:
0
,
'vaccine'
=>
isset
(
$params
[
'vaccine'
])
?
intval
(
$params
[
'vaccine'
])
:
0
,
'photo'
=>
empty
(
$photo
[
'data'
])
?
''
:
json_encode
(
$photo
[
'data'
]),
'content'
=>
$content
,
'person_name'
=>
isset
(
$params
[
'person_name'
])
?
$params
[
'person_name'
]
:
''
,
'person_tel'
=>
isset
(
$params
[
'person_tel'
])
?
$params
[
'person_tel'
]
:
''
,
'person_weixin'
=>
isset
(
$params
[
'person_weixin'
])
?
$params
[
'person_weixin'
]
:
''
,
];
if
(
empty
(
$params
[
'id'
]))
{
$data
[
'add_time'
]
=
time
();
if
(
Db
::
name
(
'PluginsPetscmsPets'
)
->
insertGetId
(
$data
)
>
0
)
{
return
DataReturn
(
'添加成功'
,
0
);
}
return
DataReturn
(
'添加失败'
,
-
100
);
}
else
{
$data
[
'upd_time'
]
=
time
();
if
(
Db
::
name
(
'PluginsPetscmsPets'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
(
$data
))
{
return
DataReturn
(
'编辑成功'
,
0
);
}
return
DataReturn
(
'编辑失败'
,
-
100
);
}
}
/**
* 获取宠物相册
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-10
* @desc description
* @param [array] $params [输入参数]
* @return [array] [一维数组但图片地址]
*/
private
static
function
GetFormPetsPhotoParams
(
$params
=
[])
{
$result
=
[];
if
(
!
empty
(
$params
[
'photo'
])
&&
is_array
(
$params
[
'photo'
]))
{
foreach
(
$params
[
'photo'
]
as
$v
)
{
$result
[]
=
ResourcesService
::
AttachmentPathHandle
(
$v
);
}
}
return
DataReturn
(
'success'
,
0
,
$result
);
}
}
?>
\ No newline at end of file
application/plugins/view/petscms/pets/index.html
浏览文件 @
2936ddf9
...
...
@@ -95,11 +95,15 @@
<thead>
<tr>
<th>
标题
</th>
<th
class=
"am-hide-sm-only"
>
类型
</th>
<th
class=
"am-hide-sm-only"
>
业务
</th>
<th>
详情
</th>
<th
class=
"am-hide-sm-only"
>
状态
</th>
<th>
姓名
</th>
<th>
类型
</th>
<th
class=
"am-hide-sm-only"
>
性别
</th>
<th
class=
"am-hide-sm-only"
>
品种
</th>
<th
class=
"am-hide-sm-only"
>
是否绝育
</th>
<th
class=
"am-hide-sm-only"
>
是否疫苗
</th>
<th
class=
"am-hide-sm-only"
>
生日/年龄
</th>
<th
class=
"am-hide-sm-only"
>
时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
...
...
@@ -107,17 +111,28 @@
{{foreach $data_list as $v}}
<tr>
<td>
{{$v.title}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.type_name}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.business_type_name}}
</td>
<td>
{{$v.detail}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.is_read_name}}
</td>
<td>
{{$v.name}}
</td>
<td>
{{$v.type_name}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.gender_name}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.varieties}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.sterilization_name}}
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.vaccine_name}}
</td>
<td
class=
"am-hide-sm-only"
>
{{if !empty($v['birthday_name'])}}
{{$v.birthday_name}}
<br
/>
{{/if}}
<span
class=
"am-badge am-radius"
>
{{$v.age}}
</span>
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.add_time_time}}
</td>
<td>
edit
</td>
</tr>
{{/foreach}}
{{/if}}
{{if empty($data_list)}}
<tr>
<td
colspan=
"
5
"
>
<td
colspan=
"
10
"
>
<div
class=
"table-no"
><i
class=
"am-icon-warning"
></i>
没有相关数据
</div>
</td>
</tr>
...
...
application/plugins/view/petscms/pets/saveinfo.html
浏览文件 @
2936ddf9
...
...
@@ -25,7 +25,7 @@
<form
class=
"am-form form-validation view-save"
action=
"{{:PluginsHomeUrl('petscms', 'pets', 'save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:PluginsHomeUrl('petscms', 'pets', 'index', $params)}}"
enctype=
"multipart/form-data"
>
<div
class=
"am-form-group"
>
<label>
标题
<span
class=
"am-form-group-label-tips-must"
>
必填
</span></label>
<input
type=
"text"
name=
"
nam
e"
placeholder=
"标题"
minlength=
"1"
maxlength=
"60"
data-validation-message=
"标题格式 1~60 个字符之间"
class=
"am-radius"
required
/>
<input
type=
"text"
name=
"
titl
e"
placeholder=
"标题"
minlength=
"1"
maxlength=
"60"
data-validation-message=
"标题格式 1~60 个字符之间"
class=
"am-radius"
required
/>
</div>
<div
class=
"am-form-group"
>
...
...
@@ -35,7 +35,7 @@
<div
class=
"am-form-group"
>
<label>
出生日期
<span
class=
"am-form-group-label-tips-must"
>
必填
</span></label>
<input
type=
"text"
name=
"birthday"
class=
"am-form-field am-radius Wdate"
placeholder=
"出生日期"
data-validation-message=
"出生日期格式有误"
{{
if
!
empty
($
data
)}}
value=
"{{$data.birthday_text}}"
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
{{/
if
}}
autocomplete=
"off"
/>
<input
type=
"text"
name=
"birthday"
class=
"am-form-field am-radius Wdate"
placeholder=
"出生日期"
data-validation-message=
"出生日期格式有误"
{{
if
!
empty
($
data
)}}
value=
"{{$data.birthday_text}}"
{{/
if
}}
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
autocomplete=
"off"
required
/>
</div>
<div
class=
"am-form-group"
>
...
...
@@ -49,8 +49,8 @@
</div>
<div
class=
"am-form-group"
>
<label>
品种
<span
class=
"am-form-group-label-tips"
>
选
填
</span></label>
<input
type=
"text"
name=
"varieties"
placeholder=
"品种"
maxlength=
"30"
data-validation-message=
"品种格式最多 30 个字符"
class=
"am-radius"
/>
<label>
品种
<span
class=
"am-form-group-label-tips"
>
必
填
</span></label>
<input
type=
"text"
name=
"varieties"
placeholder=
"品种"
maxlength=
"30"
data-validation-message=
"品种格式最多 30 个字符"
class=
"am-radius"
required
/>
</div>
<div
class=
"am-form-group"
>
...
...
@@ -85,8 +85,8 @@
<!-- 相册 -->
<div
class=
"am-form-group"
>
<label>
宠物相册
<span
class=
"am-form-group-label-tips"
>
必选
,可拖拽图片进行排序,建议图片尺寸一致
</span></label>
<ul
class=
"plug-file-upload-view goods-photo-view"
data-form-name=
"photo[]"
data-max-number=
"
5
"
data-dialog-type=
"images"
>
<label>
宠物相册
<span
class=
"am-form-group-label-tips"
>
选填
,可拖拽图片进行排序,建议图片尺寸一致
</span></label>
<ul
class=
"plug-file-upload-view goods-photo-view"
data-form-name=
"photo[]"
data-max-number=
"
6
"
data-dialog-type=
"images"
>
{{if !empty($data['photo'])}}
{{foreach $data.photo as $v}}
<li>
...
...
@@ -102,8 +102,8 @@
<!-- 宠物简介 -->
<div
class=
"am-form-group"
>
<label>
宠物简介
<span
class=
"am-form-group-label-tips-must"
>
必
填
</span></label>
<textarea
class=
"am-radius am-validate"
name=
"content"
maxlength=
"105000"
id=
"editor-tag"
data-validation-message=
"宠物简介内容最多 105000 个字符"
required
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
<label>
宠物简介
<span
class=
"am-form-group-label-tips-must"
>
选
填
</span></label>
<textarea
class=
"am-radius am-validate"
name=
"content"
maxlength=
"105000"
id=
"editor-tag"
data-validation-message=
"宠物简介内容最多 105000 个字符"
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
</div>
<!-- 主人信息 -->
...
...
@@ -122,7 +122,6 @@
</div>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block"
data-am-loading=
"{loadingText:'处理中...'}"
>
提交
</button>
</div>
...
...
application/service/ArticleService.php
浏览文件 @
2936ddf9
...
...
@@ -185,17 +185,16 @@ class ArticleService
}
// 编辑器内容
$content
=
isset
(
$
_POST
[
'content'
])
?
$_POST
[
'content'
]
:
''
;
$content
=
isset
(
$
params
[
'content'
])
?
htmlspecialchars_decode
(
$params
[
'content'
])
:
''
;
// 数据
$content
=
ResourcesService
::
ContentStaticReplace
(
$content
,
'add'
);
$image
=
self
::
MatchContentImage
(
$content
);
$data
=
[
'title'
=>
$params
[
'title'
],
'title_color'
=>
empty
(
$params
[
'title_color'
])
?
''
:
$params
[
'title_color'
],
'article_category_id'
=>
intval
(
$params
[
'article_category_id'
]),
'jump_url'
=>
empty
(
$params
[
'jump_url'
])
?
''
:
$params
[
'jump_url'
],
'content'
=>
$content
,
'content'
=>
ResourcesService
::
ContentStaticReplace
(
$content
,
'add'
)
,
'image'
=>
empty
(
$image
)
?
''
:
json_encode
(
$image
),
'image_count'
=>
count
(
$image
),
'is_enable'
=>
isset
(
$params
[
'is_enable'
])
?
intval
(
$params
[
'is_enable'
])
:
0
,
...
...
application/service/CustomViewService.php
浏览文件 @
2936ddf9
...
...
@@ -191,14 +191,13 @@ class CustomViewService
}
// 编辑器内容
$content
=
isset
(
$
_POST
[
'content'
])
?
$_POST
[
'content'
]
:
''
;
$content
=
isset
(
$
params
[
'content'
])
?
htmlspecialchars_decode
(
$params
[
'content'
])
:
''
;
// 数据
$content
=
ResourcesService
::
ContentStaticReplace
(
$content
,
'add'
);
$image
=
self
::
MatchContentImage
(
$content
);
$data
=
[
'title'
=>
$params
[
'title'
],
'content'
=>
$content
,
'content'
=>
ResourcesService
::
ContentStaticReplace
(
$content
,
'add'
)
,
'image'
=>
empty
(
$image
)
?
''
:
json_encode
(
$image
),
'image_count'
=>
count
(
$image
),
'is_enable'
=>
isset
(
$params
[
'is_enable'
])
?
intval
(
$params
[
'is_enable'
])
:
0
,
...
...
application/service/GoodsService.php
浏览文件 @
2936ddf9
...
...
@@ -1049,7 +1049,7 @@ class GoodsService
}
// 编辑器内容
$content_web
=
isset
(
$_POST
[
'content_web'
])
?
$_POST
[
'content_web'
]
:
''
;
$content_web
=
empty
(
$params
[
'content_web'
])
?
''
:
ResourcesService
::
ContentStaticReplace
(
htmlspecialchars_decode
(
$params
[
'content_web'
]),
'add'
)
;
// 基础数据
$data
=
[
...
...
@@ -1063,7 +1063,7 @@ class GoodsService
'buy_max_number'
=>
isset
(
$params
[
'buy_max_number'
])
?
intval
(
$params
[
'buy_max_number'
])
:
0
,
'is_deduction_inventory'
=>
isset
(
$params
[
'is_deduction_inventory'
])
?
intval
(
$params
[
'is_deduction_inventory'
])
:
0
,
'is_shelves'
=>
isset
(
$params
[
'is_shelves'
])
?
intval
(
$params
[
'is_shelves'
])
:
0
,
'content_web'
=>
ResourcesService
::
ContentStaticReplace
(
$content_web
,
'add'
)
,
'content_web'
=>
$content_web
,
'images'
=>
isset
(
$photo
[
'data'
][
0
])
?
$photo
[
'data'
][
0
]
:
''
,
'photo_count'
=>
count
(
$photo
[
'data'
]),
'is_home_recommended'
=>
isset
(
$params
[
'is_home_recommended'
])
?
intval
(
$params
[
'is_home_recommended'
])
:
0
,
...
...
config/shopxo.sql
浏览文件 @
2936ddf9
此差异已折叠。
点击以展开。
extend/base/Age.php
0 → 100644
浏览文件 @
2936ddf9
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
base
;
/**
* 年龄计算
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-04-12
*/
class
Age
{
/**
* 计算年龄精准到年月日
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-12T00:25:13+0800
* @param [date] $birthday [日期]
* @return [array] [计算后的时间]
*/
public
static
function
CalAge
(
$birthday
)
{
list
(
$byear
,
$bmonth
,
$bday
)
=
explode
(
'-'
,
$birthday
);
list
(
$year
,
$month
,
$day
)
=
explode
(
'-'
,
date
(
'Y-m-d'
));
$bmonth
=
intval
(
$bmonth
);
$bday
=
intval
(
$bday
);
if
(
$bmonth
<
10
)
{
$bmonth
=
'0'
.
$bmonth
;
}
if
(
$bday
<
10
)
{
$bday
=
'0'
.
$bday
;
}
$bi
=
intval
(
$byear
.
$bmonth
.
$bday
);
$ni
=
intval
(
$year
.
$month
.
$day
);
$not_birth
=
0
;
if
(
$bi
>
$ni
)
{
$not_birth
=
1
;
$tmp
=
array
(
$byear
,
$bmonth
,
$bday
);
list
(
$byear
,
$bmonth
,
$bday
)
=
array
(
$year
,
$month
,
$day
);
list
(
$year
,
$month
,
$day
)
=
$tmp
;
list
(
$bi
,
$ni
)
=
array
(
$ni
,
$bi
);
}
//先取岁数
$years
=
0
;
while
((
$bi
+
10000
)
<=
$ni
)
{
$bi
+=
10000
;
$years
++
;
$byear
++
;
}
//得到岁数后 抛弃年
list
(
$m
,
$d
)
=
self
::
GetMd
(
array
(
$year
,
$month
,
$day
),
array
(
$byear
,
$bmonth
,
$bday
));
return
array
(
'year'
=>
$years
,
'month'
=>
$m
,
'day'
=>
$d
,
'not_birth'
=>
$not_birth
);
}
/**
* 只能用于一年内计算
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-12T00:24:40+0800
* @param [date] $ymd [ymd]
* @param [date] $bymd [bymd]
*/
public
static
function
GetMd
(
$ymd
,
$bymd
)
{
list
(
$y
,
$m
,
$d
)
=
$ymd
;
list
(
$by
,
$bm
,
$bd
)
=
$bymd
;
if
((
$m
.
$d
)
<
(
$bm
.
$bd
))
{
$m
+=
12
;
}
$month
=
0
;
while
(((
$bm
.
$bd
)
+
100
)
<=
(
$m
.
$d
))
{
$bm
++
;
$month
++
;
}
//同处一个月
if
(
$bd
<=
$d
)
{
$day
=
$d
-
$bd
;
}
else
{
//少一个月
$mdays
=
$bm
>
12
?
self
::
GetMothDay
(
++
$by
,
$bm
-
12
)
:
self
::
GetMothDay
(
$by
,
$bm
);
$day
=
$mdays
-
$bd
+
$d
;
}
return
array
(
$month
,
$day
);
}
/**
* 月
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-12T00:26:48+0800
* @param [int] $year [年]
* @param [int] $month [月]
*/
private
static
function
GetMothDay
(
$year
,
$month
)
{
switch
(
$month
)
{
case
1
:
case
3
:
case
5
:
case
7
:
case
8
:
case
10
:
case
12
:
$day
=
31
;
break
;
case
2
:
//能被4除尽的为29天其他28天
$day
=
(
intval
(
$year
%
4
)
?
28
:
29
);
break
;
default
:
$day
=
30
;
break
;
}
return
$day
;
}
}
?>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录