Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cbe9f1ab50 | |||
| f6f2fa39f9 | |||
| 354e6ef316 |
@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// 服务器/etc/crontab添加cron入口
|
||||
// * * * * * cd /home/wwwroot/erp.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
|
||||
// * * * * * cd /home/wwwroot/erp.yhr.life && php artisan schedule:run >> /dev/null 2>&1
|
||||
$schedule->command(KttOrderQuery::class)->everyMinute();
|
||||
|
||||
$schedule->command(GoodsSkuDailyReport::class)->dailyAt('06:00');
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Http\Resources\ShopsResource;
|
||||
use App\Models\Shop;
|
||||
use App\Models\ShopSender;
|
||||
use App\Models\ShopShip;
|
||||
use App\Services\Business\KuaiTuanTuan\FaceSheet;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ use App\Models\GoodsSku;
|
||||
use App\Models\Shop;
|
||||
use App\Http\Resources\ShopsResource;
|
||||
use App\Models\ShopSender;
|
||||
use App\Models\ShopShip;
|
||||
use App\Services\Business\KuaiTuanTuan\FaceSheet;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@ -227,11 +228,18 @@ class ShopsController extends Controller
|
||||
|
||||
public function pddPrintAuth(Request $request)
|
||||
{
|
||||
[$shopId, $type] = explode('_', $request->get('state'));
|
||||
[$shopId, $platId] = explode('_', $request->get('state'));
|
||||
$faceSheet = new FaceSheet();
|
||||
$faceSheet->setCode($request->get('code'));
|
||||
$faceSheet->setShopWithId($shopId);
|
||||
$shopShip = $faceSheet->auth('ship', $type);
|
||||
$faceSheet->auth('ship');
|
||||
$shopShip = ShopShip::query()
|
||||
->where('shop_id', $shopId)
|
||||
->first();
|
||||
if (empty($shopShip)) {
|
||||
exit();
|
||||
}
|
||||
$faceSheet->setShop($shopShip);
|
||||
$resp = $faceSheet->searchWayBill();
|
||||
if (!isset($resp['pdd_waybill_search_response']['waybill_apply_subscription_cols'])) {
|
||||
exit();
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Events\BatchStockUpdateEvent;
|
||||
use App\Jobs\SyncCostToMiaoXuan;
|
||||
use App\Models\DailyStockRecord;
|
||||
use App\Models\GoodsSku;
|
||||
use App\Models\TodayPrice;
|
||||
@ -55,7 +54,6 @@ class InventoryImport implements ToArray, SkipsEmptyRows
|
||||
'cost' => $row[4],
|
||||
]);
|
||||
}
|
||||
SyncCostToMiaoXuan::dispatch($row[0], $row[4]);
|
||||
$updateIds[] = $goodsSku['id'];
|
||||
DailyStockRecord::query()->where('sku_id', $goodsSku['id'])->where('day', $day)->update([
|
||||
'arrived_today_num' => $row[3],
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Events\BatchStockUpdateEvent;
|
||||
use App\Jobs\SyncCostToMiaoXuan;
|
||||
use App\Models\DailyStockRecord;
|
||||
use App\Models\GoodsSku;
|
||||
use App\Utils\DateTimeUtils;
|
||||
@ -50,7 +49,6 @@ class NewSetImport implements ToArray, SkipsEmptyRows
|
||||
'stock' => $row[2] + $goodsSku['stock'],
|
||||
]);
|
||||
}
|
||||
SyncCostToMiaoXuan::dispatch($row[0], $row[3]);
|
||||
$updateIds[] = $goodsSku['id'];
|
||||
// 今日到货
|
||||
$record = DailyStockRecord::query()
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SyncCostToMiaoXuan implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $externalSkuId;
|
||||
public $cost;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($externalSkuId, $cost)
|
||||
{
|
||||
$this->externalSkuId = $externalSkuId;
|
||||
$this->cost = $cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$url = 'http://shop.chutang66.com/miaoxuan/cost';
|
||||
$method = 'PUT';
|
||||
$headers = [
|
||||
'headers' => ['Content-type' => 'application/x-www-form-urlencoded;charset=UTF-8'],
|
||||
'form_params' => [
|
||||
'external_sku_id' => $this->externalSkuId,
|
||||
'cost' => $this->cost,
|
||||
]
|
||||
];
|
||||
(new Client())->request($method, $url, $headers);
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ class ShopShip extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function shop()
|
||||
protected function shop()
|
||||
{
|
||||
return $this->belongsTo(Shop::class, 'shop_id', 'id');
|
||||
}
|
||||
@ -32,16 +32,6 @@ class ShopShip extends Model
|
||||
return $value ? date('Y-m-d H:i:s', $value) : '';
|
||||
}
|
||||
|
||||
public function getTypeAttribute($value)
|
||||
{
|
||||
$map = [
|
||||
'normal' => '电商标快',
|
||||
'air' => '空运',
|
||||
];
|
||||
|
||||
return $map[$value];
|
||||
}
|
||||
|
||||
public function senders()
|
||||
{
|
||||
return $this->hasMany(ShopSender::class, 'shop_ship_id');
|
||||
|
||||
@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Log as LogFile;
|
||||
|
||||
abstract class BusinessClient
|
||||
{
|
||||
protected $redirectUri = 'http://erp.chutang66.com/callback';
|
||||
protected $redirectUri = 'http://erp.yhr.life/callback';
|
||||
protected $code;
|
||||
protected $shop;
|
||||
protected $skuId = 0;
|
||||
|
||||
@ -6,7 +6,7 @@ class FaceSheet extends KuaiTuanTuan
|
||||
{
|
||||
protected $clientId = '24f25877aca447c5830a6aa896301d5e';
|
||||
protected $clientSecret = '59b6f4bd402c6423878a8f4ef1bde28359c1f05a';
|
||||
protected $redirectUri = 'http://erp.chutang66.com/pdd/ship';
|
||||
protected $redirectUri = 'http://erp.yhr.life/pdd/ship';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -17,9 +17,9 @@ class KuaiTuanTuan extends BusinessClient
|
||||
// 如果请求的content-type是 application/x-www-form-urlencoded,所有参数值也做urlencode编码;
|
||||
// 如果是multipart/form-data格式,每个表单字段的参数值无需编码,但每个表单字段的charset需要指定为utf-8
|
||||
// 如果指定接口返回数据格式为JSON,请指明header头content-type: application/json
|
||||
protected $clientId = '8d7ca13bc27247b6a04e08404b51dfd8';
|
||||
protected $clientId = 'd496de7fd95c4d80aa55f621b2c1fb5c';
|
||||
|
||||
protected $clientSecret = '4478bc82dc1e1f68fe06c9f2bc683f1dcb3e6d83';
|
||||
protected $clientSecret = 'fb23544ac7b3db1f356f6476e390585376020224';
|
||||
|
||||
protected $publicParams = [
|
||||
'type' => '',
|
||||
@ -31,7 +31,7 @@ class KuaiTuanTuan extends BusinessClient
|
||||
'sign' => ''
|
||||
];
|
||||
|
||||
public function auth($type = 'ktt', $shipType = 'normal')
|
||||
public function auth($type = 'ktt')
|
||||
{
|
||||
$accessToken = $this->getAccessTokenWithCode();
|
||||
$accessToken['scope'] = json_encode($accessToken['scope'], 256);
|
||||
@ -42,8 +42,8 @@ class KuaiTuanTuan extends BusinessClient
|
||||
}
|
||||
if ('ship' === $type) {
|
||||
unset($accessToken['r1_expires_at'], $accessToken['r1_expires_in'], $accessToken['r2_expires_at'], $accessToken['r2_expires_in'], $accessToken['w1_expires_at'], $accessToken['w1_expires_in'], $accessToken['w2_expires_at'], $accessToken['w2_expires_in'], $accessToken['request_id']);
|
||||
$this->shop = ShopShip::query()->updateOrCreate(
|
||||
['shop_id' => $this->shop->id, 'type' => $shipType],
|
||||
ShopShip::query()->updateOrCreate(
|
||||
['shop_id' => $this->shop->id],
|
||||
$accessToken
|
||||
);
|
||||
}
|
||||
|
||||
@ -24,9 +24,6 @@ class MiaoXuan extends BusinessClient
|
||||
|
||||
public function incrQuantity($businessGoodsSku, $num, $incremental)
|
||||
{
|
||||
$appendParams = Goods::incrQuantity($this->shop->id, $num, $businessGoodsSku);
|
||||
$url = 'http://shop.chutang66.com/miaoxuan/stock';
|
||||
$this->formDataPostRequest($url, $appendParams);
|
||||
}
|
||||
|
||||
public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1)
|
||||
@ -35,12 +32,6 @@ class MiaoXuan extends BusinessClient
|
||||
|
||||
public function batchIncrQuantity($businessGoodsSkus, $num, $incremental)
|
||||
{
|
||||
$batchAppendParams = [];
|
||||
foreach ($businessGoodsSkus as $businessGoodsSku) {
|
||||
$appendParams = Goods::incrQuantity($this->shop->id, $num, $businessGoodsSku);
|
||||
$batchAppendParams[] = $appendParams;
|
||||
}
|
||||
$this->batchAsyncPostRequest('http://shop.chutang66.com/miaoxuan/stock', $batchAppendParams);
|
||||
}
|
||||
|
||||
public function downloadGoods($skuId)
|
||||
|
||||
@ -52,7 +52,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://erp.chutang66.com/'),
|
||||
'url' => env('APP_URL', 'http://erp.yhr.life.com/'),
|
||||
|
||||
'asset_url' => env('ASSET_URL', null),
|
||||
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTypeToShopShipsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumns('shop_ships', ['type'])) {
|
||||
return;
|
||||
}
|
||||
Schema::table('shop_ships', function (Blueprint $table) {
|
||||
$table->string('type')->default('normal')->comment('账户类型normal-普通,air-空运');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('shop_ships', function (Blueprint $table) {
|
||||
$table->dropColumn(['type']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodeToWaybillsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumns('waybills', ['code'])) {
|
||||
return;
|
||||
}
|
||||
Schema::table('waybills', function (Blueprint $table) {
|
||||
$table->integer('code')->default(247)->comment('247-电商标快,266-空运');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('waybills', function (Blueprint $table) {
|
||||
$table->dropColumn(['code']);
|
||||
});
|
||||
}
|
||||
}
|
||||
4
public/dist/js/107.4ae2ec64.js
vendored
4
public/dist/js/107.4ae2ec64.js
vendored
File diff suppressed because one or more lines are too long
1
public/dist/js/107.4ae2ec64.js.map
vendored
1
public/dist/js/107.4ae2ec64.js.map
vendored
File diff suppressed because one or more lines are too long
2
public/dist/js/app.65f96f26.js
vendored
2
public/dist/js/app.65f96f26.js
vendored
File diff suppressed because one or more lines are too long
1
public/dist/js/app.65f96f26.js.map
vendored
1
public/dist/js/app.65f96f26.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,44 +1,33 @@
|
||||
<template>
|
||||
<div class="conent">
|
||||
<div>
|
||||
<el-button type="primary" @click="addAuthVisible = true">新增授权</el-button>
|
||||
</div>
|
||||
|
||||
<div class="table" style="margin-top: 10px">
|
||||
<el-table v-loading="loading" :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="shop.name" label="店铺名称"></el-table-column>
|
||||
<el-table-column prop="type" label="账户类型"></el-table-column>
|
||||
<el-table-column prop="expires_at" label="授权过期时间点"></el-table-column>
|
||||
<el-table-column prop="owner_id" label="商家店铺id"></el-table-column>
|
||||
<el-table-column prop="owner_name" label="商家账号名称"></el-table-column>
|
||||
<el-table-column prop="name" label="店铺名称"></el-table-column>
|
||||
<el-table-column prop="ship.expires_at" label="授权过期时间点"></el-table-column>
|
||||
<el-table-column prop="ship.owner_id" label="商家店铺id"></el-table-column>
|
||||
<el-table-column prop="ship.owner_name" label="商家账号名称"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="info" @click="getSenders(scope.row)" size="small">发货信息</el-button>
|
||||
<el-button type="danger" v-if="scope.row.status === '未授权'" size="small">
|
||||
<a :href="scope.row.authUrl" target="_blank" rel="noopener noreferrer">授权</a>
|
||||
</el-button>
|
||||
|
||||
<template v-if="scope.row.status === '已授权'">
|
||||
<el-button type="success" :disabled="true" size="small">{{ scope.row.status }}</el-button>
|
||||
</template>
|
||||
<template v-if="scope.row.status === '重新授权'">
|
||||
<el-button type="danger" target="_blank" size="small">
|
||||
<a :href="scope.row.authUrl" rel="noopener noreferrer">重新授权</a>
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<el-button v-if="scope.row.ship" type="info" @click="getSenders(scope.row)"
|
||||
size="small">发货信息</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 新增授权 -->
|
||||
<el-dialog title="新增授权" :visible.sync="addAuthVisible" :close-on-click-modal="false" width="20%">
|
||||
<el-form :model="authForm" label-width="80px">
|
||||
<el-form-item label="店铺">
|
||||
<el-select v-model="authForm.shop_id" placeholder="请选择店铺">
|
||||
<el-option v-for="item in shops" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="账户类型">
|
||||
<el-radio-group v-model="authForm.type">
|
||||
<el-radio label="normal">电商标快</el-radio>
|
||||
<el-radio label="air">空运</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="authBtn()">授权</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 发货信息 -->
|
||||
<el-dialog title="发货信息" :visible.sync="dialogVisible" :close-on-click-modal="false">
|
||||
@ -89,7 +78,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { shipList, ShopSenderList, saveSenders, storeList } from "../../api/shop";
|
||||
import { shipList, ShopSenderList, saveSenders } from "../../api/shop";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -97,20 +86,13 @@ export default {
|
||||
loading: true,
|
||||
tableData: [],
|
||||
dialogVisible: false,
|
||||
addAuthVisible: false,
|
||||
sendersForm: {
|
||||
senderList: []
|
||||
},
|
||||
shops: [],
|
||||
authForm: {
|
||||
shop_id: '',
|
||||
type: 'normal'
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getShipList();
|
||||
this.getShopsList();
|
||||
},
|
||||
methods: {
|
||||
getShipList() {
|
||||
@ -120,7 +102,7 @@ export default {
|
||||
this.loading = false
|
||||
},
|
||||
getSenders(row) {
|
||||
ShopSenderList(row.shop_id, row.id).then((res) => {
|
||||
ShopSenderList(row.id, row.ship.id).then((res) => {
|
||||
this.sendersForm.senderList = res.data.data;
|
||||
this.dialogVisible = true;
|
||||
})
|
||||
@ -133,19 +115,6 @@ export default {
|
||||
this.$message.error(res.data.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
getShopsList() {
|
||||
let page = {
|
||||
page: 0,
|
||||
per_page: 999,
|
||||
plat_id: 1,
|
||||
};
|
||||
storeList(page).then((res) => {
|
||||
this.shops = res.data.data;
|
||||
});
|
||||
},
|
||||
authBtn() {
|
||||
location.href = "https://wb.pinduoduo.com/logistics/auth?client_id=24f25877aca447c5830a6aa896301d5e&redirect_uri=http://erp.chutang66.com/pdd/ship&state=" + this.authForm.shop_id + '_' + this.authForm.type;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user