Пример #1
0
 public function actionNotify()
 {
     file_put_contents('/tmp/test.log', "\n\n return:" . 'testda1hongyes', FILE_APPEND);
     echo 'op';
     exit;
     //使用通用通知接口
     $notify = new \Notify_pub();
     //存储微信的回调
     $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
     $notify->saveData($xml);
     file_put_contents('/tmp/test.log', "\n\n return:" . 'test2' . $xml, FILE_APPEND);
     //验证签名,并回应微信。
     //对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败,
     //微信会通过一定的策略(如30分钟共8次)定期重新发起通知,
     //尽可能提高通知的成功率,但微信不保证通知最终能成功。
     if ($notify->checkSign() == FALSE) {
         file_put_contents('/tmp/test.log', "\n\n return:" . 'test3', FILE_APPEND);
         $notify->setReturnParameter("return_code", "FAIL");
         //返回状态码
         $notify->setReturnParameter("return_msg", "签名失败");
         //返回信息
     } else {
         file_put_contents('/tmp/test.log', "\n\n return:" . 'test4', FILE_APPEND);
         $notify->setReturnParameter("return_code", "SUCCESS");
         //设置返回码
     }
     $returnXml = $notify->returnXml();
     file_put_contents('/tmp/test.log', "\n\n return:" . 'test5' . $returnXml, FILE_APPEND);
     //==商户根据实际情况设置相应的处理流程,此处仅作举例=======
     if ($notify->checkSign() == TRUE) {
         if ($notify->data["return_code"] == 'SUCCESS' && $notify->data["result_code"] == 'SUCCESS') {
             $orderno = $notify->data["out_trade_no"];
             /* 通过id获取订单信息  更改订单的支付状态*/
             $support = Order::findOne(['orderno' => $orderno]);
             if (!$support['ispay']) {
                 $support->ispay = '1';
                 return $support->save();
                 echo $return ? 'success' : '';
             }
             // file_put_contents('/tmp/test.log',"\n\n return:".$return,FILE_APPEND);
         }
     }
 }
Пример #2
0
echo $this->render(FVariable::$layoutVipordermenu_view, ['order_vip' => $order_vip, 'orderIndex' => $orderIndex, 'orderStay' => $orderStay, 'orderFinish' => $orderFinish, 'orderEvaluate' => $orderEvaluate, 'orderCancel' => $orderCancel]);
?>
			    </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>";
    }
Пример #3
0
 /**
  * Finds the Order model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Order the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Order::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
 public static function getOrderNumber()
 {
     $yCode = date('y');
     //年份数
     $mCode = date('m');
     //月份
     $dCode = date('d');
     //日
     $tCode = substr(time(), -3);
     //时间戳的后五位
     $iCode = substr(microtime(), 2, 3);
     //返回时间戳和微秒数,从第二位开始取3位
     $rCode = sprintf('%02d', rand(0, 99));
     //返回0~99的随机整数
     $orderNo = $yCode . '' . $mCode . '' . $dCode . '' . $tCode . '' . $iCode . '' . $rCode;
     while (Order::findOne($orderNo)) {
         $orderNo = Tool::getOrderNumber();
     }
     return $orderNo;
 }
Пример #5
0
 public function actionMobileuser()
 {
     $params = Yii::$app->request->post();
     //需要修改成post
     $mobile = intval($params['mobile']);
     $rel_id = intval($params['rel_id']);
     $output = array();
     //检测手机号码格式
     if (PublicLibrary::checkMobileType($mobile) > 0) {
         //通过手机号查询该用户的信息
         $user = Member::findOne(['mobile' => $mobile]);
         // $user = spClass("m_member")->getOne(array("mobile" => $mobile));
         // print_r($user);
         // exit;
         if ($user) {
             //通过uid和rel_id和购买状态 检测该用户是否购买过该商品
             $suppo = Order::findOne(['uid' => $user['uid'], 'rel_id' => $rel_id, 'ispay' => 1]);
             if ($suppo) {
                 $code = '1000';
                 $output['status'] = 2;
                 $output['ispay'] = 1;
                 $output['res'] = $user['uid'];
                 $msg = '该手机号已被注册,且支持过该产品!';
             } else {
                 $code = '1001';
                 $output['status'] = 2;
                 $output['ispay'] = 0;
                 $output['res'] = $user['uid'];
                 $msg = '该手机号已被注册,未支持过该产品!';
             }
         } else {
             $code = '1002';
             $output['status'] = 1;
             $output['res'] = $mobile;
             $msg = '该手机号未被注册!';
         }
     } else {
         $code = '1003';
         $output['status'] = 3;
         $msg = '手机号码格式不正确!';
     }
     $output = PublicLibrary::format_res_encode($code, $msg, $output);
     // var_dump($output);
     echo $output;
 }
Пример #6
0
 public function updateOrderByOrderNoAndStatus($orderNo, $orderStatus)
 {
     date_default_timezone_set('Asia/Shanghai');
     $orderPayTime = date('Y-m-d H:i:s', time());
     $model = Order::findOne(['orderNo' => $orderNo]);
     if (!$model) {
         return false;
     }
     if (!intval($orderStatus)) {
         return false;
     }
     switch ($orderStatus) {
         case GlobalArray::$orderStateConstantArray['waitDelivery']:
             //支付完成 等待发货
             $model->orderStatus = $orderStatus;
             $model->orderPayTime = $orderPayTime;
             break;
         case GlobalArray::$orderStateConstantArray['hasDelivery']:
             //已经发货 等待收货
             $model->orderStatus = $orderStatus;
             $model->isConfirm = 1;
             $model->confirmTime = $orderPayTime;
             break;
         case GlobalArray::$orderStateConstantArray['waitEvaluate']:
             //等待评价
             $model->orderStatus = $orderStatus;
             break;
         case GlobalArray::$orderStateConstantArray['completed']:
             //订单完成
             $model->orderStatus = $orderStatus;
             break;
         case GlobalArray::$orderStateConstantArray['hasCancel']:
             //交易关闭
             $model->orderStatus = $orderStatus;
             break;
     }
     if ($model->update()) {
         return true;
     }
     return false;
 }
use yii\helpers\Html;
use common\widgets\GlobalArray;
AppAsset::register($this);
AppAsset::addCss($this, '/css/font-awesome.css');
?>
    
    <div class="evaluate">
    	<div class="evaluate-head">
    		<div>商品信息</div>
    		<div>购买时间</div>
    		<div>数量</div>
    	</div>
    	<div class="evaluate-con">
			<?php 
$productDetails = \frontend\models\OrderDetail::findByOrderDetail($details->id);
$order = \frontend\models\Order::findOne($details->id);
$orderDetail = $order->getProductDetail()->all();
foreach ($orderDetail as $detk => $detv) {
    $product = \frontend\models\OrderDetail::findOne($detv['id']);
    $product = $product->getProduct()->one();
    ?>
    		<div>
    			<div class="eva-img"><img src="<?php 
    echo GlobalArray::$imgUrlArray['0'] . $product['productLogo'];
    ?>
" /><?php 
    echo $product['productName'];
    ?>
</div>
    			<div><?php 
    echo date('Y-m-d', strtotime($details->orderTime));