Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Payment::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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(['payment_id' => $this->payment_id, 'order_id' => $this->order_id, 'payment_method' => $this->payment_method, 'payment_fee' => $this->payment_fee, 'create_at' => $this->create_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'transcation_no', $this->transcation_no]);
     return $dataProvider;
 }
Пример #2
0
 public function actionOrderSave()
 {
     $orderModel = Yii::createObject(Order::className());
     $orderModel->address = Yii::$app->request->post('address');
     $orderModel->memo = Yii::$app->request->post('memo');
     $orderModel->items = Yii::$app->request->post('items');
     if ($orderModel->saveOrder()) {
         $redirectUrl = Yii::createObject(Payment::className())->getRedirectUrl(Yii::$app->request->post('payment'), $orderModel->order_id);
         //            var_dump($redirectUrl);exit;
         return $this->redirect($redirectUrl);
     } else {
         return Json::encode(['message' => '下单失败', 'redirect' => Url::to(['/order/order/index'])]);
     }
 }
Пример #3
0
            </div>
            <div class="box-content">
                <?php 
list($addressList, $defaultAddress) = \star\member\models\DeliveryAddress::getAddressList();
?>
                <?php 
echo Html::dropDownList('address', $defaultAddress, $addressList);
?>
            </div>
        </div>
        <div class="breadcrumb">
            <div class="box-title container_24">支付方式</div>
            <div class="box-content" style="vertical-align:middle;">

                <?php 
$payment = Yii::createObject(\star\payment\models\Payment::className());
echo Html::radioList('payment', [$payment::ALIPAY], $payment->getPayList());
?>
            </div>
        </div>


        <div class="breadcrumb">
            <div class="box-title container_24">商品列表</div>
            <div class="box-content cart container_24">
                <table id="list-div-box" class="table">
                    <tr style="background:#F3F3F3;">
                        <th class="col-xs-3">图片</th>
                        <th class="col-xs-3">名称</th>
                                        <th class="col-xs-3">属性</th>
                        <th class="col-xs-1">价格</th>
Пример #4
0
 /**
  * Finds the Payment model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Payment the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Payment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #5
0
 public function getPayment()
 {
     return $this->hasOne(Payment::className(), ['order_id' => 'order_id']);
 }
Пример #6
0
 public function actionNotify()
 {
     //计算得出通知验证结果
     $alipayNotify = new AlipayNotify($this->config);
     $verify_result = $alipayNotify->verifyNotify();
     if ($verify_result) {
         //验证成功
         $order_id = \Yii::$app->request->post('out_trade_no');
         $order = \Yii::createObject(Order::className())->findOne($order_id);
         if ($_POST['trade_status'] == 'WAIT_BUYER_PAY') {
             //该判断表示买家已在支付宝交易管理中产生了交易记录,但没有付款
             //判断该笔订单是否在商户网站中已经做过处理
             //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
             //如果有做过处理,不执行商户的业务程序
             echo "success";
             //请不要修改或删除
             //调试用,写文本函数记录程序运行情况是否正常
             //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
         } else {
             if ($_POST['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
                 //该判断表示买家已在支付宝交易管理中产生了交易记录且付款成功,但卖家没有发货
                 //判断该笔订单是否在商户网站中已经做过处理
                 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                 //如果有做过处理,不执行商户的业务程序
                 $payment = \Yii::createObject(Payment::className());
                 $payment->order_id = $order->order_id;
                 $payment->status = $payment::STATUS_BUYER_PAY;
                 $payment->payment_method = $payment::ALIPAY;
                 $payment->payment_fee = \Yii::$app->request->post('price');
                 $payment->transcation_no = \Yii::$app->request->post('subject');
                 $payment->save();
                 $order->status = $order::STATUS_WAIT_SHIPMENT;
                 $order->save();
                 echo "success";
                 //请不要修改或删除
                 //调试用,写文本函数记录程序运行情况是否正常
                 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
             } else {
                 if ($_POST['trade_status'] == 'WAIT_BUYER_CONFIRM_GOODS') {
                     //该判断表示卖家已经发了货,但买家还没有做确认收货的操作
                     //判断该笔订单是否在商户网站中已经做过处理
                     //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                     //如果有做过处理,不执行商户的业务程序
                     echo "success";
                     //请不要修改或删除
                     //调试用,写文本函数记录程序运行情况是否正常
                     //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
                 } else {
                     if ($_POST['trade_status'] == 'TRADE_FINISHED') {
                         //该判断表示买家已经确认收货,这笔交易完成
                         //判断该笔订单是否在商户网站中已经做过处理
                         //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                         //如果有做过处理,不执行商户的业务程序
                         echo "success";
                         //请不要修改或删除
                         //调试用,写文本函数记录程序运行情况是否正常
                         //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
                     } else {
                         //其他状态判断
                         echo "success";
                         //调试用,写文本函数记录程序运行情况是否正常
                         //logResult ("这里写入想要调试的代码变量值,或其他运行的结果记录");
                     }
                 }
             }
         }
         //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     } else {
         //验证失败
         echo "fail";
         //调试用,写文本函数记录程序运行情况是否正常
         //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
     }
 }