0]) ->order(['id' => 'desc']) ->paginate([ 'page' => $get['page'] ?? 1, 'list_rows' => $get['limit'] ?? 10, 'var_page' => 'page' ]) ->toArray(); foreach ($list['data'] as &$v) { $v['type'] = DistributionPartnerEnum::getPartner($v['type']); } return $list; } public static function getConfig(){ $config = [ 'open_store_type' => ConfigServer::get('distribution','store_type',0), ]; return [$config]; } public static function add($post){ try{ DistributionPartner::create([ 'proportion' => str_replace('%', '', $post['proportion']), 'city' => $post['citys'], 'type' => $post['type'], 'core_city_money' => $post['core_city_money'], 'un_core_city_money' => $post['un_core_city_money'], 'is_show' => $post['is_show'], 'create_time' => time(), ]); return true; }catch(\Exception $e) { self::$error = $e->getMessage(); return false; } } public static function details($id){ return DistributionPartner::where(['id' => $id, 'is_delete' => 0])->find(); } public static function edit($post){ try{ DistributionPartner::where('id', $post['id'])->update([ 'proportion' => str_replace('%', '', $post['proportion']), 'city' => $post['citys'], 'type' => $post['type'], 'core_city_money' => $post['core_city_money'], 'un_core_city_money' => $post['un_core_city_money'], 'is_show' => $post['is_show'], 'update_time' => time(), ]); return true; }catch(\Exception $e) { self::$error = $e->getMessage(); return false; } } public static function del($id){ return DistributionPartner::where(['id' => $id])->update(['delete_time' => time(),'is_delete' => 1]); } }