public function actionLogin() { Utils::ensureOpenId(); $openId = Yii::$app->request->get('open_id'); if (!Yii::$app->user->getIsGuest() && ($model = UcenterMember::findOne(['openid' => $openId])) !== null) { return $this->redirect(Url::to(['site/member'])); } if ($_POST) { $username = $_POST['username']; $password = $_POST['password']; $openid = $_POST['open_id']; $model = UcenterMember::findOne(['username' => $username]); $result = member::login($username, $password, 4); if ($result['errorNum'] == 0) { if (Yii::$app->user->login($model)) { $model->openid = $openid; $model->save(); return $this->redirect(Url::to(['site/member'])); } } else { return $this->goBack(['info' => $result['errorMsg']], Url::to(['login'])); } } return $this->view('login'); }
public function actionIndex() { $uid = Yii::$app->user->id; $isAuthentic = member::isAuthentic(yii::$app->user->id); if ($isAuthentic['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有实名制认证')</script>"; echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/step2']) . "'</script>"; exit; } //判断用户是否绑定银行卡 $is_bind = sinapay::isBinding($uid); $model = UcenterMember::find()->where(['id' => $uid])->one(); if ($is_bind['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有绑定银行卡');</script>"; echo "<script>location.href='" . \yii\helpers\Url::to(['site/bindcard']) . "'</script>"; exit; } $uid = Yii::$app->user->id; $info = Info::find()->where(['member_id' => $uid])->one(); $limitConfig = sinapay::getsiteConfig(); if ($limitConfig) { $withdraw_max = $limitConfig->withdraw_max; $withdraw_min = $limitConfig->withdraw_min; $withdraw_times = $limitConfig->withdraw_num; } return $this->view('index', compact('info', 'withdraw_max', 'withdraw_min', 'withdraw_times')); }
public function beforeAction($event) { $action = $event->action->id; if (in_array($action, $this->actions)) { $this->controller->enableCsrfValidation = false; //记录接口记录 if ($action != 'returnurl') { if (is_array($_POST) && array_key_exists('data', $_POST)) { // 根据ip获取地区 $area = member::get_area(Yii::$app->request->userIp); $area = $area ? $area : '地球'; $post_from = ''; $post_vresion = ''; $post_data = base64_decode($_POST['data']); $post_array = json_decode($post_data, true); if (array_key_exists('post_from', $post_array) && array_key_exists('post_vresion', $post_array)) { $post_from = $post_array['post_from']; $post_vresion = $post_array['post_vresion']; } $log = new ApiPost(); $log->action = $action; $log->post_data = $post_data; $log->post_from = $post_from; $log->post_version = $post_vresion; $log->post_ip = Yii::$app->request->userIp; $log->post_time = date('Y-m-d-H-i-s', time()); $log->post_area = $area; $log->save(); } } } }
/** * Creates a new Code model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionImport() { $model = new InvitationCodeSearch(); if (\App::$app->request->post()) { $num = \App::$app->request->post()['Code']['num']; member::set_invitation($num); return $this->redirect(['index']); } else { return $this->render('import', ['model' => $model]); } }
public function actionIndex() { $uid = Yii::$app->user->id; Utils::ensureOpenId(); $openId = Yii::$app->request->get('open_id'); if (($usermodel = UcenterMember::findOne(['openid' => $openId])) !== null) { Yii::$app->user->login($usermodel); } elseif (empty(Yii::$app->user->id)) { return $this->redirect(['site/signin']); } $isAuthentic = member::isAuthentic(yii::$app->user->id); if ($isAuthentic['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有实名制认证')</script>"; echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/step2']) . "'</script>"; exit; } //判断用户是否绑定银行卡 $is_bind = sinapay::isBinding($uid); $model = UcenterMember::find()->where(['id' => $uid])->one(); if ($is_bind['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有绑定银行卡');</script>"; echo "<script>location.href='" . \yii\helpers\Url::to(['site/bindcard']) . "'</script>"; exit; } //全部记录 $logs = AloneMethod::total_log($uid, 1, 15); $logs_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid])->andWhere(['>', 'status', '0'])->andWhere(['<>', 'step', '0.00'])->asArray()->all(); $logs_pages = ceil(count($logs_pages) / 15); //$logs = Log::find()->select(['step','create_at','status'])->where(['member_id'=>$uid])->andWhere(['in','status',[1,2,3,4]])->orderBy('id desc')->asArray()->all(); //充值 $recharge = AloneMethod::recharge_log($uid, 1, 15); $recharge_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_RECHAR_SUC])->asArray()->all(); $recharge_pages = ceil(count($recharge_pages) / 15); //投资 $invest = AloneMethod::invest_log($uid, 1, 15); $invest_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_INVEST_SUC])->asArray()->all(); $invest_pages = ceil(count($invest_pages) / 15); //赎回 $ransom = AloneMethod::redeem_log($uid, 1, 15); $ransom_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_REDEM_SUC])->asArray()->all(); $ransom_pages = ceil(count($recharge_pages) / 15); //提现 $withdraw = AloneMethod::withdrawals_log($uid, 1, 15); $withdraw_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_WITHDRAW_SUC])->asArray()->all(); $withdraw_pages = ceil(count($recharge_pages) / 15); return $this->view('index', compact('invest', 'recharge', 'withdraw', 'ransom', 'logs', 'logs_pages', 'recharge_pages', 'invest_pages', 'ransom_pages', 'withdraw_pages')); }
public function actionInvitation_code() { if (!$_POST['icode']) { echo '请输入邀请码。'; exit; } $icode = $_POST['icode']; $flag = \frontend\actions\app\member::verify_code($icode); if ($flag) { echo '验证通过'; exit; } else { echo '验证失败'; exit; } }
public function actionIndex() { $uid = Yii::$app->user->id; $isAuthentic = member::isAuthentic(yii::$app->user->id); if ($isAuthentic['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有实名制认证')</script>"; echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/step2']) . "'</script>"; exit; } //判断用户是否绑定银行卡 $is_bind = sinapay::isBinding($uid); $model = UcenterMember::find()->where(['id' => $uid])->one(); if ($is_bind['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有绑定银行卡');</script>"; echo "<script>location.href='" . \yii\helpers\Url::to(['site/bindcard']) . "'</script>"; exit; } $limitConfig = sinapay::getsiteConfig(); if ($limitConfig) { $ransom_max = $limitConfig->ransom_max; $ransom_min = $limitConfig->ransom_min; $ransom_times = $limitConfig->ransom_num; } $collect = AloneMethod::user_collect($uid)[data]; //在投金额和在投收益 $red_packet = member::get_user_red_packet($uid)[data]; //个人账户 $model_asset = Info::find()->where('member_id=' . Yii::$app->user->id)->one(); //投资总额 $invest_total = 0; $model_order = Order::find()->where('member_id=' . Yii::$app->user->id . " AND status=1")->all(); if (count($model_order) > 0) { foreach ($model_order as $K => $V) { $invest_total += $V->money; } } $invest_total += $model_asset->profit; return $this->view('index', compact('invest_total', 'ransom_max', 'ransom_min', 'ransom_times', 'collect', 'red_packet')); }
public function actionIndex() { if (Yii::$app->user->isGuest) { return $this->redirect(array('/site/signin')); } $uid = Yii::$app->user->id; $isAuthentic = member::isAuthentic(yii::$app->user->id); if ($isAuthentic['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有实名制认证')</script>"; echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/step2']) . "'</script>"; exit; } //判断用户是否绑定银行卡 $is_bind = sinapay::isBinding($uid); $model = UcenterMember::find()->where(['id' => $uid])->one(); if ($is_bind['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有绑定银行卡');</script>"; echo "<script>location.href='" . \yii\helpers\Url::to(['site/bindcard']) . "'</script>"; exit; } if ($_GET) { $uid = Yii::$app->user->id; $info = Info::find()->where(['member_id' => $uid])->one(); $product = Product::find(['id' => $_GET['id']])->one(); //项目可投金额 $kmoney = \frontend\actions\App\Invest::kmoney($_GET['id'])[data]; $limitConfig = sinapay::getsiteConfig(); if ($limitConfig) { $invest_max = $limitConfig->invest_max; $invest_min = $limitConfig->invest_min; $invest_times = $limitConfig->invest_num; } return $this->view('index', compact('info', 'product', 'invest_max', 'invest_min', 'invest_num', 'kmoney')); } }
/** * 获取用户当前红包金额 * @return array|string */ public static function actionGetuserredpacket() { $result = App::AppGet(); try { if ($result['errorNum']) { $result = array('errorNum' => $result['errorNum'], 'errorMsg' => $result['errorMsg'], 'data' => null); } else { $data = $result['data']; if (array_key_exists('uid', $data)) { $uid = $data['uid']; $result = member::get_user_red_packet($uid); } else { $result = array('errorNum' => '1', 'errorMsg' => '参数错误', 'data' => null); } } } catch (ErrorException $e) { Yii::error(" 获取轮播图---异常 方法:actionGetuserredpacket 参数:" . json_encode($result['data']), "app"); Yii::trace($e->getMessage(), "app"); $result = array('errorNum' => '7', 'errorMsg' => '服务器异常,请联系管理员', 'data' => null); } $result = App::AppReturn($result); return $result; }
public function actionInvitation_code() { if (!$_POST['icode']) { echo '请输入邀请码。'; exit; } $icode = $_POST['icode']; //$result = UcenterMember::find()->where(['invitation_code'=>$icode])->one(); //if(count($result) == 1) $flag = \frontend\actions\app\member::verify_code($icode); if ($flag) { echo '验证通过0001'; exit; } else { echo '验证失败0002'; exit; } }
public function actionExportuser() { $users = UcenterMember::find()->asArray()->all(); $data = array(); if ($users !== null) { foreach ($users as $key => $value) { $data[$key]['id'] = $value['id']; $data[$key]['phone'] = $value['phone']; $data[$key]['real_name'] = $value['real_name']; $data[$key]['created_at'] = date('Y-m-d :H-m-s', $value['created_at']); $data[$key]['create_area'] = $value['create_area']; $status = $value['status']; if ($status == UcenterMember::STATUS_ACTIVE) { $data[$key]['status'] = '注册用户'; } elseif ($status == UcenterMember::STATUS_REAL) { $data[$key]['status'] = '实名用户'; } elseif ($status == UcenterMember::STATUS_BIND) { $data[$key]['status'] = '绑卡用户'; } //账户信息 $info = Info::find()->where(['member_id' => $value['id']])->one(); //账户余额 $data[$key]['balance'] = $info['balance']; //在投资金 $data[$key]['invest'] = $info['invest']; //可用收益 $data[$key]['profit'] = $info['profit']; //累计收益 $data[$key]['total_revenue'] = $info['total_revenue']; //充值--投资--赎回--提现 //首次充值 $rechar_at = Log::find()->where(['member_id' => $value['id'], 'status' => Log::STATUS_RECHAR_SUC])->orderBy('id asc')->one(); //充值总金额 $rechar_sum = Log::find()->where(['member_id' => $value['id'], 'status' => Log::STATUS_RECHAR_SUC])->sum('step'); //首次投资时间 $invest_at = Log::find()->where(['member_id' => $value['id'], 'status' => Log::STATUS_INVEST_SUC])->orderBy('id asc')->one(); //投资总额 $invest_sum = Log::find()->where(['member_id' => $value['id'], 'status' => Log::STATUS_INVEST_SUC])->sum('step'); //赎回总额 $redem_sum = Log::find()->where(['member_id' => $value['id'], 'status' => Log::STATUS_REDEM_SUC])->sum('step'); //提现总额 $withdraw_sum = Log::find()->where(['member_id' => $value['id'], 'status' => Log::STATUS_WITHDRAW_SUC])->sum('step'); //首次充值时间 $data[$key]['rechar_at'] = $rechar_at ? date('Y-m-d :H-m-s', $rechar_at['create_at']) : 0; $data[$key]['rechar_sum'] = $rechar_sum; //首次投资时间 $data[$key]['invest_at'] = $invest_at ? date('Y-m-d :H-m-s', $invest_at['create_at']) : 0; $data[$key]['invest_sum'] = $invest_sum; //赎回 $data[$key]['redem_sum'] = $redem_sum; //提现 $data[$key]['withdraw_sum'] = $withdraw_sum; //未领取红包奖励 $red = member::get_user_red_packet($value['id']); $data[$key]['red_usable'] = $red['data']['red_sum']; //总的红包奖励 $red1 = member::get_rad_list($value['id']); $data[$key]['red_sum'] = $red1['data']['sum']; } return Utils::exportExcel($data, array('用户id', '用户手机号', '用户真实姓名', '用户注册时间', '用户注册地区', '用户状态', '用户账户余额', '在投资金', '可用收益', '累计收益', '首次充值时间', '充值总金额', '首次投资时间', '投资总额', '赎回总额', '提现总额', '未领取红包', '红包奖励总额'), '数据分析' . date('Y-m-d-H-m-s')); } }
/** * 获取用户的详细信息--认证信息--账户信息 * @param $uid * @return array|null|\yii\db\ActiveRecord */ public static function getUserInfo($uid) { $year_rate = '0.08'; //活动期间利率调整TODO date_default_timezone_set('PRC'); //活动开始时间 $begin_time = strtotime('2015-9-24'); //活动结束时间 $end_time = strtotime('2015-9-30'); //当前时间 $now_time = time(); if ($now_time > $begin_time && $now_time < $end_time) { $year_rate = '0.0815'; } $yes_money = 0; $info = UcenterMember::find()->joinWith('info')->select(['id', 'ucenter_member.status', 'lock', 'invitation_code', 'phone', 'idcard', 'real_name', 'bank_card', 'bank_card_phone', 'balance', 'total_invest', 'invest', 'profit', 'total_revenue'])->where(['id' => $uid])->asArray()->one(); if ($info == null) { $return = array('errorNum' => '1', 'errorMsg' => '用户不存在', 'data' => null); return $return; } //获取网站配置信息 $config = AssetConfig::find()->select(['id', 'deposit_num', 'deposit_min', 'deposit_max', 'deposit_time', 'invest_num', 'invest_min', 'invest_max', 'invest_time', 'withdraw_num', 'withdraw_min', 'withdraw_max', 'withdraw_time', 'ransom_num', 'ransom_min', 'ransom_max', 'ransom_time'])->where(['id' => '2'])->asArray()->one(); //获取用户昨日收益金额 //今日零时时间 $zero_time = strtotime(date("Y-m-d")); //获取昨日收益 $get_yes_money = Income::find()->where(['>', 'created_at', $zero_time])->andWhere(['member_id' => $uid])->one(); //获取昨日收益金额--利率 $yes_experience_money = 0; if ($get_yes_money) { $yes_money = $get_yes_money->smoney ? $get_yes_money->smoney : 0; $year_rate = $get_yes_money->rate ? $get_yes_money->rate : 0; $yes_experience_money = $get_yes_money->goldincome ? $get_yes_money->goldincome : 0; } //获取体验金 $experience_money = 0; $money = Gold::find()->where(['<', 'created_at', time()])->andWhere(['>', 'end_at', time()])->andWhere(['uid' => $uid, 'status' => Gold::STATUS_ACTIVE])->sum('money'); if ($money) { $experience_money = sprintf("%.2f", $money); } //获取活动红包可用金额 $red_packet_money = 0; $red_money = member::get_user_red_packet($uid); if (!$red_money['errorNum']) { $red_packet_money = $red_money['data']['red_sum']; } $activity_invite = ''; //用户再投资金大于一元,可以进行分享 // $invest = $info['invest'] ? $info['invest'] : 0; // if($invest >= 1){ // $activity_invite = AloneMethod::encrypt($info['phone']); // } $activity_invite = AloneMethod::encrypt($info['phone']); $data = array('phone' => $info['phone'], 'idcard' => $info['idcard'], 'real_name' => $info['real_name'], 'status' => $info['status'], 'lock' => $info['lock'], 'invitation_code' => $info['invitation_code'], 'bank_card' => $info['bank_card'], 'bank_card_phone' => $info['bank_card_phone'], 'balance' => $info['balance'], 'total_invest' => $info['total_invest'], 'total_revenue' => $info['total_revenue'], 'invest' => $info['invest'], 'profit' => $info['profit'], 'yesterday_rate' => sprintf("%.4f", $year_rate), 'yesterday_money' => $yes_money, 'experience_money' => $experience_money, 'yes_experience_money' => $yes_experience_money, 'red_packet_money' => $red_packet_money, 'activity_invite' => $activity_invite, 'config' => $config); $return = array('errorNum' => '0', 'errorMsg' => 'success', 'data' => $data); return $return; }
public function actionRecommenddatas() { if ($_REQUEST) { $uid = yii::$app->user->id; $page = intval($_REQUEST[page]); $page_num = intval($_REQUEST[num]); try { $result = member::get_rad_list($uid, $page, $page_num); } catch (Exception $ex) { $result = ''; } $datas = json_encode($result[data]['list']); echo $datas; } }
public function actionCheckin() { if (!yii::$app->user->isGuest) { $uid = yii::$app->user->id; //$invest_total = \common\models\fund\Order::find()->where(['member_id'=>$uid,'status'=>1])->sum('money'); $checkin_total = count(SignIn::find()->where('sign_in_time >=' . strtotime(date("Y-m-d")))->all()); //本日签到总人数 /* $model = new RaiseCard(); $model->member_id = Yii::$app->user->id; $model->create_at = strtotime("now"); $coupon_id = Setting::find()->where(['code'=>'checkrate'])->asArray()->one()['value']; $model_activity_card = Card::find()->where('id='.$coupon_id)->asArray()->one(); $model->coupon_id = $coupon_id; $model->status = 0; $model->rate = $model_activity_card['rate']; $model->validity_start_at = $model_activity_card['use_start_at']; $model->validity_out_at = $model_activity_card['use_out_at']; $model->save(false); */ try { $info = \frontend\actions\app\member::signIn(yii::$app->user->id, '1'); echo json_encode($info); exit; } catch (ErrorException $e) { echo $e->getMessage(); exit; } echo $checkin_total; exit; } }
public function actionSignupofpromotion() { //进行注册操作 $post = Yii::$app->request->post(); $phone = $post['phone']; $pwd = $post['password']; $phone_code = $post['validate_code']; $from = (int) $post['url_code']; $request = member::the_promotion_register($phone, $pwd, $phone_code, $from); return json_encode($request); }
public function actionBindcard() { $uid = Yii::$app->user->id; $isAuthentic = member::isAuthentic(yii::$app->user->id); if ($isAuthentic['errorNum'] != 0) { header("Content-type: text/html; charset=utf-8"); echo "<script>alert('您还没有实名制认证')</script>"; echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/step2']) . "'</script>"; exit; } $model = UcenterMember::find()->where(['id' => $uid])->one(); return $this->view('bindcard', compact("model")); }
/** * Authre:langxi * * 用户赎回操作 */ public static function User_redeem($member_id, $money, $update = 0) { ini_set('max_execution_time', 60); //判断用户是否可进行赎回操作 $is_go = Info::find()->select(['status'])->where(['member_id' => $member_id])->asArray()->one(); if ($is_go['status'] > 0) { $result = array('errorNum' => '1', 'errorMsg' => '处理中,请稍后再试', 'data' => null); return $result; } Info::updateAll(['status' => Info::GO_THREE], ['member_id' => $member_id]); //进行操作,状态变为处理中 //检查用户一日赎回 $check_redeem = self::check_redeem($member_id, $money); if ($check_redeem) { Info::updateAll(['status' => '0'], ['member_id' => $member_id]); // $result = array('errorNum' => '1', 'errorMsg' => $check_redeem, 'data' => null); return $check_redeem; } //判断赎回金额是否小于新浪账户与网站账户余额的差值,若小于则网站端进行赎回操作,先赎回利息,然后赎回订单中的金额。 //若大于求取差值获取到网站需要赎回的金额和新浪部分需要赎回的金额,然后两端分别进行赎回操作,先赎回利息,然后赎回订单中的金额 $asset = Info::find()->where(['member_id' => $member_id])->asArray()->one(); $bank_card = $asset['bank_card']; //获取用户在投收益 $profit = $asset['profit']; //判断用户赎回金额是否可赎回。 $order_money = (new \yii\db\Query())->select(['money'])->from('fund_orders')->where(['member_id' => $member_id])->andWhere(['>', 'money', '0'])->sum('money'); //增加了活动红包begin if ($update) { $red_money = member::get_user_red_packet($member_id, $update); if (!$red_money['errorNum']) { $red = $red_money['data']['red_sum']; $order_money = $order_money + $red; } } ////活动红包end if ($order_money + $profit < $money) { Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '1', 'errorMsg' => '赎回金额大于可赎回金额,请重新输入', 'data' => null); return $result; } $w_blance = self::showBlance($member_id); //网站余额 $s_blance = sinapay::querySinaBalance($member_id); //调用第三方接口查看新浪账户可用余额(含货币基金 if ($s_blance['errorNum']) { Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '1', 'errorMsg' => $s_blance['errorMsg'], 'data' => null); return $result; } if ($w_blance > $s_blance['data']['available_balance']) { Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '1', 'errorMsg' => '账户异常请联系客服', 'data' => null); return $result; } $m_fund = $s_blance['data']['available_balance'] - $w_blance; //新浪账户比网站账户多的钱--新浪的货币基金 $red_packet = 0; $red = 0; //如果赎回和活动红包有关系 TODO if ($update) { //赎回时必须有在投金额 $invest = $asset['invest']; if ($invest && $invest >= 1) { //获取那个时间点的金额 $red_money = member::get_user_red_packet($member_id, $update); if (!$red_money['errorNum']) { $red = $red_money['data']['red_sum']; if ((double) $red > (double) $money) { //如果只是提取一部分红包 $return = array('errorNum' => '1', 'errorMsg' => '红包必须全部赎回', 'data' => null); return $return; } } else { $return = array('errorNum' => '1', 'errorMsg' => $red_money['errorMsg'], 'data' => null); return $return; } } } //应该扣除红包的金额 $red_packet = $red; //$m_fund ---新浪的货币基金 //货币基金大于用户要赎回的资金--发上几率比较小 if ($m_fund > $money) { //事物回滚 $transaction = \Yii::$app->db->beginTransaction(); try { //赎回金额小于新浪账户与网站账户的差值,仅网站端进行赎回操作 $profit = (new \yii\db\Query())->select(['profit'])->from('asset_info')->where(['member_id' => $member_id])->one(); //TODO --添加了红包++++++$red_packet; $profit = $profit['profit'] + $red_packet; //用户的可用收益 // money 减去红包 if ($money <= $profit) { // 红包表的处理 if ($update) { $info = Info::findOne($member_id); $info->profit = $info['profit'] + $red_packet; $info = $info->save(); if (!$info) { throw new ErrorException('红包赎回失败', 6001); } $flag = member::draw_red_packet($member_id, $update); if ($flag['errorNum']) { throw new ErrorException('红包赎回失败', 6001); } } //赎回金额小于等于用户可用收益 $info = Info::findOne($member_id); $info->profit = $info['profit'] - $money; $info = $info->save(); if (!$info) { throw new ErrorException('赎回失败', 6001); } $info = Info::findOne(['member_id' => $member_id]); $info->balance = $info->balance + $money; $info = $info->save(); if (!$info) { throw new ErrorException('赎回金额放入余额失败', 4002); } //由网站设定好的支付利息的账户进行利息支付 $sina_config = SinaConfig::find()->select(['sinapay_give_accrual'])->asArray()->one(); $profit_id = $sina_config['sinapay_give_accrual']; $profit_info = Info::findOne($profit_id); $profit_info->balance = $profit_info['balance'] - $money; $profit_info = $profit_info->save(); if (!$profit_info) { throw new ErrorException('支付利息账户资金减少失败'); } //写入职员账户记录表中 $clerk = new ClerkLog(); $clerk->member_id = $member_id; $clerk->clerk_id = $profit_id; $clerk->behav = ClerkLog::CLERK_BEHAV_TWO; $clerk->step = $money; $clerk->remark = '支付利息职员'; $clerk = $clerk->save(); if (!$clerk) { throw new ErrorException('写入职员账户记录失败'); } //赎回成功进行提现记录 $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RSUCCEED; //赎回成功 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回成功'; $assetlog->save(); } else { //赎回金额大于用户可用收益 $info = Info::findOne($member_id); $info->profit = 0; $info = $info->save(); if (!$info) { throw new ErrorException('赎回收益失败', 6001); } if ($update) { $flag = member::draw_red_packet($member_id, $update); if ($flag['errorNum']) { throw new ErrorException('红包赎回失败', 6001); } } //由网站设定好的支付利息的账户进行利息支付 $sina_config = SinaConfig::find()->select(['sinapay_give_accrual'])->asArray()->one(); $profit_id = $sina_config['sinapay_give_accrual']; $profit_info = Info::findOne($profit_id); $profit_info->balance = $profit_info['balance'] - $profit; $profit_info = $profit_info->save(); if (!$profit_info) { throw new ErrorException('支付利息账户资金减少失败'); } //写入职员账户记录表中 $clerk = new ClerkLog(); $clerk->member_id = $member_id; $clerk->clerk_id = $profit_id; $clerk->behav = ClerkLog::CLERK_BEHAV_TWO; $clerk->step = $profit; $clerk->remark = '支付利息职员'; $clerk = $clerk->save(); if (!$clerk) { throw new ErrorException('写入职员账户记录失败'); } $redeem_money = $money - $profit; // TODO $Redeem = self::Redeem($member_id, $redeem_money); if (!$Redeem) { throw new ErrorException('生成赎回字典失败', 4002); } else { $Redeem = self::Set_redeem($Redeem); if (!$Redeem) { throw new ErrorException('赎回失败'); } else { $info = Info::findOne(['member_id' => $member_id]); $info->balance = $info->balance + $money; $info->invest = $info['invest'] - $redeem_money; $info = $info->save(); if (!$info) { throw new ErrorException('赎回金额放入余额失败', 4002); } //赎回成功进行提现记录 $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $redeem_money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RSUCCEED; //赎回成功 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回成功'; $assetlog->save(); } } } $transaction->commit(); Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '0', 'errorMsg' => 'success', 'data' => null); return $result; } catch (\Exception $e) { $transaction->rollBack(); //对提现失败信息进行记录 $remark = $e->getMessage(); \Yii::error($e->getTraceAsString(), 'app'); $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RERROR; //赎回失败 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回失败' . $remark; $assetlog->save(); Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '1', 'errorMsg' => $remark, 'data' => null); return $result; } } else { //赎回金额大于新浪账户与网站账户的差值,取得新浪端赎回金额,网站与新浪都进行赎回操作 //---新浪货币基金不足以支撑赎回操作---$s_money ---除去新浪货币基金后要进行的赎回金额 $s_money = $money - $m_fund; //新浪端赎回金额 $profit = (new \yii\db\Query())->select(['profit'])->from('asset_info')->where(['member_id' => $member_id])->one(); $profit = $profit['profit']; //用户的可用收益 ///进行收益的赎回----假定把红包加到用户收益内 //++++用户收益足以满足用户的赎回操作---用户直接赎回投资的收益就可以了 if ($s_money <= $profit + $red_packet) { //事物回滚 赎回收益 $transaction = \Yii::$app->db->beginTransaction(); try { //红包处理---加用户收益 TODO if ($update) { $info = Info::findOne($member_id); $info->profit = $info['profit'] + $red_packet; $info = $info->save(); if (!$info) { throw new ErrorException('红包赎回失败', 6001); } $flag = member::draw_red_packet($member_id, $update); if ($flag['errorNum']) { throw new ErrorException('红包赎回失败', 6001); } } //用户收益足以满足用户的赎回操作---用户直接赎回投资的收益就可以了 $info = Info::findOne($member_id); $info->profit = $info['profit'] - $s_money; $info = $info->save(); if (!$info) { throw new ErrorException('赎回失败', 6001); } //用户只是赎回在投收益---网站给只利息就行了 $sina_config = SinaConfig::find()->select(['sinapay_give_accrual'])->asArray()->one(); $profit_id = $sina_config['sinapay_give_accrual']; $profit_info = Info::findOne($profit_id); $profit_info->balance = $profit_info['balance'] - $s_money; $profit_info = $profit_info->save(); if (!$profit_info) { throw new ErrorException('支付利息账户资金减少失败'); } //写入职员账户记录表中 $clerk = new ClerkLog(); $clerk->member_id = $member_id; $clerk->clerk_id = $profit_id; $clerk->behav = ClerkLog::CLERK_BEHAV_TWO; $clerk->step = $money; $clerk->remark = '支付利息职员'; $clerk = $clerk->save(); if (!$clerk) { throw new ErrorException('写入职员账户记录失败'); } //--网站账户处理成功了----调用第三方新浪接口赎回收益 $sina_ransom = sinapay::giveInterest($member_id, $s_money); //赎回收益 if ($sina_ransom['errorNum']) { throw new ErrorException($sina_ransom['errorMsg'], 7002); } //更新网站中账户的余额和收益---涉及到货币基金--用户更新数据用$money---实际给付是$s_money $info = Info::findOne(['member_id' => $member_id]); $info->balance = $info->balance + $money; $info = $info->save(); if (!$info) { throw new ErrorException('赎回金额放入余额失败', 4002); } //赎回成功进行赎回记录 $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RSUCCEED; //赎回成功 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回成功'; $assetlog->save(); $transaction->commit(); Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '0', 'errorMsg' => 'success', 'data' => null); return $result; } catch (\Exception $e) { $transaction->rollBack(); //对提现失败信息进行记录 $remark = $e->getMessage(); \Yii::error($e->getTraceAsString(), 'app'); $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RERROR; //赎回失败 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回失败' . $remark; $assetlog->save(); Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '1', 'errorMsg' => $remark, 'data' => null); return $result; } } else { //用户的赎回金额大于用户可用收益---需要进行债权赎回操作 $rh_money = 0; //赎回金额 //如果有活动红包奖励--进行红包加到收益里操作 //收益大于0,首先赎回收益 if ($profit + $red_packet > 0) { //事物回滚 赎回收益 $transaction = \Yii::$app->db->beginTransaction(); try { //红包操作---增加用户的账户再投收益 $profit = $profit + $red_packet; if ($update) { $flag = member::draw_red_packet($member_id, $update); if ($flag['errorNum']) { throw new ErrorException('红包赎回失败', 6001); } } //$s_money 是大于用户当前账户中的再投收益的--已经怎加活动奖励红包 $info = Info::findOne($member_id); $info->profit = 0; $info = $info->save(); if (!$info) { throw new ErrorException('赎回收益失败', 6001); } //由网站设定好的支付利息的账户进行利息支付---再投收益全部赎回了 $sina_config = SinaConfig::find()->select(['sinapay_give_accrual'])->asArray()->one(); $profit_id = $sina_config['sinapay_give_accrual']; $profit_info = Info::findOne($profit_id); $profit_info->balance = $profit_info['balance'] - $profit; $profit_info = $profit_info->save(); if (!$profit_info) { throw new ErrorException('支付利息账户资金减少失败'); } //写入职员账户记录表中 $clerk = new ClerkLog(); $clerk->member_id = $member_id; $clerk->clerk_id = $profit_id; $clerk->behav = ClerkLog::CLERK_BEHAV_TWO; $clerk->step = $profit; $clerk->remark = '支付利息职员'; $clerk = $clerk->save(); if (!$clerk) { throw new ErrorException('写入职员账户记录失败'); } $info = Info::findOne(['member_id' => $member_id]); $info->balance = $info->balance + $profit; $info = $info->save(); if (!$info) { throw new ErrorException('赎回收益放入余额失败', 4002); } $sina_ransom = sinapay::giveInterest($member_id, (string) $profit); //调用第三方接口赎回收益 if ($sina_ransom['errorNum']) { throw new ErrorException($sina_ransom['errorMsg'], 7002); } //记录用户的赎回金额 $rh_money = $profit; $transaction->commit(); } catch (\Exception $e) { $transaction->rollBack(); //对提现失败信息进行记录 $remark = $e->getMessage(); \Yii::error($e->getTraceAsString(), 'app'); $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RERROR; //赎回失败 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回失败' . $remark; $assetlog->save(); Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '1', 'errorMsg' => $remark, 'data' => null); return $result; } } //用户已经赎回了所有的再投收益---计算还需要进行多少的债权赎回操作 $money = $money - $profit; $redeem_dic = self::Redeem($member_id, $money); //获取债权字典--进行债权的赎回操作 foreach ($redeem_dic as $k => $v) { if ($v['thirdmoney'] == 0) { continue; } //事物回滚 $transaction = \Yii::$app->db->beginTransaction(); try { //网站赎回部分 //order表金额赎回 $order = Order::findOne($v['order_id']); $order->money = $order['money'] - $v['thirdmoney']; if ($order['money'] == '0') { $order->status = Order::STATUS_DELETE; } $order = $order->save(); if (!$order) { throw new ErrorException('赎回转让债权失败'); } //thirdorder表金额赎回 $thirdorder = Thirdorder::findOne($v['thirdorder_id']); $thirdorder->money = $thirdorder['money'] - $v['thirdmoney']; if ($thirdorder['money'] == '0') { $thirdorder->status = Thirdorder::STATUS_DELETED; } $thirdorder->mcmoney = $thirdorder['mcmoney'] + $v['thirdmoney']; //用户赎回,最大债权人支付此金额,记录 $thirdorder->ocmoney = $thirdorder['ocmoney'] - $v['thirdmoney']; //用户赎回,原始债权人金额减少,记录 $thirdorder = $thirdorder->save(); if (!$thirdorder) { throw new ErrorException('赎回第三方转让债权失败'); } //thirdproduct第三方债权已投金额减少 $thirdproduct = Thirdproduct::findOne($v['thirdproduct_id']); $thirdproduct->invest_sum = $thirdproduct['invest_sum'] - $v['thirdmoney']; $thirdproduct->mcmoney = $thirdproduct['mcmoney'] + $v['thirdmoney']; //赎回导致最大债权人金额增加 $thirdproduct = $thirdproduct->save(); if (!$thirdproduct) { throw new ErrorException('赎回第三方债权已投金额失败'); } //获取债权的最大债权人id,将用户赎回的钱从最大债权人的账户中减去 $maxcreditor = Thirdproduct::find()->select(['maxcreditor'])->where(['id' => $v['thirdproduct_id']])->asArray()->one(); $maxcreditor = $maxcreditor['maxcreditor']; $is_max = Catmiddle::find()->where(['cid' => '1', 'uid' => $maxcreditor])->asArray()->one(); if (!$is_max) { throw new ErrorException('最大债权人异常'); } $max_info = Info::findOne($maxcreditor); $max_info->balance = $max_info['balance'] - $v['thirdmoney']; $max_info = $max_info->save(); if (!$max_info) { throw new ErrorException('消减最大债权人账户金额失败'); } //写入职员账户记录表中 $clerk = new ClerkLog(); $clerk->member_id = $member_id; $clerk->clerk_id = $maxcreditor; $clerk->behav = ClerkLog::CLERK_BEHAV_TWO; $clerk->step = $v['thirdmoney']; $clerk->remark = '最大债权人'; $clerk = $clerk->save(); if (!$clerk) { throw new ErrorException('写入职员账户记录失败'); } //新浪赎回部分??? $k_money = $s_money - $v['thirdmoney']; //赎回金额 if ($k_money > 0) { $s_money = $k_money; //获取最大债权人 $maxcreditor = (new \yii\db\Query())->select(['maxcreditor'])->from('fund_thirdproduct')->where(['id' => $v['thirdproduct_id']])->one(); $maxcreditor = $maxcreditor['maxcreditor']; //调用第三方新浪接口赎回 // $money_sina = sprintf("%.2f", $v['thirdmoney']); if ($money_sina > 0) { $sina_ransom = sinapay::sinaRansom($member_id, $money_sina, $maxcreditor); //暂定38为支付利息的用户id if ($sina_ransom['errorNum']) { throw new ErrorException($sina_ransom['errorMsg'], 7002); } } $info = Info::findOne(['member_id' => $member_id]); $info->balance = $info->balance + $v['thirdmoney']; $info->invest = $info['invest'] - $v['thirdmoney']; $info = $info->save(); if (!$info) { $money_log = $money - $s_money + $v['thirdmoney']; throw new ErrorException('成功赎回' . $money_log . '元', 4002); } $rh_money = $rh_money + $v['thirdmoney']; //赎回金额 } else { //获取最大债权人 $maxcreditor = (new \yii\db\Query())->select(['maxcreditor'])->from('fund_thirdproduct')->where(['id' => $v['thirdproduct_id']])->one(); $maxcreditor = $maxcreditor['maxcreditor']; //调用第三方新浪接口赎回 $money_sina = sprintf("%.2f", $s_money); if ($money_sina) { $sina_ransom = sinapay::sinaRansom($member_id, $money_sina, $maxcreditor); //暂定38为支付利息的用户id if ($sina_ransom['errorNum']) { throw new ErrorException($sina_ransom['errorMsg'], 7002); } } $info = Info::findOne(['member_id' => $member_id]); $info->balance = $info->balance + $s_money + $m_fund; $info->invest = $info['invest'] - $s_money - $m_fund; $info = $info->save(); if (!$info) { $money_log = $money - $s_money + $m_fund; throw new ErrorException('赎回' . $money_log . '元', 4002); } $rh_money = $rh_money + $s_money + $m_fund; //赎回金额 } $transaction->commit(); } catch (\Exception $e) { $transaction->rollBack(); //对提现失败信息进行记录 $remark = $e->getMessage(); \Yii::error($e->getTraceAsString(), 'app'); $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $s_money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RERROR; //赎回失败 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回失败' . $remark; $assetlog->save(); Info::updateAll(['status' => '0'], ['member_id' => $member_id]); $result = array('errorNum' => '1', 'errorMsg' => $remark, 'data' => null); return $result; break; } } $assetlog = new Log(); $assetlog->member_id = $member_id; $assetlog->step = $rh_money; $assetlog->action = 'Withdrawals/Redeem'; $assetlog->status = self::RSUCCEED; //赎回成功 $assetlog->bankcard = $bank_card; $assetlog->remark = '赎回' . $rh_money . '元'; //赎回金额 $assetlog->save(); } Info::updateAll(['status' => '0'], ['member_id' => $member_id]); //赎回结束,操作状态变回常态 $result = array('errorNum' => '0', 'errorMsg' => 'success', 'data' => null); return $result; } }
public function actionDorepass() { $uid = Yii::$app->user->id; if ($_POST) { $member = member::changePassword($uid, $_POST['oldpass'], $_POST['password'], $_POST['repassword']); if ($member['errorNum'] == 1) { return $member['errorMsg']; } else { Utils::ensureOpenId(); $openId = Yii::$app->request->get('open_id'); if ($openId) { $model = UcenterMember::findOne(['openid' => $openId]); if ($model) { $model->openid = ''; $model->save(); } } Yii::$app->user->logout(); return '修改成功'; } } }
public function actionWly() { $test = sinapay::bindingBankCard('118', '201510285310056139580', '15231231883'); // $test = Balance::isBinding('11'); var_dump($test); exit; // $test = Balance::bindbankcard(31,'6217000140004808851','131102199007042019','王利亚','15127281324','1'); // $test = Balance::bindBankcardConfirm(31,'88782b223a34b136e068380d4a7a67ce75209','544755'); // $test = Balance::setBalance('11',1); // $test = Balance::confirmSet('201507244850494903618','434819'); // var_dump($test); // 短信验证 发送短信--验证手机 // $test = Port::ValidatePhone('15127281324'); // $test = Port::checkPhnoe('15127281324','775527'); // 实名认证 身份证与姓名对应 // $test = member::authentication('52','王利亚','131102199007042019'); //绑卡--》绑卡确认--(查询)》绑卡后支付--》支付确认--(查询)》订单查询---》提现操作 //绑卡操作 输入信息---进行确认 // $test = yeepay::bindbankcard(12,'6217000140004808851','131102199007042019','王利亚','15127281324',1); // $test = yeepay::bindBankcardConfirm('4b19627eba749b32d1ec46348ce347aa27322','068268'); // 查询绑卡信息 // $test = yeepay::bankcardList('0276867a089e23c4201d0ddd7a62fa8b88403'); //用户充值 充值金额--短信验证 // $test = yeepay::payment(11,1); // $test = yeepay::confirmPayment('201507239952989849677','430672'); //查询支付订单信息 // $test = yeepay::paymentQuery('201507225453102169489','411507233860836495'); //$test = Balance::isBinding('11'); // 用户提现 // $test = yeepay::withdraw(11,10); //订单查询 // $test = yeepay::payClearData('2015-07-01','2015-07-23'); // $test = Balance::bindbankcard('1','6217000140004808851','131102199007042019','王利亚','15127281324',1); // $test = Balance::bindBankcardConfirm('1','3561ae0fc7db3bc677bb7672af27c46703124','105618'); // var_dump(Yii::$app->request->post()); //app //是否实名验证 // $test = member::isAuthentic('1'); //绑卡操作 // $test = Balance::bindbankcard(1,'6217000140004808851','15127281324',1); // $test = Balance::bindBankcardConfirm(1,'61256eedde9796991433e599ba7b2cd046813','018850'); //支付操作 // $test = Balance::setBalance(1,0.01); // $test = Balance::confirmSet('201507319749100523334','109815'); //获取绑卡信息 // $test = Balance::getBalance(1); // $test = yeepay::withdraw(1,1); // $test = Port::ValidatePhone('15127281324'); // var_dump($test); // $test = User::getIdentity(); // var_dump($test); // $test = \frontend\actions\member::phoneIsRegister('15127281324'); // $test = \frontend\actions\Port::ValidatePhone('15127281324'); // $test = member::register('8888811','123','123','1','1','1'); // var_dump($test); // $test = Yii::$app->user->renewAuthStatus(); // $session = Yii::$app->getSession(); // $id = $session->getHasSessionId(); // $request = Yii::$app->getRequest(); // $test = member::phoneRegister('15127281324'); // $test = member::random(); // $test =VerifyCode::find()->where([ // 'field' => '15127281324', // 'status' => -1 // ])->orderBy('b_time desc')->one(); // $test = \frontend\actions\member::getInvite('1'); // $test = \frontend\actions\member::authentication(24,'王利亚','131102199007042019'); // $test = member::phoneRegister('18518674993'); // $test = Port::ValidatePhone('15127281324'); // $test = Port::checkPhnoe('15127281324','079361'); // $test = member::register('18518674993','123456','123456','1','932513'); // $test = member::login('18518674993','123456'); // $test = member::logout(37); // $test = member::isAuthentic(22); // $test = \frontend\actions\Balance::bindbankcard2(27,'123456','11111'); // $test = \frontend\actions\Balance::setBalance2(27,100); // $test = \frontend\actions\Balance::bindbankcard(22,'6217000140004808851','131102199007042019','王利亚','15127281324','1'); //连连支付接口---参数uid,银行卡号,充值金额。---自动判定用户是否实名认证,非实名认证不能进行 // $test = lianlian::confirmation(24,'6217000140004808851','0.01'); // $test = lianlian::confirmation(25,'6227000140510442244','0.01'); // $test = \frontend\actions\member::getInvite('24'); ////新浪支付 // $sina = new sina(); // $test = $sina->query_verify('HQW131102199007042019'); // $lili = new lianlianClass(); // $test = $sina->create_activate_member(time()); // $test = $sina->set_real_name('20150819100838','王','131102199007042000'); // $test = $sina->binding_verify(); // $test = $sina->unbinding_verify(); // $test = $sina->query_verify(); // $test = $lili->bankcardQuery('6217000140004808851'); // var_dump($test); // $test = lianlian::getBankcard(1); //使用连连支付其他接口 // $ll = new lianlianClass(); //订单查询接口 参数--商户订单号,订单时间,连连返回订单号 // $test = $ll->orderQuery('cc522b525ff348b9e58456c829e2e44a','20150808100430','2015080811466969'); //银行卡查询接口 // $test = $ll->bankcardQuery('6226901805086869'); // 用户在连连支付情况 // $test = $ll->userBankcard('d0bf2c2b6f14b7b1a10a5c3d797b4ba4'); // $test = $ll->bankcardunbind('3fef8327bc176698230248dbc1222579','2015080818510075'); // $test = \frontend\actions\member::getPhone('24'); //实名-创建新浪会员 // $test = sinapay::authentication('88','王利亚','131102199007042019'); // $test = sinapay::bindingBankCard('96','6217000140004808851','15127281324'); // $test = sinapay::checktodaydeposit('101'); // $test = sinapay::bankCardInfo('6225880136674703'); // $test = sinapay::updatebank('44',100); // $test = sinapay::bankCardAdvance('201508201001005397980','bdf307fc78ab438eb5991aa11c87809b','020346'); // $test = sinapay::queryBankCard('44'); // $test = sinapay::isBinding('44'); //用户充值操作 // $test = sinapay::recharge('44',1000); // $test = sinapay::getUserInfo('44'); // $test = sinapay::checkdeposit('44',49900); // $test = sinapay::recharge('44','1'); // $test = sinapay::recharge('105','100'); // $test = sinapay::rechargeComfirm('201510125157981071041','5c8c0014fb344b13beaaf97f1dc73b6e','841149'); //$test = $sina->query_hosting_deposit_order('1440052548HQW131102199007042019','201510054810154542450'); // $test = sinapay::bankCardInfo('6226901805086869'); // $test = $sina->query_verify('1440032322HQW131102199007042019'); // $test = $sina->query_balance('1440032322HQW131102199007042019'); //查询网站用户金额 // $test = $sina->query_balance('20150831183009HQW610523198304110017'); //查询账户余额 44 // $test = $sina->query_balance('200004227922','MEMBER_ID',"BASIC"); //查询账户余额 44 938.09 -100 // $test = sinapay::querySinaBalance('74');//网站余额 // $test = sinapay::balanceFreeze('44','1','11'); // $test = $sina->query_balance('1440236114HQW131102199007042019'); //查询账户余额 27 // $test = $sina->query_balance('1440147796HQW131102199007042019'); //查询账户余额 38 190.09 +30 // $test = $sina->query_balance('1440144466HQW131102199007042019'); //查询账户余额 42 20 // $test = $sina->query_hosting_deposit('1440144466HQW131102199007042019',''); // $test = sinapay::rechargeComfirm('201508219810049981245','dc7a57ba64fa4a2985408bef17026c39','378446'); // $test = sinapay::invest('44','1','0.01'); // $test = sinapay::invest('44','10','10'); //用户投资 // $test = sinapay::invest('44','10','10'); //用户投资 // $test = sinapay::sitePeyee('38','100','201508221019949924038','1440032322HQW131102199007042019'); //网站收钱 // $test = sinapay::hostingRefund('1440052548HQW131102199007042019','201508249749555163125',100); //中间账户退款 // $test = $sina->query_hosting_refund_byorder('1440052548HQW131102199007042019','201508244848571033366'); // $test = sinapay::withdraw('44','19'); //用户提现 网站通过 // $test = sinapay::sianWithdraw('1440052548HQW131102199007042019','201508241011005040879'); // $test = sinapay::sinaRansom('1440052548HQW131102199007042019','201508231015152521185'); // $test = \frontend\actions\member::authentication('27','网名','131102199007042019'); // $test = $sina->query_hosting_withdraw_order('1440052548HQW131102199007042019','SAVING_POT','201508221025452508718'); // $test = $sina->create_hosting_withdraw('111111111111','1440052548HQW131102199007042019','SAVING_POT','10','31193'); // $test = sinapay::withdraw('44',1); // $test = sinapay::sianWithdraw('1440052548HQW131102199007042019','201509075457555186256'); // $test = sinapay::hostingRefund('1440052548HQW131102199007042019','201508235753565114051',10,'123'); // $test = $sina->create_single_hosting_pay_trade(time(),'1440032322HQW131102199007042019','SAVING_POT','11','11111'); // $test = sinapay::query_hosting_withdraw_time('1440052548HQW131102199007042019',time()-72000000,time()); $pay_uid = array('27' => '1', '42' => '2', '38' => '3'); // $test = sinapay::batchPay($pay_uid,'201508235753565114051'); // $test = sinapay::giveInterest('27','11'); //给利息 // $test = sinapay::collectSite(4000,array('44'=>'4000')); // $test = sinapay::collectUser('44',1000); // $test = sinapay::unbinding_bank_card('44'); // $test = sinapay::sinaRansom('27','11000','44'); // $test = sinapay::sianWithdrawOnly('44',1); // $test = sinapay::getBankCard('44'); // $test = \frontend\actions\Port::sendSms2('15127281324','123456','3','4'); // $test = $sina->query_bank_card('1440817121HQW370105198910176257','32694'); // $test = sinapay::getUserInfo('44'); // $test = $sina->getConfig(); // $wei = new Weibopay(); // $test = $wei->getConfig(); // $test = sinapay::getConfig(); //$test = \frontend\actions\Port::ValidatePhone('15127281324'); // $test = member::signIn('111','2'); // $test = member::get_yesterday_sign_in(); // $test = member::get_today_sign_in(); // $test = member::get_user_sign_in(1); // $test = member::is_sign_today('21'); // $test = member::get_yesterday_user('1'); //$test = $sina->create_activate_member(time()); // $test = Withdrawals::User_redeem('53','1000'); //$test = Invest::invest('53','16','1100'); // $test = $sina->set_real_name('20150902161534HQW131102199007042019','伍文瀚','130603198803230318'); // $test = member::get_user_sign_in('1','4','2'); // $test = \frontend\actions\App\Invest::product_list(4,1); // $test = member::phonpreg_matchster('18518674993'); // $test = member::set_invitation(5); // $test = member::verify_code('57565356'); // $test = member::use_code('1'); // $test = member::register('18518674993','123456','123456','222222','3','48529853'); // $test = App::sessionkey_istimeout('f91f250602f33523296fa93d9ea086e447929--3'); // $test = sinapay::recharge('44',11.5); // $test = member::get_invest_num('44'); // $test = sinapay::sianWithdrawOnly('44',1); // $test = sinapay::getUserInfo('44'); // $test = member::set_invitation(); // $test = App\Invest::product_list('1','2'); // $test = sinapay::bankCardInfo('6226320130074914'); // $test = member::give_experience_gold('手机号注册','12'); // $test = \frontend\actions\Port::ValidatePhone('15127281324'); //$test = \frontend\actions\Port::checkPhnoe('15127281324','095130'); // $test = sinapay::collectSite(4000,array('38'=>'4000')); // $test = App\AloneMethod::invest_log('44','5','1'); // $test = sinapay::authentication('79','王利亚','131102199007042019'); // $test = sinapay::getUserInfo(44); // $test = member::signIn('44','3'); // $test = sinapay::test('55','100'); // $test = sinapay::immediate_withdraw('44','200'); // $test = App\AloneMethod::reading_log('11','12'); // $test = App\AloneMethod::is_reading('12','12'); // $test = App\AloneMethod::is_msg(array('33','55','44','66'),'12'); // $test = App\AloneMethod::ignore_all(array('33','55','44','66'),'12'); // $test = App\AloneMethod::is_exit_msg('44'); // $test = App\AloneMethod::user_msg_centor('44','1','4'); // $test = sinapay::sianWithdrawOnly('44','10'); // $test = sinapay::get_sina_balance_all('55'); // $test = sinapay::get_deal(); // $test = App\AloneMethod::experience_gold_log('44'); // $test = App\AloneMethod::cms_lunbo(); // $test = App\AloneMethod::encrypt('15127281324'); // $test = App\AloneMethod::decrypt('lmZhk5uVa2pna5Y='); // $test = member::active_log('15127281324','22','18518674993',111,90,'中秋节'); // $test = member::get_invite_info('YW5lZ5lmnWaabWg='); // $test = $sina->create_hosting_deposit(); // $test = sinapay::getUserInfo('44'); // $test = member::get_invite_info('22'); // $test = member::create_read_packet('15127281324',10); // $test = member::update_red_packet('94','15127281324','18518674992','国庆节活动'); // $cookies = Yii::$app->response->cookies; // $cookies->add(new \yii\web\Cookie([ // 'name' => 'language', // 'value' => 'zh-CN', // ])); // // var_dump($cookies['language']->value); // $test = member::get_red_packet('15127281324'); // $test = member::get_rad_list('44'); // $test = member::get_user_red_packet('44'); // $test = member::draw_red_packet('44',time()); // //活动期间利率调整TODO // date_default_timezone_set('PRC'); // //活动开始时间 // $begin_time = strtotime('2015-9-24'); // $test = UcenterMember::find()->asArray()->all(); // 获取所有用户信息 // echo '<hr/>'; // foreach($users as $key => $value){ // var_dump($value['id']); // } // if($users){ // foreach($users as $key=>$value){ // $flag = Gold::find()->where(['uid' => $value['id'],'rid' => '3','money' =>'8150'])->one(); // if(!$flag){ // $rule = Rule::find()->where(['id' => '3', 'status' => Rule::STATUS_ACTIVE])->asArray()->one(); // //判断规则是否生效 // if ($rule['time']) { // $rul_money = $rule['money']; // $end_at = time() + $rule['time'] * 24 * 3600; // //增加体验金 // $gold = new Gold(); // $gold->uid = $value['id']; // $gold->rid = '3'; // $gold->money = $rul_money; // $gold->end_at = $end_at; // echo $gold = $gold->save(); // } // } // // } // } // $test = App\AloneMethod::send_msg_all(); // $test = Port::ValidatePhone2('15127281324','1'); // $test = Port::checkPhnoe('15127281324','118812'); // $test = ArrayHelper::map() // $test = Port::ValidatePhone2('15127281324','2','100'); // $prize_arr = array( // '0' => array('id'=>1,'prize'=>'5','v'=>1), // '1' => array('id'=>2,'prize'=>'4.5','v'=>5), // '2' => array('id'=>3,'prize'=>'4','v'=>10), // '3' => array('id'=>4,'prize'=>'3.5','v'=>20), // '4' => array('id'=>5,'prize'=>'3','v'=>30), // '5' => array('id'=>6,'prize'=>'2.5','v'=>40), // '6' => array('id'=>7,'prize'=>'2','v'=>50), // '7' => array('id'=>8,'prize'=>'1.5','v'=>60), // '8' => array('id'=>9,'prize'=>'1','v'=>70), // '9' => array('id'=>10,'prize'=>'0.5','v'=>100), // ); // //读取奖项设定 // $prize = array(); // $test = HoldActivity::find()->where(['id' => 7])->asArray()->one(); // $radearray = explode('/',$test['red_money_rang']); // if(count($radearray)){ // foreach($radearray as $key=>$value){ // $v1 = explode(',',$value); // if(count($v1)){ // $v2 = explode('-',$v1['0']); // $money = rand($v2['0']*100,$v2['1']*100)/100; // $prize[$key] = array('id' => $key+1,'prize' => $money,'v' => $v1['1']); // // } // } // } // $ridearray = explode(',',$test['rid_list']); // echo in_array('3',$ridearray); // $test = member::create_read_packet('15127281324',10,'11111'); // $test = App\Invest::goldtwo('94',10); // $test = member::get_user_red_packet('94'); //// // $test = AloneMethod::get_continue_money('44',100,15); // $test = AloneMethod::get_relation('96'); // $test = AloneMethod::produce_red_packet('96'); // $test = AloneMethod::send_red_packet('96'); // $test = AloneMethod::get_recommend_relation('96',1,4); // $test = AloneMethod::produce_recommend('103'); // $test = member::draw_red_packet('100',time()); // $test = member::get_user_red_packet('100'); // $test = member::get_deposit_num('66'); // $test = member::give_experience_gold(4,10); // $test = sinapay::immediate_withdraw(105,10); // $test = member::phoneIsRegister(15127281324); // $test = member::the_master_register('18518674990','w123456','344274','105'); // $test = App\AloneMethod::decrypt('15127281324'); // $test = sinapay::bankCardInfo('622600910075787620'); // $test = AloneMethod::produce_red_packet('106') // $test = App\Withdrawals::Redeem('105',1); // $test = member::get_rad_list('106'); // $test = sinapay::getUserInfo('106'); // $test = member::draw_red_packet('106', time()); // $test = 76.76; // $cur = 60.76; // $test = ($test * 100 - $cur*100)/100; // var_dump($test); // $cur = 16; // // var_dump($test * 100 - $cur*100); // $test = ($test * 100 - $cur*100)/100; // var_dump($test); // $test = Article::find()->where(['title' => '法律保障','status' => 1])->asArray()->one(); // $test = AloneMethod::get_recommend_relation('105'); // $test = App\Withdrawals::User_redeem('106',9.99); // $test = AloneMethod::get_category_article('安全保障'); // $test = member::get_rad_list('106'); ////短息接口 // $test = Port::ValidatePhone2('15127281324','1');//用户注册 // $test = Port::ValidatePhone2('18518674993','2',9999);//投资操作--慢 // $test = Port::ValidatePhone2('18518674993','3');//提现操作 // $test = Port::ValidatePhone2('18518674993','4');//重置密码 // $test = Port::ValidatePhone2('18518674993','5');//修改密码 // echo date('y-m-d:H-i-s'); // $test = AloneMethod::statistics(); // var_dump($test); // $money_sina = sprintf("%.2f",99.0012); // var_dump($money_sina); // $virtual = new VirtualProduct(); // $virtual->money = 1; // $virtual->name = '网'; // $virtual->pid = 1; // return $virtual->save(); // $testName = array( // '伟','芳','娜','敏','静','秀英','丽','强','磊','洋','艳','勇','军','杰','娟','涛','超','明','霞','秀兰','刚','平','燕','辉', // '玲','桂英','丹','萍','鹏','华','红','玉兰','飞','桂兰','英','梅','鑫','波','斌','莉','宇','浩','凯','秀珍','健','俊','帆', // '雪','帅','慧','旭','宁','婷','玉梅','龙','林','玉珍','凤英','晶','欢','玉英','颖','红梅','佳','倩','阳','建华','亮','成', // '琴','兰英','畅','建','云','洁','峰','建国','建军','柳','淑珍','春梅','海燕','晨','冬梅','秀荣','瑞','桂珍','莹','秀云','桂荣', // '志强','秀梅','丽娟','婷婷','玉华','兵','雷','东','琳','雪梅','淑兰','丽丽','玉','秀芳','欣','淑英','桂芳','博','丽华','丹丹', // '彬','桂香','坤','想','淑华','荣','秀华','桂芝','岩','杨','小红','金凤','文','利','楠','红霞','建平','瑜','桂花','璐','凤兰' // ); // $testphone = array( // 134, 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 182, 187, 188, // china mobile // 130, 131, 132, 145, 155, 156, 185, 186, 145, // china unicom // 133 , 153 , 180 , 181 , 189, // chinatelecom // ); // $chars = "0123456789"; // $str = ''; // for ($i = 0; $i < 4; $i++) { // $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); // } // $length = count($testphone); // $key = mt_rand(0,$length-1); // return $testphone[$key].'****'.$str; // $length = count($testName); // echo $length; // $key = rand(0,$length-1); // var_dump($testName[131]); // var_dump('20150902164057HQW130733198702201538'); // $test = App\Invest::product_list('4','1'); $test = member::the_promotion_register('15127281324', '12345t', '123456', '2'); var_dump($test); }
/** * 用户进行注册操作 * @return string */ public function actionSignup() { $post = Yii::$app->request->post(); //获取邀请码 $invite_code = $post['invite_code']; $actibity_source = $post['actibity_source']; //验证邀请码的正确性 $invite_info = member::get_invite_info($invite_code); if ($invite_info['errorNum']) { //邀请链接有问题 return json_encode($invite_info); } // 获取推荐人信息 $invite_phone = $invite_info['data']['invite_phone']; $invitation_id = $invite_info['data']['invitation_id']; //创建红包 member::create_read_packet($invite_phone, 10); //进行注册操作 $phone = $post['phone']; $pwd = $post['password']; $phone_code = $post['validate_code']; $request = member::activity_register($phone, $pwd, $phone_code, $invitation_id); if ($request['errorNum']) { //注册失败 return json_encode($request); } //更新红包 $red_packet = member::update_red_packet($invitation_id, $invite_phone, $phone, $actibity_source); return json_encode($red_packet); }