소스 검색

广告管理

shish 6 년 전
부모
커밋
1cee8235a7

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

@@ -128,7 +128,7 @@ class OrderController extends BaseController
 	public function actionOrderRelate()
 	{
 		$regionTree = RegionService::tree();
-		$shop = ShopService::getDefaultShopInfo($this->merchant);
+		$shop = ShopService::getDefaultShop($this->merchant);
 		$freight = MerchantExtendService::getFreight($this->merchantExtend);
 		$out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree];
 		util::success($out);

+ 7 - 5
app/client/controllers/ShopController.php

@@ -2,6 +2,7 @@
 
 namespace client\controllers;
 
+use biz\ad\services\AdService;
 use biz\goods\services\CategoryService;
 use biz\goods\services\GoodsCategoryService;
 use biz\merchant\services\MerchantService;
@@ -12,13 +13,14 @@ use common\components\util;
 
 class ShopController extends BaseController
 {
-	
-	//获取用户所属商家的默认门店 shish 2019.12.6
-	public function actionDefaultShop()
+
+	//获取商家的默认门店 shish 2019.12.6
+	public function actionDetail()
 	{
 		$merchant = $this->merchant;
-		$shop = ShopService::getDefaultShopInfo($merchant);
-		util::success($shop);
+		$shop = ShopService::getDefaultShop($merchant);
+		$ad = AdService::getAdList($this->merchantId);
+		util::success(['ad' => $ad, 'shop' => $shop]);
 	}
 
 }

+ 16 - 1
biz/ad/classes/AdClass.php

@@ -1,9 +1,24 @@
 <?php
+
 namespace biz\ad\classes;
 
 use \biz\base\classes\BaseClass;
 
 class AdClass extends BaseClass
 {
-    public static $baseFile = '\biz\ad\models\Ad';
+	
+	public static $baseFile = '\biz\ad\models\Ad';
+	
+	//取出有效的广告 shish 2019.12.13
+	public static function getAdList($merchantId)
+	{
+		$time = time();
+		return self::getAllByCondition([
+			'merchantId' => $merchantId,
+			'status' => 1,
+			'startTime<' => $time,
+			'endTime>' => $time
+		], 'inTurn DESC', '*');
+	}
+	
 }

+ 9 - 0
biz/ad/services/AdService.php

@@ -1,9 +1,18 @@
 <?php
 namespace biz\ad\services;
 
+use biz\ad\classes\AdClass;
 use biz\base\services\BaseService;
 
 class AdService extends BaseService
 {
+
     public static $baseFile = '\biz\ad\classes\AdClass';
+
+    //取出有效的广告 shish 2019.12.13
+    public function getAdList($merchantId)
+    {
+		return AdClass::getAdList($merchantId);
+    }
+
 }

+ 1 - 1
biz/merchant/services/ShopService.php

@@ -36,7 +36,7 @@ class ShopService extends BaseService
 	}
 	
 	//获取默认门店信息 shish 2019.12.6
-	public static function getDefaultShopInfo($merchant)
+	public static function getDefaultShop($merchant)
 	{
 		$defaultShopId = $merchant['defaultShopId'];
 		return ShopClass::getById($defaultShopId);

+ 9 - 1
sql.txt

@@ -1,5 +1,13 @@
 2019.12.13 shish
 ALTER TABLE xhWxScene MODIFY `type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '场景类型 0刮刮卡 1邀请有礼领券';
+ALTER TABLE xhShop ADD `openTime` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '营业时间' AFTER `telephone`;
+ALTER TABLE `xhAd` DROP INDEX `merchantId`;
+ALTER TABLE `xhAd` ADD INDEX `merchantId`(`merchantId`);
+ALTER TABLE `xhAd` ADD INDEX `multiple`(`merchantId`,`status`,`startTime`,`endTime`);
+DELETE FROM `xhAd`;
+ALTER TABLE `xhAd` MODIFY `startTime` INT NOT NULL DEFAULT 0 COMMENT '开始时间';
+ALTER TABLE `xhAd` MODIFY `endTime` INT NOT NULL DEFAULT 0 COMMENT '结束时间;方便查询,永不过期情况,使用 开始值0 结束值4102416000即2100-01-01 00:00:00';
+ALTER TABLE `xhAd` DROP COLUMN `forever`;
 
 2019.12.12 shish 我的代理与申请试用
 DROP TABLE IF EXISTS `xhAgentLevel`;
@@ -165,7 +173,7 @@ ALTER TABLE xhCategory CHANGE cover `img` VARCHAR(500) NOT NULL DEFAULT '' COMME
 ALTER TABLE xhAd ADD `status` TINYINT NOT NULL DEFAULT 0 COMMENT '启用状态 0 未启用 1 启用' AFTER `adName`;
 ALTER TABLE xhAd ADD `inTurn` INT NOT NULL DEFAULT 0 COMMENT '排序' AFTER `status`;
 ALTER TABLE xhAd ADD `viewTimes` INT NOT NULL DEFAULT 0 COMMENT '点击次数' AFTER `adImg`;
-ALTER TABLE `huahuibao`.`xhAd` CHANGE `startTime` `startTime` DATETIME NULL COMMENT '开始时间', CHANGE `endTime` `endTime` DATETIME NULL COMMENT '结束时间';
+ALTER TABLE `xhAd` CHANGE `startTime` `startTime` DATETIME NULL COMMENT '开始时间', CHANGE `endTime` `endTime` DATETIME NULL COMMENT '结束时间';
 ALTER TABLE xhAd ADD `forever` TINYINT NOT NULL DEFAULT 0 COMMENT '永久有效:0 未启用 1 永久有效' AFTER `goodsId`;
 
 2019.12.6 shish