|
@@ -34,33 +34,34 @@ class account_helper
|
|
|
$param['sender_name'] = self::admin_name;
|
|
|
}
|
|
|
|
|
|
- private static function sender_param($sender,&$param)
|
|
|
- {
|
|
|
- $member_info = Model('member')->getMemberInfoByID($sender);
|
|
|
-
|
|
|
- $param['sender_id'] = $member_info['member_id'];
|
|
|
- $param['sender_mobile'] = $member_info['member_mobile'];
|
|
|
- $param['sender_name'] = $member_info['member_nickname'];
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
public static function gain_bonus($from_id,$to_id,$amount)
|
|
|
{
|
|
|
$param = self::base_param($amount,1);
|
|
|
- $member_info = Model('member')->getMemberInfoByID($from_id);
|
|
|
+ $minfo = new member_info($from_id);
|
|
|
|
|
|
- $param['sender_id'] = $member_info['member_id'];
|
|
|
- $param['sender_mobile'] = $member_info['member_mobile'];
|
|
|
- $param['sender_name'] = $member_info['member_nickname'];
|
|
|
+ $param['sender_id'] = $minfo->member_id();
|
|
|
+ $param['sender_mobile'] = $minfo->mobile();
|
|
|
+ $param['sender_name'] = $minfo->nickname();
|
|
|
$param['make_type'] = \bonus\type::MakeShakeType;
|
|
|
-
|
|
|
- $name = $member_info['member_nickname'];
|
|
|
+ $name = $minfo->nickname();
|
|
|
$param['type_name'] = "从{$name}摇来的红包";
|
|
|
|
|
|
$ret = bonus_helper::make_bonus($param);
|
|
|
if($ret != false) {
|
|
|
+ $to_minfo = new member_info($to_id);
|
|
|
+ $thief =$to_minfo->nickname();
|
|
|
+ $predo = new predeposit_helper($from_id);
|
|
|
+ $predo->handout_bonus($amount,$ret['type_sn'],$minfo->nickname(),"{$thief}摇走了您{$amount}元的红包.");
|
|
|
+ bonus_helper::withold($from_id,$amount);
|
|
|
+
|
|
|
$bonusex = bonus_helper::send($ret['type_sn'],array($to_id));
|
|
|
-
|
|
|
+
|
|
|
+ $push_param = array();
|
|
|
+ $push_param['member_id'] = $from_id;
|
|
|
+ $push_param['text'] = "{$thief}摇走了您{$amount}元的红包.";
|
|
|
+ $push_param['go_type'] = 'bonus';
|
|
|
+ QueueClient::push('upushSendMsg',$push_param);
|
|
|
+
|
|
|
return $bonusex;
|
|
|
} else {
|
|
|
return false;
|
|
@@ -70,26 +71,63 @@ class account_helper
|
|
|
public static function lost_bonus($from_id,$to_id,$amount)
|
|
|
{
|
|
|
$param = self::base_param($amount,1);
|
|
|
- $member_info = Model('member')->getMemberInfoByID($from_id);
|
|
|
|
|
|
- $param['sender_id'] = $member_info['member_id'];
|
|
|
- $param['sender_mobile'] = $member_info['member_mobile'];
|
|
|
- $param['sender_name'] = $member_info['member_nickname'];
|
|
|
+ $minfo = new member_info($from_id);
|
|
|
+ $param['sender_id'] = $minfo->member_id();
|
|
|
+ $param['sender_mobile'] = $minfo->mobile();
|
|
|
+ $param['sender_name'] = $minfo->nickname();
|
|
|
$param['make_type'] = \bonus\type::MakeShakeType;
|
|
|
-
|
|
|
- $name = $member_info['member_nickname'];
|
|
|
+ $name = $minfo->nickname();
|
|
|
$param['type_name'] = "{$name}摇过来的红包";
|
|
|
|
|
|
$ret = bonus_helper::make_bonus($param);
|
|
|
if($ret != false)
|
|
|
{
|
|
|
+ $predo = new predeposit_helper($from_id);
|
|
|
+ $predo->handout_bonus($amount,$ret['type_sn'],$minfo->nickname(),"您摇丢了{$amount}的红包.");
|
|
|
+ bonus_helper::withold($from_id,$amount);
|
|
|
+
|
|
|
$bonusex = bonus_helper::send($ret['type_sn'],array($to_id));
|
|
|
+
|
|
|
+ $push_param = array();
|
|
|
+ $push_param['member_id'] = $to_id;
|
|
|
+ $push_param['text'] = "{$name}的{$amount}元的红包,在向您飞来~.";
|
|
|
+ $push_param['go_type'] = 'bonus';
|
|
|
+ QueueClient::push('upushSendMsg',$push_param);
|
|
|
+
|
|
|
return $bonusex;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static function share_bonus($member_id,$bonus_sn)
|
|
|
+ {
|
|
|
+ $bonus = bonus\user_bonus::create_by_sn($bonus_sn);
|
|
|
+
|
|
|
+ $amount = $bonus->remain_amount();
|
|
|
+ $param = self::base_param($amount,1);
|
|
|
+
|
|
|
+ $minfo = new member_info($member_id);
|
|
|
+ $param['sender_id'] = $member_id;
|
|
|
+ $param['sender_mobile'] = $minfo->mobile();
|
|
|
+ $param['sender_name'] = $minfo->nickname();
|
|
|
+ $param['make_type'] = \bonus\type::MakeSendType;
|
|
|
+ $name = $minfo->nickname();
|
|
|
+ $param['type_name'] = "{$name}";
|
|
|
+
|
|
|
+ $ret = bonus_helper::make_bonus($param);
|
|
|
+ if($ret != false) {
|
|
|
+ $predo = new predeposit_helper($member_id);
|
|
|
+ $predo->handout_bonus($amount,$ret['type_sn'],$minfo->nickname(),"您分享了{$amount}元的红包.");
|
|
|
+ bonus_helper::withold_bonus($member_id,$bonus_sn);
|
|
|
+
|
|
|
+ return $ret;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static function gain_sysBonus($to_id,$amount)
|
|
|
{
|
|
|
$param = self::base_param($amount,1);
|
|
@@ -105,7 +143,7 @@ class account_helper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static function pay_refund($member_id,$amount,$bonus_name)
|
|
|
+ private static function pay_refund($member_id,$amount,$bonus_name)
|
|
|
{
|
|
|
$param = self::base_param($amount,1);
|
|
|
self::admin_param($param);
|
|
@@ -127,7 +165,7 @@ class account_helper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static function bonus_refund($member_id,$amount,$bonus_name)
|
|
|
+ private static function bonus_refund($member_id,$amount,$bonus_name)
|
|
|
{
|
|
|
$param = self::base_param($amount,1);
|
|
|
self::admin_param($param);
|
|
@@ -148,21 +186,6 @@ class account_helper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static function send_bonus($member_id,$amount)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public static function steal_bonus()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public static function fly_bonus()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
public static function onPredeposit($change_type,$member_id,$pd_amount)
|
|
|
{
|
|
|
if($change_type == 'order_pay' || $change_type == 'order_freeze') {
|
|
@@ -177,8 +200,5 @@ class account_helper
|
|
|
elseif($change_type == 'bonus_refund') { // 发送给该用户一个同等额度的红包
|
|
|
self::bonus_refund($member_id,$pd_amount,"红包过期未领退款");
|
|
|
}
|
|
|
- elseif($change_type == 'hand_out_bonus') {
|
|
|
- bonus_helper::withold($member_id,$pd_amount);
|
|
|
- }
|
|
|
}
|
|
|
}
|