示例#1
0
 /**
  * 用户首次支付
  * @param $uid 用户id
  * @param $card_no 银行卡号
  * @param $money 充值金额
  */
 public static function confirmation($uid, $card_no, $money)
 {
     $flag = member::isAuthentic($uid);
     if ($flag) {
         $id_cardno = $flag['idcard'];
         $real_name = $flag['real_name'];
         //TODO 获取银行卡信息
         $bank_code = '01050000';
         //用户标识
         $flag = payLL::find()->where(['status' => self::SUCCESS, 'uid' => $uid])->orderBy('create_at desc')->one();
         if ($flag) {
             $user_id = $flag['user_id'];
         } else {
             $user_id = self::verification($uid);
         }
         //商户业务类型
         $busi_partne = '101001';
         //商户唯一订单号
         $no_order = self::verification($card_no);
         $name_goods = "充值";
         $money_order = $money;
         $notify_url = 'http://www.lianlianpay.com/notify_url.html';
         $id_no = $id_cardno;
         $acct_name = $real_name;
         $card_no = $card_no;
         //写入数据库记录
         $pay = new payLL();
         $pay->uid = $uid;
         $pay->idcard = $id_cardno;
         $pay->real_name = $real_name;
         $pay->user_id = $user_id;
         $pay->busi_partne = $busi_partne;
         $pay->no_order = $no_order;
         $pay->name_goods = $name_goods;
         $pay->money_order = $money;
         $pay->card_no = $card_no;
         $pay->from_ip = Yii::$app->request->userIp;
         $pay->status = self::CONFIRM;
         $res = $pay->save();
         if ($res) {
             $lianlian = new lianlianClass();
             $res = $lianlian->confirmation($user_id, $busi_partne, $no_order, $name_goods, $money_order, $notify_url, $id_no, $acct_name, $card_no, $bank_code);
             return $res;
         }
     } else {
         return "先实名认证";
     }
 }
 public function actionInvitation()
 {
     if (\yii::$app->user->isGuest) {
         $this->redirect(['site/login']);
     }
     $model = UcenterMember::find()->where('id=' . Yii::$app->user->id)->one();
     $uid = yii::$app->user->id;
     $invitation_code = UcenterMember::findIdentity($uid)->invitation_code;
     //被邀请记录(分页)
     $query = member::getInvite($uid);
     $pages = new Pagination(['totalCount' => $query->count(), 'pageSize' => 4]);
     $invitation_log = $query->offset($pages->offset)->limit($pages->limit)->orderBy('id DESC')->all();
     $infos_rar = $this->Ucenter();
     //用户数据包
     return $this->render('invitation', compact("infos_rar", "invitation_code", "model", "invitation_log", "pages"));
 }
示例#3
0
 public function actionSendcode()
 {
     if (!isset($_POST['CellPhone'])) {
         echo '请输入手机号。';
         exit;
     }
     try {
         $phone = $_POST['CellPhone'];
         $is_register = member::phoneIsRegister($phone);
         if ($is_register) {
             echo '此手机号已注册,请直接登录';
             exit;
         }
         $result = Port::ValidatePhone($phone);
         if ($result) {
             echo '验证码已发送,请注意查收。';
             exit;
         }
     } catch (ErrorException $ex) {
         echo $ex->getMessage();
         exit;
     }
 }
示例#4
0
 /**
  * 用户充值行为
  * @param $uid 用户id
  * @param $money 用户金额
  * @return bool
  * @throws ErrorException
  */
 public static function setBalance($uid, $money)
 {
     //判断用户是否存在,用户状态TODO(是否锁定)
     //用户实名
     $res = member::isAuthentic($uid);
     if ($res) {
         //用户是否绑卡
         $isBinding = Balance::isBinding($uid);
         if ($isBinding) {
             ////充值金额限定判断--最小充值额度,最大充值额度,单人每次充值限额
             ////易宝充值是按-----分计算
             $money = $money * 100;
             $yeepay = yeepay::payment($uid, $money);
             if ($yeepay) {
                 return $yeepay;
             } else {
                 throw new ErrorException('充值接口失败');
             }
         } else {
             throw new ErrorException('请先绑定银行卡');
         }
     } else {
         throw new ErrorException('请先实名认证');
     }
 }
示例#5
0
 public function actionSetting()
 {
     if (\yii::$app->user->isGuest) {
         $this->redirect(['site/login']);
     }
     $uid = yii::$app->user->id;
     $is_Authentic = member::isAuthentic($uid);
     $model = UcenterMember::find()->where("id=" . $uid)->one();
     //修改密码
     if (isset($_POST['prepassword']) && isset($_POST['newpassword']) && isset($_POST['repeatpassword'])) {
         $_model = UcenterMember::findIdentity($uid);
         if (!yii::$app->security->validatePassword($_POST['prepassword'], $_model->password_hash)) {
             echo '原始密码错误';
             exit;
         } elseif ($_POST['newpassword'] == $_POST['repeatpassword']) {
             $_model->password_hash = Yii::$app->security->generatePasswordHash($_POST['newpassword']);
             $app_pwd = md5(sha1($_POST['newpassword']) . time());
             $_model->app_pwd = $app_pwd;
             $_model->save(false);
             echo '密码修改成功';
             exit;
         } else {
             echo '两次密码不一致';
             exit;
         }
     }
     //实名验证
     if (isset($_POST['realname']) && isset($_POST['idcard'])) {
         $realname = $_POST['realname'];
         $idcard = $_POST['idcard'];
         try {
             $idcard_result = Port::baiduIdentity($idcard);
             if (!$idcard) {
                 echo '身份认号不匹配,请核对后重新输入';
                 exit;
             }
         } catch (ErrorException $e) {
             echo '认证失败';
             exit;
         }
         try {
             $result = member::authentication($uid, $realname, $idcard);
             if (is_bool($result)) {
                 echo '身份认证成功';
                 exit;
             }
         } catch (ErrorException $e) {
             echo $e->getMessage();
             exit;
         }
     }
     //设置头像
     if (isset($_POST['UcenterMember']['person_face'])) {
         $model->person_face = UploadedFile::getInstance($model, 'person_face');
         if ($model->person_face) {
             if ($model->validate()) {
                 $Name = mt_rand(1100, 9900) . time() . '.' . $model->person_face->extension;
                 $model->person_face->saveAs('../web/upload/' . $Name);
                 //保存头像名到数据表
                 $model->person_face = $Name;
                 if ($model->save(false)) {
                     echo '<script>alert("头像修改完成~");</script>';
                 }
             }
         }
     }
     $infos_rar = $this->Ucenter();
     //用户数据包
     return $this->render('setting', compact("infos_rar", "model", "model_password", "is_Authentic"));
 }
示例#6
0
 /**
  * 用户充值行为
  * @param $uid 用户id
  * @param $money 用户金额
  * @return bool
  * @throws ErrorException
  */
 public static function setBalance($uid, $money)
 {
     //判断用户是否存在,用户状态TODO(是否锁定)
     //用户实名
     $res = member::isAuthentic($uid);
     if ($res) {
         //用户是否绑卡
         $isBinding = Balance::isBinding($uid);
         if ($isBinding) {
             ////易宝充值是按-----分计算
             $money = $money * 100;
             ////充值金额限定判断--最小充值额度,最大充值额度,单人每次充值限额
             $yeepay = yeepay::payment($uid, $money);
             if (!$yeepay['errorNum']) {
                 $data = $yeepay['data'];
                 $return = array('errorNum' => '0', 'errorMsg' => 'success', 'data' => $data);
                 return $return;
             } else {
                 $return = array('errorNum' => '1', 'errorMsg' => $yeepay['errorMsg'], 'data' => null);
                 return $return;
             }
         } else {
             $return = array('errorNum' => '1', 'errorMsg' => '请先绑定银行卡', 'data' => null);
             return $return;
         }
     } else {
         $return = array('errorNum' => '1', 'errorMsg' => '请先实名认证', 'data' => null);
         return $return;
     }
 }
示例#7
0
 public function actionBindcard()
 {
     $model = UcenterMember::find()->where('id=' . Yii::$app->user->id)->one();
     $uid = yii::$app->user->id;
     $is_bind = sinapay::isBinding($uid);
     if ($is_bind['errorNum'] == 0) {
         $result_bind = $is_bind['data'];
         $logo_bind = self::BankInfos();
     }
     $result = member::isAuthentic($uid);
     //接收验证码后进行银行卡绑定
     try {
         if (isset($_POST['bankcard']) && isset($_POST['idcard']) && isset($_POST['username']) && isset($_POST['phone']) && isset($_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'] == 0) {
                 //领取体验金
                 $rid = Rule::find()->where(['title' => '绑定银行卡', 'status' => 1])->one()->id;
                 $r_money = Rule::find()->where(['title' => '绑定银行卡', 'status' => 1])->one()->money;
                 $model_gold = new Gold();
                 $model_gold->rid = $rid;
                 $model_gold->money = $r_money;
                 $model_gold->uid = yii::$app->user->id;
                 $model_gold->created_at = strtotime("now");
                 $model_gold->save();
                 echo "绑卡成功";
                 exit;
             } elseif ($info['errorNum'] != 0) {
                 echo $info['errorMsg'];
                 exit;
             }
         }
     } catch (ErrorException $e) {
         echo $e->getMessage();
         exit;
     }
     //发送验证码和请求ID
     try {
         if (isset($_POST['bankcard']) && isset($_POST['idcard']) && isset($_POST['username']) && isset($_POST['phone'])) {
             $cardno = $_POST['bankcard'];
             $idcardno = $_POST['idcard'];
             $username = $_POST['username'];
             $phone = $_POST['phone'];
             try {
                 $info = sinapay::bindingBankCard($uid, $cardno, $phone);
                 echo json_encode($info);
                 exit;
             } catch (ErrorException $e) {
                 echo $e->getMessage();
                 exit;
             }
         }
     } catch (ErrorException $e) {
         echo $e->getMessage();
         exit;
     }
     if (isset($_POST['bankcard']) && isset($_POST['phone'])) {
         $cardno = $_POST['bankcard'];
         $phone = $_POST['phone'];
         $info = Balance::bindbankcard2($uid, $cardno, $phone);
         if ($info) {
             echo '绑卡成功';
             exit;
         }
     }
     $infos_rar = $this->Ucenter();
     //用户数据包
     return $this->render('bindcard', compact("infos_rar", "result", "result_bind", "model", "logo_bind"));
 }