Explorar o código

层级关系功能完成

BF-202205051124\Administrator %!s(int64=3) %!d(string=hai) anos
pai
achega
038e33f4c2

+ 10 - 0
app/Console/Commands/TestCommand.php

@@ -40,6 +40,7 @@ use App\Servers\HxServer;
 use App\Servers\Icon\TronRPC;
 use App\Servers\ImgServer;
 use App\Servers\ImServer;
+use App\Servers\MemberClanServer;
 use App\Servers\MemberServer;
 use App\Servers\OrderServer;
 use App\Servers\PayServer;
@@ -95,6 +96,15 @@ class TestCommand extends Command
      */
     public function handle()
     {
+//        for ($i=1;$i<=20;++$i){
+//            MemberServer::creatServer()->register($i.'abc', 1, '', '');
+//        }
+        $list=Member::where('id','>',12)->select(['id'])->get();
+        foreach ($list as $value){
+            MemberClanServer::creatServer()->creatBoth($value->{'id'},1);
+        }
+//
+        dd(1);
        $address=TronRPC::CreationTron()->getContract('41a614f803b6fd780986a42c78ec9c7f77e6ded13c');
        dd($address);
 

+ 82 - 0
app/Http/Controllers/MemberBoth/MemberBothsController.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace App\Http\Controllers\MemberBoth;
+
+use App\Http\Controllers\AdminBaseController;
+use App\Http\Requests\MemberBothCreateRequest;
+use App\Http\Requests\MemberBothUpdateRequest;
+use App\Repositories\Eloquent\MemberBothRepositoryEloquent;
+use App\Validators\MemberBothValidator;
+
+/**
+ * Class MemberBothsController.
+ *
+ * @package namespace App\Http\Controllers;
+ */
+class MemberBothsController extends AdminBaseController
+{
+    /**
+     * @var MemberBothRepositoryEloquent
+     */
+    protected $repository;
+
+    /**
+     * @var MemberBothValidator
+     */
+    protected $validator;
+
+    /**
+     * MemberBothsController constructor.
+     *
+     * @param MemberBothRepositoryEloquent $repository
+     * @param MemberBothValidator $validator
+     */
+    public function __construct(MemberBothRepositoryEloquent $repository, MemberBothValidator $validator)
+    {
+        parent::__construct($repository, $validator);
+    }
+
+    /**
+     * 数据检索
+     */
+     public function _indexScopeQuery()
+        {
+            $where = [];
+            $search = explode(";", request()->input('search', ""));
+            $start = $end = null;
+            $fieldSearchable=$this->repository->getFieldsSearchable();
+            foreach ($search as $value) {
+                if (!empty($value)) {
+                    list($one, $tow) = explode(":", $value);
+                    if (!empty($fieldSearchable[$one])) {
+                        if($fieldSearchable[$one]=='like')$tow="%{$tow}%";
+                        $where[]=[$one,$fieldSearchable[$one],$tow];
+                    } elseif ($one == 'start') {
+                        $start = $tow . " 00:00:00";
+                    } elseif ($one == 'end') {
+                        $end = $tow . " 23:59:59";
+                    } else {
+                        continue;
+                    }
+                }
+            }
+            return function ($query) use ($where, $start, $end) {
+
+                if ($start) $where[] = ['created_at', '>=', $start];
+                if ($end) $where[] = ['created_at', '<=', $end];
+                if ($where) {
+                    $query->where($where);
+                }
+
+            };
+        }
+
+   /**
+     * 数据更新
+     */
+    protected function _indexPost($datum)
+    {
+        return $datum;
+    }
+
+}

+ 30 - 0
app/Http/Requests/MemberBothCreateRequest.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class MemberBothCreateRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return false;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            //
+        ];
+    }
+}

+ 30 - 0
app/Http/Requests/MemberBothUpdateRequest.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class MemberBothUpdateRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return false;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            //
+        ];
+    }
+}

+ 38 - 0
app/Jobs/CreatBothJob.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Jobs;
+
+use App\Servers\MemberClanServer;
+use Illuminate\Bus\Queueable;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+
+class CreatBothJob implements ShouldQueue
+{
+    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
+    private $mId;
+    private $pId;
+    /**
+     * Create a new job instance.
+     *
+     * @return void
+     */
+    public function __construct($mId,$pId)
+    {
+        $this->mId=$mId;
+        $this->pId=$pId;
+    }
+
+    /**
+     * Execute the job.
+     *
+     * @return void
+     */
+    public function handle()
+    {
+        MemberClanServer::creatServer()->creatBoth($this->mId,$this->pId);
+    }
+}

+ 53 - 0
app/Models/MemberBoth.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Prettus\Repository\Contracts\Transformable;
+use Prettus\Repository\Traits\TransformableTrait;
+
+/**
+ * Class MemberBoth.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property int $m_id m_id
+ * @property int $left_id 左节点
+ * @property int $right_id 右节点
+ * @property int $parent_id 父级节点
+ * @property int $direct_id 直推节点
+ * @property string $parent_ids 父级族谱
+ * @property string $child_ids 子族谱
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth query()
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereChildIds($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereDirectId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereLeftId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereMId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereParentId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereParentIds($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereRightId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereUpdatedAt($value)
+ * @mixin \Eloquent
+ * @property int|null $tier_num 层级
+ * @property int|null $is_end 是否完整
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereIsEnd($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberBoth whereTierNum($value)
+ */
+class MemberBoth extends Model implements Transformable
+{
+    use TransformableTrait;
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $guarded = ['id', 'updated_at', 'created_at'];
+
+}

+ 24 - 0
app/Presenters/MemberBothPresenter.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Presenters;
+
+use App\Transformers\MemberBothTransformer;
+use Prettus\Repository\Presenter\FractalPresenter;
+
+/**
+ * Class MemberBothPresenter.
+ *
+ * @package namespace App\Presenters;
+ */
+class MemberBothPresenter extends FractalPresenter
+{
+    /**
+     * Transformer
+     *
+     * @return \League\Fractal\TransformerAbstract
+     */
+    public function getTransformer()
+    {
+        return new MemberBothTransformer();
+    }
+}

+ 1 - 0
app/Providers/RepositoryServiceProvider.php

@@ -49,6 +49,7 @@ class RepositoryServiceProvider extends ServiceProvider
         $this->app->bind(\App\Repositories\MessageRepository::class, \App\Repositories\Eloquent\MessageRepositoryEloquent::class);
         $this->app->bind(\App\Repositories\ContractRepository::class, \App\Repositories\Eloquent\ContractRepositoryEloquent::class);
         $this->app->bind(\App\Repositories\InvestRepository::class, \App\Repositories\Eloquent\InvestRepositoryEloquent::class);
+        $this->app->bind(\App\Repositories\MemberBothRepository::class, \App\Repositories\Eloquent\MemberBothRepositoryEloquent::class);
         //:end-bindings:
     }
 }

+ 57 - 0
app/Repositories/Eloquent/MemberBothRepositoryEloquent.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace App\Repositories\Eloquent;
+
+use Prettus\Repository\Eloquent\BaseRepository;
+use Prettus\Repository\Criteria\RequestCriteria;
+use App\Repositories\MemberBothRepository;
+use App\Models\MemberBoth;
+use App\Validators\MemberBothValidator;
+
+/**
+ * Class MemberBothRepositoryEloquent.
+ *
+ * @package namespace App\Repositories\Eloquent;
+ */
+class MemberBothRepositoryEloquent extends BaseRepository implements MemberBothRepository
+{
+    /**
+     * 查询检索的字段
+     *
+     * @return string
+     */
+    protected $fieldSearchable = [
+        'id'                => '=',
+    ];
+
+    /**
+     * Specify Model class name
+     *
+     * @return string
+     */
+    public function model()
+    {
+        return MemberBoth::class;
+    }
+
+    /**
+    * Specify Validator class name
+    *
+    * @return mixed
+    */
+    public function validator()
+    {
+
+        return MemberBothValidator::class;
+    }
+
+
+    /**
+     * Boot up the repository, pushing criteria
+     */
+    public function boot()
+    {
+        // $this->pushCriteria(app(RequestCriteria::class));
+    }
+
+}

+ 15 - 0
app/Repositories/MemberBothRepository.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Repositories;
+
+use Prettus\Repository\Contracts\RepositoryInterface;
+
+/**
+ * Interface MemberBothRepository.
+ *
+ * @package namespace App\Repositories;
+ */
+interface MemberBothRepository extends RepositoryInterface
+{
+    //
+}

+ 18 - 7
app/Servers/ContractServer.php

@@ -11,6 +11,7 @@ use App\Jobs\MsgFileJob;
 use App\Models\BlockItems;
 use App\Models\Contract;
 use App\Models\ErrorRecord;
+use App\Servers\Icon\TronRPC;
 
 /**
  * Redis数据缓存类
@@ -51,14 +52,24 @@ class ContractServer
                     'data' => json_encode($contract)
                 ]);
             }else{
-                //检测交易信息
-
-                if($contract->{'type'}==1){
-                    //初始合约
-
-                }else{
-                    //复投合约
+                $ret = TronRPC::CreationTron()->getTransaction($contract->{'hash'});
+                if (!empty($ret['ret'][0]['contractRet']) && $ret['ret'][0]['contractRet'] == 'SUCCESS') {
+                    //检测交易信息
+                    if($contract->{'type'}==1){
+                        //初始合约
+
+                    }else{
+                        //复投合约
+
+                    }
+                } else {
+                    ErrorRecord::create([
+                        'm_id' => 0,
+                        'msg' => '交易失败',
+                        'data' => json_encode($contract)
+                    ]);
                 }
+
             }
         }
     }

+ 10 - 0
app/Servers/JobServer.php

@@ -8,6 +8,7 @@ namespace App\Servers;
 
 use App\Jobs\BoadcastDetectionJob;
 use App\Jobs\BusinessFileJob;
+use App\Jobs\CreatBothJob;
 use App\Jobs\MsgFileJob;
 use App\Models\BlockItems;
 
@@ -47,6 +48,15 @@ class JobServer
         BoadcastDetectionJob::dispatch($blockItem)->delay(3)->onConnection('redis')->onQueue('broadcastDetection');
     }
 
+    /**
+     * 双线关系绑定
+     * @param $mId
+     * @param $pId
+     */
+    function creatBothJob($mId,$pId){
+        CreatBothJob::dispatch($mId,$pId)->delay(3)->onConnection('redis')->onQueue('creatBoth');
+    }
+
 
 
 

+ 60 - 1
app/Servers/MemberClanServer.php

@@ -5,6 +5,7 @@ namespace App\Servers;
 
 use App\Jobs\MemberShareJob;
 use App\Models\Member;
+use App\Models\MemberBoth;
 use App\Models\MemberClan;
 use Illuminate\Support\Facades\DB;
 
@@ -108,7 +109,6 @@ class MemberClanServer
         $p_clans = MemberClan::where('m_id', $p_member->{'id'})->select(['id', 'm_ids', 'p_ids'])->first();
         $new_p_ids_str = $p_clans->{'p_ids'} . ',' . $p_member->{'id'};
         $new_p_ids = array_filter(explode(',', $new_p_ids_str));
-
         foreach ($new_p_ids as $new_p_id) {
             $new_m_ids = MemberClan::where('m_id', $new_p_id)->value('m_ids');
             $new_m_ids = explode(',', $new_m_ids);
@@ -133,5 +133,64 @@ class MemberClanServer
         return true;
     }
 
+    /**
+     * 双线关系绑定
+     * @param $mId
+     * @param $pId
+     * @return bool
+     */
+    function creatBoth($mId,$pId){
+        $num=MemberBoth::where('m_id',$mId)->count();
+        if($num>0){
+            return ;
+        }
+        $bothData=[
+            'm_id'=>$mId,
+            'direct_id'=>$pId,
+            'left_id'=>0,
+            'right_id'=>0,
+        ];
+        $pBothData=MemberBoth::where('m_id',$pId)->first();
+        if(empty($pBothData)){
+            CommonServer::creatServer()->addErrorRecord('层级关系错误',$bothData);
+        }else{
+            if($pBothData->{'is_end'}!=0){
+                //直推人已满就检查下面人员
+                $childIds=array_filter(explode(',',$pBothData->{'child_ids'}));
+                //重新获取
+                $pBothData=MemberBoth::whereIn('m_id',$childIds)->where('is_end',0)->orderBy('tier_num' ,'asc')->orderBy('id','asc')->first();
+                if(empty($pBothData)){
+                    CommonServer::creatServer()->addErrorRecord('子节点层级关系错误',$bothData);
+                }
+            }
+            if($pBothData->{'left_id'}){
+                $pBothData->{'right_id'}=$mId;
+            }else{
+                $pBothData->{'left_id'}=$mId;
+            }
+            $pBothData->{'child_ids'}.=(($pBothData->{'child_ids'}?',':'').$mId);
+            $bothData['tier_num']=$pBothData->{'tier_num'}+1;
+            $bothData['parent_id']=$pBothData->{'id'};
+            $bothData['parent_ids']=$pBothData->{'parent_ids'}.','.$pBothData->{'id'};
+            $bothData['child_ids']='';
+            $bothData['is_end']='0';
+            $bothData=MemberBoth::create($bothData);
+            if($pBothData->{'left_id'} && $pBothData->{'right_id'}){
+                $pBothData->{'is_end'}=1;
+            }
+            $pBothData->save();
+            $parentIds=array_filter(explode(',',$bothData['parent_ids']));
+            foreach ($parentIds as $parentId){
+                if($parentId!=$pBothData->{'id'}){
+                    $childIds=MemberBoth::where('id',$parentId)->value('child_ids');
+                    $childIds=explode(',', $childIds);
+                    $childIds[]=$bothData->{'id'};
+                    MemberBoth::where('id',$parentId)->update(['child_ids'=>implode(',',$childIds)]);
+                }
+            }
+        }
+        return true;
+    }
+
 
 }

+ 33 - 0
app/Transformers/MemberBothTransformer.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Transformers;
+
+use League\Fractal\TransformerAbstract;
+use App\Models\MemberBoth;
+
+/**
+ * Class MemberBothTransformer.
+ *
+ * @package namespace App\Transformers;
+ */
+class MemberBothTransformer extends TransformerAbstract
+{
+    /**
+     * Transform the MemberBoth entity.
+     *
+     * @param \App\Models\MemberBoth $model
+     *
+     * @return array
+     */
+    public function transform(MemberBoth $model)
+    {
+        return [
+            'id'         => (int) $model->id,
+
+            /* place your other model properties here */
+
+            'created_at' => $model->created_at,
+            'updated_at' => $model->updated_at
+        ];
+    }
+}

+ 24 - 0
app/Validators/MemberBothValidator.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Validators;
+
+use \Prettus\Validator\Contracts\ValidatorInterface;
+use \Prettus\Validator\LaravelValidator;
+
+/**
+ * Class MemberBothValidator.
+ *
+ * @package namespace App\Validators;
+ */
+class MemberBothValidator extends LaravelValidator
+{
+    /**
+     * Validation Rules
+     *
+     * @var array
+     */
+    protected $rules = [
+        ValidatorInterface::RULE_CREATE => [],
+        ValidatorInterface::RULE_UPDATE => [],
+    ];
+}

+ 41 - 0
database/migrations/2022_10_23_213544_create_member_boths_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+/**
+ * Class CreateMemberBothsTable.
+ */
+class CreateMemberBothsTable extends Migration
+{
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+		Schema::create('member_boths', function(Blueprint $table) {
+            $table->increments('id');
+            $table->integer('m_id')->index('m_id')->default('0')->comment('m_id');
+            $table->integer('tier_num')->default('0')->comment('层级');
+            $table->integer('left_id')->default('0')->comment('左节点');
+            $table->integer('right_id')->default('0')->comment('右节点');
+            $table->integer('parent_id')->default('0')->comment('父级节点');
+            $table->integer('direct_id')->default('0')->comment('直推节点');
+            $table->text('parent_ids')->comment('父级族谱');
+            $table->text('child_ids')->comment('子族谱');
+            $table->timestamps();
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('member_boths');
+	}
+}

+ 85 - 0
resources/views/admins/memberBoths/create.blade.php

@@ -0,0 +1,85 @@
+<div style="margin-top: 10px;" id="memberBoths-app">
+    <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
+        新增 - MemberBoth
+    </div>
+    <el-form action="{{route('admin.memberBoth.save')}}" method="post" id="form-create">
+        <!-- image -->
+        <ui-file label="图片(686*128)" size="0.5" name="image" :data="{uploadName:'memberBoths'}" tips="图片建议(686*128)"></ui-file>
+        <!-- link -->
+{{--        <ui-input-text label="memberBoth链接" name="link" placeholder="memberBoth跳转链接" maxlength="255" tips="请输入有效的链接" autofocus="true"></ui-input-text>--}}
+        <!-- show -->
+        <ui-radio label="是否开启" :params="params" tips="控制前台是否显示"></ui-radio>
+        <!-- sort -->
+        <ui-input-number label="排序" checked="checked" value="50" name="sort" min="1" max="100" tips="控制前台显示顺序"></ui-input-number>
+        <ui-submit></ui-submit>
+    </el-form>
+</div>
+
+<script type="application/javascript">
+    $(function () {
+        // 注意:Vue组件一定放在jQuery.validator前面验证
+        new Vue({
+            el: '#memberBoths-app',
+            data :function () {
+                return {
+                    params: {
+                        // 注意:group和attr连个属性都不能省略 就算为空
+                        group: {},
+                        attr: {
+                            name: 'status',   // 当前checkbox框的name属性  【必填】
+                            radioCheck:1,   // 当前选中项 int | string   【必填】
+                            label: 'el-radio-button', // 当前样式 默认 el-radio 样式 【非必填】
+                            radios: [ // 每个checkbox 就是一个json对象     【必填】
+                                {
+                                    value:0,      // 当前选中时值也就是value属性的值      【必填】
+                                    label: '关闭',    // 当前提示文字                 【必填】
+                                    disable: false   // 是否禁止点击 默认:false 不禁止
+                                },
+                                {
+                                    value:1,      // 当前选中时值也就是value属性的值      【必填】
+                                    label: '开启',    // 当前提示文字                 【必填】
+                                    disable: false   // 是否禁止点击 默认:false 不禁止
+                                }
+                            ]
+                        }
+                    }
+                };
+            }
+        });
+        jQuery.validator.setDefaults({
+            debug: false,         // 调试模式true不会提交,false允许提交
+            success: "success",   // 匹配成功的class样式名称
+            errorElement: 'div'   // 兼容el标签时使用(兼容el Vue组件label.error标签问题)
+        });
+        // 前台数据验证 验证需要设置window.form全局变量
+        window.form = $('#form-create').validate({
+            rules: {
+                image: {
+                    required: true,
+                    maxlength: 255,
+                    normalizer: function ( value ) {
+                        return $.trim(value);
+                    }
+                },
+                // link: {
+                //     required: true,
+                //     url:true,
+                //     maxlength: 255,
+                //     normalizer: function ( value ) {
+                //         return $.trim(value);
+                //     }
+                // },
+                show: {
+                    required: true
+                },
+                sort: {
+                    required: true,
+                    normalizer: function ( value ) {
+                        return $.trim(value);
+                    }
+                }
+            }
+        });
+    });
+</script>
+@include('layouts.admin.form_script')

+ 86 - 0
resources/views/admins/memberBoths/edit.blade.php

@@ -0,0 +1,86 @@
+<div style="margin-top: 10px;" id="memberBoths-app">
+    <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
+        编辑MemberBoth
+    </div>
+    <el-form action="{{route('admin.memberBoth.update',array('id'=>$model->id))}}" method="post" id="form-create">
+        <!-- 图片 -->
+        <ui-file label="图片(686*128)" size="0.5" name="image" :data="{uploadName:'memberBoths'}" imageurl="{{$model->image}}" tips="图片大小建议(686*128)"></ui-file>
+        <!-- 链接 -->
+{{--        <ui-input-text label="链接" name="link" value="{{$model->link}}" placeholder="跳转链接" maxlength="255" tips="请输入有效的链接" autofocus="true"></ui-input-text>--}}
+        <!-- 是否显示 -->
+        <ui-radio label="是否开启" :params="params" tips="控制前台是否显示"></ui-radio>
+        <!-- 排序 -->
+        <ui-input-number label="排序" checked="checked" name="sort" value="{{$model->sort}}" min="1" max="100" tips="控制前台显示顺序"></ui-input-number>
+        <ui-submit></ui-submit>
+    </el-form>
+</div>
+
+<script type="application/javascript">
+    $(function () {
+        // 注意:Vue组件一定放在jQuery.validator前面验证
+        new Vue({
+            el: '#memberBoths-app',
+            data :function () {
+                return {
+                    params: {
+                        // 注意:group和attr连个属性都不能省略 就算为空
+                        group: {},
+                        attr: {
+                            name: 'status',   // 当前checkbox框的name属性  【必填】
+                            radioCheck:{{$model->status}},   // 当前选中项 int | string   【必填】
+                            label: 'el-radio-button', // 当前样式 默认 el-radio 样式 【非必填】
+                            radios: [ // 每个checkbox 就是一个json对象     【必填】
+                                {
+                                    value:0,      // 当前选中时值也就是value属性的值      【必填】
+                                    label: '关闭',    // 当前提示文字                 【必填】
+                                    disable: false   // 是否禁止点击 默认:false 不禁止
+                                },
+                                {
+                                    value:1,      // 当前选中时值也就是value属性的值      【必填】
+                                    label: '开启',    // 当前提示文字                 【必填】
+                                    disable: false   // 是否禁止点击 默认:false 不禁止
+                                }
+                            ]
+                        }
+                    }
+                };
+            }
+        });
+        jQuery.validator.setDefaults({
+            debug: false,         // 调试模式true不会提交,false允许提交
+            success: "success",   // 匹配成功的class样式名称
+            errorElement: 'div'   // 兼容el标签时使用(兼容el Vue组件label.error标签问题)
+        });
+        // 前台数据验证 验证需要设置window.form全局变量
+        window.form = $('#form-create').validate({
+            rules: {
+                image: {
+                    required: true,
+                    maxlength: 255,
+                    normalizer: function ( value ) {
+                        return $.trim(value);
+                    }
+                },
+                // link: {
+                //     required: true,
+                //     maxlength: 255,
+                //     normalizer: function ( value ) {
+                //         return $.trim(value);
+                //     }
+                // },
+                show: {
+                    required: true
+                },
+                sort: {
+                    required: true,
+                    normalizer: function ( value ) {
+                        return $.trim(value);
+                    }
+                }
+            }
+        });
+        // 编辑保存变量
+        window.formDatum = $('form').serialize();
+    });
+</script>
+@include('layouts.admin.form_script')

+ 156 - 0
resources/views/admins/memberBoths/index.blade.php

@@ -0,0 +1,156 @@
+@extends('layouts.admin.app')
+@section('plug-css')
+    <link href="{{ asset('js/bootstrap-table/dist/bootstrap-table.css') }}" rel="stylesheet">
+@endsection
+@section('crumbs')
+    <ol class="breadcrumb crumbs">
+        <li><a href="{{ route('admin.index') }}#">后台导航</a></li>
+        <li><a href="{{ route('admin.memberBoth.index') }}">后台MemberBoth首页</a></li>
+        <li class="active">MemberBoth列表</li>
+    </ol>
+@endsection
+
+@section('content')
+    <form id="searchForm" class="form-inline">
+        <div class="">
+            <div class="form-group">
+                <label for="name" class="label-css"> ID:</label>
+                <input class="form-control" type="text" name="id">
+            </div>
+            &ensp;&ensp;
+            <button type="button" class="btn btn-primary">查询</button>
+        </div>
+    </form>
+    <hr class="hr-css">
+    <div>
+        <div id="toolbar">
+            <div class="columns columns-left btn-group pull-left">
+                <a class="createForm" data-url="{{ route('admin.memberBoth.store') }}" data-title="create">
+                    <button class="btn btn-default" type="button">
+                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增MemberBoth
+                    </button>
+                </a>
+                <a>
+                    <button id="deleteAll" data-url="{{ route('admin.memberBoth.destroys',['is_del'=>1]) }}" class="btn btn-default" type="button">
+                        <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&ensp;删除
+                    </button>
+                </a>
+            </div>
+        </div>
+        <table id="ContentTable"></table>
+    </div>
+@endsection
+
+@section('plug-js')
+    <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
+    <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
+    <script src="{{ asset('js/jquery-validation1.16/dist/jquery.validate.min.js') }}"></script>
+    <script src="{{ asset('js/jquery-validation1.16/dist/additional-methods.min.js') }}"></script>
+    <script src="{{ asset('js/jquery-validation1.16/src/localization/messages_zh.js') }}"></script>
+@endsection
+
+@section('scripts')
+    <script>
+        $(function(){
+            BootStrapInit.init('tableMemberBoth','ContentTable',{
+                searchForm: 'searchForm',   // 表单搜索id 省略默认 'searchForm'
+                url: "{{ route('admin.memberBoth.ajax.index') }}",
+                method: 'post',
+                toolbar: '#toolbar',
+                idField: '',        // 指定主键列
+                uniqueId: "id",     // 这里需要指定当前查询表唯一主键字段
+                columns: [
+                    {
+                        checkbox: true,
+                        align: 'center',
+                        valign: 'middle'
+                    },
+                    {
+                        field: 'id',
+                        title: 'ID',
+                        align: 'center',
+                        valign: 'middle',
+                        sortable: true
+                    },
+                    {
+                        field: 'image',
+                        title: 'Image',
+                        align: 'center',
+                        valign: 'middle',
+                        formatter:thumbFormatter
+                    },
+                    // {
+                    //     field: 'link',
+                    //     title: '链接',
+                    //     align: 'center',
+                    //     valign: 'middle'
+                    // },
+                    {
+                        field: 'status',
+                        title: '显示',
+                        align: 'center',
+                        valign: 'middle',
+                        sortable: true,
+                        formatter:yesOrNo,
+                        bool_data:{
+                            'class' : 'cursor',
+//                            'url'   : 'javascript:;',
+                            'table' : 'memberBoths'
+//                            'pk' : 'id'   // 主键名称不写默认id主键
+                        }
+                    },
+                    {
+                        field: 'sort',
+                        title: '排序',
+                        align: 'center',
+                        valign: 'middle',
+                        sortable: true,
+                        formatter:inputData,
+                        input_data: {
+//                        'class' : 'cursor',     // 当前样式
+//                        'url'   : 'javascript', // url存在 及请求指定地址修改数据
+                            'table' : 'memberBoths'   // url为空时采用,
+//                        'pk'    : 'id'          // 默认修改主键名称 不写 默认id为主键
+                        }
+                    },
+                    {
+                        field: 'created_at',
+                        title: '创建时间',
+                        align: 'center',
+                        valign: 'middle',
+                        sortable: true
+                    },
+                    {
+                        field: 'updated_at',
+                        title: '更新时间',
+                        align: 'center',
+                        valign: 'middle',
+                        sortable: true
+                    },
+                    {
+                        pkId: 'id',         // 当前主键id 兼容排序 field='id' 默认值id
+                        title: '操作',
+                        align: 'center',
+                        valign: 'middle',
+                        width: '185px',
+                        formatter:operateFormatter,
+                        btn_group:[
+                            {
+                                'name'  : '编辑',
+                                'class' : 'btn-primary createForm',
+                                'url'   : 'javascript:;',
+                                'confirm_url': '{{ route('admin.memberBoth.edit', ['id'=>'-val-'])}}'
+                            },
+                            {
+                                'name'  : '删除',
+                                'class' : 'btn-danger deleteBtn', // class标签 deleteBtn删除 layer弹出框
+                                'url'   : 'javascript:;',
+                                'confirm_url': '{{ route('admin.memberBoth.destroy', ['id'=>'-val-','is_del'=>1])}}'   // 选择按钮
+                            }
+                        ]
+                    }
+                ]
+            });
+        });
+    </script>
+@endsection

+ 21 - 0
routes/web/memberBoth.php

@@ -0,0 +1,21 @@
+<?php
+
+use Illuminate\Support\Facades\Route;
+
+Route::group(['domain' => env('APP_HOST'), 'prefix' => 'admin/memberBoth'],function(){
+    Route::get('index', 'MemberBothsController@index')->name('admin.memberBoth.index');
+    Route::post('index', 'MemberBothsController@index')->name('admin.memberBoth.ajax.index');
+
+    Route::get('store','MemberBothsController@store')->name('admin.memberBoth.store');
+    Route::post('store','MemberBothsController@store')->name('admin.memberBoth.save');
+
+    Route::post('destroy/{id?}','MemberBothsController@destroy')->name('admin.memberBoth.destroy');
+    Route::post('destroys','MemberBothsController@destroys')->name('admin.memberBoth.destroys');
+
+    Route::get('edit/{id?}','MemberBothsController@edit')->name('admin.memberBoth.edit');
+    Route::post('update/{id?}','MemberBothsController@update')->name('admin.memberBoth.update');
+});
+
+Route::group(['domain' => env('APP_HOST_WEB'), 'prefix' => 'memberBoth'],function (){
+    Route::post('list', 'Front\\MemberBothsController@index');
+});