DESKTOP-70VPDLK\Administrator 2 сар өмнө
parent
commit
3f7851fa32

+ 5 - 2
app/Http/Controllers/Api/CommonController.php

@@ -43,8 +43,11 @@ class CommonController extends FrontController
 
     function index()
     {
-        $bnb_block = BanRPC::creatServer()->sendBlockNumber();
-        dd($bnb_block);
+//        $bnb_block = BanRPC::creatServer()->sendBlockNumber();
+//        $block_deal = BanRPC::creatServer()->sendBlockByNumber($bnb_block);
+//        $deal =  BanRPC::creatServer()->getTransactionReceipt("0xd520c1b14e4d49064612c92647e2338547e5864fe1401972e356a658d4aa0972");//交易查询
+        $deal =  BanRPC::creatServer()->getGasPrice();//交易查询
+        dd($deal);
         $random = new Random();
         // 生成随机数(initial entropy)
         $entropy = $random->bytes(Bip39Mnemonic::MIN_ENTROPY_BYTE_LEN);

+ 4 - 10
app/Models/Banner.php

@@ -6,36 +6,30 @@ use Illuminate\Database\Eloquent\Model;
 use Prettus\Repository\Contracts\Transformable;
 use Prettus\Repository\Traits\TransformableTrait;
 
+
 /**
- * Class Banner.
+ * App\Models\Banner
  *
- * @package namespace App\Models;
  * @property int $id
  * @property string $image banner图片
  * @property string|null $link banner跳转链接
  * @property int $sort 排序1-100:正序
  * @property int $show 是否显示 0:不显示;1:显示
- * @property int $type 跳转类型:0:不跳转,1:商品,2:分类,3:秒杀
- * @property int $to_id 关联ID
  * @property \Illuminate\Support\Carbon|null $created_at
  * @property \Illuminate\Support\Carbon|null $updated_at
- * @property string|null $title 标题
+ * @property string $image_en banner英文图片
  * @method static \Illuminate\Database\Eloquent\Builder|Banner newModelQuery()
  * @method static \Illuminate\Database\Eloquent\Builder|Banner newQuery()
  * @method static \Illuminate\Database\Eloquent\Builder|Banner query()
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereCreatedAt($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereId($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereImage($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Banner whereImageEn($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereLink($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereShow($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereSort($value)
- * @method static \Illuminate\Database\Eloquent\Builder|Banner whereTitle($value)
- * @method static \Illuminate\Database\Eloquent\Builder|Banner whereToId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|Banner whereType($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Banner whereUpdatedAt($value)
  * @mixin \Eloquent
- * @property string $image_en banner英文图片
- * @method static \Illuminate\Database\Eloquent\Builder|Banner whereImageEn($value)
  */
 class Banner extends Model implements Transformable
 {

+ 59 - 0
app/Models/BlockItem.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Prettus\Repository\Contracts\Transformable;
+use Prettus\Repository\Traits\TransformableTrait;
+
+/**
+ * Class BlockItem.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property int $m_id m_id
+ * @property int $coin_id coin_id
+ * @property int $block_num block_num
+ * @property float $money 余额
+ * @property string $from_a from_a
+ * @property string $hash hash
+ * @property string $to_a to_a
+ * @property string $to_type to_type
+ * @property string $fee_limit fee_limit
+ * @property string $coin_name coin_name
+ * @property string|null $pay_at
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem query()
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereBlockNum($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereCoinId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereCoinName($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereFeeLimit($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereFromA($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereHash($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereMId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereMoney($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem wherePayAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereToA($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereToType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereUpdatedAt($value)
+ * @mixin \Eloquent
+ * @property string|null $contract_address 合约地址
+ * @method static \Illuminate\Database\Eloquent\Builder|BlockItem whereContractAddress($value)
+ */
+class BlockItem extends Model implements Transformable
+{
+    use TransformableTrait;
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $guarded = ['id', 'updated_at', 'created_at'];
+
+}

+ 2 - 0
app/Models/Broadcast.php

@@ -64,6 +64,8 @@ use Prettus\Repository\Traits\TransformableTrait;
  * @method static \Illuminate\Database\Eloquent\Builder|Broadcast whereUpdatedAt($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Broadcast whereValue($value)
  * @mixin \Eloquent
+ * @property int $u_id m_id
+ * @method static \Illuminate\Database\Eloquent\Builder|Broadcast whereUId($value)
  */
 class Broadcast extends Model implements Transformable
 {

+ 9 - 7
app/Models/Member.php

@@ -69,20 +69,22 @@ use Prettus\Repository\Traits\TransformableTrait;
  * @method static \Illuminate\Database\Eloquent\Builder|Member whereSource($value)
  * @property string $address 手机号码
  * @property string $recom_mobile 推荐人手机号码
+ * @property string|null $remember_token
  * @property string|null $err_msg 锁定说明
  * @property string|null $m_p
+ * @property string|null $m_p_p
  * @property int|null $is_lock 是否锁定,1:是,0否
+ * @property string|null $total_money 累计总金额
  * @method static \Illuminate\Database\Eloquent\Builder|Member whereAddress($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Member whereErrMsg($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Member whereIsLock($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Member whereMP($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Member whereMPP($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Member whereRecomMobile($value)
- * @property int|null $is_auto 是否自动升级
- * @property int|null $is_boss is_boss
- * @method static \Illuminate\Database\Eloquent\Builder|Member whereIsAuto($value)
- * @method static \Illuminate\Database\Eloquent\Builder|Member whereIsBoss($value)
- * @property string $recom_address 推荐人手机号码
- * @method static \Illuminate\Database\Eloquent\Builder|Member whereRecomAddress($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Member whereRememberToken($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Member whereTotalMoney($value)
+ * @property int|null $m_id 客户端ID
+ * @method static \Illuminate\Database\Eloquent\Builder|Member whereMId($value)
  */
 class Member extends Model implements Transformable
 {
@@ -106,7 +108,7 @@ class Member extends Model implements Transformable
      */
     public function recomMember()
     {
-        return $this->hasOne('App\Models\Member', 'id', 'recom_id')->select(['id', 'nickname']);
+        return $this->hasOne('App\Models\Member', 'id', 'recom_id')->select(['id', 'nickname','phone']);
     }
 
 }

+ 51 - 0
app/Models/MemberCoin.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Prettus\Repository\Contracts\Transformable;
+use Prettus\Repository\Traits\TransformableTrait;
+
+/**
+ * Class MemberCoin.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property int $m_id m_id
+ * @property int $coin_id coin_id
+ * @property string $coin_name 币名
+ * @property float $num 余额
+ * @property float $lock_num 锁定数量
+ * @property string $address address
+ * @property string $private
+ * @property string $code_img
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin query()
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereAddress($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereCodeImg($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereCoinId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereCoinName($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereLockNum($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereMId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereNum($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin wherePrivate($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|MemberCoin whereUpdatedAt($value)
+ * @mixin \Eloquent
+ */
+class MemberCoin extends Model implements Transformable
+{
+    use TransformableTrait;
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $guarded = ['id', 'updated_at', 'created_at'];
+
+}

+ 6 - 6
app/Models/Members.php

@@ -75,17 +75,17 @@ use Prettus\Repository\Traits\TransformableTrait;
  * @property string $address 手机号码
  * @property string|null $err_msg 锁定说明
  * @property string|null $m_p
+ * @property string|null $m_p_p
  * @property int|null $is_lock 是否锁定,1:是,0否
+ * @property string|null $total_money 累计总金额
  * @method static \Illuminate\Database\Eloquent\Builder|Members whereAddress($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Members whereErrMsg($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Members whereIsLock($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Members whereMP($value)
- * @property int|null $is_auto 是否自动升级
- * @property int|null $is_boss is_boss
- * @method static \Illuminate\Database\Eloquent\Builder|Members whereIsAuto($value)
- * @method static \Illuminate\Database\Eloquent\Builder|Members whereIsBoss($value)
- * @property string $recom_address 推荐人手机号码
- * @method static \Illuminate\Database\Eloquent\Builder|Members whereRecomAddress($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Members whereMPP($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Members whereTotalMoney($value)
+ * @property int|null $m_id 客户端ID
+ * @method static \Illuminate\Database\Eloquent\Builder|Members whereMId($value)
  */
 class Members extends Model implements Transformable
 {

+ 49 - 0
app/Models/Task.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 Task.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property string $model_name 任务名称
+ * @property int $m_id 任务名称
+ * @property int $u_id 任务名称
+ * @property int $status 任务名称
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|Task newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Task newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Task query()
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereMId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereModelName($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereStatus($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereUId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereUpdatedAt($value)
+ * @mixin \Eloquent
+ * @property string|null $data 请求信息
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereData($value)
+ * @property int|null $execute_id 任务ID
+ * @method static \Illuminate\Database\Eloquent\Builder|Task whereExecuteId($value)
+ */
+class Task extends Model implements Transformable
+{
+    use TransformableTrait;
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $guarded = ['id', 'updated_at', 'created_at'];
+    protected $casts = [
+        'data' => 'array',
+    ];
+}

+ 48 - 0
app/Models/WalletLog.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Prettus\Repository\Contracts\Transformable;
+use Prettus\Repository\Traits\TransformableTrait;
+
+/**
+ * Class WalletLog.
+ *
+ * @package namespace App\Models;
+ * @property int $id
+ * @property string $model_name 请求模型
+ * @property string $send_dta 请求信息
+ * @property string $reply_dta 应答信息
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog query()
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereModelName($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereReplyDta($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereSendDta($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereUpdatedAt($value)
+ * @mixin \Eloquent
+ * @property int|null $status
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereStatus($value)
+ * @property string|null $url
+ * @method static \Illuminate\Database\Eloquent\Builder|WalletLog whereUrl($value)
+ */
+class WalletLog extends Model implements Transformable
+{
+    use TransformableTrait;
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $guarded = ['id', 'updated_at', 'created_at'];
+    protected $casts = [
+        'send_dta' => 'array',
+        'reply_dta' => 'array',
+    ];
+}

+ 2 - 0
app/Models/Withdraw.php

@@ -40,6 +40,8 @@ use Prettus\Repository\Traits\TransformableTrait;
  * @method static \Illuminate\Database\Eloquent\Builder|Withdraw whereAddress($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Withdraw whereCoinId($value)
  * @method static \Illuminate\Database\Eloquent\Builder|Withdraw whereHash($value)
+ * @property int $task_id 任务ID
+ * @method static \Illuminate\Database\Eloquent\Builder|Withdraw whereTaskId($value)
  */
 class Withdraw extends Model implements Transformable
 {

+ 1 - 0
app/Servers/BroadcastServer.php

@@ -149,6 +149,7 @@ class BroadcastServer
             $transaction['chain_id'] = $bnbServer->chainId;
             $transaction['value'] = Utils::dec2hex(Utils::fund2int($value['money'] )); // 转账金额
             $transaction['data'] = '0x0';
+//        $transaction['data'] = Utils::decodeSolMethod('transfer(address,uint256)', [$value['to'], Utils::fund2int($value['money'], 18)]);
             $nonce = $bnbServer->getTransactionCount($value['from']);
             $transaction['nonce'] = $nonce;
             $gas_price = $bnbServer->getGasPrice();

+ 20 - 1
app/Servers/Icon/BanRPC.php

@@ -13,7 +13,7 @@ class BanRPC
     /**
      * @var string RPC URL
      */
-    public $url='https://bsc-dataseed1.ninicoin.io/';
+    private $url='https://bsc-dataseed1.ninicoin.io/';
 
     public $chainId='56';
 
@@ -33,10 +33,29 @@ class BanRPC
      */
     static function creatServer()
     {
+
         if (empty(self::$server)) self::$server = new BanRPC();
         return self::$server;
     }
+    private function __construct(){
+        $testServe=env('TEST_SERVE');
+        if($testServe){
+            $this->url='https://data-seed-prebsc-1-s1.binance.org:8545';
+            $this->chainId='97';
+        }
+    }
+
+    function sendBlockNumber(){
+        $num= $this->send('eth_blockNumber', []);
+        if(empty($num)){
+            return 0;
+        }
+        return Utils::hex2dec($num);
+    }
 
+    function sendBlockByNumber($num){
+        return $this->send('eth_getBlockByNumber', [Utils::dec2hex($num),true]);
+    }
     // 执行eth_call
     public function call($params)
     {