diff --git a/app/Admin/Forms/CategoryTieForm.php b/app/Admin/Forms/CategoryTieForm.php index 8eb222c..ca78341 100644 --- a/app/Admin/Forms/CategoryTieForm.php +++ b/app/Admin/Forms/CategoryTieForm.php @@ -26,23 +26,33 @@ class CategoryTieForm extends Form $data = []; if(!empty($category)){ foreach ($category as $key => $value){ - $data[$value->id] = json_encode([ + $data[$value->sort] = [ 'icon' => $value->cover_img, 'name' => $value->title, - 'sort' => $value->sort - ]); + 'sort' => $value->sort, + 'id' => $value->id + ]; } + if(count($data) > 0){ + // 根据sort排序 + krsort($data); + $save = array_column($data,null,'id'); + foreach($save as &$cate){ + $cate = json_encode($cate); + } + $this->ssdb->client()->hclear('applet_index_category'); - } - } - $category = $this->ssdb->client()->multi_hset('applet_index_category',$data); - if($category === false){ - return $this->error('修改失败'); - } + $category = $this->ssdb->client()->multi_hset('applet_index_category',$save); - return $this->success('修改成功', '/category'); + if($category === false){ + return $this->error('修改失败'); + } + return $this->success('修改成功', '/category'); + } + } + return $this->success('未进行修改或者查询不到分类', '/category'); } /** diff --git a/app/Console/Commands/MigrateStoreAccount.php b/app/Console/Commands/MigrateStoreAccount.php index 76ab4c6..5e4debd 100644 --- a/app/Console/Commands/MigrateStoreAccount.php +++ b/app/Console/Commands/MigrateStoreAccount.php @@ -39,18 +39,6 @@ class MigrateStoreAccount extends Command */ 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'; $newTableName = 'lanzu_financial_record'; // 判断表是否存在