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) {
$res = "无货";
$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();
// var_dump($goods);
// exit();
if ($goods['region'] && !in_array($city->id, json_decode($goods['region']))) {
$data = [
'state' => "无货",
@ -124,8 +129,9 @@ class Goods extends Controller
$arr = [];
$ret = $jd->getGoodsStock($province->jd_code, $city->jd_code, $district->jd_code, $goods['goods_no'], $value['num'] ?? 1);
//var_dump($ret);
if ($ret) {
$res = $ret['stockResp']['desc'];
$res = $ret['stockResp']['desc'] ?? "无货";
if (strpos($res, "无货") !== false) {
$res = "无货";
} elseif (strpos($res, "有货") == false) {

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

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

Loading…
Cancel
Save