Browse Source

Merge branch 'phoenix' into develop

master
liangyuyan 6 years ago
parent
commit
04759f7c9f
  1. 24
      app/Admin/Forms/CategoryTieForm.php
  2. 12
      app/Console/Commands/MigrateStoreAccount.php

24
app/Admin/Forms/CategoryTieForm.php

@ -26,24 +26,34 @@ class CategoryTieForm extends Form
$data = []; $data = [];
if(!empty($category)){ if(!empty($category)){
foreach ($category as $key => $value){ foreach ($category as $key => $value){
$data[$value->id] = json_encode([
$data[$value->sort] = [
'icon' => $value->cover_img, 'icon' => $value->cover_img,
'name' => $value->title, 'name' => $value->title,
'sort' => $value->sort
]);
'sort' => $value->sort,
'id' => $value->id
];
} }
if(count($data) > 0){ if(count($data) > 0){
$this->ssdb->client()->hclear('applet_index_category');
}
// 根据sort排序
krsort($data);
$save = array_column($data,null,'id');
foreach($save as &$cate){
$cate = json_encode($cate);
} }
$category = $this->ssdb->client()->multi_hset('applet_index_category',$data);
$this->ssdb->client()->hclear('applet_index_category');
$category = $this->ssdb->client()->multi_hset('applet_index_category',$save);
if($category === false){ if($category === false){
return $this->error('修改失败'); return $this->error('修改失败');
} }
return $this->success('修改成功', '/category'); return $this->success('修改成功', '/category');
} }
}
return $this->success('未进行修改或者查询不到分类', '/category');
}
/** /**
* Build a form here. * Build a form here.

12
app/Console/Commands/MigrateStoreAccount.php

@ -39,18 +39,6 @@ class MigrateStoreAccount extends Command
*/ */
public function handle() public function handle()
{ {
$m = ['120'=>['sort'=>'12'],'12'=>['sort'=>'3'],'112'=>['sort'=>'2'],'110'=>['sort'=>'120']];
$arr = [];
foreach ($m as $key=>$value){
$arr[$value['sort']] = $value;
$arr[$value['sort']]['id'] = $key;
}
krsort($arr);
$b = array_column($arr,null,'id');
// array_multisort($sort,SORT_DESC,SORT_NUMERIC,$m);
var_dump($b);
return 0;
$oldTableName = 'ims_cjdc_store_account'; $oldTableName = 'ims_cjdc_store_account';
$newTableName = 'lanzu_financial_record'; $newTableName = 'lanzu_financial_record';
// 判断表是否存在 // 判断表是否存在

Loading…
Cancel
Save