瀏覽代碼

申请记录

shish 6 年之前
父節點
當前提交
d419c9f38f

+ 13 - 25
app/saas/controllers/ApplyController.php

@@ -1,34 +1,22 @@
 <?php
+
 namespace saas\controllers;
+
+use biz\saas\services\ApplyService;
+use common\components\util;
 use Yii;
 use yii\web\Controller;
-use common\components\util;
-use common\components\configDict;
-use common\components\weixinUtil;
-use common\components\page;
-use common\components\stringUtil;
-use common\models\xhMerchantAccount;
 
-class ApplyController extends PlatformController
+
+class ApplyController extends BaseController
 {
 
-    /**
-     * 申请列表
-     */
-    public function actionList()
-    {
-    	$get			= Yii::$app->request->get();
-    	$query			= xhMerchantAccount::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();
-	    $now			= time();
-    	return $this->render('list', ['models' => $models,'paging' => $paging]);
-    }
+	//申请列表
+	public function actionList()
+	{
+		$where = [];
+		$list = ApplyService::getApplyList($where);
+		util::success($list);
+	}
 
 }

+ 8 - 3
biz/merchant/classes/MerchantClass.php

@@ -7,20 +7,25 @@ use biz\base\classes\BaseClass;
 
 class MerchantClass extends BaseClass
 {
-
+	
 	public static $baseFile = '\biz\merchant\models\Merchant';
-
+	
 	//常用链接
 	public static $commonUrl = [
 		['id' => 0, 'url' => '/mall/index?account=12358', 'sign' => 'mall', 'name' => '商城'],
 		['id' => 1, 'url' => '/mall/index?account=12358', 'sign' => 'mall', 'name' => '申请会员'],
 		['id' => 2, 'url' => '/mall/index?account=12358', 'sign' => 'mall', 'name' => '点我付款'],
 	];
-
+	
 	//商家信息组合 shish 2019.12.20
 	public static function groupMerchantBaseInfo($list)
 	{
 		return $list;
 	}
 
+	public static function getMerchantByIds($ids)
+	{
+		return self::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
+	}
+
 }

+ 6 - 0
biz/merchant/services/MerchantExtendService.php

@@ -48,5 +48,11 @@ class MerchantExtendService extends BaseService
 			'add' => $arr[1]
 		];
 	}
+
+	//拓展信息列表
+	public static function getExtendByMerchantIds($ids)
+	{
+		return MerchantExtendClass::getAllByCondition(['merchantId' => ['in', $ids]], null, '*', 'merchantId');
+	}
 	
 }

+ 9 - 1
biz/merchant/services/MerchantService.php

@@ -91,7 +91,8 @@ class MerchantService extends BaseService
 		//套餐
 		$setIdList = array_column($list, 'setId');
 		$set = SetMealService::getSetByIds($setIdList);
-		
+		//拓展
+		$ext = MerchantExtendService::getExtendByMerchantIds($merchantIdList);
 		foreach ($list as $key => $val) {
 			$adminId = $val['adminId'];
 			$merchantId = $val['id'];
@@ -99,10 +100,17 @@ class MerchantService extends BaseService
 			$val['adminName'] = isset($admin[$adminId]['adminName']) ? $admin[$adminId]['adminName'] : '';
 			$val['merchantAsset'] = isset($asset[$merchantId]) ? $asset[$merchantId] : [];
 			$val['setMealName'] = isset($set[$setId]) ? $set[$setId]['name'] : '';
+			$val['extend'] = isset($ext[$merchantId]) ? $ext[$merchantId] : [];
 			$list[$key] = business::formatMerchantLogo($val);
 		}
 		$data['list'] = $list;
 		return $data;
 	}
 	
+	//根据id批量取商家 shish 2019.12.20
+	public static function getMerchantByIds($ids)
+	{
+		return MerchantClass::getMerchantByIds($ids);
+	}
+	
 }

+ 13 - 0
biz/saas/classes/ApplyClass.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace biz\saas\classes;
+
+use Yii;
+use biz\base\classes\BaseClass;
+
+class ApplyClass extends BaseClass
+{
+
+	public static $baseFile = '\biz\saas\models\Apply';
+
+}

+ 15 - 0
biz/saas/models/Apply.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace biz\saas\models;
+
+use biz\base\models\Base;
+
+class Apply extends Base
+{
+
+	public static function tableName()
+	{
+		return 'xhApply';
+	}
+
+}

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

@@ -0,0 +1,46 @@
+<?php
+
+namespace biz\saas\services;
+
+use biz\base\services\BaseService;
+use biz\merchant\services\MerchantService;
+use biz\saas\classes\ApplyClass;
+use biz\user\services\UserService;
+
+class ApplyService extends BaseService
+{
+	
+	public static $baseFile = '\biz\saas\classes\ApplyClass';
+	
+	public static function getApplyList($where)
+	{
+		$data = ApplyClass::getList('*', $where, 'addTime DESC');
+		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+		if (empty($list)) {
+			return $data;
+		}
+		//用户信息
+		$userIdList = array_column($list, 'userId');
+		$user = UserService::getUserByIds($userIdList);
+		//商家信息
+		$oldList = array_column($list, 'oldId');
+		$newIdList = array_column($list, 'newId');
+		$idList = array_merge($newIdList, $oldList);
+		$idList = array_unique(array_filter($idList));
+		$merchant = [];
+		if(!empty($idList)){
+			$merchant = MerchantService::getMerchantByIds($idList);
+		}
+
+		foreach ($list as $key => $val) {
+			$userId = $val['userId'];
+			$oldId = $val['oldId'];
+			$list[$key]['userName'] = isset($user[$userId]) ? $user[$userId]['userName'] : '';
+			$list[$key]['oldName'] = isset($merchant[$oldId]['merchantName']) ? $merchant[$oldId]['merchantName'] : '';
+		}
+		$data['list'] = $list;
+		return $data;
+		
+	}
+	
+}

+ 15 - 0
sql.txt

@@ -1,3 +1,18 @@
+2019.12.19 15:22 小程序相关
+ALTER TABLE `xhMerchantExtend` ADD miniVersion INT NOT NULL DEFAULT 0 COMMENT '小程序当前版本' AFTER `miniRefreshToken`;
+DROP TABLE IF EXISTS `xhMiniUpgrade`;
+CREATE TABLE `xhMiniUpgrade`(
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+merchantId INT NOT NULL DEFAULT 0 COMMENT '商家id',
+`version` INT NOT NULL DEFAULT 0 COMMENT '提交版本号',
+`submitTime` INT NOT NULL DEFAULT 0 COMMENT '提交时间',
+`checkTime` INT NOT NULL DEFAULT 0 COMMENT '审核时间',
+`checkReturn` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '审核结果返回的信息',
+`remark` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '备注',
+`status` TINYINT NOT NULL DEFAULT 0 COMMENT '0待审核 1审核通过 2审核未通过',
+`addTime` INT NOT NULL DEFAULT 0 COMMENT '添加时间'
+)COMMENT='小程序升级记录';
+
 2019.12.19 20:14 商家相关再更新
 ALTER TABLE `xhMerchantAsset` MODIFY `totalOrder` INT NOT NULL DEFAULT 0 COMMENT '订单总数,包括所有的';
 ALTER TABLE `xhMerchantAsset` ADD `payOrder` INT NOT NULL DEFAULT 0 COMMENT '付款订单数' AFTER `totalOrder`;