|
@@ -15,8 +15,8 @@ require_once (BASE_ROOT_PATH . '/helper/bonus/bind.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/bonus/factory.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/bonus/manager.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/bonus/shaker.php');
|
|
|
-require_once (BASE_ROOT_PATH . '/helper/bonus/shaker.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/bonus/allocator.php');
|
|
|
+require_once (BASE_ROOT_PATH . '/helper/bonus/sender.php');
|
|
|
|
|
|
require_once (BASE_ROOT_PATH . '/helper/field_helper.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/predeposit_helper.php');
|
|
@@ -167,93 +167,13 @@ class bonus_helper
|
|
|
}
|
|
|
|
|
|
//检查个人发送红包参数
|
|
|
- static public function check_personal($input,&$ret)
|
|
|
- {
|
|
|
- $param = array();
|
|
|
- $send_type = intval($input['send_type']);
|
|
|
- if(!in_array($send_type,array(1,2))) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "请输入正确的红包类型.");
|
|
|
- return false;
|
|
|
- }
|
|
|
- $param['send_type'] = $send_type; // '红包类型,1为随机红包,2为固定额度红包'
|
|
|
- $type_bless = isset($input['type_bless']) && !empty($input['type_bless']) ? $input['type_bless'] : self::def_bless;
|
|
|
- $type_bless = urldecode($type_bless);
|
|
|
- $type_bless = text_filter::filter_input($type_bless);
|
|
|
-
|
|
|
- $param['type_bless'] = $type_bless;
|
|
|
-
|
|
|
- $param['total_num'] = intval($input['total_num']);
|
|
|
- if($param['total_num'] <= 0) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "红包个数不能小于1.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if(bonus_helper::isFixed($send_type))
|
|
|
- {
|
|
|
- $fixed_mondey = floatval($input['fixed_money']);
|
|
|
- if ($fixed_mondey * 100 < 1) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "红包额度不能小于一分钱.");
|
|
|
- return false;
|
|
|
- }
|
|
|
- $param['total_amount'] = $fixed_mondey * $param['total_num'];
|
|
|
- $param['fixed_money'] = $fixed_mondey;
|
|
|
- }
|
|
|
- else if (bonus_helper::isRandom($send_type))
|
|
|
- {
|
|
|
- $total_amount = floatval($input['total_amount']);
|
|
|
- if($total_amount * 100 < $param['total_num']) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "金额不够.");
|
|
|
- return false;
|
|
|
- }
|
|
|
- $param['total_amount'] = $total_amount;
|
|
|
- }
|
|
|
-
|
|
|
- if($total_amount > self::max_total_amount || $param['total_num'] > self::max_total_num) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => sprintf("红包个数不能大于%d,总金额不能大于%.2f元.",self::max_total_num,self::max_total_amount));
|
|
|
- return false;
|
|
|
- }
|
|
|
- $param['use_type'] = 1;
|
|
|
- $param['user_type'] = 2;
|
|
|
-
|
|
|
- return $param;
|
|
|
+ static public function check_personal($input,&$ret) {
|
|
|
+ return \bonus\sender::check_personal($input,$ret);
|
|
|
}
|
|
|
|
|
|
//检查活动红包参数
|
|
|
- static public function check_activity($input,&$ret)
|
|
|
- {
|
|
|
- if(!isset($input['start_time']) || !isset($input['end_time'])) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "请输入活动开始和结束时间.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $start_tm = strtotime($input['start_time']);
|
|
|
- if($start_tm == false) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "错误的活动开始时间格式,请参考,2016-06-04 10:00:00.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if($start_tm < time()) {
|
|
|
- $cur_time = date("Y-m-d H:i:s");
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "活动时间不能小于服务器当前时间:{$cur_time}");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $end_tm = strtotime($input['end_time']);
|
|
|
- if($end_tm == false) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "错误的活动结束时间格式,请参考,2016-06-04 10:00:00.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if($end_tm <= $start_tm) {
|
|
|
- $ret = array('code' => errcode::ErrParamter,'msg' => "活动结束时间必须大于开始时间");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $param = array();
|
|
|
- $param['send_start_date'] = $start_tm;
|
|
|
- $param['send_end_date'] = $end_tm;
|
|
|
-
|
|
|
- return $param;
|
|
|
+ static public function check_activity($input,&$ret) {
|
|
|
+ return \bonus\sender::check_activity($input,$ret);
|
|
|
}
|
|
|
|
|
|
static public function direct_asc() {
|
|
@@ -311,4 +231,10 @@ class bonus_helper
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ static public function withold($member_id,$money)
|
|
|
+ {
|
|
|
+ $holder = new \bonus\witholder($member_id);
|
|
|
+ return $holder->withhold($money);
|
|
|
+ }
|
|
|
}
|