public function actionExport()
 {
     $time = \App::$app->request->post()['time'];
     $arr[0] = 0;
     $arr[1] = 0;
     if ($time) {
         $arr = explode('至', \App::$app->request->post()['time']);
         $arr[0] = strtotime($arr[0] . ' 00:00:00');
         $arr[1] = strtotime($arr[1] . ' 23:59:59');
     }
     $users = $this->memberList($arr[0], $arr[1]);
     Utils::exportExcel($users, ['ID', '用户名', '电话', '邮箱', '身份证', '真实姓名', '状态', '注册时间', '登陆IP'], '用户信息' . date('Y.m.d'));
 }
Example #2
0
 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'));
 }
Example #3
0
 public function actionLogout()
 {
     Utils::ensureOpenId();
     $request = Yii::$app->request;
     if ($request->isPost) {
         if (($model = UcenterMember::findOne(['openid' => $request->post('open_id')])) !== null) {
             /** @var MemberOther $model */
             $model->openid = '';
             $model->save();
         }
         Yii::$app->user->logout();
         return $this->goBack(['info' => "解绑成功"], Url::to(['site/signin']));
     }
     return $this->view('logout');
 }
Example #4
0
 /**
  * Updates an existing Card model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(\App::$app->request->post())) {
         $model->rate = \App::$app->request->post()['Card']['rate'] * 0.01;
         $model->use_start_at = strtotime(\App::$app->request->post()['Card']['use_start_at']);
         $model->use_out_at = strtotime(\App::$app->request->post()['Card']['use_out_at']);
         $model->validity_time = Utils::count_days($model->use_start_at, $model->use_out_at);
         $model->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         $model['rate'] = $model['rate'] * 100;
         $model['use_start_at'] = date("Y-m-d H:i", $model['use_start_at']);
         $model['use_out_at'] = date("Y-m-d H:i", $model['use_out_at']);
         return $this->render('update', ['model' => $model]);
     }
 }
Example #5
0
 public function actionGindex()
 {
     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']);
     }
     $uid = yii::$app->user->id;
     $gold = Gold::find()->select('uid,sum(money) as smoney')->where(['uid' => $uid])->asArray()->one();
     $allgold = Gold::find()->select('uid,rid,sum(money) as smoney')->where(['uid' => $uid])->asArray()->groupBy('rid')->all();
     $invitation_code = UcenterMember::findIdentity($uid)->invitation_code;
     $goldincome = Income::find()->select('member_id,sum(goldincome) as sincome')->where(['member_id' => $uid])->asArray()->one();
     $jssdk = new Jssdk('wx32814d588c44c17c', '23b0f218574551f18db1dc991dbee87f');
     $signpack = $jssdk->getSignPackage();
     return $this->view('gindex', compact('gold', 'allgold', 'goldincome', 'invitation_code', 'signpack'));
 }
Example #6
0
 public function actionAjaxdata()
 {
     $betime = strtotime(date('Y-m-d' . ' 00:00:00', time()));
     $endtime = strtotime(date('Y-m-d' . ' 23:59:59', time()));
     $now = strftime('%Y-%m-%d', time());
     list($wstart, $wend) = Utils::lastNWeek(time(), 1);
     list($mstart, $mend) = Utils::lastMonth(time());
     list($qstart, $qend) = Utils::lastQuarter(time());
     $beginThismonth = mktime(0, 0, 0, date('m'), 1, date('Y'));
     $endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y'));
     $today = [];
     $week = [];
     $month = [];
     $quart = [];
     $payment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', $betime, $endtime])->asArray()->one();
     $withdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', $betime, $endtime])->asArray()->one();
     $wpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', strtotime($wstart), strtotime($wend)])->asArray()->one();
     $wwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', strtotime($wstart), strtotime($wend)])->asArray()->one();
     $mpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', strtotime($mstart), strtotime($mend)])->asArray()->one();
     $mwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', strtotime($mstart), strtotime($mend)])->asArray()->one();
     $qpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', strtotime($qstart), strtotime($qend)])->asArray()->one();
     $qwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', strtotime($qstart), strtotime($qend)])->asArray()->one();
     $benpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', $beginThismonth, $endThismonth])->asArray()->one();
     $benwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', $beginThismonth, $endThismonth])->asArray()->one();
     $oldpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->asArray()->one();
     $oldwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->asArray()->one();
     $today = '今日提现' . ($withdraw['smoney'] ? $withdraw['smoney'] : '0') . '充值' . ($payment['smoney'] ? $payment['smoney'] : "0");
     $week = '上周提现' . ($wwithdraw['smoney'] ? $wwithdraw['smoney'] : '0') . '充值' . ($wpayment['smoney'] ? $wpayment['smoney'] : '0');
     $benmonth = '本月提现' . ($benwithdraw['smoney'] ? $benwithdraw['smoney'] : '0') . '充值' . ($benpayment['smoney'] ? $benpayment['smoney'] : "0");
     $month = '上月提现' . ($mwithdraw['smoney'] ? $mwithdraw['smoney'] : '0') . '充值' . ($mpayment['smoney'] ? $mpayment['smoney'] : "0");
     $quart = '上个季度提现' . ($qwithdraw['smoney'] ? $qwithdraw['smoney'] : '0') . '充值' . ($qpayment['smoney'] ? $qpayment['smoney'] : '0');
     $oldtotal = '总提现' . ($oldwithdraw['smoney'] ? $oldwithdraw['smoney'] : '0') . '充值' . ($oldpayment['smoney'] ? $oldpayment['smoney'] : '0');
     echo $today . ',' . $week . ',' . $benmonth . ',' . $month . ',' . $quart . ',' . $oldtotal;
 }
Example #7
0
 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 '修改成功';
         }
     }
 }
Example #8
0
 public function actionSignup()
 {
     //判断注册URL中是否包含邀请码参数
     if (isset($_GET['code'])) {
         $code = $_GET['code'];
         //$_code_source = UcenterMember::find()->where(['invitation_code'=>$code])->one();
         //if(count($_code_source) != 1)
         $flag = \frontend\actions\app\member::verify_code($code);
         if (!$flag) {
             header("Content-type: text/html; charset=utf-8");
             echo "<script>alert('来源链接不合法!')</script>";
             echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/signup']) . "'</script>";
             exit;
         }
     }
     $model = new SignupForm();
     //是否邀请注册
     $test_invite = 1;
     if ($model->load(Yii::$app->request->post())) {
         if ($_POST['SignupForm']['username'] && $_POST['SignupForm']['validate_code'] && $_POST['SignupForm']['password'] && $_POST['SignupForm']['password_repeat']) {
             $invite_code = $_POST["SignupForm"]['invitation_code'];
             //使用测试邀请码
             if ($test_invite) {
                 //使用测试邀请
                 $flag = \frontend\actions\app\member::verify_code($invite_code);
                 //验证码通过
                 if (!$flag) {
                     echo "<script>alert('" . '邀请码错误' . "')</script>";
                 }
             }
             $_phone = $_POST['SignupForm']['username'];
             $_code = $_POST['SignupForm']['validate_code'];
             try {
                 $result = Port::checkPhnoe($_phone, $_code);
                 if (is_bool($result)) {
                 }
             } catch (ErrorException $e) {
                 header("Content-type: text/html; charset=utf-8");
                 echo "<script>alert('" . $e->getMessage() . "')</script>";
                 echo "<script>location.href='" . \yii\helpers\Url::to(['site/signup']) . "'</script>";
                 exit;
             }
             $user = new UcenterMember();
             $user->username = $_POST["SignupForm"]['username'];
             $user->phone = $_POST["SignupForm"]['username'];
             $user->invitation_code = $_POST["SignupForm"]['invitation_code'];
             $password = $_POST["SignupForm"]['password'];
             $user->setPassword($password);
             $user->create_ip = Yii::$app->request->userIp;
             $app_pwd = md5(sha1($password) . time());
             $user->app_pwd = $app_pwd;
             try {
                 $area = self::get_area(Yii::$app->request->userIp);
                 $user->create_area = $area;
             } catch (ErrorException $e) {
             }
             $user->generateAuthKey();
             if ($user->save()) {
                 $uid = $user['id'];
                 if ($test_invite) {
                     //使用验证码
                     $flag = \frontend\actions\app\member::verify_code($invite_code);
                     $invite_flag = \frontend\actions\app\member::use_code($flag, $uid);
                     if (!$invite_flag) {
                         $return = array('errorNum' => '1', 'errorMsg' => '注册失败', 'data' => null);
                         return $return;
                     }
                 }
                 if (Yii::$app->getUser()->login($user)) {
                     $newModel = UcenterMember::find()->where(['id' => Yii::$app->user->id])->one();
                     //$newModel->invitation_id= \yii::$app->params['invitation_id'];
                     $invitation_code = Utils::createcode();
                     $newModel->invitation_code = $invitation_code;
                     $newModel->person_face = Setting::find()->where("code='img'")->one()->value;
                     if ($_POST['url_code']) {
                         $code_source = UcenterMember::find()->where(['invitation_code' => $_POST["url_code"]])->asArray()->one();
                         if ($code_source) {
                             $newModel->invitation_id = $code_source['id'];
                         }
                         //好友注册领取体验金
                         $rule = Rule::find()->where(['title' => '好友注册', 'status' => Rule::STATUS_ACTIVE])->one();
                         if ($rule) {
                             $rid = $rule->id;
                             $r_money = $rule->money;
                             $model_gold = new Gold();
                             $model_gold->rid = $rid;
                             $model_gold->money = $r_money;
                             $model_gold->uid = $code_source['id'];
                             $model_gold->created_at = strtotime("now");
                             $model_gold->save();
                         }
                     } elseif ($_POST['SignupForm']['invitation_code']) {
                         $code_source = UcenterMember::find()->where(['invitation_code' => $_POST["SignupForm"]["invitation_code"]])->asArray()->one();
                         if ($code_source) {
                             $newModel->invitation_id = $code_source['id'];
                         }
                         //好友注册领取体验金
                         $rule = Rule::find()->where(['title' => '好友注册', 'status' => Rule::STATUS_ACTIVE])->one();
                         if ($rule) {
                             $rid = $rule->id;
                             $r_money = $rule->money;
                             $model_gold = new Gold();
                             $model_gold->rid = $rid;
                             $model_gold->money = $r_money;
                             $model_gold->uid = $code_source['id'];
                             $model_gold->created_at = strtotime("now");
                             $model_gold->save();
                         }
                     }
                     $newModel->save(false);
                     $model_asset_info = new Info();
                     $model_asset_info->member_id = yii::$app->user->id;
                     $model_asset_info->create_at = strtotime("now");
                     $model_asset_info->save(false);
                     //手机号注册领取体验金
                     $rule = Rule::find()->where(['title' => '手机号注册', 'status' => Rule::STATUS_ACTIVE])->one();
                     if ($rule) {
                         $rid = $rule->id;
                         $r_money = $rule->money;
                         $model_gold = new Gold();
                         $model_gold->rid = $rid;
                         $model_gold->money = $r_money;
                         $model_gold->uid = $code_source['id'];
                         $model_gold->created_at = strtotime("now");
                         $model_gold->save();
                     }
                     return $this->goHome();
                 }
             }
         }
     }
     return $this->render('signup', compact("model", "code"));
 }
Example #9
0
 public function actionLogout()
 {
     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 $this->redirect(['site/main']);
 }
Example #10
0
 public function actionSend()
 {
     try {
         Utils::sendEmail('*****@*****.**', '统计发送', '123');
     } catch (\Exception $e) {
         throw new ErrorException($e);
     }
 }
Example #11
0
 /**
  * 获取用户信息
  */
 public static function statistics()
 {
     $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'));
     }
 }
Example #12
0
 public function actionExport()
 {
     $time = \App::$app->request->post()['time'];
     $arr[0] = 0;
     $arr[1] = 0;
     if ($time) {
         $arr = explode('至', \App::$app->request->post()['time']);
         $arr[0] = strtotime($arr[0] . ' 00:00:00');
         $arr[1] = strtotime($arr[1] . ' 23:59:59');
     }
     $logs = $this->logList($arr[0], $arr[1]);
     Utils::exportExcel($logs, ['ID', '金额', '状态', '银行卡', '创建时间', '用户名'], '资金记录导出' . date('Y.m.d'));
 }