lqmac 5 months ago
parent 53d652bc85
commit d5f521c8db
  1. 8
      app/api/controller/Goods.php
  2. 6
      app/command/CalDealerTime.php
  3. 2
      app/store/model/Goods.php

@ -91,8 +91,13 @@ class Goods extends Controller
foreach ($params['list'] as $value) { foreach ($params['list'] as $value) {
$res = "无货"; $res = "无货";
$goods = GoodsModel::where('goods_id', $value['goods_id'])->find(); $goods = GoodsModel::where('goods_id', $value['goods_id'])->find();
if (!$goods) {
return $this->renderError('商品不存在');
}
//限制销售区域 //限制销售区域
$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find(); $city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find();
// var_dump($goods);
// exit();
if ($goods['region'] && !in_array($city->id, json_decode($goods['region']))) { if ($goods['region'] && !in_array($city->id, json_decode($goods['region']))) {
$data = [ $data = [
'state' => "无货", 'state' => "无货",
@ -124,8 +129,9 @@ class Goods extends Controller
$arr = []; $arr = [];
$ret = $jd->getGoodsStock($province->jd_code, $city->jd_code, $district->jd_code, $goods['goods_no'], $value['num'] ?? 1); $ret = $jd->getGoodsStock($province->jd_code, $city->jd_code, $district->jd_code, $goods['goods_no'], $value['num'] ?? 1);
//var_dump($ret);
if ($ret) { if ($ret) {
$res = $ret['stockResp']['desc']; $res = $ret['stockResp']['desc'] ?? "无货";
if (strpos($res, "无货") !== false) { if (strpos($res, "无货") !== false) {
$res = "无货"; $res = "无货";
} elseif (strpos($res, "有货") == false) { } elseif (strpos($res, "有货") == false) {

@ -53,9 +53,11 @@ class CalDealerTime extends Command
private function dealerUser($nowDay) private function dealerUser($nowDay)
{ {
$dealerUser = (new User)->where(['user_type' => UserTypeEnum::DEALER]) $dealerUser = (new User)->where(['user_type' => UserTypeEnum::DEALER])
->whereDay('fx_effective_time', $nowDay) ->where('fx_effective_time', "<", $nowDay)
->field('user_id,user_type,fx_effective_time,effective_time') ->field('user_id,user_type,fx_effective_time,effective_time,store_id')
->select(); ->select();
// var_dump($dealerUser);
// exit();
$plusUserIds = []; $plusUserIds = [];
$normalUserIds = []; $normalUserIds = [];
if (!$dealerUser->isEmpty()) { if (!$dealerUser->isEmpty()) {

@ -310,6 +310,8 @@ class Goods extends GoodsModel
private function createData(array $data): array private function createData(array $data): array
{ {
$data['goods_sku_no'] = $data['goods_no'] ?? ""; $data['goods_sku_no'] = $data['goods_no'] ?? "";
$data['link'] = $data['goods_no'] ? "https://item.jd.com/".$data['goods_no'].".html" : "";
// 默认数据 // 默认数据
$data = array_merge($data, [ $data = array_merge($data, [
'line_price' => $data['line_price'] ?? 0, 'line_price' => $data['line_price'] ?? 0,

Loading…
Cancel
Save