sys 3 лет назад
Родитель
Сommit
8852f59d0c
36 измененных файлов с 1505 добавлено и 33 удалено
  1. 3 9
      app/Console/Commands/TestCommand.php
  2. 91 0
      app/Http/Controllers/Api/ContractController.php
  3. 1 1
      app/Http/Controllers/Api/MemberController.php
  4. 82 0
      app/Http/Controllers/Contract/ContractsController.php
  5. 82 0
      app/Http/Controllers/Invest/InvestsController.php
  6. 2 19
      app/Http/Middleware/MemberAuthMiddleware.php
  7. 30 0
      app/Http/Requests/ContractCreateRequest.php
  8. 30 0
      app/Http/Requests/ContractUpdateRequest.php
  9. 30 0
      app/Http/Requests/InvestCreateRequest.php
  10. 30 0
      app/Http/Requests/InvestUpdateRequest.php
  11. 49 0
      app/Models/Contract.php
  12. 39 0
      app/Models/Invest.php
  13. 24 0
      app/Presenters/ContractPresenter.php
  14. 24 0
      app/Presenters/InvestPresenter.php
  15. 2 0
      app/Providers/RepositoryServiceProvider.php
  16. 15 0
      app/Repositories/ContractRepository.php
  17. 57 0
      app/Repositories/Eloquent/ContractRepositoryEloquent.php
  18. 57 0
      app/Repositories/Eloquent/InvestRepositoryEloquent.php
  19. 15 0
      app/Repositories/InvestRepository.php
  20. 2 0
      app/Servers/MemberServer.php
  21. 5 4
      app/Servers/TronAnalyzeServer.php
  22. 33 0
      app/Transformers/ContractTransformer.php
  23. 33 0
      app/Transformers/InvestTransformer.php
  24. 24 0
      app/Validators/ContractValidator.php
  25. 35 0
      app/Validators/InvestValidator.php
  26. 40 0
      database/migrations/2022_10_20_143347_create_contracts_table.php
  27. 35 0
      database/migrations/2022_10_20_144802_create_invests_table.php
  28. 85 0
      resources/views/admins/contracts/create.blade.php
  29. 86 0
      resources/views/admins/contracts/edit.blade.php
  30. 156 0
      resources/views/admins/contracts/index.blade.php
  31. 85 0
      resources/views/admins/invests/create.blade.php
  32. 65 0
      resources/views/admins/invests/edit.blade.php
  33. 106 0
      resources/views/admins/invests/index.blade.php
  34. 10 0
      routes/api/contract.php
  35. 21 0
      routes/web/contract.php
  36. 21 0
      routes/web/invest.php

+ 3 - 9
app/Console/Commands/TestCommand.php

@@ -37,6 +37,7 @@ use App\Servers\Electricity\JdElectricityServer;
 use App\Servers\Electricity\TbElectricityServer;
 use App\Servers\ExpressServer;
 use App\Servers\HxServer;
+use App\Servers\Icon\TronRPC;
 use App\Servers\ImgServer;
 use App\Servers\ImServer;
 use App\Servers\MemberServer;
@@ -94,15 +95,8 @@ class TestCommand extends Command
      */
     public function handle()
     {
-        $ids=Menu::where('p_id',0)->pluck('id');
-        $this->info(implode(',',$ids->toArray()));
-        $ids_t=Menu::whereIn('p_id',$ids)->pluck('id');
-        $this->info(implode(',',$ids_t->toArray()));
-        $ids_s=Menu::whereIn('p_id',$ids_t)->pluck('id');
-        $this->info(implode(',',$ids_s->toArray()));
-        $id_all=array_merge($ids->toArray(),$ids_t->toArray(),$ids_s->toArray());
-        $this->info(implode(',',$id_all));
-        Menu::whereNotIn('id',$id_all)->delete();
+       $address=TronRPC::CreationTron()->getContract('41a614f803b6fd780986a42c78ec9c7f77e6ded13c');
+       dd($address);
 
     }
 }

+ 91 - 0
app/Http/Controllers/Api/ContractController.php

@@ -0,0 +1,91 @@
+<?php
+
+
+namespace App\Http\Controllers\Api;
+
+
+use App\Http\Controllers\FrontController;
+use App\Models\Contract;
+use App\Models\Invest;
+use App\Servers\CommonServer;
+use App\Servers\RedisDataServer;
+use Illuminate\Support\Facades\Auth;
+
+class ContractController extends FrontController
+{
+
+
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 获取基本投资信息
+     * @return \Illuminate\Http\JsonResponse
+     */
+    function getInvestData(){
+        $mId=Auth::id();
+        $sysAddress=CommonServer::creatServer()->getConfigValue('sys_address');
+        $num=Contract::where('m_id',$mId)->where('status',2)->count();
+        $sendNum=Contract::where('m_id',$mId)->where('status',1)->count();
+        if($num>0){
+            $investId=2;
+        }else{
+            $investId=1;
+        }
+        $investData=Invest::where('id',$investId)->select(['id','invest_money'])->first();
+        if(empty($investData)){
+            return $this->apiResponseError('信息异常');
+        }
+        $investData->{'sysAddress'}=$sysAddress;
+        $investData->{'sendNum'}=$sendNum;
+        return $this->apiResponseSuccess('获取信息成功',$investData);
+    }
+
+    /**
+     * 执行报单
+     * @return \Illuminate\Http\JsonResponse
+     */
+    function setInvest(){
+        $mId=Auth::id();
+        $redis_on_name = 'setInvest' . $mId;
+        $redis_time = RedisDataServer::creatServer()->getData($redis_on_name);
+        $time=time();
+        if(!empty($redis_time) && $redis_time >$time-2){
+            return $this->apiResponseError( '请不要频繁执行');
+        }
+        RedisDataServer::creatServer()->setData($redis_on_name,$time,'str',2,false);
+        $investId=request()->input('id');
+        $txid=request()->input('txid');
+        if(empty($investId)){
+            return $this->apiResponseError('缺少必要参数');
+        }
+        if(empty($txid)){
+            return $this->apiResponseError('缺少必要参数');
+        }
+
+        $num=Contract::where('hash',$txid)->count();
+        if($num>0){
+            return $this->apiResponseError('当前交易已执行');
+        }
+        $investData=Invest::where('id',$investId)->select(['id','invest_money'])->first();
+        $contractData=Contract::create([
+            'm_id'=>$mId,
+            'type'=>$investId,
+            'status'=>1,
+            'hash'=>$txid,
+            'broadcast_data'=>'',
+            'money'=>$investData->{'invest_money'},
+            'error_msg'=>'',
+        ]);
+        if(empty($contractData)){
+            return  $this->apiResponseError('执行失败');
+        }else{
+            return  $this->apiResponseSuccess('执行成功');
+        }
+    }
+
+
+
+}

+ 1 - 1
app/Http/Controllers/Api/MemberController.php

@@ -70,7 +70,7 @@ class MemberController extends FrontController
     {
         $invite_code = request()->input('inviteCode', '');
         if (!empty($invite_code)) {
-            $p_member = Member::where('invite_code', $invite_code)->where('status',1)->select(['id', 'address'])->first();
+            $p_member = Member::where('address', $invite_code)->where('status',1)->select(['id', 'address'])->first();
         }
         if (empty($p_member)) {
             return $this->apiResponseError('推荐码错误');

+ 82 - 0
app/Http/Controllers/Contract/ContractsController.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace App\Http\Controllers\Contract;
+
+use App\Http\Controllers\AdminBaseController;
+use App\Http\Requests\ContractCreateRequest;
+use App\Http\Requests\ContractUpdateRequest;
+use App\Repositories\Eloquent\ContractRepositoryEloquent;
+use App\Validators\ContractValidator;
+
+/**
+ * Class ContractsController.
+ *
+ * @package namespace App\Http\Controllers;
+ */
+class ContractsController extends AdminBaseController
+{
+    /**
+     * @var ContractRepositoryEloquent
+     */
+    protected $repository;
+
+    /**
+     * @var ContractValidator
+     */
+    protected $validator;
+
+    /**
+     * ContractsController constructor.
+     *
+     * @param ContractRepositoryEloquent $repository
+     * @param ContractValidator $validator
+     */
+    public function __construct(ContractRepositoryEloquent $repository, ContractValidator $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;
+    }
+
+}

+ 82 - 0
app/Http/Controllers/Invest/InvestsController.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace App\Http\Controllers\Invest;
+
+use App\Http\Controllers\AdminBaseController;
+use App\Http\Requests\InvestCreateRequest;
+use App\Http\Requests\InvestUpdateRequest;
+use App\Repositories\Eloquent\InvestRepositoryEloquent;
+use App\Validators\InvestValidator;
+
+/**
+ * Class InvestsController.
+ *
+ * @package namespace App\Http\Controllers;
+ */
+class InvestsController extends AdminBaseController
+{
+    /**
+     * @var InvestRepositoryEloquent
+     */
+    protected $repository;
+
+    /**
+     * @var InvestValidator
+     */
+    protected $validator;
+
+    /**
+     * InvestsController constructor.
+     *
+     * @param InvestRepositoryEloquent $repository
+     * @param InvestValidator $validator
+     */
+    public function __construct(InvestRepositoryEloquent $repository, InvestValidator $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;
+    }
+
+}

+ 2 - 19
app/Http/Middleware/MemberAuthMiddleware.php

@@ -6,6 +6,7 @@ use App\Exceptions\MemberAuthException;
 use App\Models\Member;
 use App\Servers\RedisDataServer;
 use Closure;
+use Illuminate\Support\Facades\Auth;
 
 class MemberAuthMiddleware
 {
@@ -52,27 +53,9 @@ class MemberAuthMiddleware
                     throw new MemberAuthException('认证信息已过期', 401);
                 }
             }
-
+            Auth::loginUsingId($member['id']);
             //用户信息缓存30秒
             RedisDataServer::creatServer()->setData($token . '_' . $token, $member, 'json', 300);
-            $request->member = $member;
-        }else{
-            if( $token){
-                $member = RedisDataServer::creatServer()->getData( 'login_' . $token, 'json');
-                if (empty($member)) {
-                    $member = Member::where('token_str', $token)->where('status',1)->select(['id', 'address',  'status', 'token_str', 'level_id'])->first();
-                }
-                //用户信息缓存30秒
-                if($member){
-                    RedisDataServer::creatServer()->setData('login_' . $token, $member, 'json', 300);
-                    $request->member = $member;
-                }else{
-                    $request->member = ['id'=>0];
-                }
-            }else{
-                $request->member = ['id'=>0];
-            }
-
         }
 
 

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

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class ContractCreateRequest 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/ContractUpdateRequest.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class ContractUpdateRequest 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/InvestCreateRequest.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class InvestCreateRequest 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/InvestUpdateRequest.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class InvestUpdateRequest 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 [
+            //
+        ];
+    }
+}

+ 49 - 0
app/Models/Contract.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Prettus\Repository\Contracts\Transformable;
+use Prettus\Repository\Traits\TransformableTrait;
+
+/**
+ * Class Contract.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property int $m_id m_id
+ * @property int $type 类型:1:初投,2:复投
+ * @property int $status 1:广播中,2:成功,3:失败
+ * @property string $hash 交易hash
+ * @property string $broadcast_data 交易详情
+ * @property float $money 投入金额
+ * @property string $error_msg 错误内容
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract query()
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereBroadcastData($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereErrorMsg($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereHash($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereMId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereMoney($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereStatus($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Contract whereUpdatedAt($value)
+ * @mixin \Eloquent
+ */
+class Contract extends Model implements Transformable
+{
+    use TransformableTrait;
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $guarded = ['id', 'updated_at', 'created_at'];
+
+}

+ 39 - 0
app/Models/Invest.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Prettus\Repository\Contracts\Transformable;
+use Prettus\Repository\Traits\TransformableTrait;
+
+/**
+ * Class Invest.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property string $title 投资名称
+ * @property float $invest_money 投入金额
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest query()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest whereInvestMoney($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest whereTitle($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invest whereUpdatedAt($value)
+ * @mixin \Eloquent
+ */
+class Invest 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/ContractPresenter.php

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

+ 24 - 0
app/Presenters/InvestPresenter.php

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

+ 2 - 0
app/Providers/RepositoryServiceProvider.php

@@ -47,6 +47,8 @@ class RepositoryServiceProvider extends ServiceProvider
         $this->app->bind(\App\Repositories\BlockItemsRepository::class, \App\Repositories\Eloquent\BlockItemsRepositoryEloquent::class);
         $this->app->bind(\App\Repositories\BroadcastRepository::class, \App\Repositories\Eloquent\BroadcastRepositoryEloquent::class);
         $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);
         //:end-bindings:
     }
 }

+ 15 - 0
app/Repositories/ContractRepository.php

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

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

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

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

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

+ 15 - 0
app/Repositories/InvestRepository.php

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

+ 2 - 0
app/Servers/MemberServer.php

@@ -22,6 +22,7 @@ use App\Models\ShopFans;
 use App\Models\ShopMoney;
 use App\Models\ShopSet;
 use App\Models\ShopUser;
+use Illuminate\Support\Facades\Auth;
 use Intervention\Image\Facades\Image;
 
 
@@ -157,6 +158,7 @@ class MemberServer
 
 
 
+
     /**
      * 截取掉微信表情
      * @param $str

+ 5 - 4
app/Servers/TronAnalyzeServer.php

@@ -3,16 +3,17 @@
 
 namespace App\Servers;
 
-use App\Jobs\SetMemberCoin;
+
 use App\Models\BlockInfo;
 use App\Models\BlockItems;
-use App\Models\BuyJobs;
+
 use App\Models\CoinType;
 use App\Models\Config;
 use App\Models\MemberCoins;
-use App\Models\MemberCoinTwo;
+
 use App\Servers\Icon\TronRPC;
-use App\Servers\Eth\Utils;
+
+use App\Servers\Icon\Utils;
 use Illuminate\Support\Facades\DB;
 
 /**

+ 33 - 0
app/Transformers/ContractTransformer.php

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

+ 33 - 0
app/Transformers/InvestTransformer.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Transformers;
+
+use League\Fractal\TransformerAbstract;
+use App\Models\Invest;
+
+/**
+ * Class InvestTransformer.
+ *
+ * @package namespace App\Transformers;
+ */
+class InvestTransformer extends TransformerAbstract
+{
+    /**
+     * Transform the Invest entity.
+     *
+     * @param \App\Models\Invest $model
+     *
+     * @return array
+     */
+    public function transform(Invest $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/ContractValidator.php

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

+ 35 - 0
app/Validators/InvestValidator.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Validators;
+
+use \Prettus\Validator\Contracts\ValidatorInterface;
+use \Prettus\Validator\LaravelValidator;
+
+/**
+ * Class InvestValidator.
+ *
+ * @package namespace App\Validators;
+ */
+class InvestValidator extends LaravelValidator
+{
+    /**
+     * Validation Rules
+     *
+     * @var array
+     */
+    protected $rules = [
+        ValidatorInterface::RULE_CREATE => [
+            'title' => 'required',
+            'invest_money' => 'required|min:0.1',
+        ],
+        ValidatorInterface::RULE_UPDATE => [
+            'title' => 'required',
+            'invest_money' => 'required|min:0.1',
+        ],
+    ];
+    protected $messages=[
+        'title.required'=>'请输入投资名称',
+        'invest_money.required'=>'请输入投入金额',
+        'invest_money.min'=>'投入金额最小0.1',
+    ];
+}

+ 40 - 0
database/migrations/2022_10_20_143347_create_contracts_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+/**
+ * Class CreateContractsTable.
+ */
+class CreateContractsTable extends Migration
+{
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+		Schema::create('contracts', function(Blueprint $table) {
+            $table->increments('id');
+            $table->integer('m_id')->index('m_id')->default('0')->comment('m_id');
+            $table->integer('type')->index('type')->default('0')->comment('类型:1:初投,2:复投');
+            $table->integer('status')->index('status')->default('1')->comment('1:广播中,2:成功,3:失败');
+            $table->string('hash')->index('hash')->default('')->comment('交易hash');
+            $table->text('broadcast_data')->comment('交易详情');
+            $table->double('money',16,6)->default(0)->comment('投入金额');
+            $table->string('error_msg')->default('')->comment('错误内容');
+            $table->timestamps();
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('contracts');
+	}
+}

+ 35 - 0
database/migrations/2022_10_20_144802_create_invests_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+/**
+ * Class CreateInvestsTable.
+ */
+class CreateInvestsTable extends Migration
+{
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+		Schema::create('invests', function(Blueprint $table) {
+            $table->increments('id');
+            $table->string('title')->default('')->comment('投资名称');
+            $table->double('invest_money',16,6)->default(0)->comment('投入金额');
+            $table->timestamps();
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('invests');
+	}
+}

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

@@ -0,0 +1,85 @@
+<div style="margin-top: 10px;" id="contracts-app">
+    <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
+        新增 - Contract
+    </div>
+    <el-form action="{{route('admin.contract.save')}}" method="post" id="form-create">
+        <!-- image -->
+        <ui-file label="图片(686*128)" size="0.5" name="image" :data="{uploadName:'contracts'}" tips="图片建议(686*128)"></ui-file>
+        <!-- link -->
+{{--        <ui-input-text label="contract链接" name="link" placeholder="contract跳转链接" 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: '#contracts-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/contracts/edit.blade.php

@@ -0,0 +1,86 @@
+<div style="margin-top: 10px;" id="contracts-app">
+    <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
+        编辑Contract
+    </div>
+    <el-form action="{{route('admin.contract.update',array('id'=>$model->id))}}" method="post" id="form-create">
+        <!-- 图片 -->
+        <ui-file label="图片(686*128)" size="0.5" name="image" :data="{uploadName:'contracts'}" 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: '#contracts-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/contracts/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.contract.index') }}">后台Contract首页</a></li>
+        <li class="active">Contract列表</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.contract.store') }}" data-title="create">
+                    <button class="btn btn-default" type="button">
+                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增Contract
+                    </button>
+                </a>
+                <a>
+                    <button id="deleteAll" data-url="{{ route('admin.contract.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('tableContract','ContentTable',{
+                searchForm: 'searchForm',   // 表单搜索id 省略默认 'searchForm'
+                url: "{{ route('admin.contract.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' : 'contracts'
+//                            'pk' : 'id'   // 主键名称不写默认id主键
+                        }
+                    },
+                    {
+                        field: 'sort',
+                        title: '排序',
+                        align: 'center',
+                        valign: 'middle',
+                        sortable: true,
+                        formatter:inputData,
+                        input_data: {
+//                        'class' : 'cursor',     // 当前样式
+//                        'url'   : 'javascript', // url存在 及请求指定地址修改数据
+                            'table' : 'contracts'   // 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.contract.edit', ['id'=>'-val-'])}}'
+                            },
+                            {
+                                'name'  : '删除',
+                                'class' : 'btn-danger deleteBtn', // class标签 deleteBtn删除 layer弹出框
+                                'url'   : 'javascript:;',
+                                'confirm_url': '{{ route('admin.contract.destroy', ['id'=>'-val-','is_del'=>1])}}'   // 选择按钮
+                            }
+                        ]
+                    }
+                ]
+            });
+        });
+    </script>
+@endsection

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

@@ -0,0 +1,85 @@
+<div style="margin-top: 10px;" id="invests-app">
+    <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
+        新增 - Invest
+    </div>
+    <el-form action="{{route('admin.invest.save')}}" method="post" id="form-create">
+        <!-- image -->
+        <ui-file label="图片(686*128)" size="0.5" name="image" :data="{uploadName:'invests'}" tips="图片建议(686*128)"></ui-file>
+        <!-- link -->
+{{--        <ui-input-text label="invest链接" name="link" placeholder="invest跳转链接" 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: '#invests-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')

+ 65 - 0
resources/views/admins/invests/edit.blade.php

@@ -0,0 +1,65 @@
+<div style="margin-top: 10px;" id="invests-app">
+    <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
+        编辑 - 投资金额
+    </div>
+    <el-form action="{{route('admin.invest.update',array('id'=>$model->id))}}" method="post" id="form-create">
+        <!-- 图片 -->
+
+        <!-- 链接 -->
+        <ui-input-text label="投资名称" name="title" value="{{$model->title}}" placeholder="投资名称" maxlength="255" tips="请输入投资名称" autofocus="true"></ui-input-text>
+        <ui-input-float-number :max="9999999" label="投资金额" name="invest_money" value="{{$model->invest_money}}" placeholder="投资金额" maxlength="255" tips="请输入投资金额" autofocus="true"></ui-input-float-number>
+        <!-- 是否显示 -->
+
+        <ui-submit></ui-submit>
+    </el-form>
+</div>
+
+<script type="application/javascript">
+    $(function () {
+        // 注意:Vue组件一定放在jQuery.validator前面验证
+        new Vue({
+            el: '#invests-app',
+            data :function () {
+                return {
+
+                };
+            }
+        });
+        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')

+ 106 - 0
resources/views/admins/invests/index.blade.php

@@ -0,0 +1,106 @@
+@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 class="active">投资金额列表</li>
+    </ol>
+@endsection
+
+@section('content')
+    <form id="searchForm" class="form-inline">
+        <div class="">
+
+        </div>
+    </form>
+    <hr class="hr-css">
+    <div>
+        <div id="toolbar">
+            <div class="columns columns-left btn-group pull-left">
+
+
+            </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('tableInvest','ContentTable',{
+                searchForm: 'searchForm',   // 表单搜索id 省略默认 'searchForm'
+                url: "{{ route('admin.invest.ajax.index') }}",
+                method: 'post',
+                toolbar: '#toolbar',
+                idField: '',        // 指定主键列
+                uniqueId: "id",     // 这里需要指定当前查询表唯一主键字段
+                columns: [
+                    {
+                        checkbox: true,
+                        align: 'center',
+                        valign: 'middle'
+                    },
+                    {
+                        field: 'id',
+                        title: 'ID',
+                        align: 'center',
+                        valign: 'middle',
+                    },
+
+                    {
+                        field: 'title',
+                        title: '投资名称',
+                        align: 'center',
+                        valign: 'middle'
+                    },
+                    {
+                        field: 'invest_money',
+                        title: '投入金额',
+                        align: 'center',
+                        valign: 'middle'
+                    },
+
+                    {
+                        field: 'created_at',
+                        title: '创建时间',
+                        align: 'center',
+                        valign: 'middle',
+                    },
+                    {
+                        field: 'updated_at',
+                        title: '更新时间',
+                        align: 'center',
+                        valign: 'middle',
+                    },
+                    {
+                        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.invest.edit', ['id'=>'-val-'])}}'
+                            }
+                        ]
+                    }
+                ]
+            });
+        });
+    </script>
+@endsection

+ 10 - 0
routes/api/contract.php

@@ -0,0 +1,10 @@
+<?php
+
+use Illuminate\Support\Facades\Route;
+
+
+
+Route::group(['domain' => env('APP_HOST_WEB'), 'prefix' => 'contract'],function (){
+    Route::match(['get','post'],'invest', 'ContractController@getInvestData')->name('contract.invest');
+    Route::match(['get','post'],'add-invest', 'ContractController@setInvest')->name('contract.add-invest');
+});

+ 21 - 0
routes/web/contract.php

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

+ 21 - 0
routes/web/invest.php

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