コード例 #1
0
ファイル: PayController.php プロジェクト: xmhkjp/-shiti
 /**
  * 微信支付页面
  * @author pwstrick
  */
 public function actionWeixin()
 {
     $this->layout = 'default';
     $this->getView()->title = '支付确认';
     $uid = $this->uid();
     //获取session中的值
     $openid = $this->openid();
     //获取到地址信息
     $addressId = $this->getParam('address_id');
     $addressModel = new UserAddress();
     $address = $addressModel->getRowById($addressId);
     $this->getView()->params['address'] = $address;
     //产品信息
     $product_id = (int) $this->getParam('product_id');
     $productModel = new DetectionProductService();
     $product = $productModel->getRowById($product_id);
     $this->getView()->params['product'] = $product;
     //数量
     $num = 1;
     //总数
     $total = $num * $product['product_price'];
     $this->getView()->params['jsconfig'] = $this->getJsapiConfig();
     //微信支付配置信息
     //查询订单是否存在
     $orderModel = new UserOrder();
     $pay_type = AppConst::PAY_TYPE_WEIXIN;
     //微信支付
     $pay_status = AppConst::PAY_STATUS_UNPAY;
     //未支付
     $order = $orderModel->exist($uid, $pay_type, $product_id, $pay_status);
     $row = array('uid' => $uid, 'type' => $pay_type, 'product_id' => $product_id, 'num' => $num, 'total' => $total, 'status' => $pay_status, 'address_id' => $addressId, 'order_number' => $this->_ordernumber(), 'status' => 1);
     //print_r($order);
     //var_dump($result);
     if (empty($order['id'])) {
         //如果为空就重新添加一张订单
         $row['order_id'] = $this->_orderno($product_id);
         $row['create_time'] = time();
         $order = $row;
         //添加订单
         $orderModel->add($row);
     } else {
         //更新订单信息
         $row['update_time'] = time();
         $order['order_number'] = $row['order_number'];
         $orderModel->modify($row, $order['id']);
     }
     $this->getView()->params['order'] = $order;
     $this->getView()->params['tester'] = $tester;
     $this->getView()->params['payparam'] = $this->getJspayParam($order, $openid);
     return $this->render('weixin');
 }
コード例 #2
0
 public function findByIdDelete($id)
 {
     $result = UserAddress::findOne($id);
     $result->delete();
 }
コード例 #3
0
			    </div>
			    
			    <div class="order-con">
					<ul>
						<?php 
foreach ($orderCanceled as $k => $v) {
    echo "<li>";
    echo "<div class='order-con-head'>";
    echo "<span class='ord-number'>订单号:<b>" . $v->orderNo . "</b></span>";
    echo "<span class='ord-times'>" . $v->orderTime . "</span>";
    echo "</div>";
    echo "<div class='order-sub-con'>";
    echo "<div class='sub-con-list'>";
    $order = \frontend\models\Order::findOne($v->id);
    $orderDetail = $order->getProductDetail()->all();
    $addressName = \frontend\models\UserAddress::findOne($v->addressId);
    $addressName = $addressName->userName;
    foreach ($orderDetail as $detk => $detv) {
        echo "<div class='sub-row'>";
        echo "<div>";
        $product = \frontend\models\OrderDetail::findOne($detv['id']);
        $product = $product->getProduct()->one();
        echo "<img src='" . GlobalArray::$imgUrlArray['0'] . $product['productLogo'] . "' class='img-responsive' />";
        echo "</div>";
        echo "<div>" . $product['productName'] . "</div>";
        echo "<div>" . $detv['productCount'] . "包</div>";
        echo "<div>" . '¥' . $detv['productPrice'] . "</div>";
        echo "</div>";
    }
    echo "</div>";
    echo "<div>¥" . $v->orderMoney . "</div>";
コード例 #4
0
ファイル: User.php プロジェクト: jaybril/www.mimgpotea.com
 public function getUserAddress()
 {
     // 第一个参数为要关联的子表模型类名,
     // 第二个参数指定 通过子表的customer_id,关联主表的id字段
     return $this->hasMany(UserAddress::className(), ['userId' => 'id']);
 }
コード例 #5
0
 public function actionOrdercancel()
 {
     $userId = Yii::$app->session->get(FVariable::$session_userId_str);
     if (!$userId) {
         return $this->redirect(FVariable::$siteLogin_view);
     }
     $orderNo = Yii::$app->request->get('id');
     $order = new Order();
     $details = $order->findByOrderReturn($orderNo);
     if (!$details) {
         return $this->redirect(FVariable::$error404_view);
     }
     $address = new UserAddress();
     $orderDetail = new OrderDetail();
     $addressList = $address->findByAddressIdAll($details->addressId);
     $orderDetailList = $orderDetail->findByIdOrderReturnDetail($details->id);
     return $this->render(FVariable::$userOrdercancel_view, ['details' => $details, 'addressList' => $addressList, 'orderDetailList' => $orderDetailList]);
 }