Example #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 "先实名认证";
     }
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = payLL::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;
     }
     $query->andFilterWhere(['id' => $this->id, 'uid' => $this->uid, 'status' => $this->status, 'create_at' => $this->create_at, 'update_at' => $this->update_at]);
     $query->andFilterWhere(['like', 'idcard', $this->idcard])->andFilterWhere(['like', 'real_name', $this->real_name])->andFilterWhere(['like', 'user_id', $this->user_id])->andFilterWhere(['like', 'busi_partne', $this->busi_partne])->andFilterWhere(['like', 'no_order', $this->no_order])->andFilterWhere(['like', 'name_goods', $this->name_goods])->andFilterWhere(['like', 'money_order', $this->money_order])->andFilterWhere(['like', 'card_no', $this->card_no])->andFilterWhere(['like', 'from_ip', $this->from_ip])->andFilterWhere(['like', 'bank_code', $this->bank_code])->andFilterWhere(['like', 'remark', $this->remark])->andFilterWhere(['like', 'sign_type', $this->sign_type])->andFilterWhere(['like', 'sign', $this->sign])->andFilterWhere(['like', 'oid_paybill', $this->oid_paybill])->andFilterWhere(['like', 'money_lianlian', $this->money_lianlian])->andFilterWhere(['like', 'settle_date', $this->settle_date])->andFilterWhere(['like', 'pay_type', $this->pay_type]);
     return $dataProvider;
 }
Example #3
0
 public function returnNotify()
 {
     $llpayNotify = new LLpayNotify($this->llpay_config);
     $verify_result = $llpayNotify->verifyNotify();
     if ($verify_result) {
         //验证成功
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         //请在这里加上商户的业务逻辑程序代
         //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
         //获取连连支付的通知返回参数,可参考技术文档中服务器异步通知参数列表
         $is_notify = true;
         $json = new JSON();
         $str = file_get_contents("php://input");
         $val = $json->decode($str);
         $oid_partner = trim($val->{'oid_partner'});
         $dt_order = trim($val->{'dt_order'});
         $no_order = trim($val->{'no_order'});
         $oid_paybill = trim($val->{'oid_paybill'});
         $money_order = trim($val->{'money_order'});
         $result_pay = trim($val->{'result_pay'});
         $settle_date = trim($val->{'settle_date'});
         $info_order = trim($val->{'info_order'});
         $pay_type = trim($val->{'pay_type'});
         $bank_code = trim($val->{'bank_code'});
         $sign_type = trim($val->{'sign_type'});
         $sign = trim($val->{'sign'});
         ///如果同步接受操作没有处理成功
         $pay = payLL::findOne(['no_order' => $no_order, 'status' => self::CONFIRM]);
         if ($pay) {
             if ($result_pay == 'SUCCESS') {
                 //验证支付金额
                 if ($pay->money_order == $money_order) {
                     //支付成功了--更新数据
                     $pay->status = self::SUCCESS;
                     $pay->remark = "success";
                     $pay->sign_type = $sign_type;
                     $pay->sign = $sign;
                     $pay->oid_paybill = $oid_paybill;
                     $pay->settle_date = $settle_date;
                     $pay->money_lianlian = $money_order;
                     $pay->pay_type = $pay_type;
                     $pay->bank_code = $bank_code;
                     $res = $pay->save();
                     if ($res) {
                         $card_no = $pay->card_no;
                         $uid = $pay->uid;
                         $info = Info::find()->where(['member_id' => $uid])->one();
                         $newmoney = $info->balance;
                         $info->balance = $newmoney + $money_order;
                         $info->bank_card = $card_no;
                         $info->bank_card_phone = $bank_code;
                         $info->save();
                     }
                 } else {
                     $pay->status = self::ERROR;
                     $pay->remark = "订单金额错误";
                     $pay->sign_type = $sign_type;
                     $pay->sign = $sign;
                     $pay->oid_paybill = $oid_paybill;
                     $pay->settle_date = $settle_date;
                     $pay->money_lianlian = $money_order;
                     $pay->pay_type = $pay_type;
                     $pay->bank_code = $bank_code;
                     $pay->save();
                 }
             }
         }
         file_put_contents("log.txt", "异步通知 验证成功\n", FILE_APPEND);
         die("{'ret_code':'0000','ret_msg':'交易成功'}");
         //请不要修改或删除
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     } else {
         file_put_contents("log.txt", "异步通知 验证失败\n", FILE_APPEND);
         //验证失败
         die("{'ret_code':'9999','ret_msg':'验签失败'}");
         //调试用,写文本函数记录程序运行情况是否正常
         //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
     }
 }
Example #4
0
 /**
  * Finds the payLL model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return payLL the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = payLL::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }