切换导航条
此项目
正在载入...
登录
郭盛
/
community
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Cool
5 years ago
提交
0c69615b1c9c5d6641822176aa8953a69ad3833b
1 个父辈
e0ecee88
商圈信息发布修改
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
53 行增加
和
1 行删除
application/api/controller/Store.php
application/api/model/StoreInform.php
application/common.php
application/api/controller/Store.php
查看文件 @
0c69615
...
...
@@ -615,6 +615,7 @@ class Store extends Api
* @ApiParams (name="inform_id", type="string", required=false, description="信息id")
* @ApiParams (name="content", type="string", required=true, description="详细内容")
* @ApiParams (name="images", type="string", required=true, description="图片")
* @ApiParams (name="video", type="string", required=true, description="视频")
* @ApiParams (name="house_ids", type="string", required=true, description="推广社区")
* @ApiParams (name="type", type="integer", required=true, description="推广类型1=红包推送信息2=一般信息")
* @ApiParams (name="red_package", type="string", required=false, description="红包总金额")
...
...
@@ -640,6 +641,14 @@ class Store extends Api
$this
->
error
(
'包含未绑定的社区,请重新选择'
);
}
}
$img_count
=
count
(
explode
(
','
,
$param
[
'images'
]));
$video_count
=
!
empty
(
$param
[
'video'
])
?
count
(
explode
(
','
,
$param
[
'video'
]))
:
0
;
if
(
$video_count
>
1
)
{
$this
->
error
(
'视频只能上传一个'
);
}
if
((
$video_count
==
1
&&
$img_count
>
8
)
||
$img_count
>
9
)
{
$this
->
error
(
'最多上传9张图片或1个视频及8张图片'
);
}
if
(
$param
[
'type'
]
==
1
)
{
$param
[
'single'
]
=
$param
[
'red_package'
]
/
$param
[
'number'
];
$param
[
'score'
]
=
bcadd
(
config
(
'site.send_score'
),
$param
[
'red_package'
]
*
config
(
'site.withdraw_percent'
),
2
);
...
...
application/api/model/StoreInform.php
查看文件 @
0c69615
...
...
@@ -8,7 +8,8 @@ class StoreInform extends Base
{
protected
$append
=
[
'image_arr'
'image_arr'
,
'video_image'
];
public
function
getImageArrAttr
(
$value
,
$data
)
...
...
@@ -23,6 +24,27 @@ class StoreInform extends Base
return
$image_arr
;
}
public
function
getVideoAttr
(
$value
)
{
$video
=
''
;
if
(
$value
)
{
// 获取视频第一帧图片
$video
=
cdnurl
(
$value
,
true
);
}
return
$video
;
}
public
function
getVideoImageAttr
(
$value
,
$data
)
{
$img
=
''
;
if
(
$data
[
'video'
])
{
// 获取视频第一帧图片
$video_info
=
json_decode
(
file_get_contents
(
cdnurl
(
$data
[
'video'
],
true
)
.
'?avinfo'
),
true
);
$lesson_matter
[
'video_image'
]
=
get_video_first_image
(
cdnurl
(
$data
[
'video'
],
true
),
$video_info
);
}
return
$img
;
}
// public function getCreatetimeAttr($value)
// {
// return date('Y-m-d H:i:s',$value);
...
...
application/common.php
查看文件 @
0c69615
...
...
@@ -453,4 +453,25 @@ if(!function_exists('httpPost')){
curl_close
(
$curl
);
// 关键CURL会话
return
json_decode
(
$result
,
true
);
// 返回数据
}
}
if
(
!
function_exists
(
'get_video_first_image'
))
{
/**
* 获取视频第一帧图片
* @param $video_url 视频地址
* @param $video_info 视频数据
*/
function
get_video_first_image
(
$video_url
,
$video_info
)
{
if
(
empty
(
$video_info
[
'streams'
][
0
][
'width'
]))
{
$width
=
$video_info
[
'streams'
][
1
][
'width'
];
$height
=
$video_info
[
'streams'
][
1
][
'height'
];
}
else
{
$width
=
$video_info
[
'streams'
][
0
][
'width'
];
$height
=
$video_info
[
'streams'
][
0
][
'height'
];
}
return
$video_url
.
'?vframe/jpg/offset/1/w/'
.
$width
.
'/h/'
.
$height
;
}
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论