Browse Source

Merge branch 'phoenix' into develop

master
liangyuyan 5 years ago
parent
commit
2d6b419181
  1. 13
      app/Admin/Controllers/v3/StoreController.php
  2. 80
      app/Console/Commands/MigrateFePrint.php
  3. 93
      app/Console/Commands/MigrateShoppingCart.php
  4. 8
      app/Console/Commands/MigrateStore.php
  5. 185
      app/Console/Commands/MigrateStoreAccount.php
  6. 88
      app/Console/Commands/MigrateStoreBalance.php
  7. 65
      app/Console/Commands/SetGoodsMarketId.php
  8. 10
      app/Console/Commands/SetStoreUsers.php

13
app/Admin/Controllers/v3/StoreController.php

@ -128,10 +128,9 @@ class StoreController extends AdminController
*/ */
protected function form() protected function form()
{ {
// dd(StoreModel::pluck('admin_id'));
return Form::make(new Store(), function (Form $form) { return Form::make(new Store(), function (Form $form) {
// 查询市场经理 // 查询市场经理
$mmList = MminfoModel::getMmInfoArray();
// $mmList = MminfoModel::getMmInfoArray();
// 查询市场 // 查询市场
$marketList = MarketModel::getMarketArray(); $marketList = MarketModel::getMarketArray();
// 查询一级分类 // 查询一级分类
@ -147,9 +146,9 @@ class StoreController extends AdminController
} }
} }
$form->column(6, function (Form $form) use($mmList,$marketList,$categoryList){
$form->column(6, function (Form $form) use($marketList,$categoryList){
$form->hidden('id'); $form->hidden('id');
$form->select('mm_user_id')->options($mmList);
$form->number('mm_user_id')->help('市场经理的懒ID');
$form->select('market_id')->required()->options($marketList); $form->select('market_id')->required()->options($marketList);
$form->select('category_id')->options($categoryList); $form->select('category_id')->options($categoryList);
$form->text('name')->required()->maxLength(50); $form->text('name')->required()->maxLength(50);
@ -178,8 +177,8 @@ class StoreController extends AdminController
$form->image('business_license')->required()->uniqueName(); $form->image('business_license')->required()->uniqueName();
$form->image('zm_img')->required()->uniqueName(); $form->image('zm_img')->required()->uniqueName();
$form->image('fm_img')->required()->uniqueName(); $form->image('fm_img')->required()->uniqueName();
$form->select('admin_id')->options($userList)->required();/*需要优化 一个用户只能绑定一家店铺*/
$form->select('user_id')->options($userList)->required();/*需要优化 一个用户只能绑定一家店铺*/
$form->select('admin_id')->options($userList)->required();
$form->select('user_id')->options($userList)->required();
$form->time('time1','时间段一开始')->format('HH:mm'); $form->time('time1','时间段一开始')->format('HH:mm');
$form->time('time2','时间段一结束')->format('HH:mm')->rules('after:time1',['after'=>'选择的时间必须比时间段一开始时间晚']); $form->time('time2','时间段一结束')->format('HH:mm')->rules('after:time1',['after'=>'选择的时间必须比时间段一开始时间晚']);
$form->time('time3','时间段二开始')->format('HH:mm')->rules('after:time2',['after'=>'选择的时间必须比时间段一结束时间晚']); $form->time('time3','时间段二开始')->format('HH:mm')->rules('after:time2',['after'=>'选择的时间必须比时间段一结束时间晚']);
@ -241,7 +240,7 @@ class StoreController extends AdminController
$storeUsersModel->register_type = 4; $storeUsersModel->register_type = 4;
$storeUsersModel->status = 2; $storeUsersModel->status = 2;
$storeUsersModel->salt = $this->random(8); $storeUsersModel->salt = $this->random(8);
$storeUsersModel->password = $this->stringHash(substr($form->link_tel,-1,5),$storeUsersModel->salt);
$storeUsersModel->password = $this->stringHash(substr($form->link_tel,-6),$storeUsersModel->salt);
$storeUsersModel->remark = '入驻店铺注册'; $storeUsersModel->remark = '入驻店铺注册';
$storeUsersModel->save(); $storeUsersModel->save();
} }

80
app/Console/Commands/MigrateFePrint.php

@ -0,0 +1,80 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class MigrateFePrint extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'migrateData:fePrint';
/**
* The console command description.
*
* @var string
*/
protected $description = 'migrate 迁移打印机数据';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$oldTableName = 'ims_cjdc_feprint';
$newTableName = 'lanzu_feprint_copy';
// 判断表是否存在
if(!Schema::hasTable($oldTableName)){
var_dump('旧表不存在');
return 0;
}
if(!Schema::hasTable($newTableName)){
var_dump('新表不存在');
return 0;
}
$oldData = DB::table($oldTableName)->get();
$bar = $this->output->createProgressBar(count($oldData));
$bar->start();
$newData = [];
foreach ($oldData as $key => $value) {
$newData[] = [
'id' => $value->id,
'name' => $value->name,
'sn' => $value->sn,
'market_id' => $value->market_id ,
'simnum' => $value->simnum,
'addtime' => $value->addtime,
'status' => $value->status,
'created_at' => strtotime($value->addtime),
'updated_at' => time(),
];
$bar->advance();
}
DB::table($newTableName)->insert($newData);
$bar->finish();
return 0;
}
}

93
app/Console/Commands/MigrateShoppingCart.php

@ -1,93 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class MigrateShoppingCart extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'migrateData:shoppingCart';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command 迁移购物车数据';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$oldTableName = 'ims_cjdc_shopcar';
$oldStoreTableName = 'ims_cjdc_store';
$newTableName = 'lanzu_shopping_cart';
// 判断表是否存在
if(!Schema::hasTable($oldTableName)){
var_dump('旧表不存在');
return 0;
}
if(!Schema::hasTable($newTableName)){
var_dump('新表不存在');
return 0;
}
$oldData = DB::table($oldTableName)->orderBy('id','asc')->get();
$oldStoreData = DB::table($oldStoreTableName)->pluck('market_id','id');
$bar = $this->output->createProgressBar(count($oldData));
$bar->start();
$startTime = time();
$error = [];
foreach ($oldData as $key => $value){
$cartId = $value->id;
// 判断是否存在
$exist = DB::table($newTableName)->where('id',$cartId)->exists();
if($exist){
continue;
}
$newData =[
'id'=>$cartId,
'market_id'=> isset($oldStoreData[$value->store_id])?$oldStoreData[$value->store_id]:0,
'store_id'=>$value->store_id,
'goods_id'=>$value->good_id,
'user_id'=>$value->user_id,
'num'=>$value->num,
'activity_type'=>1,
'created_at' => time(),
'updated_at' => time(),
];
$res = DB::table($newTableName)->insert($newData);
if(!$res){
$error[] = ['id'=>$cartId];
break;
}
$bar->advance();
}
$bar->finish();
var_dump([time()-$startTime]);
var_dump($error);
return 0;
}
}

8
app/Console/Commands/MigrateStore.php

@ -92,10 +92,10 @@ class MigrateStore extends Command
'link_name'=>$value->link_name, 'link_name'=>$value->link_name,
'link_tel' => $value->link_tel, 'link_tel' => $value->link_tel,
'expire_time'=> strtotime($value->rzdq_time), 'expire_time'=> strtotime($value->rzdq_time),
'time1' => $value->time,
'time2'=>$value->time2,
'time3' => $value->time3,
'time4'=>$value->time4,
'time1' => (empty($value->time) || $value->time == 'null')? '': $value->time,
'time2'=> (empty($value->time2) || $value->time2 == 'null')? '': $value->time2,
'time3' => (empty($value->time3) || $value->time3 == 'null')? '': $value->time3,
'time4'=> (empty($value->time4) || $value->time4 == 'null')? '': $value->time4,
'award_money' => $value->award_money, 'award_money' => $value->award_money,
'sales'=>$value->score, 'sales'=>$value->score,

185
app/Console/Commands/MigrateStoreAccount.php

@ -40,6 +40,7 @@ class MigrateStoreAccount extends Command
public function handle() public function handle()
{ {
$oldTableName = 'ims_cjdc_store_account'; $oldTableName = 'ims_cjdc_store_account';
$oldStoreTableName = 'ims_cjdc_store';
$newTableName = 'lanzu_financial_record'; $newTableName = 'lanzu_financial_record';
// 判断表是否存在 // 判断表是否存在
if(!Schema::hasTable($oldTableName)){ if(!Schema::hasTable($oldTableName)){
@ -51,56 +52,48 @@ class MigrateStoreAccount extends Command
return 0; return 0;
} }
$desc='用户店铺首单奖励';
$comment='用户当面付商户奖励';
$desc='新用户下单奖励';
$comment='用户当面付商户奖励';
$desc = '线上外卖订单收入';
$comment = '用户订单完成';
$desc = '线下当面付订单收入';
$comment = '用户订单完成';
$desc = '线上订单退款';
$comment = '线上订单退款到微信';
$desc = '商户提现';
$comment = '商户提现打款';
$oldData = DB::table($oldTableName)->orderBy('id','asc')->get(); $oldData = DB::table($oldTableName)->orderBy('id','asc')->get();
$oldStoreData = DB::table($oldStoreTableName)->pluck('user_id','id');
$bar = $this->output->createProgressBar(count($oldData)); $bar = $this->output->createProgressBar(count($oldData));
$bar->start(); $bar->start();
$startTime = time(); $startTime = time();
$error = []; $error = [];
foreach ($oldData as $key => $value){ foreach ($oldData as $key => $value){
$type = $value->type;
$note = $value->note;
$storeId = $value->store_id; $storeId = $value->store_id;
$userId = $value->user_id; $userId = $value->user_id;
if(empty($userId) || empty($storeId)){
$error[] = ['user_id'=>$userId,'store_id'=>$storeId];
break;
if(empty($storeId) || empty($type) || empty($note)){
$error[] = ['id'=>$value->id];
continue;
}
if(empty($userId)){
if(isset($oldStoreData[$storeId])){
$userId = $oldStoreData[$storeId];
}else{
$error[] = ['id'=>$value->id,'msg'=>'找不到用户'];
continue;
}
} }
$userType = 0;
$moneyType = 0;
$typeArr = $this->getType($type,$note);
$userType = 5;
$money = $value->money;
$moneyType = $typeArr['money_type'];
$sourceId = $value->order_id; $sourceId = $value->order_id;
$sourceType = 0;
// 判断是否存在 总账
$exist = DB::table($newTableName)
->where('user_id',$userId)
->where('user_type',5)
->where('source_id',$value->order_id)
->where('source_type',0)
->where('money_type')
->exists();
$desc = '';
$comment = '';
if(!$exist){
$sourceType = $typeArr['source_type'];
$desc = $typeArr['desc'];
$comment = $typeArr['comment'];
$newData =[ $newData =[
'user_id'=>$userId, 'user_id'=>$userId,
'user_type'=>$userType, 'user_type'=>$userType,
'money'=>$value->money,
'money'=>$money,
'money_type'=>$moneyType, 'money_type'=>$moneyType,
'source_id'=>$sourceId, 'source_id'=>$sourceId,
@ -110,43 +103,41 @@ class MigrateStoreAccount extends Command
'comment'=>$comment, 'comment'=>$comment,
'status'=>1, 'status'=>1,
'created_at' => time(),
'created_at' => strtotime($value->time),
'updated_at' => time(), 'updated_at' => time(),
]; ];
$res = DB::table($newTableName)->insert($newData);
if(!$res){
$error[] = ['id'=>$userId];
// 判断是否存在 总账
$exist = DB::table($newTableName)
->where('user_id',$userId)
->where('user_type',$userType)
->where('source_id',$sourceId)
->where('source_type',$sourceType)
->where('money',$money)
->where('money_type',$moneyType)
->exists();
if(!$exist){
if(!DB::table($newTableName)->insert($newData)){
$error[] = ['id'=>$value->id,'msg'=>'总账添加失败'];
break; break;
} }
} }
// 判断是否存在 详细账
// 判断是否存在 用户
$mod = bcmod((string)$userId, '5', 0); $mod = bcmod((string)$userId, '5', 0);
$newSubTableName = $newTableName.'_'.$mod; $newSubTableName = $newTableName.'_'.$mod;
$existSub = DB::table($newSubTableName)->where('id',$userId)->exists();
$existSub = DB::table($newSubTableName)
->where('user_id',$userId)
->where('user_type',$userType)
->where('source_id',$sourceId)
->where('source_type',$sourceType)
->where('money',$money)
->where('money_type',$moneyType)
->exists();
if(!$existSub){ if(!$existSub){
$newData =[
'id'=>$userId,
'nick_name'=>$value->name,
'avatar'=>$value->img,
'openid'=>$value->openid,
'total_score'=>$value->total_score,
'wallet'=>$value->wallet,
'real_name'=>$value->user_name,
'tel'=>$value->user_tel,
'unionid'=>$value->unionid,
'created_at' => strtotime($value->join_time),
'updated_at' => $value->updated_at,
];
$res = DB::table($newSubTableName)->insert($newData);
if(!$res){
$error[] = ['id'=>$userId];
if(!DB::table($newSubTableName)->insert($newData)){
$error[] = ['id'=>$value->id,'msg'=>'用户账添加失败'];
break; break;
} }
} }
@ -159,8 +150,74 @@ class MigrateStoreAccount extends Command
return 0; return 0;
} }
public function getMoneyType($type,$note)
public function getType($type,$note)
{ {
$array = [];
// 1加,2减
switch($type){
case 1:
if($note == '用户下单成功,平台奖励'){
$array['money_type'] = 5;
$array['source_type'] = 1;
$array['desc'] = '用户店铺首单奖励';
$array['comment'] = '用户当面付商户奖励';
}else if($note == '新用户下单成功,平台奖励'){
$array['money_type'] = 4;
$array['source_type'] = 1;
$array['desc'] = '新用户下单奖励';
$array['comment'] = '用户当面付商户奖励';
}else if($note == '当面付订单收入'){
$array['money_type'] = 7;
$array['source_type'] = 1;
$array['desc'] = '线下当面付订单收入';
$array['comment'] = '用户订单完成';
}else if($note == '线上订单' || $note == '线上订单收入' || $note == '线上订单收入-测试'){
$array['money_type'] = 6;
$array['source_type'] = 1;
$array['desc'] = '线上外卖订单收入';
$array['comment'] = '用户订单完成';
}
break;
case 2:
if($note == '提现到微信'){
$array['money_type'] = 105;
$array['source_type'] = 2;
$array['desc'] = '商户提现';
$array['comment'] = '商户提现打款';
} }
break;
default:
break;
}
return $array;
}
// 用户下单成功,平台奖励
// $desc='用户店铺首单奖励';
// $comment='用户当面付商户奖励';
// 新用户下单成功,平台奖励
// $desc='新用户下单奖励';
// $comment='用户当面付商户奖励';
// 线上订单
// $desc = '线上外卖订单收入';
// $comment = '用户订单完成';
// 当面付订单收入
// $desc = '线下当面付订单收入';
// $comment = '用户订单完成';
// 线上订单退款
// $desc = '线上订单退款';
// $comment = '线上订单退款到微信';
// 提现到微信
// $desc = '商户提现';
// $comment = '商户提现打款';
} }

88
app/Console/Commands/MigrateStoreBalance.php

@ -39,10 +39,6 @@ class MigrateStoreBalance extends Command
*/ */
public function handle() public function handle()
{ {
$oldStoreTableName = 'ims_cjdc_store';
$oldOrderTableName = 'ims_cjdc_order';
$oldWithdrawalTableName = 'ims_cjdc_withdrawal';
$oldAccountTableName = 'ims_cjdc_store_account'; $oldAccountTableName = 'ims_cjdc_store_account';
$newBalanceTableName = 'lanzu_user_balance'; $newBalanceTableName = 'lanzu_user_balance';
@ -58,14 +54,14 @@ class MigrateStoreBalance extends Command
} }
// 流水算法 // 流水算法
// $newData = $this->countStore($oldAccountTableName);
$newData = $this->countStore($oldAccountTableName);
// 订单算法 // 订单算法
$newData = $this->countOrder($oldStoreTableName,$oldOrderTableName,$oldWithdrawalTableName);
// $newData = $this->countOrder();
var_dump($newData);
// var_dump(number_format($newData[12],2));
// var_dump($newData);
// var_dump(count($newData));
// return 0;
return 0;
$bar = $this->output->createProgressBar(count($newData)); $bar = $this->output->createProgressBar(count($newData));
$bar->start(); $bar->start();
$startTime = time(); $startTime = time();
@ -75,11 +71,12 @@ return 0;
$exist = DB::table($newBalanceTableName)->where('source_id',$store_id)->where('user_type',5)->exists(); $exist = DB::table($newBalanceTableName)->where('source_id',$store_id)->where('user_type',5)->exists();
if($exist){ if($exist){
$saveData = [ $saveData = [
'balance' => number_format($money,2),
'balance' => number_format($money,2,'.',''),
'updated_at' => time() 'updated_at' => time()
]; ];
return 0;
$res = DB::table($newBalanceTableName)->update($saveData);
// var_dump($saveData);
// return 0;
$res = DB::table($newBalanceTableName)->where('source_id',$store_id)->where('user_type',5)->update($saveData);
if(!$res){ if(!$res){
$error[] = ['store_id'=>$store_id,'money'=>$money]; $error[] = ['store_id'=>$store_id,'money'=>$money];
} }
@ -87,10 +84,11 @@ return 0;
$saveData = [ $saveData = [
'source_id' => $store_id, 'source_id' => $store_id,
'user_type' => 5, 'user_type' => 5,
'balance' => number_format($money),
'balance' => number_format($money,2,'.',''),
'updated_at' => time() 'updated_at' => time()
]; ];
return 0;
// var_dump($saveData);
// return 0;
$res = DB::table($newBalanceTableName)->insert($saveData); $res = DB::table($newBalanceTableName)->insert($saveData);
if(!$res){ if(!$res){
$error[] = ['store_id'=>$store_id,'money'=>$money]; $error[] = ['store_id'=>$store_id,'money'=>$money];
@ -130,30 +128,34 @@ return 0;
/** /**
* 根据订单进行计算 * 根据订单进行计算
*/ */
public function countOrder( $oldStoreTableName, $oldOrderTableName, $oldWithdrawalTableName)
public function countOrder()
{ {
$oldStoreTableName = 'ims_cjdc_store';
$oldStoreSetTableName = 'ims_cjdc_storeset';
$oldStoreTypeTableName = 'ims_cjdc_storetype';
$oldOrderTableName = 'ims_cjdc_order';
$oldWithdrawalTableName = 'ims_cjdc_withdrawal';
$newData = []; $newData = [];
// 查询所有店铺 // 查询所有店铺
$stores = DB::table($oldStoreTableName)->select('id','md_type','award_money')->get();
$stores = DB::table($oldStoreTableName)->select('id','md_type','ps_poundage','award_money')->get();
//店铺设置 //店铺设置
$storeSets = DB::table('ims_cjdc_storeset')->get()->toArray();
$storeSets = DB::table($oldStoreSetTableName)->select('id','store_id','is_poundage','poundage','dn_poundage','dm_poundage','yd_poundage')->get()->toArray();
$storeSetArr = array_column($storeSets,null,'store_id'); $storeSetArr = array_column($storeSets,null,'store_id');
// 所有商家分类 // 所有商家分类
$storeTypes = DB::table('ims_cjdc_storetype')->get()->toArray();
$storeTypes = DB::table($oldStoreTypeTableName)->get()->toArray();
$storeTypeArr = array_column($storeTypes,null,'id'); $storeTypeArr = array_column($storeTypes,null,'id');
return $storeTypeArr;
foreach($stores as $key => $value){ foreach($stores as $key => $value){
$storeId = $value->id; $storeId = $value->id;
// 获取商家手续费 % 如果商家设置有自己的手续费则用商家的 // 获取商家手续费 % 如果商家设置有自己的手续费则用商家的
if($storeSets[$storeId]['is_poundage'] == 1){
if(isset($storeSetArr[$storeId]) && $storeSetArr[$storeId]->is_poundage == 1){
$poundage = $storeSetArr[$storeId]; $poundage = $storeSetArr[$storeId];
}else{ }else{
$poundage = $storeTypeArr[$storeId];
$poundage = $storeTypeArr[$value->md_type];
} }
// 商家订单金额 // 商家订单金额
@ -162,60 +164,66 @@ return 0;
// state '1.待付款2.待结单3.等待送达4.完成5.已评价6.取消7.拒绝8.退款中9.已退款10.退款拒绝', // state '1.待付款2.待结单3.等待送达4.完成5.已评价6.取消7.拒绝8.退款中9.已退款10.退款拒绝',
// 外卖 // 外卖
$wmOrder = DB::table('ims_cjdc_order')
$wmOrder = DB::table($oldOrderTableName)
->select(DB::raw('sum(money) as total_money'),DB::raw('sum(ps_money) as ps_money'),DB::raw('sum(yhq_money2) as hb_money')) ->select(DB::raw('sum(money) as total_money'),DB::raw('sum(ps_money) as ps_money'),DB::raw('sum(yhq_money2) as hb_money'))
->where('store_id',$storeId) ->where('store_id',$storeId)
->where('type',1) ->where('type',1)
->whereIn('state',[4,5,10]) ->whereIn('state',[4,5,10])
->whereIn('pay_type',[1,2]) ->whereIn('pay_type',[1,2])
->get();
->first();
// 店内 // 店内
$dnOrder = DB::table('ims_cjdc_order')
$dnOrder = DB::table($oldOrderTableName)
->select(DB::raw('sum(money) as total_money'),DB::raw('sum(yhq_money2) as hb_money')) ->select(DB::raw('sum(money) as total_money'),DB::raw('sum(yhq_money2) as hb_money'))
->where('store_id',$storeId) ->where('store_id',$storeId)
->where('type',2) ->where('type',2)
->where('dn_state',2) ->where('dn_state',2)
->whereIn('pay_type',[1,2]) ->whereIn('pay_type',[1,2])
->get();
->first();
// 当面 // 当面
$dmOrder = DB::table('ims_cjdc_order')
$dmOrder = DB::table($oldOrderTableName)
->select(DB::raw('sum(money) as total_money')) ->select(DB::raw('sum(money) as total_money'))
->where('store_id',$storeId) ->where('store_id',$storeId)
->where('type',4) ->where('type',4)
->where('dm_state',2) ->where('dm_state',2)
->whereIn('pay_type',[1,2]) ->whereIn('pay_type',[1,2])
->get();
->first();
// 预约 // 预约
$yyOrder = DB::table('ims_cjdc_order')
$yyOrder = DB::table($oldOrderTableName)
->select(DB::raw('sum(money) as total_money')) ->select(DB::raw('sum(money) as total_money'))
->where('store_id',$storeId) ->where('store_id',$storeId)
->where('type',3) ->where('type',3)
->where('yy_state',3) ->where('yy_state',3)
->whereIn('pay_type',[1,2]) ->whereIn('pay_type',[1,2])
->get();
->first();
// 提现 // 提现
$txTotal = DB::table('ims_cjdc_withdrawal')
$txTotal = DB::table($oldWithdrawalTableName)
->select(DB::raw('sum(tx_cost) as total')) ->select(DB::raw('sum(tx_cost) as total'))
->where('store_id',$storeId) ->where('store_id',$storeId)
->whereIn('state',[1,2]) ->whereIn('state',[1,2])
->get();
->first();
// 商家奖励 // 商家奖励
$awardTotal = empty($value->award_money) ? 0 : $value->award_money; $awardTotal = empty($value->award_money) ? 0 : $value->award_money;
// 计算 金额 = 奖励 + 订单() - 手续费 - 提现
// 商户配送手续费
$psMoney = number_format(floatval($wmOrder->ps_money)*floatval($value->ps_poundage)/100,2,'.','');
// 不计算拼团和抢购的订单,目前没有这样的订单,在另外的订单表
// 计算 金额 = 奖励 + 订单(外卖+店内+当面+预约) - 手续费 - 提现 - 配送费
$balance = $awardTotal $balance = $awardTotal
+ ($wmOrder->total_money + $wmOrder->hb_money + $dnOrder->total_money + $dnOrder->hb_money + $dmOrder->total_money + $yyOrder->total_money ) + ($wmOrder->total_money + $wmOrder->hb_money + $dnOrder->total_money + $dnOrder->hb_money + $dmOrder->total_money + $yyOrder->total_money )
- (( - ((
($wmOrder->total_money + $wmOrder->ps_money + $wmOrder->hb_money) * $poundage->poundage
+ ($dnOrder->total_money + $dnOrder->hb_money ) * $poundage->dn_poundage
+ $dmOrder->total_money * $poundage->dm_poundage
+ $yyOrder->total_money * $poundage->yd_poundage
($wmOrder->total_money + $wmOrder->ps_money + $wmOrder->hb_money) * floatval($poundage->poundage)
+ ($dnOrder->total_money + $dnOrder->hb_money ) * floatval($poundage->dn_poundage)
+ $dmOrder->total_money * floatval($poundage->dm_poundage)
+ $yyOrder->total_money * floatval($poundage->yd_poundage)
)/100) )/100)
- ($txTotal->total)
;
- $txTotal->total
- $psMoney;
$newData[$storeId] = number_format($balance,2);
$newData[$storeId] = $balance;
} }
return $newData; return $newData;

65
app/Console/Commands/SetGoodsMarketId.php

@ -1,65 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\LanzuGoods;
use App\Models\LanzuStore;
class SetGoodsMarketId extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'migrateData:SetGoodsMarketId';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command 根据商品表中storeid设置市场id';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$goods = LanzuGoods::all();
$no_store_ids = [];
foreach($goods as $key => $item){
$store = LanzuStore::find($item->store_id);
if($store){
$item->market_id = $store->market_id;
$item->save();
print_r($item->id.'\r\n');
}else{
$no_store_ids[] = $item->store_id;
break;
}
}
var_dump($no_store_ids);
return 0;
}
}

10
app/Console/Commands/SetStoreUsers.php

@ -42,11 +42,11 @@ class SetStoreUsers extends Command
public function handle() public function handle()
{ {
// 如果表不存在则创建 // 如果表不存在则创建
if(!Schema::hasTable('lanzu_store_users')){
Schema::create('lanzu_store_users',function (Blueprint $table){
$table->id();
});
}
// if(!Schema::hasTable('lanzu_store_users')){
// Schema::create('lanzu_store_users',function (Blueprint $table){
// $table->id();
// });
// }
$account = DB::table('ims_cjdc_account')->get(); $account = DB::table('ims_cjdc_account')->get();
$bar = $this->output->createProgressBar(count($account)); $bar = $this->output->createProgressBar(count($account));
$bar->start(); $bar->start();

Loading…
Cancel
Save