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;
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"];
}
......@@ -334,7 +342,7 @@ class GoodsService
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]);
}
......@@ -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);
}
......@@ -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)) {
foreach ($recordList as $key => $record) {
$data["record_list"][$key]["status"] = $record["goods_status"];
......
......@@ -13,6 +13,7 @@ use Api\PhpServices\Ksy\Ksyun;
use App\Exception\custom\MarketingException;
use App\Services\common\CommonService;
use Api\PhpServices\Sensitive\Sensitive;
use App\Services\goods\GoodsService;
class MarketingGoodsService
{
public static function getMarketingGoodsList($params)
......
......@@ -72,6 +72,7 @@ class MarketingService
$where = [
'online_status' => 1,
'rule_refund' => 2,
"expiration_time[>]" => date("Y-m-d"),
];
if (!empty($tmpGoodsSkuId)) {
......
......@@ -6,6 +6,7 @@ namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface;
use App\Models\goods\mysql\GoodsSku;
use Api\PhpUtils\Log\FileLog;
class Goods implements DaemonServiceInterface
{
public function __construct(int $mid)
......@@ -18,9 +19,10 @@ class Goods implements DaemonServiceInterface
sleep(2);
$orderData = [
'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);
FileLog::info('DaemonServiceInterface_goods', json_encode($goodsList));
foreach ($goodsList as $key => $value) {
$where = [];
$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