You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
<?php
|
|
defined('IN_IA') or exit('Access Denied');
|
|
class MemberCampusActivities
|
|
{
|
|
|
|
/**
|
|
* 处理图集
|
|
* @param $promotional_img
|
|
* @param $type
|
|
* @return false|mixed|string[]
|
|
*/
|
|
public static function handlePromotionalImg($promotional_img,$type = 1)
|
|
{
|
|
$promotional_img = explode("||",$promotional_img);
|
|
foreach ($promotional_img as $imageKey => $imageVal) {
|
|
$promotional_img[$imageKey] = tomedia($imageVal);
|
|
}
|
|
$image_val = array_values($promotional_img);
|
|
$first_image = $image_val[0];
|
|
return $type == 1 ? $promotional_img : $first_image;
|
|
}
|
|
|
|
/**
|
|
* 返回数组 展示
|
|
* @param $promotionalImg
|
|
* @return false|string[]
|
|
*/
|
|
public static function promotionalImgArr($promotionalImg)
|
|
{
|
|
return explode("||",$promotionalImg);
|
|
}
|
|
|
|
/**
|
|
* 返回字符串 保存
|
|
* @param $promotionalImg
|
|
* @return string
|
|
*/
|
|
public static function promotionalImgStr($promotionalImg)
|
|
{
|
|
return implode("||",$promotionalImg);
|
|
}
|
|
|
|
/**
|
|
* 获取收藏数量
|
|
* @param $mid
|
|
* @return int|mixed
|
|
*/
|
|
public static function getCollectActivitiesCount($mid)
|
|
{
|
|
$sql = "select count(a.id) as `count` from ".tablename(PDO_NAME . 'member_collect_activities')
|
|
." as a join ".tablename(PDO_NAME . 'member_campus_activities') . " as b"
|
|
." on a.campus_activities_id = b.id where a.mid = '{$mid}'";
|
|
|
|
$res = pdo_fetch($sql);
|
|
return $res['count'] ?: 0;
|
|
}
|
|
}
|