shish 6 лет назад
Родитель
Сommit
2bc9ce992e

+ 5 - 1
app/open/controllers/ApplyController.php

@@ -1,5 +1,7 @@
 <?php
+
 namespace open\controllers;
+
 use biz\saas\services\ApplyService;
 use common\components\util;
 use Yii;
@@ -10,7 +12,9 @@ class ApplyController extends BaseController
 	//申请 shish 2019.12.23
 	public function actionAdd()
 	{
-		ApplyService::addApply();
+		$post = Yii::$app->request->post();
+		$post['userId'] = $this->userId;
+		ApplyService::addApply($post);
 		util::ok('提交成功');
 	}
 

+ 47 - 1
app/open/controllers/BaseController.php

@@ -3,9 +3,55 @@
 namespace open\controllers;
 
 use Yii;
-use yii\web\Controller;
+use biz\merchant\services\MerchantExtendService;
+use biz\merchant\services\MerchantService;
+use biz\user\services\UserService;
+use common\components\httpUtil;
+use common\components\jwt;
+use common\components\util;
 
 class BaseController extends PublicController
 {
 
+	public $validate = true;
+	public $withoutLogin = [];//不需要登陆可以访问的方法
+	public $userId, $user;
+	public $merchantId, $merchant, $merchantExtend;
+	public $isWeixin;
+
+	public function beforeAction($action)
+	{
+		//token验证
+		//$userId = jwt::getLoginId();
+		$userId = 12536630;
+		$account = 12358;
+		if (empty($account)) {
+			util::fail('商家无效');
+		}
+		$merchant = MerchantService::getById($account);
+		if (empty($merchant)) {
+			util::fail('商家信息无效');
+		}
+		$this->merchantId = $account;
+		$this->merchant = $merchant;
+		$this->merchantExtend = MerchantExtendService::getByMerchantId($account);
+		$this->isWeixin = util::isWeixin();
+		
+		if (empty($userId)) {
+			$this->validate = false;
+		} else {
+			$this->validate = true;
+			$this->userId = $userId;
+			$this->user = UserService::getById($userId);
+		}
+		//游客可以访问的方法
+		if (in_array($action->id, $this->withoutLogin)) {
+			$this->validate = true;
+		}
+		if ($this->validate == false) {
+			util::notLogin();
+		}
+		return parent::beforeAction($action);
+	}
+
 }

+ 16 - 0
app/open/controllers/RenewController.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace open\controllers;
+
+use common\components\util;
+use Yii;
+
+class RenewController extends BaseController
+{
+
+	public function action()
+	{
+
+	}
+
+}

+ 16 - 0
app/open/web/index.php

@@ -1,5 +1,21 @@
 <?php
 
+//跨域临时解决方案 shish 2019.12.1
+header('Access-Control-Allow-Origin:*');
+// 响应类型
+header('Access-Control-Allow-Methods:*');
+// 响应头设置
+header('Access-Control-Allow-Headers:content-type,token,id,source,account');
+header("Access-Control-Request-Headers: Origin, X-Requested-With, content-Type, Accept, Authorization");
+
+//调用使用的输出方法
+function dd($out)
+{
+	echo '<pre>';
+	print_r($out);
+	Yii::$app->end();
+}
+
 require(__DIR__ . '/../../../vendor/autoload.php');
 
 require(__DIR__ . '/../../../env.php');// Environment

+ 4 - 0
biz/saas/services/ApplyService.php

@@ -63,6 +63,10 @@ class ApplyService extends BaseService
 			util::fail('您已经申请过了');
 		}
 		$oldId = isset($data['oldId']) ? $data['oldId'] : 0;
+		//有人邀请
+		if(!empty($oldId)){
+		
+		}
 		ApplyClass::add($data);
 	}
 

+ 1 - 0
sql.txt

@@ -1,5 +1,6 @@
 2019.12.23
 ALTER TABLE `xhApply` ADD UNIQUE INDEX `mobile`(`mobile`);
+ALTER TABLE `xhRenew` ADD `orderSn` CHAR(30) NOT NULL DEFAULT '' COMMENT '订单编号' AFTER `id`;
 
 2019.12.21 10:27 平台零售业资产
 ALTER TABLE xhMerchantAsset DROP `totalWeixinFans`;