lqmac 6 months ago
parent b4ce7fea8b
commit 354715505a
  1. 5
      app/api/controller/Square.php
  2. 7
      app/api/model/Goods.php
  3. 9
      app/api/service/Cart.php
  4. 32
      app/common/model/Goods.php
  5. 2
      app/common/service/Suning.php
  6. 10
      app/job/service/goods/Collector.php
  7. 72
      app/store/controller/Goods.php
  8. 45
      app/store/model/Goods.php
  9. 3
      app/store/model/goods/Import.php
  10. 1
      config/app.php

@ -101,6 +101,11 @@ class Square extends Controller
$files = UploadFile::getFileList($img_ids);
$list['data'][$kr]['imgs'] = $files ?: null;
}
if ($r['files']) {
$img_ids = explode(",", $r['files']);
$files = UploadFile::getFileList($img_ids);
$list['data'][$kr]['files'] = $files ?: null;
}
if ($r['user_name']) {
$files = UploadFile::getFileList([$user['avatar_id']]);
$list['data'][$kr]['avatar_url'] = $files ?: null;

@ -465,7 +465,7 @@ class Goods extends GoodsModel
}
$goodsInfo['merchant'] = null;
//商户信息
if ($goodsInfo['merchant_id'] && !in_array($goodsInfo['channel'], ['jd','jd1','jd2','sn','sn2','xqtx'])) {
if ($goodsInfo['merchant_id'] && !in_array($goodsInfo['channel'], config('app.not_show_merchant'))) {
//if ($goodsInfo['merchant_id']) {
$merchant = \app\common\model\Merchant::detail($goodsInfo['merchant_id'], $goodsInfo->store_id);
if ($merchant) {
@ -484,6 +484,11 @@ class Goods extends GoodsModel
} else {
$goodsInfo['merchant_id'] = 0;
}
//处理苏宁商品,京东价拖的问题
if (in_array($goodsInfo['channel'], ['sn','sn1']) && $goodsInfo['link_other']) {
$goodsInfo['link'] = $goodsInfo['link_other'];
$goodsInfo['goods_no'] = $goodsInfo['goods_no_other'];
}
//加入足迹
$userId = UserService::getCurrentLoginUserId(false) ?? '';
if ($userId) {

@ -50,6 +50,15 @@ class Cart extends BaseService
foreach ($cartList as $cartIdx => $item) {
// 查找商品, 商品不存在则删除该购物车记录
$result = $this->findGoods($goodsList, $item, $enableGradeMoney);
//商户信息处理
if ($result['merchant_id'] && !in_array($result['channel'], config('app.not_show_merchant'))) {
$merchant = \app\common\model\Merchant::detail($result['merchant_id'], $result->store_id);
$result['merchant'] = $merchant;
} else {
$result['merchant_id'] = 0;
$result['merchant'] = null;
}
if ($result !== false) {
$cartList[$cartIdx]['goods'] = $result;
} else {

@ -299,38 +299,6 @@ class Goods extends BaseModel
}
}
// if (!empty($order)) {
// if ($order == 1) {
// $sort = ['goods_price_min' => 'asc'];
// }
// if ($order == 2) {
// $sort = ['goods_price_min' => 'desc'];
// }
// if ($order == 3) {
// $sort = ['discount' => 'asc'];
// }
// if ($order == 4) {
// $sort = ['discount' => 'desc'];
// }
// if ($order == 5) {
// $sort = ['goods_sales' => 'asc'];
// }
// if ($order == 6) {
// $sort = ['goods_sales' => 'desc'];
// }
// if ($order == 7) {
// $sort = ['goods_sales' => 'asc'];
// }
// if ($order == 8) {
// $sort = ['goods_sales' => 'desc'];
// }
// }
$field = $this->getAliasFields($this->name, ['content']);
$field[] = 'selling_point';

@ -219,7 +219,7 @@ class Suning extends BaseService {
foreach ($data as $key => &$value) {
//$goods = GoodsModel::where('goods_id', $sku['goods_id'])->find();
$arr = [
'state'=> $value['state'] == 1 ? "有货" : "无货",
'state'=> (isset($value['state']) &&$value['state'] == 1) ? "有货" : "无货",
//'goods_name'=> $goods['goods_name'],
//'goods_id'=> $goods['goods_id'],
];

@ -279,8 +279,8 @@ class Collector extends BaseService
if (!$goods || !$url) {
return true;
}
//新阙通信的抓取过了,就不抓取了
if ($goods['channel'] == 'xqtx' && $goods['content']) {
//新阙通信的抓取过了,就不抓取了;京东价拖抓取过了就不抓取了
if (($goods['channel'] == 'xqtx' && $goods['content']) || $goods->goods_no_other) {
return true;
}
try {
@ -320,9 +320,9 @@ class Collector extends BaseService
$this->errorLog[] = ['url' => trim($url), 'message' => $e->getMessage()];
return false;
}
if ($original['goods_price'] == 0) {
return false;
}
// if ($original['goods_price'] == 0) {
// return false;
// }
$original['cost_price'] = $form['cost_price_min'];
$data['link_other'] = $url;

@ -208,7 +208,79 @@ class Goods extends Controller
}
return $this->renderSuccess('操作成功');
}
/**
* 修改商品状态(上下架)
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function setBrand(array $goodsIds, bool $is_brand): Json
{
$model = new GoodsModel;
if (!$model->setBrand($goodsIds, $is_brand)) {
return $this->renderError($model->getError() ?: '操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 修改商品状态(上下架)
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function setNew(array $goodsIds, bool $is_new): Json
{
$model = new GoodsModel;
if (!$model->setNew($goodsIds, $is_new)) {
return $this->renderError($model->getError() ?: '操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 修改商品状态(上下架)
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function setInstore(array $goodsIds, bool $is_in_store): Json
{
$model = new GoodsModel;
if (!$model->setInstore($goodsIds, $is_in_store)) {
return $this->renderError($model->getError() ?: '操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 修改商品状态(上下架)
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function setRank(array $goodsIds, int $paihang): Json
{
$model = new GoodsModel;
if (!$model->setRank($goodsIds, $paihang)) {
return $this->renderError($model->getError() ?: '操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 商品归类
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function category(array $goodsIds, array $categoryIds): Json
{
$model = new GoodsModel;
foreach ($goodsIds as $key => $goodsId) {
$categoryIds = $model->dealCategory($categoryIds);
\app\store\model\GoodsCategoryRel::updates($goodsId, $categoryIds);
}
$model->whereIn('goods_id', $goodsIds)->update(['cate_status'=>1,'update_time' => time()]);
return $this->renderSuccess('操作成功');
}
/**
* 删除商品
* @param array $goodsIds

@ -220,7 +220,50 @@ class Goods extends GoodsModel
// 批量更新记录
return static::updateBase(['status' => $state ? 10 : 20], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return bool|false
*/
public function setBrand(array $goodsIds, bool $is_brand): bool
{
// 批量更新记录
return static::updateBase(['is_brand' => $is_brand], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return bool|false
*/
public function setNew(array $goodsIds, bool $is_new): bool
{
// 批量更新记录
return static::updateBase(['is_new' => $is_new], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return bool|false
*/
public function setInstore(array $goodsIds, bool $is_in_store): bool
{
// 批量更新记录
return static::updateBase(['is_in_store' => $is_in_store], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return bool|false
*/
public function setRank(array $goodsIds, int $is_paihang): bool
{
// 批量更新记录
return static::updateBase(['paihang' => $is_paihang], [['goods_id', 'in', $goodsIds]]);
}
/**
* 软删除
* @param array $goodsIds

@ -86,7 +86,7 @@ class Import extends ImportModel
// exit();
// 验证导入的商品数量是否合法
$this->checkLimit($execlData);
self::$merchantId = $form['merchant_id'] ?? 0;
self::$storeId = $form['store_id'] ?? 0;
foreach ($execlData as &$value) {
$value['B'] = $form['channel']??'zy';
@ -197,6 +197,7 @@ class Import extends ImportModel
$this->checkLimit($execlData);
self::$storeId = $form['store_id'] ?? 0;
self::$merchantId = $form['merchant_id'] ?? 0;
// $obj = new \app\job\service\goods\GoodsUpdateImport();
// $service = new \app\job\service\goods\Collector();
// foreach ($execlData as $item) {

@ -46,4 +46,5 @@ return [
'pdd' => "拼多多",
'xqtx' => "新阕通信",
],
'not_show_merchant' => ['jd','jd1','jd2','sn','sn1','xqtx'],
];

Loading…
Cancel
Save