mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #10000 测试修改
This commit is contained in:
parent
a4d9d6cc9a
commit
d86418ea8c
48
app/Console/Commands/Test.php
Normal file
48
app/Console/Commands/Test.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Shop;
|
||||
use App\Services\Business\BusinessFactory;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Test extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'test';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '测试';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$shop = Shop::query()->find(2);
|
||||
$business = BusinessFactory::init()->make($shop->plat_id);
|
||||
$business->setShop($shop);
|
||||
$res = $business->downloadGoods();
|
||||
var_dump($res);
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,8 @@ class GoodsSkusController extends Controller
|
||||
Rule::exists('goods_skus', 'id'),
|
||||
],
|
||||
];
|
||||
$validator = $this->validateUpdate($request->all(), $appendRules);
|
||||
$skuRules = (new GoodsSkuRequest())->arrayRules('skus.*.');
|
||||
$validator = Validator::make($request->all(), array_merge($appendRules, $skuRules));
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
|
||||
|
||||
@ -27,11 +27,11 @@ class GoodsSkuRequest extends FormRequest
|
||||
return [
|
||||
'id' => ['sometimes', 'required', 'integer', 'exists:goods_skus,id'],
|
||||
'goods_id' => ['sometimes', 'required', 'integer', 'exists:goods,id'],
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'sku_code' => ['required', 'distinct', 'alpha_dash', 'max:32'],
|
||||
'status' => ['required', 'integer', Rule::in([0, 1, 2])],
|
||||
'num' => ['required', 'integer'],
|
||||
'cost' => ['required', 'numeric'],
|
||||
'title' => ['sometimes', 'required', 'string', 'max:255'],
|
||||
'sku_code' => ['sometimes', 'required', 'distinct', 'alpha_dash', 'max:32'],
|
||||
'status' => ['sometimes', 'required', 'integer', Rule::in([0, 1, 2])],
|
||||
'num' => ['sometimes', 'required', 'integer'],
|
||||
'cost' => ['sometimes', 'required', 'numeric'],
|
||||
'reference_price' => [
|
||||
'sometimes',
|
||||
'numeric',
|
||||
|
||||
@ -16,7 +16,9 @@ class Shop extends Model
|
||||
'pop_auth_token_create_response',
|
||||
];
|
||||
|
||||
protected $guarded = [];
|
||||
protected $fillable = [
|
||||
'access_token', 'expires_at', 'expires_in', 'owner_id', 'owner_name', 'refresh_token', 'refresh_token_expires_at', 'refresh_token_expires_in', 'scope', 'pop_auth_token_create_response', 'status'
|
||||
];
|
||||
|
||||
public function getStatusAttribute($value)
|
||||
{
|
||||
|
||||
@ -93,6 +93,9 @@ abstract class BusinessClient
|
||||
$log->user_id = 1;
|
||||
$log->message = json_encode($res, 256);
|
||||
$log->save();
|
||||
if (isset($res['error_response'])) {
|
||||
throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -30,7 +30,9 @@ class KuaiTuanTuan extends BusinessClient
|
||||
public function auth()
|
||||
{
|
||||
$accessToken = $this->getAccessTokenWithCode();
|
||||
$accessToken['scope'] = json_encode($accessToken['scope'], 256);
|
||||
$accessToken['pop_auth_token_create_response'] = json_encode($accessToken, 256);
|
||||
$accessToken['status'] = 1;
|
||||
$this->shop->update($accessToken);
|
||||
|
||||
return $this->shop;
|
||||
@ -107,7 +109,7 @@ class KuaiTuanTuan extends BusinessClient
|
||||
'timestamp' => time()
|
||||
];
|
||||
if ('pdd.pop.auth.token.create' !== $type) {
|
||||
$publicParams['access_token'] = $this->getAccessToken();
|
||||
$publicParams['access_token'] = $this->getShop()->access_token;
|
||||
}
|
||||
$publicParams = array_merge($publicParams, $appendParams);
|
||||
$publicParams['sign'] = $this->getSign($publicParams);
|
||||
|
||||
@ -18,12 +18,12 @@ class CreateShopsTable extends Migration
|
||||
$table->string('name')->unique();
|
||||
$table->unsignedTinyInteger('plat_id')->comment('平台id');
|
||||
$table->string('access_token')->nullable();
|
||||
$table->unsignedMediumInteger('expires_at')->nullable()->comment('access_token过期时间点');
|
||||
$table->unsignedBigInteger('expires_at')->nullable()->comment('access_token过期时间点');
|
||||
$table->unsignedInteger('expires_in')->nullable()->comment('access_token过期时间段,10(表示10秒后过期)');
|
||||
$table->string('owner_id')->nullable()->comment('商家店铺id');
|
||||
$table->string('owner_name')->nullable()->comment('商家账号名称');
|
||||
$table->string('refresh_token')->nullable()->comment('refresh token,可用来刷新access_token');
|
||||
$table->unsignedMediumInteger('refresh_token_expires_at')->nullable()->comment('Refresh token过期时间点');
|
||||
$table->unsignedBigInteger('refresh_token_expires_at')->nullable()->comment('Refresh token过期时间点');
|
||||
$table->unsignedInteger('refresh_token_expires_in')->nullable()->comment('refresh_token过期时间段,10表示10秒后过期');
|
||||
$table->text('scope')->nullable()->comment('接口列表');
|
||||
$table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息');
|
||||
|
||||
@ -19,27 +19,27 @@ class CreateBusinessGoodsSkusTable extends Migration
|
||||
$table->bigInteger('self_sku_id')->nullable();
|
||||
$table->string('activity_no')->nullable();
|
||||
$table->string('category_name')->nullable();
|
||||
$table->mediumInteger('create_time')->nullable();
|
||||
$table->bigInteger('create_time')->nullable();
|
||||
$table->text('goods_desc')->nullable();
|
||||
$table->string('goods_id')->nullable();
|
||||
$table->text('goods_image_list')->nullable();
|
||||
$table->string('goods_name')->nullable();
|
||||
$table->integer('is_activity_delete')->nullable();
|
||||
$table->integer('limit_buy')->nullable();
|
||||
$table->mediumInteger('market_price')->nullable();
|
||||
$table->mediumInteger('update_time')->nullable();
|
||||
$table->bigInteger('market_price')->nullable();
|
||||
$table->bigInteger('update_time')->nullable();
|
||||
$table->string('external_sku_id')->nullable();
|
||||
$table->mediumInteger('goods_purchase_price')->nullable();
|
||||
$table->mediumInteger('price_in_fen')->nullable();
|
||||
$table->mediumInteger('quantity')->nullable();
|
||||
$table->bigInteger('goods_purchase_price')->nullable();
|
||||
$table->bigInteger('price_in_fen')->nullable();
|
||||
$table->bigInteger('quantity')->nullable();
|
||||
$table->integer('quantity_type')->nullable();
|
||||
$table->mediumInteger('reserve_quantity')->nullable();
|
||||
$table->mediumInteger('sku_id')->nullable();
|
||||
$table->mediumInteger('sold_quantity')->nullable();
|
||||
$table->bigInteger('reserve_quantity')->nullable();
|
||||
$table->bigInteger('sku_id')->nullable();
|
||||
$table->bigInteger('sold_quantity')->nullable();
|
||||
$table->text('spec_list')->nullable();
|
||||
$table->string('spec_name')->nullable();
|
||||
$table->string('thumb_url')->nullable();
|
||||
$table->mediumInteger('total_quantity')->nullable();
|
||||
$table->bigInteger('total_quantity')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@ -18,22 +18,22 @@ class CreateBusinessOrdersTable extends Migration
|
||||
$table->integer('shop_id');
|
||||
$table->bigInteger('activity_no')->nullable();
|
||||
$table->string('activity_title')->nullable();
|
||||
$table->mediumInteger('after_sales_status')->nullable();
|
||||
$table->bigInteger('after_sales_status')->nullable();
|
||||
$table->string('business_note')->nullable();
|
||||
$table->string('buyer_memo')->nullable();
|
||||
$table->integer('cancel_status')->nullable();
|
||||
$table->mediumInteger('confirm_at')->nullable();
|
||||
$table->mediumInteger('discount_amount')->nullable();
|
||||
$table->bigInteger('confirm_at')->nullable();
|
||||
$table->bigInteger('discount_amount')->nullable();
|
||||
$table->string('help_sell_nickname')->nullable();
|
||||
$table->string('inner_transaction_id')->nullable();
|
||||
$table->boolean('is_supplier')->nullable();
|
||||
$table->integer('logistics_type')->nullable();
|
||||
$table->integer('mall_activity_type')->nullable();
|
||||
$table->string('nick_name')->nullable();
|
||||
$table->mediumInteger('order_amount')->nullable();
|
||||
$table->bigInteger('order_amount')->nullable();
|
||||
$table->string('order_sn')->nullable();
|
||||
$table->integer('participate_no')->nullable();
|
||||
$table->mediumInteger('platform_discount_amount')->nullable();
|
||||
$table->bigInteger('platform_discount_amount')->nullable();
|
||||
$table->string('receiver_address_city')->nullable();
|
||||
$table->string('receiver_address_detail')->nullable();
|
||||
$table->string('receiver_address_district')->nullable();
|
||||
@ -46,12 +46,12 @@ class CreateBusinessOrdersTable extends Migration
|
||||
$table->string('self_pick_up_contact_mobile')->nullable();
|
||||
$table->string('self_pick_up_contact_name')->nullable();
|
||||
$table->string('self_pick_up_site_name')->nullable();
|
||||
$table->mediumInteger('service_amount')->nullable();
|
||||
$table->mediumInteger('shipping_amount')->nullable();
|
||||
$table->bigInteger('service_amount')->nullable();
|
||||
$table->bigInteger('shipping_amount')->nullable();
|
||||
$table->integer('shipping_status')->nullable();
|
||||
$table->string('supply_activity_no')->nullable();
|
||||
$table->integer('supply_participate_no')->nullable();
|
||||
$table->mediumInteger('theoretical_refund_amount')->nullable();
|
||||
$table->bigInteger('theoretical_refund_amount')->nullable();
|
||||
$table->string('transaction_id')->nullable();
|
||||
$table->integer('verification_status')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
@ -21,21 +21,21 @@ class CreateBusinessOrderItemsTable extends Migration
|
||||
$table->integer('cancel_status')->nullable();
|
||||
$table->string('category_name')->nullable();
|
||||
$table->string('external_sku_id')->nullable();
|
||||
$table->mediumInteger('goods_amount')->nullable();
|
||||
$table->mediumInteger('goods_cost_price')->nullable();
|
||||
$table->mediumInteger('goods_id')->nullable();
|
||||
$table->bigInteger('goods_amount')->nullable();
|
||||
$table->bigInteger('goods_cost_price')->nullable();
|
||||
$table->bigInteger('goods_id')->nullable();
|
||||
$table->string('goods_name')->nullable();
|
||||
$table->integer('goods_number')->nullable();
|
||||
$table->mediumInteger('goods_price')->nullable();
|
||||
$table->mediumInteger('goods_purchase_price')->nullable();
|
||||
$table->bigInteger('goods_price')->nullable();
|
||||
$table->bigInteger('goods_purchase_price')->nullable();
|
||||
$table->string('goods_specification')->nullable();
|
||||
$table->mediumInteger('help_sell_amount')->nullable();
|
||||
$table->bigInteger('help_sell_amount')->nullable();
|
||||
$table->boolean('is_supplier')->nullable();
|
||||
$table->integer('need_verification_number')->nullable();
|
||||
$table->integer('shipping_status')->nullable();
|
||||
$table->mediumInteger('sku_id')->nullable();
|
||||
$table->bigInteger('sku_id')->nullable();
|
||||
$table->string('sub_order_sn')->nullable();
|
||||
$table->mediumInteger('theoretically_refund_amount')->nullable();
|
||||
$table->bigInteger('theoretically_refund_amount')->nullable();
|
||||
$table->string('thumb_url')->nullable();
|
||||
$table->integer('verification_number')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user