Browse Source

购买订单

shish 6 years ago
parent
commit
d2524430e8

+ 19 - 0
app/saas/controllers/RenewController.php

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

+ 42 - 0
biz/saas/classes/RenewClass.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace biz\saas\classes;
+
+use biz\merchant\classes\MerchantClass;
+use biz\user\classes\UserClass;
+use Yii;
+use biz\base\classes\BaseClass;
+
+class RenewClass extends BaseClass
+{
+	
+	public static $baseFile = '\biz\saas\models\Renew';
+	
+	public static function getRenewList($where)
+	{
+		$data = self::getList('*', $where, 'addTime DESC');
+		$list = isset($data['list']) ? $data['list'] : [];
+		if (empty($list)) {
+			return $data;
+		}
+		$ids = array_column($list, 'merchantId');
+		$merchant = MerchantClass::getMerchantByIds($ids);
+		$userIdList = array_column($list, 'userId');
+		$user = UserClass::getUserByIds($userIdList);
+		$setIds = array_column($list, 'setId');
+		$setIds = array_filter(array_unique($setIds));
+		$set = SetMealClass::getSetByIds($setIds);
+		foreach ($list as $key => $val) {
+			$merchantId = $val['merchantId'];
+			$userId = $val['userId'];
+			$setId = $val['setId'];
+			$list[$key]['merchantName'] = isset($merchant[$merchantId]['merchantName']) ? $merchant[$merchantId]['merchantName'] : '';
+			$list[$key]['userName'] = isset($user[$userId]['userName']) ? $user[$userId]['userName'] : '';
+			$list[$key]['mobile'] = isset($user[$userId]['mobile']) ? $user[$userId]['mobile'] : '';
+			$list[$key]['setName'] = isset($set[$setId]['name']) ? $set[$setId]['name'] : '';
+		}
+		$data['list'] = $list;
+		return $data;
+	}
+	
+}

+ 6 - 1
biz/saas/classes/SetMealClass.php

@@ -9,5 +9,10 @@ class SetMealClass extends BaseClass
 {
 	
 	public static $baseFile = '\biz\saas\models\SetMeal';
-
+	
+	public static function getSetByIds($ids)
+	{
+		return self::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
+	}
+	
 }

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

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

+ 19 - 0
biz/saas/services/RenewService.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace biz\saas\services;
+
+use biz\base\services\BaseService;
+use biz\saas\classes\RenewClass;
+
+class RenewService extends BaseService
+{
+	
+	public static $baseFile = '\biz\saas\classes\RenewClass';
+	
+	//续费列表 shish 2019.12.20
+	public static function getRenewList($where)
+	{
+		return RenewClass::getRenewList($where);
+	}
+	
+}

+ 4 - 4
biz/saas/services/SetMealService.php

@@ -8,13 +8,13 @@ use Yii;
 
 class SetMealService extends BaseService
 {
-
+	
 	public static $baseFile = '\biz\saas\classes\SetMealClass';
-
+	
 	//根据id批量取套餐信息 shish 2019.12.20
 	public static function getSetByIds($ids)
 	{
-		return SetMealClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
+		return SetMealClass::getSetByIds($ids);
 	}
-
+	
 }

+ 13 - 0
biz/user/classes/UserClass.php

@@ -420,4 +420,17 @@ class UserClass extends BaseClass
 		return true;
 	}
 
+	public static function getUserByIds($ids)
+	{
+		$info = self::getByIds($ids, null, 'id');
+		if (empty($info)) {
+			return [];
+		}
+		$imgUrl = Yii::$app->params['imgUrl'];
+		foreach ($info as $userId => $user) {
+			$info[$userId]['avatar'] = !empty($user['avatar']) ? $imgUrl . $user['avatar'] : '';
+		}
+		return $info;
+	}
+
 }

+ 9 - 17
biz/user/services/UserService.php

@@ -46,9 +46,9 @@ class UserService extends BaseService
 	}
 	
 	//根据手机号查询客户 shish 2019.12.1
-	public static function getByMobile($mobile,$merchantId)
+	public static function getByMobile($mobile, $merchantId)
 	{
-		return UserClass::getByMobile($mobile,$merchantId);
+		return UserClass::getByMobile($mobile, $merchantId);
 	}
 	
 	/**
@@ -237,18 +237,18 @@ class UserService extends BaseService
 		}
 		return $info;
 	}
-
+	
 	//升级成为会员,并更新用户相关信息 shish 2019.9.7
 	public static function upgradeToMember($userId, $merchantId, $data = [])
 	{
 		$data['isMember'] = 1;
 		self::updateById($userId, $data);
 		UserAssetService::updateByUserId($userId, ['isMember' => 1]);
-
+		
 		/**会员数+1**/
 		MerchantAssetService::addMemberNum($merchantId);
 	}
-
+	
 	//取消关注 shish 2019.9.8
 	public static function unFocus($userId, $merchantId)
 	{
@@ -260,15 +260,7 @@ class UserService extends BaseService
 	//批量获取用户信息,图片等信息处理好了 shish 2019.11.28
 	public static function getUserByIds($ids)
 	{
-		$info = self::getByIds($ids, null, 'id');
-		if (empty($info)) {
-			return [];
-		}
-		$imgUrl = Yii::$app->params['imgUrl'];
-		foreach ($info as $userId => $user) {
-			$info[$userId]['avatar'] = !empty($user['avatar']) ? $imgUrl . $user['avatar'] : '';
-		}
-		return $info;
+		return UserClass::getUserByIds($ids);
 	}
 	
 	//验证支付密码是否正确 shish 2019.12.6
@@ -282,17 +274,17 @@ class UserService extends BaseService
 			util::fail('密码错误');
 		}
 	}
-
+	
 	//验证用户权限
 	public static function valid($info, $merchantId)
 	{
 		return UserClass::valid($info, $merchantId);
 	}
-
+	
 	//根据消费次数和有没领优惠券来判断是不是新人
 	public static function newUser($userInfo)
 	{
 		return UserClass::newUser($userInfo);
 	}
-
+	
 }

+ 5 - 0
sql.txt

@@ -19,6 +19,11 @@ ALTER TABLE `xhApply` MODIFY `status` TINYINT NOT NULL DEFAULT 0 COMMENT '0审
 ALTER TABLE `xhMiniUpgrade` MODIFY `status` TINYINT NOT NULL DEFAULT 0 COMMENT '0待审核 1审核通过,待上线 2审核未通过 3已上线';
 ALTER TABLE `xhMiniUpgrade` ADD `onTime` INT NOT NULL DEFAULT 0 COMMENT '上线时间' AFTER `version`;
 ALTER TABLE `xhMiniUpgrade` MODIFY `status` TINYINT NOT NULL DEFAULT 0 COMMENT '0待审核 1待上线 2已上线 3审核未通过';
+RENAME TABLE `xhRenewAccount` TO `xhRenew`;
+ALTER TABLE `xhRenew` DROP COLUMN `dealStatus`;
+ALTER TABLE `xhRenew` MODIFY `status` TINYINT NOT NULL DEFAULT 0 COMMENT '0 待付款 1已付款';
+ALTER TABLE `xhRenew` DROP COLUMN `orderStyle`;
+ALTER TABLE `xhRenew` ADD setId SMALLINT NOT NULL DEFAULT 0 COMMENT '套餐id' AFTER `remark`;
 
 2019.12.19 20:14 商家相关再更新
 ALTER TABLE `xhMerchantAsset` MODIFY `totalOrder` INT NOT NULL DEFAULT 0 COMMENT '订单总数,包括所有的';