lqmac 7 months ago
parent bbc8f28c2d
commit 3d6245d999
  1. 3
      app/admin/controller/Goods.php
  2. 1
      app/api/controller/Goods.php
  3. 28
      app/command/SyncStoreBasicData.php
  4. 2
      app/common/model/Goods.php
  5. 2
      app/store/controller/Goods.php

@ -266,6 +266,7 @@ class Goods extends Controller
['stock_total'=>'库存'],
['link_other'=>'京东的价拖链接'],
['goods_price_min'=>'前台价'],
['goods_no'=>'sku'],
];
downLoadExcel('导出数据-'.date('Y-m-d', time()),$titles,$data['data']);
@ -331,6 +332,8 @@ class Goods extends Controller
* @param int $rate [description]
*/
public function addPrice(array $categoryIds, int $rate){
ini_set('memory_limit', '1024M');
set_time_limit(0);
$goods = GoodsCategoryRel::whereIn('category_id',$categoryIds)->where('store_id', 0)->select()->toArray();
if (!$goods) {
return $this->renderSuccess('没有需要加价的商品');

@ -112,6 +112,7 @@ class Goods extends Controller
$data['goods_id'] = $goods['goods_id'];
break;
case 'jd':
case 'jd1':
$province = Region::withoutGlobalScope()->where('name', $params['province'])->where('level', 1)->find();
//$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find();
$district = Region::withoutGlobalScope()->where('name', $params['district'])->where('level', 3)->find();

@ -23,7 +23,7 @@ use app\store\model\ServerCategory;
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test
class SyncStoreBasicData extends Command
{
const DEFAULT_STORE_ID = 10048;
const DEFAULT_STORE_ID = 10037;
protected function configure()
{
@ -43,6 +43,8 @@ class SyncStoreBasicData extends Command
$isSyncMaintenanceData = $input->getArgument("isSyncMaintenanceData");
$isSyncHelpData = $input->getArgument("isSyncHelpData");
$isSyncRichTextData = $input->getArgument("isSyncRichTextData");
$isSyncRecoveryData = $input->getArgument("isSyncRecoveryData");
$isSyncServerData = $input->getArgument("isSyncServerData");
$where[] = ['is_sync','=', 0];
$where[] = ['is_delete','=', 0];
@ -72,7 +74,13 @@ class SyncStoreBasicData extends Command
if ($isSyncRichTextData) {
$this->syncRichTextData($store);
}
Store::where('store_id', $store['store_id'])->update(['is_sync' => 1]);
if ($isSyncRecoveryData) {
$this->syncRecoveryData($store);
}
if ($isSyncServerData) {
$this->syncServerData($store);
}
//Store::where('store_id', $store['store_id'])->update(['is_sync' => 1]);
}
@ -289,13 +297,13 @@ class SyncStoreBasicData extends Command
//写入维修数据
$articleCategory['image_id'] = $image_id ?? 0;
$ret = RecoveryCategory::create($articleCategory);
var_dump($ret->id);
var_dump($ret->category_id);
}
unset($articleCategory);
}
//维修数据同步
$articleList = ServerRecovery::where('store_id',self::DEFAULT_STORE_ID)->where('is_delete', 0)->where('status', 1)->select()->toArray();
$articleList = ServerRecovery::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray();
if ($articleList) {
foreach ($articleList as &$article) {
$info = ServerRecovery::where('store_id', $store['store_id'])->where('original_id', $article['recovery_id'])->find();
@ -326,7 +334,7 @@ class SyncStoreBasicData extends Command
$article['image_id'] = $image_id;
$ret = ServerRecovery::create($article);
//写入图片id
var_dump($ret->id);
var_dump($ret->recovery_id);
}
unset($article);
}
@ -339,7 +347,7 @@ class SyncStoreBasicData extends Command
* @return [type] [description]
*/
private function syncServerData($store){
//维修分类数据同步
//服务分类数据同步
$articleCategoryList = ServerCategory::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray();
if ($articleCategoryList) {
foreach ($articleCategoryList as &$articleCategory) {
@ -365,13 +373,13 @@ class SyncStoreBasicData extends Command
//写入维修数据
$articleCategory['image_id'] = $image_id ?? 0;
$ret = ServerCategory::create($articleCategory);
var_dump($ret->id);
var_dump($ret->category_id);
}
unset($articleCategory);
}
//维修数据同步
$articleList = Server::where('store_id',self::DEFAULT_STORE_ID)->where('is_delete', 0)->where('status', 1)->select()->toArray();
//服务数据同步
$articleList = Server::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray();
if ($articleList) {
foreach ($articleList as &$article) {
$info = Server::where('store_id', $store['store_id'])->where('original_id', $article['server_id'])->find();
@ -402,7 +410,7 @@ class SyncStoreBasicData extends Command
$article['image_id'] = $image_id;
$ret = Server::create($article);
//写入图片id
var_dump($ret->id);
var_dump($ret->server_id);
}
unset($article);
}

@ -208,7 +208,7 @@ class Goods extends BaseModel
// 执行查询
$list = $query
->alias($this->name)
->field(['goods.goods_id', 'goods.goods_name', 'cmmdty_model', 'link', 'cost_price_min', 'stock_total', 'link_other', 'goods_price_min'])
->field(['goods.goods_id', 'goods.goods_name', 'cmmdty_model', 'link', 'cost_price_min', 'stock_total', 'link_other', 'goods_price_min','goods_no'])
->where('is_delete', '=', 0)
->order($sort)
->paginate($listRows);

@ -35,7 +35,7 @@ class Goods extends Controller
// 获取列表记录
$model = new GoodsModel;
$params = $this->request->param();
//$params['channel'] = 'zy';
$params['channel'] = 'zy';
$list= $model->getList($params, (int)$this->request->param('pageSize', 15));
return $this->renderSuccess(compact('list'));
}

Loading…
Cancel
Save