|
@@ -18,7 +18,6 @@ require_once (BASE_ROOT_PATH . '/helper/search/util.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/search_param.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/goods_helper.php');
|
|
|
|
|
|
-
|
|
|
class member_bonusControl extends mbMemberControl
|
|
|
{
|
|
|
private $mPred;
|
|
@@ -466,7 +465,78 @@ class member_bonusControl extends mbMemberControl
|
|
|
|
|
|
public function topupOp()
|
|
|
{
|
|
|
- return self::outerr(errcode::ErrBonus,"APP版本太旧了,请升级到最新版本.");
|
|
|
+ $items = $this->mPred->topup_bonus($_SESSION['member_mobile']);
|
|
|
+ if($items === false) {
|
|
|
+ return self::outsuccess(array("count" => 0,'total_amount' => 0.00));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $total_amount = 0.00;
|
|
|
+ $max_rate = 0;
|
|
|
+ $max_share = 0;
|
|
|
+
|
|
|
+ $result = [];
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
+ $bonus = \bonus\user_bonus::create_by_param($item);
|
|
|
+ $type = \bonus\type::create_by_sn($bonus->type_sn());
|
|
|
+ $user_id = $type->sender_id();
|
|
|
+ $member = new member_info($user_id);
|
|
|
+ $avatar = $member->avatar();
|
|
|
+
|
|
|
+ if($type->binded_over() == false && $type->getTotal_num())
|
|
|
+ {
|
|
|
+ $share_num = $type->getTotal_num() - $type->binded_num();
|
|
|
+ if($max_share < $share_num) {
|
|
|
+ $result['max_share']['avatar'] = $avatar;
|
|
|
+ $result['max_share']['count'] = $share_num;
|
|
|
+ $result['max_share']['total_amount'] = $type->getTotal_amount();
|
|
|
+ $result['max_share']['rate'] = $type->bonus_rate();
|
|
|
+ $result['max_share']['type_sn'] = $type->getType_sn();
|
|
|
+ $max_share = $share_num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $rate = $bonus->bonus_rate();
|
|
|
+ if ($max_rate < $rate)
|
|
|
+ {
|
|
|
+ $result['max_rate']['avatar'] = $avatar;
|
|
|
+ $result['max_rate']['rate'] = $rate;
|
|
|
+ $result['max_rate']['type_sn'] = $type->getType_sn();
|
|
|
+ $max_rate = $rate;
|
|
|
+ }
|
|
|
+ $total_amount += doubleval($item['bonus_value']);
|
|
|
+ }
|
|
|
+ $result['max_rate']['total_amount'] = $total_amount;
|
|
|
+ $result['max_rate']['count'] = count($items);
|
|
|
+
|
|
|
+ if(!empty($result['max_share'])) {
|
|
|
+ $info = $result['max_share'];
|
|
|
+ $count = intval($info['count']);
|
|
|
+ $title = "恭喜获得{$count}个红包";
|
|
|
+ $sub_title = "分享给小伙伴,大家一起抢。";
|
|
|
+ $btn_type = 'send';
|
|
|
+ $btn_title = '发红包';
|
|
|
+ } else {
|
|
|
+ $info = $result['max_rate'];
|
|
|
+ $count = intval($info['count']);
|
|
|
+ $total_amount = $info['total_amount'];
|
|
|
+ $title = "您领了{$count}个,共{$total_amount}元的红包.";
|
|
|
+ $sub_title = "已帮你纳入\"我的红包\"中。";
|
|
|
+ $btn_type = 'detail';
|
|
|
+ $btn_title = '查看详情';
|
|
|
+ }
|
|
|
+
|
|
|
+ $detail_url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=detail&client_type=wap&type_sn={$info['type_sn']}";
|
|
|
+ return self::outsuccess(array("count" => $count, 'total_amount' => $info['total_amount'],
|
|
|
+ 'title' => $title,'sub_title' => $sub_title,
|
|
|
+ 'avatar' => $info['avatar'],
|
|
|
+ 'rate' => $info['rate'],
|
|
|
+ 'type_sn' => $info['type_sn'],
|
|
|
+ 'btn_type' => $btn_type,
|
|
|
+ 'btn_title' => $btn_title,
|
|
|
+ 'detail_url' => $detail_url));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function topupexOp()
|
|
@@ -874,8 +944,6 @@ class member_bonusControl extends mbMemberControl
|
|
|
$pages = $this->pages($count);
|
|
|
return $type_infos;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
class tpl_invite
|