Commit b173804b authored by luhongguang's avatar luhongguang

Merge branch 'test'

parents 6ecea2b9 03db065e
<?php
namespace App\Models\goods\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
/**
* Class LifeAccountShopNum
* 生活号下店铺的数量
* @package App\Models\goods\mysql
*/
class LifeAccountShopNum extends MysqlBase
{
const TABLE_NAME = 'life_account_shop_num';
const CONFIG_INDEX = 'goods';
const PRIMARY_KEY = 'life_account_id';
public static function getRecord($where, $colums = [])
{
if (empty($colums)) {
$colums = '*';
}
return self::get($colums, $where);
}
public static function getRecordMaster($where, $colums = [])
{
if (empty($colums)) {
$colums = '*';
}
return self::selectMaster($colums, $where);
}
public static function save($data, $where = [])
{
if (empty($where)) {
return self::insert($data);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
...@@ -19,6 +19,7 @@ use App\Models\goods\mysql\GoodsSkuPicRecord; ...@@ -19,6 +19,7 @@ use App\Models\goods\mysql\GoodsSkuPicRecord;
use App\Models\goods\mysql\GoodsSkuSubShop; use App\Models\goods\mysql\GoodsSkuSubShop;
use App\Models\goods\mysql\GoodsSnapshot; use App\Models\goods\mysql\GoodsSnapshot;
use App\Models\goods\mysql\GoodsSpu; use App\Models\goods\mysql\GoodsSpu;
use App\Models\goods\mysql\LifeAccountShopNum;
use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord; use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord;
use App\Models\goods\mysql\Shop; use App\Models\goods\mysql\Shop;
use App\Models\marketing\mysql\Distributor; use App\Models\marketing\mysql\Distributor;
...@@ -256,6 +257,13 @@ class GoodsService ...@@ -256,6 +257,13 @@ class GoodsService
"merchant_id" => $lifeAccount["merchant_id"], "merchant_id" => $lifeAccount["merchant_id"],
"status" => Shop::STATUS_ONLINE, "status" => Shop::STATUS_ONLINE,
]); ]);
$shopNum = LifeAccountShopNum::getRecord(["life_account_id" => $lifeAccountId]);
if (empty($shopNum)) {
LifeAccountShopNum::save(["life_account_id" => $lifeAccountId, "number" => 1]);
} else {
LifeAccountShopNum::save(["number" => $shopNum["number"] + 1], ["life_account_id" => $lifeAccountId]);
}
} else { } else {
$shopId = $shop[0]["shop_id"]; $shopId = $shop[0]["shop_id"];
} }
...@@ -334,7 +342,7 @@ class GoodsService ...@@ -334,7 +342,7 @@ class GoodsService
throw new GoodsException(["cus" => 12]); throw new GoodsException(["cus" => 12]);
} }
//驳回时候要有原因 //驳回时候要有原因
if ($status == GoodsSku::STATUS_REJECT && empty($params["rejected_reason"])) { if ($status == GoodsSku::STATUS_REJECT && strlen(trim($params["rejected_reason"])) == 0) {
throw new GoodsException(["cus" => 9]); throw new GoodsException(["cus" => 9]);
} }
...@@ -381,6 +389,10 @@ class GoodsService ...@@ -381,6 +389,10 @@ class GoodsService
"note" => $rejectedReason, "note" => $rejectedReason,
]; ];
GoodsOperationRecord::insertRecord($record); GoodsOperationRecord::insertRecord($record);
//审核通过并且上架后,添加镜像
if ($status == GoodsSku::STATUS_PASS) {
self::addGoodsSnapshot($sku);
}
self::updateGoodsInfoToEs($goodsSkuId); self::updateGoodsInfoToEs($goodsSkuId);
} }
...@@ -466,6 +478,7 @@ class GoodsService ...@@ -466,6 +478,7 @@ class GoodsService
if (empty($skuInfo["setmeal"])) { if (empty($skuInfo["setmeal"])) {
$skuInfo["setmeal"] = json_encode([]); $skuInfo["setmeal"] = json_encode([]);
} }
unset($skuInfo["is_import"], $skuInfo["update_time"], $skuInfo["create_time"]);
GoodsSnapshot::insertRecord($skuInfo); GoodsSnapshot::insertRecord($skuInfo);
} }
...@@ -756,7 +769,7 @@ class GoodsService ...@@ -756,7 +769,7 @@ class GoodsService
} }
} }
} }
$recordList = GoodsOperationRecord::select("*", ["goods_spu_id" => $goodsSpuId]); $recordList = GoodsOperationRecord::select("*", ["goods_spu_id" => $goodsSpuId, "ORDER"=>["create_time"=>"DESC"]]);
if (!empty($recordList)) { if (!empty($recordList)) {
foreach ($recordList as $key => $record) { foreach ($recordList as $key => $record) {
$data["record_list"][$key]["status"] = $record["goods_status"]; $data["record_list"][$key]["status"] = $record["goods_status"];
......
...@@ -13,6 +13,7 @@ use Api\PhpServices\Ksy\Ksyun; ...@@ -13,6 +13,7 @@ use Api\PhpServices\Ksy\Ksyun;
use App\Exception\custom\MarketingException; use App\Exception\custom\MarketingException;
use App\Services\common\CommonService; use App\Services\common\CommonService;
use Api\PhpServices\Sensitive\Sensitive; use Api\PhpServices\Sensitive\Sensitive;
use App\Services\goods\GoodsService;
class MarketingGoodsService class MarketingGoodsService
{ {
public static function getMarketingGoodsList($params) public static function getMarketingGoodsList($params)
......
...@@ -72,6 +72,7 @@ class MarketingService ...@@ -72,6 +72,7 @@ class MarketingService
$where = [ $where = [
'online_status' => 1, 'online_status' => 1,
'rule_refund' => 2, 'rule_refund' => 2,
"expiration_time[>]" => date("Y-m-d"),
]; ];
if (!empty($tmpGoodsSkuId)) { if (!empty($tmpGoodsSkuId)) {
......
...@@ -6,6 +6,7 @@ namespace Daemon; ...@@ -6,6 +6,7 @@ namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface; use Api\PhpServices\Daemon\DaemonServiceInterface;
use App\Models\goods\mysql\GoodsSku; use App\Models\goods\mysql\GoodsSku;
use Api\PhpUtils\Log\FileLog;
class Goods implements DaemonServiceInterface class Goods implements DaemonServiceInterface
{ {
public function __construct(int $mid) public function __construct(int $mid)
...@@ -18,9 +19,10 @@ class Goods implements DaemonServiceInterface ...@@ -18,9 +19,10 @@ class Goods implements DaemonServiceInterface
sleep(2); sleep(2);
$orderData = [ $orderData = [
'online_status' => 1, 'online_status' => 1,
'rule_end_time[<]' => date("Y-m-d H:i:s",time()) 'expiration_time[<]' => date("Y-m-d H:i:s",time())
]; ];
$goodsList = GoodsSku::getRecords($orderData); $goodsList = GoodsSku::getRecords($orderData);
FileLog::info('DaemonServiceInterface_goods', json_encode($goodsList));
foreach ($goodsList as $key => $value) { foreach ($goodsList as $key => $value) {
$where = []; $where = [];
$where['goods_sku_id'] = !empty($value['goods_sku_id']) ? $value['goods_sku_id'] : ''; $where['goods_sku_id'] = !empty($value['goods_sku_id']) ? $value['goods_sku_id'] : '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment