quanwei
3 days ago 73b874c72ad55eb9eef21c36160ac0de58f0189e
admin/app/shop/model/supplier/Plan.php
@@ -22,8 +22,24 @@
            $model = $model->where('status', '=', $data['status']);
        }
        $list = $model->with('plan_access')
            ->where(['is_delete'=>0])
            ->order(['sort' => 'asc', 'create_time' => 'desc'])
            ->paginate($data);
        if (empty($list)) {
            $addDate=[
                'name' => '默认套餐',
                'price' => 0,
                'sort' => 0,
                'status' => 1,
                'is_default' => 1,
                'app_id' => self::$app_id,
            ];
            $this->save($addDate);
            $list = $model->with('plan_access')
                ->order(['sort' => 'asc', 'create_time' => 'desc'])
                ->paginate($data);
        }
        return $list;
    }
@@ -53,7 +69,7 @@
    }
    private function addPlanAccess($list)
    {
        $this->planAccess()->delete();
        $this->planAccess()->where('plan_id', $this->plan_id)->delete();
        $list = json_decode($list);
        $data=array_map(function($item){
            return [