Commit 3563bf7c authored by jianghaiming's avatar jianghaiming

Merge branch 'develop' of https://gitlab.yidian-inc.com/bp/goods into develop

parents 797a6ce9 a8092c18
<?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;
use App\Models\goods\mysql\GoodsSkuSubShop;
use App\Models\goods\mysql\GoodsSnapshot;
use App\Models\goods\mysql\GoodsSpu;
use App\Models\goods\mysql\LifeAccountShopNum;
use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord;
use App\Models\goods\mysql\Shop;
use App\Models\marketing\mysql\Distributor;
......@@ -256,6 +257,13 @@ class GoodsService
"merchant_id" => $lifeAccount["merchant_id"],
"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 {
$shopId = $shop[0]["shop_id"];
}
......@@ -381,6 +389,10 @@ class GoodsService
"note" => $rejectedReason,
];
GoodsOperationRecord::insertRecord($record);
//审核通过并且上架后,添加镜像
if ($status == GoodsSku::STATUS_PASS) {
self::addGoodsSnapshot($sku);
}
self::updateGoodsInfoToEs($goodsSkuId);
}
......@@ -466,6 +478,7 @@ class GoodsService
if (empty($skuInfo["setmeal"])) {
$skuInfo["setmeal"] = json_encode([]);
}
unset($skuInfo["is_import"], $skuInfo["update_time"], $skuInfo["create_time"]);
GoodsSnapshot::insertRecord($skuInfo);
}
......
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