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')); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = product::find()->orderBy('id DESC'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $ucmember = new UcenterMember(); $user = new User(); $ocreditor = $ucmember->find()->andWhere(['username' => $this->ocreditor])->one(); $oid = $ocreditor ? $ocreditor->id : ''; $maxcreditor = $ucmember->find()->andWhere(['username' => $this->maxcreditor])->one(); $mid = $maxcreditor ? $maxcreditor->id : ''; $user = $user->find()->andWhere(['username' => $this->create_user_id])->one(); $uid = $user ? $user->id : ''; $query->andFilterWhere(['id' => $this->id, 'amount' => $this->amount, 'start_at' => $this->start_at, 'end_at' => $this->end_at, 'rate' => $this->rate, 'invest_people' => $this->invest_people, 'invest_sum' => $this->invest_sum, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'status' => $this->status, 'type' => $this->type, 'create_user_id' => $uid, 'check_user_id' => $this->check_user_id, 'ocreditor' => $oid, 'maxcreditor' => $mid]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'each_max', $this->each_max])->andFilterWhere(['like', 'each_min', $this->each_min]); return $dataProvider; }
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 static function Ucenter() { $model = UcenterMember::find()->where(['id' => Yii::$app->user->id])->one(); //个人账户 $model_asset = Info::find()->where(['member_id' => Yii::$app->user->id])->one(); $session = yii::$app->session; $session->open(); if (isset($session['last_time'])) { $updated_at = $session['last_time']; } else { $updated_at = $model->updated_at; } $balance = $model_asset->balance; $username = yii::$app->user->identity->username; return compact('updated_at', 'balance', 'username'); }
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')); }
private function memberList($startTime = 0, $endTime = 0) { $endTime = $endTime == 0 ? time() : $endTime; $users = UcenterMember::find()->select('id,username,phone,email,idcard,real_name,status,created_at,login_ip')->andWhere(['between', 'created_at', $startTime, $endTime])->asArray()->all(); foreach ($users as &$user) { $user['created_at'] = date('Y-m-d', $user['created_at']); switch ($user['status']) { case UcenterMember::STATUS_ACTIVE: $user['status'] = '注册'; break; case UcenterMember::STATUS_REAL: $user['status'] = '实名认证'; break; case UcenterMember::STATUS_BIND: $user['status'] = '绑定银行卡'; break; default: # code... break; } } return $users; }
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')); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = UcenterMember::find()->orderBy('id DESC'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $this->load($params); if (\App::$app->request->post()) { $time = \App::$app->request->post()['time']; if ($time) { $arr = explode('至', \App::$app->request->post()['time']); //var_dump($arr); // var_dump(strtotime($arr[0].' 00:00:00')); // var_dump(strtotime($arr[1].' 23:59:59')); $query->andWhere(['between', 'created_at', strtotime($arr[0] . ' 00:00:00'), strtotime($arr[1] . ' 23:59:59')]); } } if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'lock' => $this->lock, 'type' => $this->type, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'create_channel' => $this->create_channel, 'error_num' => $this->error_num, 'parent_member_id' => $this->parent_member_id, 'vip' => $this->vip]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'idcard', $this->idcard])->andFilterWhere(['like', 'real_name', $this->real_name])->andFilterWhere(['like', 'create_ip', $this->create_ip])->andFilterWhere(['like', 'create_area', $this->create_area])->andFilterWhere(['like', 'login_ip', $this->login_ip])->andFilterWhere(['like', 'login_area', $this->login_area]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\widgets\ActiveForm; use common\models\base\experience\Gold; $octor = \common\models\UcenterMember::find()->asArray()->all(); foreach ($octor as $k => $v) { $octor[$k]['newname'] = '(' . $v['real_name'] . ')' . $v['username']; } /* @var $this yii\web\View */ /* @var $model common\models\base\experience\Gold */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="gold-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'uid')->dropDownList(ArrayHelper::map($octor, 'id', 'newname')); ?> <?php echo $form->field($model, 'money')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', '派发') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
public static function Ucenter() { $model = UcenterMember::find()->where('id=' . Yii::$app->user->id)->one(); //个人账户 $model_asset = Info::find()->where('member_id=' . Yii::$app->user->id)->one(); $updated_at = $model->updated_at; $balance = $model_asset->balance; $username = yii::$app->user->identity->username; return compact('updated_at', 'balance', 'username'); }
public static function send_msg_all($templateid) { //获取所有用户信息 $users = UcenterMember::find()->asArray()->all(); if ($users) { //循环用户手机号 foreach ($users as $key => $value) { $log = new SendMsgAll(); $log->phone = $value['phone']; $log->templateid = $templateid; $log->status = ''; $log->save(); var_dump($value['phone']); } } }
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')); } }
<?php use yii\helpers\Html; use yii\helpers\Url; use common\models\base\experience\Rule; use common\models\UcenterMember; use yii\captcha\Captcha; /* @var $this yii\web\View */ $this->title = 'My Yii Application'; $upload = yii::$app->request->baseUrl . '/../../backend/web/upload/'; $user = UcenterMember::find()->where(['id' => $_GET['id']])->one(); ?> <span class="spanti-c2"></span> <section> <p><img class="d-block" width="100%" src="<?php echo Yii::getAlias('@web') . '/'; ?> rq-images/sign2-bg.jpg" alt="活琪王"></p> <div class="Invitat-top Invtiat2-top"> <p class="Invitat-tp1">您的好友<span><?php echo $user->username; ?> </span> 邀请您一起使用天天理财</p> <p class="Invitat-tp2">赚钱的好事要分享,独食难肥哟~</p> <form method="post" id="signupform" action="<?php echo yii\helpers\Url::to(['gold/gsignup']); ?> "> <span id="invitacode" class="spanti-flash"> <?php
/** * 获取用户注册手机号 * @param $uid * @return bool|mixed */ public static function getPhone($uid) { $user = UcenterMember::find()->where(['id' => $uid, 'lock' => UcenterMember::TYPE_UNLOCK])->asArray()->one(); if ($user) { return $user['phone']; } else { return false; } }
/** *Auther:langxi * *检测用户状态 银行卡手机号 真实姓名身份证号 及是否被锁定 * @param $member_id * @return bool * @throws ErrorException */ private static function checkMember($member_id) { if (!$member_id || !is_numeric($member_id) || !is_int($member_id)) { $result = array('errorNum' => '1', 'errorMsg' => '参数错误', 'data' => null); return $result; } $card = Info::find()->where(['member_id' => $member_id])->asArray()->one(); if (!$card) { $result = array('errorNum' => '1', 'errorMsg' => '此账户不存在1', 'data' => null); return $result; } else { if (empty($card['bank_card']) || empty($card['bank_card_phone'])) { $result = array('errorNum' => '1', 'errorMsg' => '未绑定银行卡及银行卡关联手机号', 'data' => null); return $result; } } $member = UcenterMember::find()->where(['id' => $member_id])->asArray()->one(); $real_name = $member['real_name']; $idcard = $member['idcard']; if (empty($real_name) || empty($idcard)) { $result = array('errorNum' => '1', 'errorMsg' => '未进行实名认证', 'data' => null); return $result; } $status = $member['lock']; if ($status != UcenterMember::TYPE_UNLOCK) { $result = array('errorNum' => '1', 'errorMsg' => '用户被锁定', 'data' => null); return $result; } return false; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function addsearch($params) { $user = User::find()->where(['id' => \App::$app->user->identity->getId()])->one(); if ($user->role == 'admin') { $query = Thirdproduct::find()->orderBy('id DESC'); } else { $query = Thirdproduct::find()->andWhere(['create_user_id' => Yii::$app->user->identity->getId()])->orderBy('id DESC'); } $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $ucmember = new UcenterMember(); $user = new User(); $creditor = $ucmember->find()->andWhere(['username' => $this->creditor])->one(); $maxcreditor = $ucmember->find()->andWhere(['username' => $this->maxcreditor])->one(); $user = $user->find()->andWhere(['username' => $this->create_user_id])->one(); $oid = $creditor ? $creditor->id : ''; $mid = $maxcreditor ? $maxcreditor->id : ''; $uid = $user ? $user->id : ''; $query->andFilterWhere(['id' => $this->id, 'amount' => $this->amount, 'start_at' => $this->start_at, 'end_at' => $this->end_at, 'rate' => $this->rate, 'invest_people' => $this->invest_people, 'invest_sum' => $this->invest_sum, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'status' => $this->status, 'create_user_id' => $uid, 'check_user_id' => $this->check_user_id, 'ocreditor' => $oid, 'maxcreditor' => $mid]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'source', $this->source])->andFilterWhere(['like', 'creditor', $this->creditor])->andFilterWhere(['like', 'contract', $this->contract])->andFilterWhere(['like', 'remarks', $this->remarks]); return $dataProvider; }
/** * Logs in a user using the provided username and password. * * @return boolean whether the user is logged in successfully */ public function login($username, $password) { $user = $this->_getUser($username); if ($user && $user->validatePassword($password)) { $model = UcenterMember::find()->where("username="******"username="******"用户已锁定,请联系管理员"; exit; } } //记录登录IP $this->_user->login_ip = Yii::$app->request->userIp; $this->_user->error_num = 0; if ($this->_user->save()) { $session = yii::$app->session; $session->open(); $session['last_time'] = $model->updated_at; echo "登陆成功"; if (Yii::$app->user->login($this->_getUser($username))) { $model_log = new Log(); $model_log->member_id = yii::$app->user->id; $model_log->login_ip = yii::$app->request->userIp; try { $model_log->login_area = self::get_area(yii::$app->request->userIp); } catch (ErrorException $e) { $model_log->login_area = '未知'; } $model_log->login_time = strtotime("now"); $model_log->status = 1; $model_log->save(false); } exit; } } elseif ($user) { $model = UcenterMember::find()->where("username="******"username="******"用户已锁定,请联系管理员"; exit; } else { $model->error_num += 1; $model->save(false); echo "密码输入错误(超过" . self::ERROR_NUM . "次后锁定)"; exit; } } } else { echo "此用户未注册"; exit; } }
/** * 推广大师进行注册操作 * @return string */ public function actionSignupofmaster() { $post = Yii::$app->request->post(); $userIp = Yii::$app->request->userIp; //获取邀请码 $invite_code = $post['invite_code']; //解析链接中的手机号 $invite_phone = \frontend\actions\App\AloneMethod::decrypt($invite_code); //判定手机号的合法性 $res = UcenterMember::find()->where(['phone' => $invite_phone, 'username' => $invite_phone])->asArray()->one(); if ($res == null) { $return = array('errorNum' => '1', 'errorMsg' => '活动链接来源不合法', 'data' => null); return json_encode($return); } // 获取推荐人信息 $invitation_id = $res['id']; //进行注册操作 $phone = $post['phone']; $pwd = $post['password']; $phone_code = $post['validate_code']; $request = member::the_master_register($phone, $pwd, $phone_code, $invitation_id, $userIp); return json_encode($request); }
public function actionDobindcard() { $uid = yii::$app->user->id; $model = UcenterMember::find()->where(['id' => $uid])->one(); if ($_POST) { if ($_POST['bankcard'] && $_POST['phone'] && $_POST['code'] && isset($_POST['ticket']) && isset($_POST['request_no'])) { $valid_code = $_POST['code']; $request_no = $_POST['request_no']; $ticket = $_POST['ticket']; $info = sinapay::bankCardAdvance($request_no, $ticket, $valid_code); if ($info['errorNum'] == 1) { return $this->goBack(['info' => $info['errorMsg'], 'model' => $model], Url::to(['bindcard'])); } return $this->view('member'); } else { return $this->goBack(['info' => '你没有输入完整', 'model' => $model], Url::to(['bindcard'])); } // $bandcard = $_POST['bankcard']; // $phone = $_POST['phone']; // $return = sinapay::bindingBankCard($uid,$bandcard,$phone); // if($return['errorNum']==1){ // return $this->goBack([ // 'info' => $return['errorMsg'], // 'model' => $model, // ], Url::to(['bindcard'])); // } // return $this->view('member'); } }
public function actionIndex() { error_reporting(0); //取出后台设置最大红包 $maxincome = Setting::getCode('maxincome'); //取出后台设置的每人最大红白 $maxpeople = Setting::getCode('maxpeople'); //后台设置体验金利率 $goldrate = Setting::getCode('goldrate'); //设定时区 date_default_timezone_set('PRC'); //取出当前时间 $btime = date('Y-m-d' . '00:00:00', time()); //转换成“开始”的时间戳 $btimestr = strtotime($btime); // //判定今日是否已经计算了收益---防止收益被多次计算 $count = Income::find()->where(['>', 'created_at', $btimestr])->count(); if ($count) { return '收益已经计算过了'; } //查询昨天以前所有的投资订单,查询order表 $order = Order::find()->select('member_id,sum(money) as smoney,product_id')->andWhere(['<', 'start_at', Utils::alldaytostr($btimestr)[1]])->andWhere(['status' => 1])->groupBy(['member_id', 'product_id'])->asArray()->all(); $arrnew = array(); //循环所有投资 // $test = 0; foreach ($order as $k => $v) { //查询订单下对应项目 $product = Product::findOne($v['product_id']); //查询昨天的生成的利息 $income = Income::find()->andWhere(['member_id' => $v['member_id']])->andWhere(['between', 'created_at', Utils::alldaytostr($btimestr)[0], Utils::alldaytostr($btimestr)[1]])->one(); //查询增值卡昨天信息 // $railscard = RaiseCard::find() // ->select('member_id,sum(rate) as srate') // ->andWhere(['member_id'=>$v['member_id']]) // ->andWhere(['<', 'use_at',Utils::alldaytostr($btimestr)[1]]) // ->andWhere(['>', 'use_end_time',Utils::alldaytostr($btimestr)[1]]) // ->andWhere(['status'=>RaiseCard::STATUS_USE]) // ->groupBy(['member_id']) // ->asArray() // ->one(); //昨日签到人数 $count = SignIn::find()->joinWith(['info' => function ($query) { /** @var \yii\db\ActiveQuery $query */ $query->andWhere(['>', 'asset_info.invest', '1000']); }])->andWhere(['between', 'sign_in.sign_in_time', Utils::alldaytostr($btimestr)[0], Utils::alldaytostr($btimestr)[1]])->asArray()->count(); //每人赠送利息,如果每人分的利息大于设置的每人获得的最大利息,就用设置的每人利息,如果小于就用分的利息 $everyincome = 0; if ($count) { $everyincome = $maxincome / $count > $maxpeople ? $maxpeople : $maxincome / $count; } //取出昨天这个人有没有签到 $rails = SignIn::find()->andWhere(['uid' => $v['member_id']])->andWhere(['between', 'sign_in_time', Utils::alldaytostr($btimestr)[0], Utils::alldaytostr($btimestr)[1]])->asArray()->one(); //判断订单是否有总金额 $smoney = isset($v['smoney']) ? $v['smoney'] : 0; //查询该用户体验金 // $all = Gold::find()->select('experience_gold.id,experience_gold.rid,sum(experience_gold.money) as gmoney')->andWhere(['uid'=>$v['member_id']])->joinWith(['rule' => function ($query) { // /** @var \yii\db\ActiveQuery $query */ // $query->andWhere(['experience_rule.status'=>Rule::STATUS_ACTIVE]); // }])->asArray()->all(); // // //查询发放给该用户体验金昨天信息 // $sendgold = RaiseCard::find() // ->select('member_id,sum(rate) as srate') // ->andWhere(['member_id'=>$v['member_id']]) // ->andWhere(['<', 'validity_start_at',Utils::alldaytostr($btimestr)[1]]) // ->andWhere(['>', 'validity_out_at',Utils::alldaytostr($btimestr)[1]]) // ->andWhere(['status'=>RaiseCard::STATUS_USE]) // ->asArray() // ->one(); //查询该用户体验金-----TODO $all = Gold::find()->select('uid,sum(money) as smoney')->andWhere(['uid' => $v['member_id'], 'status' => Gold::STATUS_ACTIVE])->andWhere(['<', 'created_at', time()])->andWhere(['>', 'end_at', time()])->asArray()->one(); // $summoney = 0; // foreach($all as $kmmy=>$vmmy){ // $newbetime = strtotime(date('Y-m-d'.' 00:00:00',time())); // $endtime = $vmmy['created_at'] + 3600 * 24 * $vmmy['time']; // if($vmmy['created_at']<$newbetime && $endtime>$newbetime){ // $summoney +=$all[$kmmy]['money']; // } // } // var_dump($summoney); // var_dump($all); //查询发放给该用户体验金昨天信息 // $sendgold = RaiseCard::find() // ->select('member_id,sum(rate) as srate') // ->andWhere(['member_id'=>$v['member_id']]) // ->andWhere(['<', 'validity_start_at',Utils::alldaytostr($btimestr)[1]]) // ->andWhere(['>', 'validity_out_at',Utils::alldaytostr($btimestr)[1]]) // ->groupBy(['member_id']) // ->asArray() // ->one(); //计算利率,增息卡的利率+项目的利率 // $railscardrate = isset($railscard)? $railscard['srate']+$product->rate/365:$product->rate/365; //TODO $railscardrate = isset($railscard) ? $railscard['srate'] + $product->rate : $product->rate; //活动期间利率调整TODO date_default_timezone_set('PRC'); //活动开始时间 $begin_time = strtotime('2015-10-1'); //活动结束时间 $end_time = strtotime('2015-10-7'); //当前时间 $now_time = time(); if ($now_time > $begin_time && $now_time < $end_time) { $railscardrate = '0.101'; } $railscardrate = '0.08'; //组成新数组,用户的id $arrnew[$v['member_id']]['member_id'] = $v['member_id']; //用户昨日利息,因利息也会产生利息,所以昨日利息乘以利率 // $arrnew[$v['member_id']]['smoney'] += isset($income)?($smoney+$income->smoney)*Utils::moneyFormat($railscardrate) :$smoney*Utils::moneyFormat($railscardrate); //投资总额---记录当前再投资金 $arrnew[$v['member_id']]['money'] += $v['smoney']; //计算收益--TODO $arrnew[$v['member_id']]['smoney'] += ceil($smoney * $railscardrate * 100 / 365) / 100; //取不包含红包体验金收益 $arrnew[$v['member_id']]['iincome'] += ceil($smoney * $railscardrate * 100 / 365) / 100; //用户的昨日之前的累计利息 // isset($income)? $arrnew[$v['member_id']]['newmoney'] = $arrnew[$v['member_id']]['smoney']+$income->newmoney : $arrnew[$v['member_id']]['newmoney'] += $smoney*Utils::moneyFormat($railscardrate); // TODO isset($income) ? $arrnew[$v['member_id']]['newmoney'] = $arrnew[$v['member_id']]['smoney'] + $income->newmoney : ($arrnew[$v['member_id']]['newmoney'] += ceil($smoney * $railscardrate * 100 / 365) / 100); //签到获取的利息 $arrnew[$v['member_id']]['railscard'] = $rails ? $everyincome : 0; //在投金额大于1元--计算体验金收益 if ($smoney >= 1) { //计算该用户体验金获取的利息 $arrnew[$v['member_id']]['goldincome'] = ceil($all['smoney'] * $railscardrate * 100 / 365) / 100; } //每人的利率 $arrnew[$v['member_id']]['rate'] = $railscardrate; } foreach ($arrnew as $k => &$v) { //求出每个用户的昨日利率 $v['rate'] = Utils::moneyFormat(($v['smoney'] + $v['railscard']) * 365 / $v['money']); //总利息加上签到获取的利息 $v['newmoney'] = $v['railscard'] + $v['newmoney'] + $v['goldincome']; //利息加上签到获取的利息 $v['smoney'] = $v['railscard'] + $v['smoney'] + $v['goldincome']; //利息计算时的投资--- // $v['money'] = $v['money'] + $v['goldincome'] + $v['railscard']; // -- 计算在投金额不应该增加利息产生的金额 $v['money'] = $v['money']; } //循环数组 foreach ($arrnew as $vs) { $_model = new Income(); //查出用户表的余额 $Info = Info::find()->where(['member_id' => $vs['member_id']])->one(); if ($Info) { $Info->profit = $Info->profit + $vs['smoney']; $Info->total_revenue = $Info->total_revenue + $vs['smoney']; $Info->save(); } //取出昨天这个人有没有签到 $signin = SignIn::find()->andWhere(['uid' => $vs['member_id']])->andWhere(['between', 'sign_in_time', Utils::alldaytostr($btimestr)[0], Utils::alldaytostr($btimestr)[1]])->one(); if ($signin && $vs['money'] >= 1000) { $signin->sign_in_money = $vs['railscard']; $signin->status = SignIn::STATUS_FINISH; $signin->save(); $_model->railscard = $vs['railscard']; } $_model->member_id = $vs['member_id']; $_model->smoney = $vs['smoney']; $_model->money = $vs['money']; $_model->rate = $vs['rate']; $_model->newmoney = $vs['newmoney']; $_model->goldincome = $vs['goldincome']; $_model->iincome = $vs['iincome']; //生成每日利息表的数据 $_model->save(); } //推荐大师活动 //获取所有用户信息 $users = UcenterMember::find()->select(['id'])->asArray()->all(); if ($users !== null) { //获取所有用户id值 foreach ($users as $key => $value) { //循环用户信息--判定其推荐人中是否有符合奖励规则的人--有进行推荐表中状态更改 AloneMethod::produce_red_packet($value['id']); } } //判定推荐表中用户是否符合拿取奖励规则 if ($users !== null) { foreach ($users as $key => $value) { AloneMethod::send_red_packet($value['id']); } } echo "成功"; }
<tr> <th>ID</th> <th>用户名 </th> <th>项目</th> <th>金额</th> <th>购买时间</th> </tr> </thead> <tbody> <?php foreach ($model as $item) { ?> <?php $product = Product::find()->where(['id' => $item['product_id']])->asArray()->one(); $member = UcenterMember::find()->where(['id' => $item['member_id']])->asArray()->one(); ?> <tr data-key="1"> <td><?php echo $item['id']; ?> </td> <td><?php echo $member['username']; ?> </td> <td><?php echo $product['title']; ?> </td> <td><?php
private static function datas() { $uid = yii::$app->user->id; $model = UcenterMember::find()->where(['id' => Yii::$app->user->id])->one(); //个人账户 $model_asset = Info::find()->where(['member_id' => Yii::$app->user->id])->one(); if (!isset($model_asset)) { //跳转至绑定银行卡 echo "<script>alert('您还没有绑定银行卡');</script>"; echo "<script>location.href='" . \yii\helpers\Url::to(['money/bindcard']) . "'</script>"; exit; } //收益总额 $income_total = $model_asset->total_revenue; //当前收益 $income_current = $model_asset->profit; //昨日收益 try { $income_yesterday = Income::find()->where(['member_id' => yii::$app->user->id, 'created_at' => strtotime(date('Y-m-d', time()))])->one()->smoney; } catch (ErrorException $e) { $income_yesterday = 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); } //投资总额 $invest_total = 0; $model_order = Order::find()->where(['member_id' => Yii::$app->user->id, 'status' => 1])->all(); if (count($model_order) > 0) { foreach ($model_order as $K => $V) { $invest_total += $V->money; } } //用户投资记录 $query1 = (new Query())->select("A.step,A.create_at,B.title")->from("asset_log AS A")->where('A.member_id=' . Yii::$app->user->id . " AND A.action='Invest/invest' AND A.status=2 ")->join("left join", "fund_product AS B", "A.product_id=B.id")->orderBy("A.id DESC"); $pages = new Pagination(['totalCount' => $query1->count(), 'pageSize' => '10']); $array_investlog = $query1->offset($pages->offset)->limit($pages->limit)->all(); $pages_offset = $pages->offset; //用户交易记录 $query2 = Log::find()->where(['member_id' => Yii::$app->user->id, 'status' => [1, 2, 3, 4]]); $pages_trade = new Pagination(['totalCount' => $query2->count(), 'pageSize' => '2']); $array_tradelog = $query2->offset($pages_trade->offset)->limit($pages_trade->limit)->orderBy("id DESC")->all(); $pages_trade_offset = $pages_trade->offset; //当前投资记录 $query3 = (new Query())->select("A.step,A.create_at,B.title")->from("asset_log AS A")->where('A.member_id=' . Yii::$app->user->id . " AND A.action='Invest/invest' AND A.status=2 ")->join("left join", "fund_product AS B", "A.product_id=B.id")->limit(4)->orderBy("A.id DESC")->createCommand(); $invest_log = $query3->queryAll(); //数据包变量 $amount_total = $model_asset->balance + $invest_total + $income_current; $session = yii::$app->session; $session->open(); if (isset($session['last_time'])) { $updated_at = $session['last_time']; } else { $updated_at = $model->updated_at; } $phone = $model->phone; $balance = $model_asset->balance; $freeze = $model_asset->freeze; return $infos_rar = compact("invest_total", "income_total", "amount_total", "updated_at", "phone", "balance", "freeze", "invest_log", "array_investlog", "array_tradelog", "pages", "pages_trade", "pages_offset", "pages_trade_offset", "income_current", "income_yesterday", "experience_money"); }
public function actionSetting() { $uid = Yii::$app->user->id; $user = UcenterMember::find()->andWhere(['id' => $uid])->one(); return $this->view('setting', compact('user')); }
/** * 获取用户的详细信息--认证信息--账户信息 * @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; }
use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model common\models\base\cms\Feedback */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="feedback-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'uid')->dropDownList(ArrayHelper::map(\common\models\UcenterMember::find()->asArray()->all(), 'id', 'username')); ?> <?php echo $form->field($model, 'feedback')->textarea(['rows' => 6]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php
/** *Auther:langxi * *检测用户状态 银行卡手机号 真实姓名身份证号 及是否被锁定 * @param $member_id * @return bool * @throws ErrorException */ private static function checkMember($member_id) { $member_id = (int) $member_id; if (!is_numeric($member_id)) { $result = '参数错误'; return $result; } $card = Info::find()->where(['member_id' => $member_id])->asArray()->one(); if (!$card) { $result = '此账户不存在'; return $result; } else { if (empty($card['bank_card']) || empty($card['bank_card_phone'])) { $result = '银行卡或银行卡对应手机号不存在'; return $result; } } $member = UcenterMember::find()->where(['id' => $member_id])->asArray()->one(); if (!$member) { $result = '用户不存在'; return $result; } $real_name = $member['real_name']; $idcard = $member['idcard']; if (empty($real_name) || empty($idcard)) { $result = '真实姓名或身份证号不存在'; return $result; } $status = $member['lock']; if ($status != UcenterMember::TYPE_UNLOCK) { $result = '用户被锁定'; return $result; } return false; }
?> </option> <?php } ?> </select> <div class="help-block"></div> </div> <?php echo $form->field($model, 'ocreditor', ['options' => ['style' => 'display:block;', 'id' => 'ocreditor']])->dropDownList(ArrayHelper::map(\common\models\UcenterMember::find()->andWhere(['type' => \common\models\UcenterMember::CUS_CRE])->asArray()->all(), 'id', 'username')); ?> <?php echo $form->field($model, 'maxcreditor', ['options' => ['style' => 'display:block;', 'id' => 'maxcreditor']])->dropDownList(ArrayHelper::map(\common\models\UcenterMember::find()->andWhere(['type' => \common\models\UcenterMember::CUS_MAXCRE])->asArray()->all(), 'id', 'username')); ?> <?php echo $form->field($model, 'intro')->textarea(['rows' => 6]); ?> <div class="form-group field-thirdproduct-start_at required" style="width: 300px"> <label class="control-label" for="thirdproduct-amount">起始时间</label> <?php echo DateTimePicker::widget(['model' => $model, 'attribute' => 'start_at', 'language' => 'zh-CN', 'size' => 'ms', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd HH:ii ', 'todayBtn' => true]]); ?> </div> <div class="form-group field-thirdproduct-start_at required" style="width: 300px"> <label class="control-label" for="thirdproduct-amount">结束时间</label> <?php
/** * 获取用户活动红包列表---双向红包列表记录 * @param $uid * @param int $page_no * @param int $page_size * @return array|\common\models\base\activity\ActivityLog[] */ public static function get_rad_list($uid, $page_no = 1, $page_size = 20) { //获取用户注册手机号 $info = UcenterMember::find()->where(['id' => $uid])->asArray()->one(); $phone = ''; if ($info !== null) { $phone = $info['phone']; } $num = ($page_no - 1) * $page_size; //获取是分享得到的红包 $list = ActivityLog::find()->select(['phone', 'invite_phone', 'red_packet', 'actibity_source', 'update_at', 'inviter_draw', 'invitee_draw'])->where(['invite_id' => $uid, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_TO_INVITER])->orWhere(['phone' => $phone, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_YES])->orWhere(['invite_phone' => $phone, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_YES])->orderBy('update_at desc')->limit($page_size)->offset($num)->asArray()->all(); $red_packet_count = ActivityLog::find()->where(['invite_id' => $uid, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_TO_INVITER])->orWhere(['phone' => $phone, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_YES])->orWhere(['invite_phone' => $phone, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_YES])->count(); if ($list) { $red_packet_sum = ActivityLog::find()->where(['invite_id' => $uid, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_TO_INVITER])->orWhere(['phone' => $phone, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_YES])->orWhere(['invite_phone' => $phone, 'status' => ActivityLog::STATUS_SUCCESS, 'type' => ActivityLog::RED_BOTHWAY_YES])->sum('red_packet'); $red_packet_sum = $red_packet_sum ? $red_packet_sum : 0; foreach ($list as $key => $value) { if ($value['invite_phone'] == $phone) { //邀请其他用户获得的奖励 $list[$key]['type'] = 1; $list[$key]['phone'] = $value['phone']; unset($list[$key]['invite_phone']); } else { //被邀请获得的奖励 $list[$key]['type'] = 2; $list[$key]['phone'] = $value['invite_phone']; unset($list[$key]['invite_phone']); } } $data = array('sum' => $red_packet_sum, 'count' => $red_packet_count, 'list' => $list); $return = array('errorNum' => 0, 'errorMsg' => 'success', 'data' => $data); return $return; } elseif (!$list && $red_packet_count) { $return = array('errorNum' => 1, 'errorMsg' => '没有更多的记录', 'data' => null); return $return; } else { $return = array('errorNum' => 1, 'errorMsg' => '暂无记录', 'data' => null); return $return; } }