5 changed files with 78 additions and 14 deletions
@ -0,0 +1,57 @@ |
|||||
|
<?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; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue