فهرست منبع

新增官网模块

shish 6 سال پیش
والد
کامیت
5f28d07a45

+ 3 - 1
.gitignore

@@ -12,9 +12,11 @@ app/api/runtime/
 app/client/runtime/
 app/open/runtime/
 app/saas/runtime/
+app/www/runtime/
 
 app/business/web/assets/
 app/api/web/assets/
 app/client/web/assets/
 app/open/web/assets/
-app/saas/web/assets/
+app/saas/web/assets/
+app/www/web/assets/

+ 48 - 7
app/www/controllers/ApplyController.php

@@ -1,21 +1,62 @@
 <?php
 
-namespace open\controllers;
+namespace www\controllers;
 
 use biz\saas\services\ApplyService;
 use common\components\util;
 use Yii;
+use yii\web\Controller;
+
 
 class ApplyController extends BaseController
 {
-
-	//申请 shish 2019.12.23
-	public function actionAdd()
+	
+	//申请列表
+	public function actionList()
+	{
+		$where = [];
+		$list = ApplyService::getApplyList($where);
+		util::success($list);
+	}
+	
+	//审核
+	public function actionCheck()
+	{
+		$id = Yii::$app->request->post('id');
+		$status = Yii::$app->request->post('status', 0);
+		$remark = Yii::$app->request->post('remark', '');
+		$apply = ApplyService::getById($id);
+		if (empty($apply)) {
+			util::fail('找不到申请记录');
+		}
+		if ($apply['status'] != 0) {
+			util::fail('已经审过了');
+		}
+		ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
+		if ($status == 1) {
+			ApplyService::pass($id);
+		}
+		util::success('操作成功');
+	}
+	
+	//申请试用登记 shish 2020.1.11
+	public function actionRegister()
 	{
 		$post = Yii::$app->request->post();
-		$post['userId'] = $this->userId;
-		ApplyService::addApply($post);
-		util::ok('提交成功');
+		$rand = rand(0, 1);
+		$data = ['focus' => 1, 'qrCode' => ''];
+		if ($rand == 0) {
+			$data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
+		}
+		util::success($data);
+	}
+
+	//申请状态
+	public function actionApplyStatus()
+	{
+		//-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
+		$status = rand(0, 4);
+		util::success(['status' => $status]);
 	}
 
 }

+ 52 - 14
app/www/controllers/AuthController.php

@@ -1,23 +1,61 @@
 <?php
 
-namespace open\controllers;
+namespace www\controllers;
 
-use biz\user\services\UserService;
-use common\services\xhWxOpenService;
+use biz\auth\services\AuthService;
 use common\components\util;
 use Yii;
-use yii\web\Controller;
-use common\services\xhMerchantService;
-use common\services\xhUserService;
-use common\components\weixinUtil;
-use common\components\configDict;
-use common\components\stringUtil;
 
-/**
- * 微信 oauth 授权相关
- *
- */
-class AuthController extends PublicController
+class AuthController extends BaseController
 {
+	
+	//获取权限树 shish 2019.11.24
+	public function actionTree()
+	{
+		$get = Yii::$app->request->get();
+		$endId = isset($get['endId']) ? $get['endId'] : 1;
+		$tree = AuthService::getTree($endId);
+		util::success($tree);
+	}
+	
+	//添加权限 shish 2019.11.24
+	public function actionAdd()
+	{
+		$post = Yii::$app->request->post();
+		$endId = isset($post['endId']) ? $post['endId'] : 1;
+		$authName = isset($post['authName']) ? $post['authName'] : '';
+		$list = AuthService::getNameList($endId);
+		if (in_array($authName, $list)) {
+			util::fail('名称已经存在');
+		}
+		AuthService::add($_POST);
+		util::ok();
+	}
+	
+	//修改 shish 2019.11.24
+	public function actionUpdate()
+	{
+		$post = Yii::$app->request->post();
+		$id = isset($post['id']) ? $post['id'] : 0;
+		$auth = AuthService::getById($id);
+		if (empty($auth)) {
+			util::fail('没有找到权限');
+		}
+		$endId = $auth['endId'];
+		$nameList = AuthService::getNameList($endId);
+		$authName = isset($post['authName']) ? $post['authName'] : '';
+		if ($authName != $auth['authName'] && in_array($authName, $nameList)) {
+			util::fail('名称已经存在');
+		}
+		AuthService::updateById($id, $_POST);
+		util::ok();
+	}
+
+	//删除权限 shish 2020.1.7
+	public function actionDelete()
+	{
+		$id = Yii::$app->request->get('id');
+		util::ok('删除成功');
+	}
 
 }

+ 25 - 34
app/www/controllers/BaseController.php

@@ -1,48 +1,30 @@
 <?php
 
-namespace open\controllers;
+namespace www\controllers;
 
+use biz\saas\services\StaffService;
 use Yii;
-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;
+use yii\web\Controller;
 
+/**
+ * 平台次级基类,次于PublicController
+ */
 class BaseController extends PublicController
 {
-
+	
+	public $staff, $staffId, $userId, $user;
+	public $isLogin = false;
+	public $withoutLogin = [];//不需要登陆的方法名
 	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)) {
+		//$staffId = jwt::getLoginId();
+		$staffId = 1;
+		$userId = 1;
+		if (empty($staffId)) {
 			$this->validate = false;
-		} else {
-			$this->validate = true;
-			$this->userId = $userId;
-			$this->user = UserService::getById($userId);
 		}
 		//游客可以访问的方法
 		if (in_array($action->id, $this->withoutLogin)) {
@@ -51,7 +33,16 @@ class BaseController extends PublicController
 		if ($this->validate == false) {
 			util::notLogin();
 		}
+		$staff = StaffService::getById($staffId);
+		if (empty($staff)) {
+			util::fail('没有找到管理员');
+		}
+		
+		$this->staff = $staff;
+		$this->staffId = $staffId;
+		$this->user = $staff;
+		$this->userId = $userId;
 		return parent::beforeAction($action);
 	}
-
+	
 }

+ 66 - 0
app/www/controllers/CleanCacheController.php

@@ -0,0 +1,66 @@
+<?php
+namespace www\controllers;
+
+use Yii;
+use common\components\util;
+use common\components\configDict;
+
+class CleanCacheController extends PlatformController{
+
+    public function actionIndex(){
+        $cacheKeys = configDict::$cacheKey;
+
+        $i = 1;
+        foreach ($cacheKeys as $keyName => $redisKey){
+            $newCacheKeys[] = ['id'=>$i, 'keyName'=>$keyName];
+            $i++;
+        }
+        return $this->render('index', ['cacheKeys'=>$newCacheKeys]);
+    }
+
+    /**
+     * 删除模糊匹配的所有键
+     */
+    public function actionAllClean(){
+        $keyName = Yii::$app->request->get('keyName');
+
+        $cacheKeys = configDict::$cacheKey;
+        if(!key_exists($keyName, $cacheKeys)){
+            util::failInfo($keyName.'缓存键不存在');
+        }
+        $redisKey = $cacheKeys[$keyName].'*';//模糊匹配所有的键
+
+        $allKeys = Yii::$app->redis->keys($redisKey);
+        foreach ($allKeys as $key){
+            Yii::$app->redis->executeCommand('DEL', [$key]);
+        }
+        util::successInfo($keyName.'匹配的缓存键清除完成', 'success');
+    }
+
+    public function actionKeysList(){
+        $keyName = Yii::$app->request->get('keyName');
+
+        $cacheKeys = configDict::$cacheKey;
+        if(!key_exists($keyName, $cacheKeys)){
+            util::failInfo($keyName.'缓存键不存在');
+        }
+
+        $redisKey = $cacheKeys[$keyName].'*';//模糊匹配所有的键
+        $allKeys = Yii::$app->redis->keys($redisKey);
+        return $this->render('keys-list', ['allKeys'=>$allKeys]);
+    }
+
+    /**
+     * 指定删除单个键
+     */
+    public function actionSingleClean(){
+        $key = Yii::$app->request->get('key');
+        $exist = Yii::$app->redis->executeCommand('EXISTS', [$key]);
+        if($exist){
+            Yii::$app->redis->executeCommand('DEL', [$key]);
+            util::successInfo($key.'缓存键清除成功', 'success');
+        }
+
+        util::failInfo($key.'缓存键不存在', 'error');
+    }
+}

+ 135 - 0
app/www/controllers/DrawCashController.php

@@ -0,0 +1,135 @@
+<?php
+
+namespace www\controllers;
+
+use common\components\stringUtil;
+use common\services\xhAdminToMerchantService;
+
+use common\services\xhCommonService;
+use common\services\xhMerchantAssetService;
+use common\services\xhUserService;
+
+use common\services\xhWxOpenService;
+
+use common\services\xhMerchantExtendService;
+use Yii;
+use common\models\xhDrawCash;
+use common\components\page;
+use common\services\xhMerchantService;
+use common\services\xhDrawCashService;
+use common\services\xhTMessageService;
+use common\components\util;
+use common\components\weixinUtil;
+use common\services\xhStatIncomeService;
+
+class DrawCashController extends PlatformController
+{
+	public function actionList()
+	{
+		$get = Yii::$app->request->get();
+		$query = xhDrawCash::find();
+		$countQuery = clone $query;
+		$count = $countQuery->count();
+		$page = isset($get['page']) ? $get['page'] : 1;
+		$pageSize = 20;
+		$offset = ($page - 1) * $pageSize;
+		$models = $query->offset($offset)->orderBy('id desc')->limit($pageSize)->asArray()->all();
+		$page = new page($count, $page, $pageSize);
+		$paging = $page->fpage();
+		return $this->render('list', ['models' => $models, 'paging' => $paging]);
+	}
+	
+	/**
+	 * 提现审核通过
+	 */
+	public function actionCompleteOrder()
+	{
+		$get = Yii::$app->request->get();
+		$id = isset($get['id']) ? $get['id'] : 0;
+		$draw = xhDrawCashService::getById($id);
+		$drawAmount = isset($draw['amount']) ? floatval($draw['amount']) : 0;
+		if ($draw['status'] == 1) {
+			util::failInfo('已经完成转账,请不要重复请求!');
+		}
+		$merchantId = isset($draw['merchantId']) ? $draw['merchantId'] : 0;
+		$admin = xhAdminToMerchantService::getAdminByMerchantId($merchantId);
+		$time = strtotime(date("Y-m-d"));
+		$income = xhStatIncomeService::getByIds($merchantId, $time);
+		$amount = isset($income['amount']) ? $income['amount'] : 0;
+		$merchantExtInfo = xhMerchantExtendService::getByMerchantId($merchantId);//取支付宝帐号
+		
+		$asset = xhMerchantAssetService::getByMerchantId($merchantId);
+		
+		if ($merchantExtInfo['alipayAccount'] == '') {
+			util::failInfo('转账接收方的支付宝帐号为空');
+		}
+		if ($drawAmount == 0) {
+			util::failInfo('转账金额为0');
+		}
+		$alipayWap = Yii::getAlias("@vendor/alipayWap");
+		require_once($alipayWap . '/aop/AopClient.php');
+		require_once($alipayWap . '/aop/request/AlipayFundTransToaccountTransferRequest.php');
+		require_once($alipayWap . '/config.php');
+		
+		$aop = new \AopClient();
+		$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
+		$aop->appId = $config['app_id'];
+		$aop->rsaPrivateKey = $config['merchant_private_key'];
+		$aop->alipayrsaPublicKey = $config['alipay_public_key'];
+		$aop->apiVersion = '1.0';
+		$aop->signType = 'RSA2';
+		$aop->postCharset = 'UTF-8';
+		$aop->format = 'json';
+		$request = new \AlipayFundTransToaccountTransferRequest ();
+		$request->setBizContent("{" .
+			"\"out_biz_no\":\"" . $id . "\"," .
+			"\"payee_type\":\"ALIPAY_LOGONID\"," .
+			"\"payee_account\":\"" . $merchantExtInfo['alipayAccount'] . "\"," .
+			"\"amount\":\"" . $drawAmount . "\"," .
+			"\"payee_real_name\":\"" . $merchantExtInfo['alipayAccountName'] . "\"," .
+			"\"payer_show_name\":\"厦门中花汇信息科技有限公司\"," .
+			"\"remark\":\"提现申请\"" .
+			"  }");
+		$result = $aop->execute($request);
+		$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
+		$resultCode = $result->$responseNode->code;
+		$returnOrderId = $result->$responseNode->order_id;
+		if (!empty($resultCode) && $resultCode == 10000) {
+			xhDrawCashService::updateById($id, ['thirdSerialNumber' => $returnOrderId, 'status' => 1]);
+			$remainAmount = stringUtil::calcSub($asset['freezeBalance'], $drawAmount);
+			xhMerchantAssetService::updateByMerchantId($merchantId, ['freezeBalance' => $remainAmount]);
+			/*
+			$openId = $admin['openId'];
+			$openMerchant = xhWxOpenService::getMerchant();//取平台绑定的商家
+			$openMerchantId = $openMerchant['id'];
+			$allTM = xhTMessageService::getList($openMerchantId);
+			$shortTempId = 'OPENTM201319876';
+			if(isset($allTM[$shortTempId])){
+			$tempId =  $allTM[$shortTempId];
+			$data = [
+				"touser" => $openId,
+				"template_id" => $tempId,
+				"url" => Yii::$app->params['adminUrl'] . '/draw-cash/list',
+				"data" => [
+					"first" => ["value" => '已经完成结算。', "color" => "#173177"],
+					"keyword1" => ["value" => '当天', "color" => "#173177"],
+					"keyword2" => ["value" => $amount . '元', "color" => "#173177"],
+					"remark" => ["value" => "支付宝收入:{$drawAmount}元,已汇入您的帐户。\n点击查看结算记录", "color" => "#173177"]
+				]
+			];
+			weixinUtil::sendTaskInform($data, $openMerchant);
+			}
+			*/
+			xhCommonService::sendMobileMsg($admin['mobile'], "您申请的提现金额:{$drawAmount}元已经到帐,请注意查收。");
+			util::successInfo();
+		} else {
+			$msg = $result->$responseNode->msg;
+			$sub_code = $result->$responseNode->sub_code;
+			$sub_msg = $result->$responseNode->sub_msg;
+			Yii::info("转帐失败,原因:code:" . $resultCode . " msg:" . $msg . " sub_code:" . $sub_code . " sub_msg:" . $sub_msg);
+		}
+		util::failInfo('转账失败');
+		
+	}
+	
+}

+ 46 - 0
app/www/controllers/FestController.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace www\controllers;
+
+use biz\saas\services\FestService;
+use Yii;
+use common\components\util;
+
+
+class FestController extends BaseController
+{
+	
+	//节日列表 shish 2019.12.8
+	public function actionList()
+	{
+		$fest = FestService::getAllByCondition([], null, '*');
+		util::success($fest);
+	}
+	
+	//添加节日 shish 2019.12.21
+	public function actionAdd()
+	{
+		$post = Yii::$app->request->post();
+		$return = FestService::add($post);
+		util::success($return);
+	}
+	
+	//修改节日 shish 2019.12.21
+	public function actionUpdate()
+	{
+		$post = Yii::$app->request->post();
+		$id = $post['id'];
+		unset($post['id']);
+		FestService::updateById($id, $post);
+		util::ok();
+	}
+	
+	//节日详情 shish 2019.12.21
+	public function actionDetail()
+	{
+		$id = Yii::$app->request->get('id');
+		$fest = FestService::getById($id);
+		util::success($fest);
+	}
+
+}

+ 24 - 0
app/www/controllers/GoodsController.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace www\controllers;
+
+use biz\goods\services\GoodsService;
+use biz\retail\services\RetailAssetService;
+use Yii;
+use common\components\util;
+
+
+class GoodsController extends BaseController
+{
+
+	//商品列表 shish 2019.12.7
+	public function actionList()
+	{
+		$where = [];
+		$data = GoodsService::getGoodsList($where);
+		$asset = RetailAssetService::getAsset();
+		$data['RetailAsset'] = $asset;
+		util::success($data);
+	}
+
+}

+ 52 - 3
app/www/controllers/MainController.php

@@ -1,14 +1,63 @@
 <?php
-namespace open\controllers;
+namespace www\controllers;
+use common\components\configDict;
+
+use common\components\util;
+
 use Yii;
 use yii\web\Controller;
+use yii\filters\AccessControl;
+use common\services\xhWxOpenAdminService;
 
-class MainController extends BaseController
+class MainController extends PlatformController
 {
 
+	public $withoutLogin = ['login','logout','check-login'];
+
     public function actionIndex()
     {
+		return $this->render('index');
+    }
+
+    public function actionLogin()
+    {
+
+    }
 
+    /**
+     * 重复登陆,记录登陆名
+     */
+    public function actionRelogin()
+    {
+    	return $this->renderPartial('relogin');
+    }
+
+    public function actionLogout()
+    {
+    	xhWxOpenAdminService::logout();//不注销所有的 用户会话数据
+    	$this->redirect(['main/login']);
+    }
+
+    public function actionCheckLogin()
+    {
+    	$request	= Yii::$app->request;  	
+    	$mobile		= $request->post('mobile');
+    	$password	= $request->post('password');
+		$return		= xhWxOpenAdminService::loginByMobile($mobile, $password,true);//true 自动登陆
+		if($return){
+			util::successInfo('success');
+		}
+		util::failInfo('帐号或密码错误');
+    }
+    
+    public function actionRunning()
+    {
+    	return $this->render('running');
+    }
+    
+    public function actionBook()
+    {
+    	return $this->render('book');
     }
 
-}
+}

+ 42 - 0
app/www/controllers/MerchantController.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace www\controllers;
+
+use biz\admin\services\AdminService;
+use biz\merchant\services\MerchantService;
+use common\components\util;
+use Yii;
+
+class MerchantController extends BaseController
+{
+	
+	//商家列表 shish 2019.12.20
+	public function actionList()
+	{
+		$where = [];
+		$list = MerchantService::getSaasMerchant($where);
+		util::success($list);
+	}
+	
+	//获取当前登陆老板的帐号详情,官网购买套餐时使用 shish 2020.1.11
+	public function actionLoginAccount()
+	{
+		$userId = $this->userId;
+		$admin = AdminService::getByCondition(['platUserId' => $userId]);
+		if (empty($admin)) {
+			util::fail('没有找到注册信息');
+		}
+		$merchantId = $admin['merchantId'];
+		$merchant = MerchantService::getMerchantById($merchantId);
+		util::success($merchant);
+	}
+	
+	//商家信息 shish 2020.1.11
+	public function actionDetail()
+	{
+		$id = Yii::$app->request->get('id');
+		$merchant = MerchantService::getMerchantById(12358);
+		util::success($merchant);
+	}
+
+}

+ 33 - 0
app/www/controllers/MiniUpgradeController.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace www\controllers;
+
+use biz\weixin\services\MiniUpgradeService;
+use common\components\util;
+use Yii;
+use yii\web\Controller;
+
+class MiniUpgradeController extends BaseController
+{
+	
+	//审核记录
+	public function actionList()
+	{
+		$where = [];
+		$status = Yii::$app->request->get('status', -1);
+		if ($status != -1) {
+			$where['status'] = $status;
+		}
+		$list = MiniUpgradeService::getUpgradeList($where);
+		$list['version'] = 11;
+		util::success($list);
+	}
+	
+	//更新版本 shish 2019.12.20
+	public function actionUpdate()
+	{
+		$version = Yii::$app->request->get('version');
+		util::ok('提交成功');
+	}
+
+}

+ 22 - 0
app/www/controllers/OrderController.php

@@ -0,0 +1,22 @@
+<?php
+namespace www\controllers;
+use biz\order\services\OrderService;
+use biz\retail\services\RetailAssetService;
+use Yii;
+use common\components\util;
+
+class OrderController extends BaseController
+{
+
+	public function actionList()
+	{
+		$get = Yii::$app->request->get();
+		$status = isset($get['status']) ? $get['status'] : 0;
+		$where = ['status' => $status];
+		$list = OrderService::getOrderList($where);
+		$asset = RetailAssetService::getAsset();
+		$list['asset'] = $asset;
+		util::success($list);
+	}
+
+}

+ 41 - 0
app/www/controllers/PlatformController.php

@@ -0,0 +1,41 @@
+<?php
+namespace www\controllers;
+
+use biz\auth\services\PlatMenuService;
+use Yii;
+use yii\web\Controller;
+use common\services\xhWxOpenAdminService;
+
+/**
+ * 平台次级基类,次于PublicController
+ */
+class PlatformController extends PublicController
+{
+	
+	public $isLogin = false;
+	public $withoutLogin = [];//不需要登陆的方法名
+	public $admin, $adminId, $menuList, $subMenuList;
+	
+	public function beforeAction($action)
+	{
+		
+		//取一级菜单 二级菜单 shish 2019.8.17
+		$controllerName = $action->controller->id;
+		$actionName = $action->id;
+		$this->menuList = PlatMenuService::getMenu($controllerName);
+		$this->subMenuList = PlatMenuService::getSubMenu($controllerName, $actionName);
+		
+		$this->isLogin = xhWxOpenAdminService::isLogin();
+		if (!in_array($action->id, $this->withoutLogin) && $this->isLogin == false) {
+			$this->redirect(['main/login']);
+			Yii::$app->end();
+		}
+		if ($this->isLogin) {
+			$adminId = xhWxOpenAdminService::getId();
+			$admin = xhWxOpenAdminService::getById($adminId);
+			$this->adminId = $adminId;
+		}
+		return parent::beforeAction($action);
+	}
+	
+}

+ 1 - 1
app/www/controllers/PublicController.php

@@ -1,5 +1,5 @@
 <?php
-namespace open\controllers;
+namespace www\controllers;
 use common\services\xhWxOpenAdminService;
 
 use Yii;

+ 25 - 57
app/www/controllers/RenewController.php

@@ -1,71 +1,39 @@
 <?php
 
-namespace open\controllers;
+namespace www\controllers;
 
 use biz\saas\services\RenewService;
-use biz\saas\services\SetMealService;
-use common\components\configDict;
-use common\components\stringUtil;
 use common\components\util;
 use Yii;
 
 class RenewController extends BaseController
 {
-	
-	//微信支付 shish 2019.12.23
+
+	public function actionList()
+	{
+		$where = [];
+		$list = RenewService::getRenewList($where);
+		util::success($list);
+	}
+
+	//微信支付购买 shish 2020.1.11
 	public function actionWxPay()
 	{
-		ini_set('date.timezone', 'Asia/Shanghai');
-		$setId = Yii::$app->request->get('setId', 1);
-		$set = SetMealService::getById($setId);
-		if (empty($set)) {
-			util::fail('没有找到套餐');
-		}
-		$post['userId'] = $this->userId;
-		$price = $set['price'];
-		$post['prePrice'] = $price;
-		$post['actPrice'] = $price;
-		$post['payWay'] = 0;
-		$post['orderSn'] = 'RE'.stringUtil::buildOrderNo();
-		$now = time();
-		$expireTime = $now + 300;//订单5分钟后过期
-		$post['createTime'] = date("Y-m-d H:i:s", $now);
-		$post['deadline'] = $expireTime;
-		$renew = RenewService::add($post);
-		$orderId = $renew['orderSn'];
-		$name = $set['name'] . '购买续费';
-		$totalFee = $price;
-		$user = $this->user;
-		$openId = $user['openId'];
-		$typeList = configDict::getConfig('capitalType');
-		$capitalType = $typeList['xhOrder']['id'];
-		$attach = 'capitalType=' . $capitalType . '&couponId=0';//将流水类型、优惠卷传过去
-		$wx = Yii::getAlias("@vendor/weixin");
-		require_once($wx . '/lib/WxPay.Api.php');
-		require_once($wx . '/example/WxPay.JsApiPay.php');
-		$input = new \WxPayUnifiedOrder();
-		$input->SetBody($name);
-		$input->SetOut_trade_no($orderId);
-		$input->SetTotal_fee($totalFee * 100);
-		$input->SetTime_start(date("YmdHis", $now));
-		$input->SetAttach($attach);
-		$input->SetTime_expire(date("YmdHis", $expireTime));//设置订单有效期5分钟
-		$input->SetNotify_url($this->frontUrl . '/notice/weixin-callback/');
-		$input->SetTrade_type("JSAPI");
-		
-		//花卉宝代为申请的微信支付
-		$merchantExtend = $this->merchantExtend;
-		if ($merchantExtend['generalMerchant'] == 1) {
-			$input->SetSub_openid($openId);
-		} else {
-			$input->SetOpenid($openId);
-		}
-		$wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
-		$tools = new \JsApiPay();
-		$jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
-		$newParams = json_decode($jsApiParameters, true);
-		$newParams['orderId'] = $orderId;
-		util::success($newParams);
+		$id = Yii::$app->request->get('id');
+		$string = '{
+		"code": 1,
+    "msg": "操作成功",
+    "data": {
+			"appId": "wx193341a4a80f6ea3",
+        "nonceStr": "tfunt38g0s8jcxo9g09ep3i65t9bwh1c",
+        "package": "prepay_id=wx11163027396857ab83a8c8431935656300",
+        "signType": "MD5",
+        "timeStamp": "1578731428",
+        "paySign": "B6197F9059697DC799273F36C7A17C43"
+    }
+}';
+		$r = json_decode($string, true);
+		util::success($r['data']);
 	}
 
 }

+ 37 - 0
app/www/controllers/SetAuthController.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace www\controllers;
+
+use biz\saas\services\SetAuthService;
+use Yii;
+use common\components\util;
+
+
+class SetAuthController extends BaseController
+{
+	
+	//套餐列表 shish 2019.12.8
+	public function actionUpdate()
+	{
+		$post = Yii::$app->request->post();
+		$setId = isset($post['setId']) ? $post['setId'] : 0;
+		$endId = isset($post['endId']) ? $post['endId'] : 0;
+		$auth = isset($post['auth']) ? $post['auth'] : '*';
+		SetAuthService::updateByCondition(['setId' => $setId, 'endId' => $endId], ['auth' => $auth]);
+		util::ok('修改成功');
+	}
+	
+	public function actionDetail()
+	{
+		$get = Yii::$app->request->get();
+		$setId = isset($get['setId']) ? $get['setId'] : 0;
+		$endId = isset($get['endId']) ? $get['endId'] : 0;
+		$return = SetAuthService::getByCondition(['setId' => $setId, 'endId' => $endId]);
+		$authList = [];
+		if (isset($return['auth']) && !empty($return['auth'])) {
+			$authList = explode(',', $return['auth']);
+		}
+		util::success($authList);
+	}
+	
+}

+ 63 - 0
app/www/controllers/SetMealController.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace www\controllers;
+
+use biz\saas\services\SetMealService;
+use Yii;
+use common\components\util;
+
+
+class SetMealController extends BaseController
+{
+	
+	//套餐列表 shish 2019.12.8
+	public function actionList()
+	{
+		$fest = SetMealService::getAllByCondition([], null, '*');
+		util::success($fest);
+	}
+	
+	//添加套餐 shish 2019.12.21
+	public function actionAdd()
+	{
+		$post = Yii::$app->request->post();
+		$return = SetMealService::add($post);
+		util::success($return);
+	}
+	
+	//修改套餐 shish 2019.12.21
+	public function actionUpdate()
+	{
+		$post = Yii::$app->request->post();
+		$id = $post['id'];
+		unset($post['id']);
+		SetMealService::updateById($id, $post);
+		util::ok();
+	}
+	
+	//套餐详情 shish 2019.12.21
+	public function actionDetail()
+	{
+		$id = Yii::$app->request->get('id');
+		$fest = SetMealService::getById($id);
+		util::success($fest);
+	}
+	
+	//花店老板查看套餐详情 shish 2020.1.11
+	public function actionGetDetail()
+	{
+		$id = Yii::$app->request->get('id', 1);
+		$detail = SetMealService::getSetById($id);
+		$detail['introduce'] = '适用于5人以下的花店,可以满足日常的经常、管理和营销需求。';
+		$function = [
+			['name' => '微信商城', 'has' => 1],
+			['name' => '节日自动涨价', 'has' => 1],
+			['name' => '小程序商城', 'has' => 1],
+			['name' => '人脸支付', 'has' => 0],
+		];
+		$free = rand(0, 1);
+		$data = ['detail' => $detail, 'function' => $function, 'free' => $free];
+		util::success($data);
+	}
+	
+}

+ 19 - 0
app/www/controllers/ShopController.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace www\controllers;
+
+use biz\merchant\services\ShopService;
+use common\components\util;
+use Yii;
+
+class ShopController extends BaseController
+{
+	
+	public function actionList()
+	{
+		$where = [];
+		$list = ShopService::getShopList($where);
+		util::success($list);
+	}
+
+}

+ 44 - 0
app/www/controllers/StaffController.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace www\controllers;
+
+use biz\saas\services\StaffService;
+use common\components\jwt;
+use common\components\stringUtil;
+use common\components\util;
+use Yii;
+
+class StaffController extends BaseController
+{
+	
+	public function actionLogin()
+	{
+		//登陆并拿到token shish 2019.11.23
+		$get = Yii::$app->request->get();
+		$mobile = isset($get['mobile']) ? $get['mobile'] : 0;
+		if (stringUtil::isMobile($mobile) == false) {
+			util::fail('请填写正常的手机号');
+		}
+		$password = isset($get['password']) && !empty($get['password']) ? $get['password'] : '';
+		if (empty($password)) {
+			util::fail('请输入密码');
+		}
+		
+		$staff = StaffService::getByCondition(['mobile' => $mobile]);
+		if (password_verify($password, $staff['password']) == false) {
+			util::fail('密码错误');
+		}
+		$staffId = $staff['id'];
+		//获取token
+		$token = jwt::getNewToken($staffId);
+		util::success(['token' => $token]);
+	}
+
+	//登陆员工的详情 shish 2019.12.26
+	public function actionLoginDetail()
+	{
+		$detail = StaffService::getDetail($this->staffId);
+		util::success($detail);
+	}
+
+}

+ 60 - 0
app/www/controllers/UserController.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace www\controllers;
+
+use biz\merchant\services\MerchantAssetService;
+use biz\retail\services\RetailAssetService;
+use biz\user\services\UserService;
+use common\components\util;
+use Yii;
+
+class UserController extends BaseController
+{
+	
+	public function actionList()
+	{
+		$get = Yii::$app->request->get();
+		$type = isset($get['type']) ? $get['type'] : -1;
+		$where = [];
+		switch ($type) {
+			case 1:
+				//粉丝
+				$where['subscribe'] = 1;
+				break;
+			case 2:
+				//会员
+				$where['member>'] = -1;
+				break;
+			default:
+		}
+		$list = UserService::getUserList($where);
+		$asset = RetailAssetService::getAsset();
+		$list['asset'] = $asset;
+		util::success($list);
+	}
+	
+	//客户列表 shish 2019.11.30
+	public function actionOaList()
+	{
+		$get = Yii::$app->request->get();
+		$type = isset($get['type']) ? $get['type'] : -1;
+		$merchantId = 12358;
+		$where = ['merchantId' => $merchantId];
+		switch ($type) {
+			case 1:
+				//粉丝
+				$where['subscribe'] = 1;
+				break;
+			case 2:
+				//会员
+				$where['member>'] = -1;
+				break;
+			default:
+		}
+		$list = UserService::getUserList($where);
+		$merchantAsset = MerchantAssetService::getByMerchantId($merchantId);
+		$list['asset'] = $merchantAsset;
+		util::success($list);
+	}
+	
+}

+ 2 - 9
app/www/controllers/ZhhController.php

@@ -1,22 +1,15 @@
 <?php
-namespace open\controllers;
+namespace www\controllers;
 use common\components\configDict;
-
 use common\components\util;
-
 use Yii;
 use yii\web\Controller;
 use yii\filters\AccessControl;
 use common\services\xhWxOpenAdminService;
 
-class ZhhController extends OpenendController
+class ZhhController extends PlatformController
 {
 
 	public $withoutLogin = [];
-    
-    public function actionRunning()
-    {
-    	return $this->render('running');
-    }
 
 }

+ 1 - 0
common/config/bootstrap.php

@@ -5,5 +5,6 @@ Yii::setAlias('@business', dirname(dirname(__DIR__)) . '/app/business');
 Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
 Yii::setAlias('@open', dirname(dirname(__DIR__)) . '/app/open');
 Yii::setAlias('@saas', dirname(dirname(__DIR__)) . '/app/saas');
+Yii::setAlias('@www', dirname(dirname(__DIR__)) . '/app/www');
 Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/app/api');
 Yii::setAlias('@biz', dirname(dirname(__DIR__)) . '/biz');