Przeglądaj źródła

全局关闭csrf

shish 6 lat temu
rodzic
commit
362ffa0050

+ 0 - 1
app/business/controllers/GoodsController.php

@@ -16,7 +16,6 @@ use biz\goods\services\GoodsService;
 class GoodsController extends BaseController
 {
     //index,view,create,update,delete,options
-    public $enableCsrfValidation = false;
 
     public function actionList()
     {

+ 1 - 1
app/business/controllers/OrderController.php

@@ -22,7 +22,7 @@ use common\components\configDict;
 class OrderController extends BaseController
 {
 	
-	public $enableCsrfValidation = false;
+	
 	
 	public function actionList()
 	{

+ 1 - 1
app/business/controllers/UserController.php

@@ -19,7 +19,7 @@ use common\components\util;
 class UserController extends BaseController
 {
 	
-	public $enableCsrfValidation = false;
+	
 	
 	//客户列表 shish 2019.11.30
 	public function actionGetList()

+ 1 - 1
app/client/controllers/AuthController.php

@@ -25,7 +25,7 @@ use Lcobucci\JWT\ValidationData;
 class AuthController extends PublicController
 {
 	
-	public $enableCsrfValidation = false;
+	
 	
 	//准备授权 shish 2019.11.19
 	public function actionPrepare()

+ 1 - 1
app/client/controllers/NoticeController.php

@@ -16,7 +16,7 @@ class NoticeController extends PublicController
 {
 	
 	public $cateogryList;
-	public $enableCsrfValidation = false;
+	
 	
 	/**
 	 * 微信支付异步回调

+ 13 - 9
app/client/controllers/OrderController.php

@@ -15,6 +15,8 @@ use common\components\util;
 
 class OrderController extends BaseController
 {
+
+	
 	
 	//商城下单操作 shish 2019.12.3
 	public function actionCreateOrder()
@@ -22,6 +24,7 @@ class OrderController extends BaseController
 		//给出省市区的接口 todo
 		//给出商家门店地址接口 todo
 		//给出腾讯的接口 todo
+		//运费 计算方式 todo
 
 		$post = Yii::$app->request->post();
 		$goodsId = isset($post['goodsId']) ? $post['goodsId'] : 0;
@@ -34,16 +37,15 @@ class OrderController extends BaseController
 		}
 		//确认是否要配送的商品
 		$needSend = isset($goodsInfo['needSend']) && $goodsInfo['needSend'] == 1 ? 1 : 0;
-		
-		$userId = $this->userId;
-		$post['userId'] = $userId;
+dd($goodsInfo);
+		$post['userId'] = $this->userId;
 		$post['payWay'] = $this->isWeixin == true ? 0 : 1;
 		$defaultShopId = MerchantService::getDefaultShopId($this->merchant);
 		if (empty($defaultShopId)) {
 			util::fail('没有找到门店');
 		}
 		$shopInfo = ShopService::getById($defaultShopId);
-		
+
 		//计算运费
 		$post['sendDistance'] = isset($post['sendDistance']) ? $post['sendDistance'] : 0;
 		$post['sendCost'] = 0;
@@ -54,20 +56,19 @@ class OrderController extends BaseController
 			$sendCost = ShopService::getSendCost($lat, $lng, $jsStatDistance, $shopInfo);
 			$post['sendCost'] = $sendCost;
 		}
-		//付款成功才保存优惠券id
-		unset($post['couponId']);
 		$post['merchantId'] = $this->merchantId;
 		$post['shopId'] = $defaultShopId;
+
 		$order = OrderService::add($post);
 		$orderId = $order['id'];
 
 		$data = [
 			'orderId' => $orderId,
 			'goodsId' => $goodsId,
-			'userId' => $userId,
+			'userId' => $this->userId,
 			'merchantId' => $this->merchantId,
-			'title' => $goods['goodsName'],
-			'cover' => $goods['cover'],
+			'title' => $goodsInfo['goodsName'],
+			'cover' => $goodsInfo['cover'],
 			'unitPrice' => $price,
 			'num' => $num,
 			'multiPriceId' => $multiPriceId,
@@ -75,6 +76,9 @@ class OrderController extends BaseController
 		];
 		xhOrderGoodsService::add($data);//创建订单商品列表
 
+		//付款成功才保存优惠券id
+		unset($post['couponId']);
+
 		util::success(['orderId' => $orderId, 'couponId' => $couponId]);
 	}
 	

+ 1 - 1
app/client/controllers/PayController.php

@@ -31,7 +31,7 @@ class PayController extends BaseController
 
 	public $withoutLogin = ['get-params'];
 
-	public $enableCsrfValidation = false;
+	
 
 	//创建订单 shish 2019.12.3
 	public function actionCreateOrder()

+ 1 - 1
app/open/controllers/NoticeController.php

@@ -18,7 +18,7 @@ use common\services\xhPayToolService;
 class NoticeController extends PublicController{
 
 	public $cateogryList;
-	public $enableCsrfValidation = false;
+	
 
 	/**
 	 * 微信支付异步回调

+ 1 - 1
app/open/controllers/WxAuthController.php

@@ -23,7 +23,7 @@ use common\components\util;
 
 class WxAuthController extends PublicController{
 
-	public $enableCsrfValidation = false;
+	
 	
 	public function actionApi()
 	{

+ 1 - 1
app/open/controllers/WxController.php

@@ -26,7 +26,7 @@ use common\components\qqFaceUtil;
 
 class WxController extends PublicController
 {
-	public $enableCsrfValidation = false;
+	
 	public $fromUsername, $toUsername, $msgType;
 	
 	/**

+ 1 - 1
app/saas/controllers/AuthController.php

@@ -9,7 +9,7 @@ use Yii;
 class AuthController extends BaseController
 {
 	
-	public $enableCsrfValidation = false;
+	
 	
 	//获取权限树 shish 2019.11.24
 	public function actionTree()

+ 1 - 1
biz/goods/services/GoodsService.php

@@ -22,5 +22,5 @@ class GoodsService extends BaseService
 	{
 		return GoodsClass::getGoodsInfo($id);
 	}
-	
+
 }

+ 3 - 0
common/components/business.php

@@ -40,12 +40,14 @@ class business
 		unset($info['shopImg']);
 		//没有保存图片返回空
 		if (empty($shopImg)) {
+			$info['originImgList'] = [];
 			$info['imgList'] = ['normal' => '', 'middle' => ''];
 			return $info;
 		}
 		$arr = json_decode($shopImg, true);
 		//图片内容转化失败返回空
 		if (is_array($arr) == false) {
+			$info['originImgList'] = [];
 			$info['imgList'] = ['normal' => '', 'middle' => ''];
 			return $info;
 		}
@@ -57,6 +59,7 @@ class business
 			$middle = $prefixImgUrl . $middleImg;
 			$imgList[] = ['normal' => $normal, 'middle' => $middle];
 		}
+		$info['originImgList'] = $arr;
 		$info['imgList'] = $imgList;
 		return $info;
 	}

+ 4 - 3
common/config/main.php

@@ -4,15 +4,16 @@ return [
 	'components' => [
 		'request' => [
 			'cookieValidationKey' => '3i18DOM7ZDqqQfr2S0hj0c60wFxxTb3J',
+			'enableCsrfValidation' => false,
 		],
 		'cache' => [
 			'class' => 'yii\caching\FileCache',
 		],
 		'db' => [
 			'class' => 'yii\db\Connection',
-            'dsn' => getenv('DB_DSN'),
-            'username' => getenv('DB_USERNAME'),
-            'password' => getenv('DB_PASSWORD'),
+			'dsn' => getenv('DB_DSN'),
+			'username' => getenv('DB_USERNAME'),
+			'password' => getenv('DB_PASSWORD'),
 			'charset' => 'utf8',
 		],
 		'redis' => [

+ 1 - 1
console/controllers/InitController.php

@@ -25,7 +25,7 @@ use common\services\xhInitService;
 class InitController extends Controller
 {
 
-	public $enableCsrfValidation = false;
+	
 
 	//接入一个商家需要的操作 shish 2019.9.7 yii init/join-one
 	public function actionJoinOne()

+ 1 - 1
console/controllers/MerchantCapitalController.php

@@ -15,6 +15,6 @@ use linslin\yii2\curl;
 class MerchantCapitalController extends Controller
 {
 	
-	public $enableCsrfValidation = false;
+
 	
 }

+ 1 - 1
console/controllers/ShellController.php

@@ -18,7 +18,7 @@ use common\components\stringUtil;
 class ShellController extends Controller
 {
 	
-	public $enableCsrfValidation = false;
+	
 	
 	//每天要跑的东西放这里 shish 2019.9.10
 	// 10 0 * * * /usr/local/nginx/html/huahuibao/yii shell/per-day

+ 1 - 1
console/controllers/TMessageController.php

@@ -8,7 +8,7 @@ use yii\console\Controller;
 class TMessageController extends Controller
 {
 
-	public $enableCsrfValidation = false;
+	
 
 	public function actionVisit()
 	{

+ 1 - 1
vendor/yiisoft/yii2/rest/Controller.php

@@ -39,7 +39,7 @@ class Controller extends \yii\web\Controller
     /**
      * {@inheritdoc}
      */
-    public $enableCsrfValidation = false;
+    
 
 
     /**