Browse Source

Merge branch 'phoenix' into develop

master
liangyuyan 5 years ago
parent
commit
0072c8f515
  1. 2
      app/Admin/Controllers/v3/CategoryController.php
  2. 3
      app/Console/Commands/MigrateMarketData.php
  3. 7
      app/Models/v3/Category.php
  4. 7
      app/Models/v3/CouponSetting.php
  5. 5
      app/Models/v3/GoodsCategory.php
  6. 11
      app/Models/v3/Market.php

2
app/Admin/Controllers/v3/CategoryController.php

@ -49,7 +49,7 @@ class CategoryController extends AdminController
return Form::make(new Category(),function (Form $form){
// 只查一级
$parentList = Category::getArray([['parent_id','=',0]],[0=>'顶级']);
$parentList = Category::getArray([['parent_id','=',0]],['顶级'=>0]);
$form->select('parent_id')->default(0)->options($parentList);
$form->text('title')->required();

3
app/Console/Commands/MigrateMarketData.php

@ -40,7 +40,7 @@ class MigrateMarketData extends Command
{
// get old data from old table
$oldData = DB::table('ims_cjdc_market')->get();
$oldData = DB::table('ims_cjdc_market_new')->get();
$bar = $this->output->createProgressBar(count($oldData));
$bar->start();
@ -49,6 +49,7 @@ class MigrateMarketData extends Command
foreach ($oldData as $key => $value) {
$coordinates = explode(',', $value->coordinates);
$newData[] = [
'id' => $value->id,
'mp_id' => $value->mp_id ?? 0,
'name' => $value->name ?? '',
'logo' => $value->logo ?? '',

7
app/Models/v3/Category.php

@ -56,11 +56,12 @@ class Category extends Model
if(count($where) > 0){
$model->where($where);
}
$list = $model->pluck('title','id')->toArray();
$list = $model->pluck('id','title')->toArray();
if(!empty($options)){
return array_merge($options,$list);
$new = array_merge($options,$list);
return array_flip($new);
}else{
return $list;
return array_flip($list);
}
}

7
app/Models/v3/CouponSetting.php

@ -41,11 +41,12 @@ class CouponSetting extends Model
if(!empty($where)){
$model->where($where);
}
$list = $model->pluck('name','id')->toArray();
$list = $model->pluck('id','name')->toArray();
if(!empty($options)){
return array_merge($options,$list);
$new = array_merge($options,$list);
return array_flip($new);
}else{
return $list;
return array_flip($list);
}
}

5
app/Models/v3/GoodsCategory.php

@ -40,9 +40,10 @@ class GoodsCategory extends Model
if(count($where) > 0){
$model->where($where);
}
$list = $model->pluck('title','id')->toArray();
$list = $model->pluck('id','title')->toArray();
if(!empty($options)){
return array_merge($options,$list);
$new = array_merge($options,$list);
return array_flip($new);
}else{
return $list;
}

11
app/Models/v3/Market.php

@ -34,17 +34,18 @@ class Market extends Model
*/
public static function getMarketArray($where = [], $options = [])
{
$model = self::where('status',1)
->whereNull('deleted_at');
$model = self::whereNull('deleted_at');
// ->where('status',1)
if(!empty($where)){
$model->where($where);
}
$list = $model->pluck('name','id')->toArray();
$list = $model->pluck('id','name')->toArray();
if(!empty($options)){
return array_merge($options,$list);
$new = array_merge($options,$list);
return array_flip($new);
}else{
return $list;
return array_flip($list);
}
}

Loading…
Cancel
Save