afa 11 months ago
parent
commit
38f25130d5
28 changed files with 209 additions and 540 deletions
  1. 5 6
      application/admin/controller/Dashboard.php
  2. 3 189
      application/admin/controller/offline/OfflineRecharge.php
  3. 27 4
      application/admin/controller/offline/Order.php
  4. 26 1
      application/admin/controller/product/Transfer.php
  5. 21 8
      application/admin/lang/zh-cn/offline/offline_recharge.php
  6. 1 1
      application/admin/lang/zh-cn/offline/order.php
  7. 0 61
      application/admin/model/OfflineRechargeRecord.php
  8. 0 69
      application/admin/model/offline/Order.php
  9. 0 27
      application/admin/validate/OfflineRechargeRecord.php
  10. 1 1
      application/admin/validate/offline/Offline_recharge.php
  11. 0 54
      application/admin/view/offline/offline_recharge/add.html
  12. 10 5
      application/admin/view/offline/offline_recharge/index.html
  13. 1 15
      application/admin/view/product/transfer/index.html
  14. 10 2
      application/api/common.php
  15. 2 0
      application/api/controller/Order.php
  16. 2 2
      application/api/controller/User.php
  17. 5 7
      application/api/lang/en/home.php
  18. 6 0
      application/api/lang/en/order.php
  19. 9 3
      application/api/lang/en/user.php
  20. 6 0
      application/api/lang/zh-cn/order.php
  21. 6 0
      application/api/lang/zh-cn/user.php
  22. 22 6
      application/common/model/ProductOrder.php
  23. 13 0
      application/common/model/ProductTransfer.php
  24. 1 5
      application/common/model/ProductsModel.php
  25. 5 1
      application/common/model/UserBalanceLog.php
  26. 11 53
      public/assets/js/backend/offline/offline_recharge.js
  27. 9 11
      public/assets/js/backend/offline/order.js
  28. 7 9
      public/assets/js/backend/product/transfer.js

+ 5 - 6
application/admin/controller/Dashboard.php

@@ -4,7 +4,6 @@ namespace app\admin\controller;
 
 use app\admin\model\Admin;
 use app\admin\model\User;
-use app\admin\model\OfflineRechargeRecord;
 use app\common\model\OfflineRechargeRecordModel;
 use app\common\model\OfflineWithdrawRecordModel;
 use app\admin\model\LedgerTokenChange;
@@ -59,19 +58,19 @@ class Dashboard extends Backend
             'todayusersignup'   => User::whereTime('create_time', 'today')->count(),
             'threednu'          => User::whereTime('create_time', '-3 days')->count(),
             'sevendnu'          => User::whereTime('create_time', '-7 days')->count(),
-            'yestoday_usdt'     => OfflineRechargeRecord::whereBetween('create_time', $yestoday_date)->where('status', OfflineRechargeRecordModel::StatusSuccess)->sum('amount'),
-            'yestoday_usdt_num' => OfflineRechargeRecord::whereBetween('create_time', $yestoday_date)->where('status', OfflineRechargeRecordModel::StatusSuccess)->count(),
+            'yestoday_usdt'     => OfflineRechargeRecordModel::whereBetween('create_time', $yestoday_date)->where('status', OfflineRechargeRecordModel::StatusSuccess)->sum('amount'),
+            'yestoday_usdt_num' => OfflineRechargeRecordModel::whereBetween('create_time', $yestoday_date)->where('status', OfflineRechargeRecordModel::StatusSuccess)->count(),
 
             'yestoday_out'      => OfflineWithdrawRecordModel::whereBetween('create_time', $yestoday_date)->sum('amount'),
             'yestoday_out_num'  => OfflineWithdrawRecordModel::whereBetween('create_time', $yestoday_date)->count(),
 
-            'all_in_usdt'       => OfflineRechargeRecord::where('status', OfflineRechargeRecordModel::StatusSuccess)->sum('amount'),
-            'all_in_usdt_num'   => OfflineRechargeRecord::where('status', OfflineRechargeRecordModel::StatusSuccess)->count(),
+            'all_in_usdt'       => OfflineRechargeRecordModel::where('status', OfflineRechargeRecordModel::StatusSuccess)->sum('amount'),
+            'all_in_usdt_num'   => OfflineRechargeRecordModel::where('status', OfflineRechargeRecordModel::StatusSuccess)->count(),
 
             'all_out_usdt'      => OfflineWithdrawRecordModel::where('status', 'in', [2,4])->sum('real_amount'),
             //'all_in-out'         => OfflineRechargeRecord::where('status', 'in', [2,4])->count(),
 
-            'month_in_usdt'     => OfflineRechargeRecord::where('create_time', '>', strtotime($month_date))->where('status', OfflineRechargeRecordModel::StatusSuccess)->sum('amount'),
+            'month_in_usdt'     => OfflineRechargeRecordModel::where('create_time', '>', strtotime($month_date))->where('status', OfflineRechargeRecordModel::StatusSuccess)->sum('amount'),
             'attachmentsize'    => 0,
             'picturenums'       => 0,
             'picturesize'       => 0,

+ 3 - 189
application/admin/controller/offline/OfflineRecharge.php

@@ -3,18 +3,6 @@
 namespace app\admin\controller\offline;
 
 use app\common\controller\Backend;
-use app\common\model\LedgerWalletModel;
-use app\common\model\OfflineRechargeRecordModel;
-use app\common\model\ServersModel;
-use app\common\model\UserModel;
-use fast\Action;
-use fast\Asset;
-use fast\RechargeStatus;
-use fast\RechargeType;
-use fast\WithdrawStatus;
-use think\exception\DbException;
-use think\response\Json;
-use think\Db;
 
 /**
  * 充值记录管理
@@ -25,15 +13,15 @@ class OfflineRecharge extends Backend
 {
 
     /**
-     * OfflineRechargeRecord模型对象
-     * @var \app\admin\model\OfflineRechargeRecord
+     * Offline_recharge模型对象
+     * @var \app\admin\model\offline\OfflineRecharge
      */
     protected $model = null;
 
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\admin\model\OfflineRechargeRecord;
+        $this->model = new \app\common\model\OfflineWithdrawRecordModel;
     }
 
 
@@ -45,178 +33,4 @@ class OfflineRecharge extends Backend
      */
 
 
-    /**
-     * 查看
-     *
-     * @return string|Json
-     * @throws \think\Exception
-     * @throws DbException
-     */
-    public function index()
-    {
-        //设置过滤方法
-        $this->request->filter(['strip_tags', 'trim']);
-        if (false === $this->request->isAjax()) {
-            return $this->view->fetch();
-        }
-        //如果发送的来源是 Selectpage,则转发到 Selectpage
-        if ($this->request->request('keyField')) {
-            return $this->selectpage();
-        }
-        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
-        $list     = $this->model->alias('r')
-            ->where($where)
-            ->order($sort, $order)
-            ->paginate($limit);
-        foreach ($list as $k => $v) {
-            $list[$k]['user_address'] = (new UserModel())->getById($v['user_id'])['address'];
-        }
-
-        $result = ['total' => $list->total(), 'rows' => $list->items()];
-        return json($result);
-    }
-
-    /**
-     * 发货
-     * @param $ids
-     * @return string|void
-     * @throws \think\Exception
-     * @throws \think\exception\DbException
-     */
-    public function delivery($ids = null)
-    {
-        $row = $this->model->get($ids);
-        if (!$row) {
-            $this->error(__('No Results were found'));
-        }
-        $adminIds = $this->getDataLimitAdminIds();
-        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
-            $this->error(__('You have no permission'));
-        }
-        $user = (new UserModel())->getById($row['user_id']);
-        if(empty($user)){
-            $this->error("用户信息不存在");
-        }
-
-        if (false === $this->request->isPost()) {
-            $this->view->assign('row', $row);
-            return $this->view->fetch();
-        }
-        $params = $this->request->post('row/a');
-        if (empty($params)) {
-            $this->error(__('Parameter %s can not be empty', ''));
-        }
-        $params = $this->preExcludeFields($params);
-        $result = false;
-        Db::startTrans();
-        try {
-            //是否采用模型验证
-            if ($this->modelValidate) {
-                $name     = str_replace("\\model\\", "\\validate\\", get_class($this->model));
-                $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
-                $row->validateFailException()->validate($validate);
-            }
-
-            $update = [
-                'express_status'    => 1,
-                'express_name'      => $params['express_name'],
-                'express_num'       => $params['express_num'],
-                'update_time'       => time(),
-            ];
-
-
-            // 仅处理"待处理"状态的订单,"已抢单"的暂不处理
-            $result = (new OfflineRechargeRecordModel())->where('id', $row['id'])->update($update);
-            if (empty($result)) {
-                throw new Exception("订单发货失败");
-            }
-
-            Db::commit();
-        } catch (\Exception $e) {
-            Db::rollback();
-            $this->error($e->getMessage());
-        }
-        if (false === $result) {
-            $this->error(__('No rows were updated'));
-        }
-        $this->success();
-    }
-
-    /**
-     * 手动报单
-     *
-     * @param $ids
-     * @return string
-     * @throws DbException
-     * @throws \think\Exception
-     */
-    public function add()
-    {
-        if (false === $this->request->isPost()) {
-            return $this->view->fetch();
-        }
-        $params = $this->request->post('row/a');
-        if (empty($params)) {
-            $this->error(__('Parameter %s can not be empty', ''));
-        }
-        $params = $this->preExcludeFields($params);
-
-        $user_info = UserModel::where('address', $params['address'])->find();
-        if(empty($user_info)){
-            $this->error('用户钱包地址不存在');
-        }
-
-        $insert = [];
-        if(empty($params['date_time'])){
-            $this->error('报单日期不能为空');
-        }
-        $insert['user_id']     = $user_info['id'];
-        $insert['create_time'] = time();
-        $insert['update_time'] = strtotime($params['date_time']);
-        $insert['order_type']  = 2;//服务器
-        $insert['order_no']    = 'S' . $user_info['id'] . time();
-        $insert['server_no']   = $params['server_no'];
-        $insert['pro_name']    = $params['pro_name'];
-        $insert['amount']      = $params['amount'];
-        $insert['power']       = $params['power'];
-        $insert['status']      = OfflineRechargeRecordModel::StatusSuccess;
-        $insert['tx_hash']     = '手动报单_' . $user_info['id'] . '_操作员ID:' . $this->auth->id.
-
-
-//        $pro_info = (new ServersModel())
-//            ->where('price', $params['price'])
-//            ->find();
-//        if(empty($pro_info)){
-//            $this->error(__('没有对应价格的服务器', ''));
-//        }
-
-        $result = false;
-        Db::startTrans();
-        try {
-            //$order_id = (new OfflineRechargeRecordModel())->insertGetId(RechargeType::CashFromSys, '后台手动报单,admin_id:' . $this->auth->id . ',时间戳:' . time(), $user_info['id'], $params['price'], RechargeStatus::StatusAuthSuccess);
-            $order_id = (new OfflineRechargeRecordModel())->insertGetId($insert);
-            // 更新总算力和账变
-            (new LedgerWalletModel)->changeWalletAccount($user_info['id'], Asset::POWER, $insert['power'], Action::PowerRentalPower, $order_id);
-            //(new LedgerWalletModel)->changeWalletAccount($user_info['id'], Asset::SERVER_POWER, $pro_info['power'], Action::PowerRentalPower, $order_id);
-
-            // 更新服务器算力,不账变
-            //(new LedgerWalletModel)->changeWalletOnly($user_info['id'], Asset::SERVER_POWER, $insert['power']);
-
-            // 更新自己激活时间
-            if($user_info['effective_time'] < 1){
-                (new UserModel())
-                    ->where('id', $user_info['id'])
-                    ->update(['effective_time' => $insert['update_time']]);
-            }
-
-            // 发放服务器市场推荐相关收益
-            //(new LedgerWalletModel)->sendServersBonus($user_info['id'], $servers_info);
-
-            Db::commit();
-        } catch (ValidateException|PDOException|Exception $e) {
-            Db::rollback();
-            $this->error($e->getMessage());
-        }
-        $this->success('手动报单成功');
-    }
 }

+ 27 - 4
application/admin/controller/offline/Order.php

@@ -21,17 +21,40 @@ class Order extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\admin\model\offline\Order;
+        $this->model = new \app\common\model\ProductOrder();
 
     }
 
-
-
     /**
      * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
      * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
      * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
      */
-
+    /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model->with('users,products,areas')
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 }

+ 26 - 1
application/admin/controller/product/Transfer.php

@@ -32,6 +32,31 @@ class Transfer extends Backend
      * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
      * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
      */
-
+    /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model->with('products,users')
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 }

+ 21 - 8
application/admin/lang/zh-cn/offline/offline_recharge.php

@@ -1,12 +1,25 @@
 <?php
 
 return [
-    'Type'        => '充值方式',
-    'Tx_hash'     => '交易哈希',
-    'User_id'     => '用户ID',
-    'Symbol'      => '币种',
-    'Amount'      => '金额',
-    'Status'      => '状态',
-    'Create_time' => '创建时间',
-    'Update_time' => '更新时间'
+    'Order_type'     => '订单类型',
+    'Pro_name'       => '产品名称',
+    'Server_no'      => '服务器编号',
+    'Type'           => '充值方式',
+    'Tx_hash'        => '交易哈希',
+    'User_id'        => '用户',
+    'Symbol'         => '币种',
+    'Amount'         => '金额',
+    'Power'          => '对应算力',
+    'Real_name'      => '收货人',
+    'Mobile'         => '手机号码',
+    'To_address'     => '充值地址',
+    'From_address'   => '用户地址',
+    'Status'         => '状态',
+    'Express_status' => '是否发货',
+    'Express_name'   => '快递名称',
+    'Express_num'    => '快递单号',
+    'Create_time'    => '创建时间',
+    'Update_time'    => '更新时间',
+    'Declaration'    => '手动报单',
+    'Note'           => '备注'
 ];

+ 1 - 1
application/admin/lang/zh-cn/offline/order.php

@@ -2,7 +2,7 @@
 
 return [
     'Id'          => 'ID',
-    'Order_id'    => '来源',
+    'Order_id'    => '来源ID',
     'User_id'     => '用户',
     'Product_id'  => '产品',
     'Area_id'     => '区域',

+ 0 - 61
application/admin/model/OfflineRechargeRecord.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace app\admin\model;
-
-use think\Model;
-
-
-class OfflineRechargeRecord extends Model
-{
-
-    
-
-    
-
-    // 表名
-    protected $table = 'offline_recharge_record';
-    
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = false;
-
-    // 定义时间戳字段名
-    protected $createTime = false;
-    protected $updateTime = false;
-    protected $deleteTime = false;
-
-    // 追加属性
-    protected $append = [
-        'create_time_text',
-        'update_time_text'
-    ];
-    
-
-    
-
-
-
-    public function getCreateTimeTextAttr($value, $data)
-    {
-        $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
-        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
-    }
-
-
-    public function getUpdateTimeTextAttr($value, $data)
-    {
-        $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
-        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
-    }
-
-    protected function setCreateTimeAttr($value)
-    {
-        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
-    }
-
-    protected function setUpdateTimeAttr($value)
-    {
-        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
-    }
-
-
-}

+ 0 - 69
application/admin/model/offline/Order.php

@@ -1,69 +0,0 @@
-<?php
-
-namespace app\admin\model\offline;
-
-use think\Model;
-
-
-class Order extends Model
-{
-
-    
-
-    
-
-    // 表名
-    protected $table = 'product_order';
-    
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = false;
-
-    // 定义时间戳字段名
-    protected $createTime = false;
-    protected $updateTime = false;
-    protected $deleteTime = false;
-
-    // 追加属性
-    protected $append = [
-        'create_time_text',
-        'update_time_text'
-    ];
-    
-
-    protected static function init()
-    {
-        self::afterInsert(function ($row) {
-            $pk = $row->getPk();
-            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
-        });
-    }
-
-    
-
-
-
-    public function getCreateTimeTextAttr($value, $data)
-    {
-        $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
-        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
-    }
-
-
-    public function getUpdateTimeTextAttr($value, $data)
-    {
-        $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
-        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
-    }
-
-    protected function setCreateTimeAttr($value)
-    {
-        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
-    }
-
-    protected function setUpdateTimeAttr($value)
-    {
-        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
-    }
-
-
-}

+ 0 - 27
application/admin/validate/OfflineRechargeRecord.php

@@ -1,27 +0,0 @@
-<?php
-
-namespace app\admin\validate;
-
-use think\Validate;
-
-class OfflineRechargeRecord extends Validate
-{
-    /**
-     * 验证规则
-     */
-    protected $rule = [
-    ];
-    /**
-     * 提示消息
-     */
-    protected $message = [
-    ];
-    /**
-     * 验证场景
-     */
-    protected $scene = [
-        'add'  => [],
-        'edit' => [],
-    ];
-    
-}

+ 1 - 1
application/admin/validate/offline/Order.php → application/admin/validate/offline/Offline_recharge.php

@@ -4,7 +4,7 @@ namespace app\admin\validate\offline;
 
 use think\Validate;
 
-class Order extends Validate
+class Offline_recharge extends Validate
 {
     /**
      * 验证规则

+ 0 - 54
application/admin/view/offline/offline_recharge/add.html

@@ -1,54 +0,0 @@
-<form id="add-form" role="form" data-toggle="validator" method="POST" action="">
-
-    <div class="form-horizontal">
-        <div class="form-group">
-            <label class="control-label col-xs-12 col-sm-2">用户钱包地址:</label>
-            <div class="col-xs-12 col-sm-8">
-                <input id="c-user_id" data-rule="required" class="form-control" name="row[address]" type="text" value="">
-            </div>
-        </div>
-
-        <div class="form-group">
-            <label class="control-label col-xs-12 col-sm-2">报单日期:</label>
-            <div class="col-xs-12 col-sm-8">
-                <input id="c-date_time" class="form-control datetimepicker" name="row[date_time]" data-date-use-current="true" data-date-format="YYYY-MM-DD">
-            </div>
-        </div>
-
-        <div class="form-group">
-            <label class="control-label col-xs-12 col-sm-2">报单金额:</label>
-            <div class="col-xs-12 col-sm-8">
-                <input id="c-amount" class="form-control" step="0.001" name="row[amount]" type="number">
-            </div>
-        </div>
-
-        <div class="form-group">
-            <label class="control-label col-xs-12 col-sm-2">赠送算力:</label>
-            <div class="col-xs-12 col-sm-8">
-                <input id="c-power" class="form-control" step="0.001" name="row[power]" type="number">
-            </div>
-        </div>
-
-        <div class="form-group">
-            <label class="control-label col-xs-12 col-sm-2">服务器名称:</label>
-            <div class="col-xs-12 col-sm-8">
-                <input id="c-pro_name" class="form-control" name="row[pro_name]" type="text">
-            </div>
-        </div>
-
-        <div class="form-group">
-            <label class="control-label col-xs-12 col-sm-2">服务器编号:</label>
-            <div class="col-xs-12 col-sm-8">
-                <input id="c-server_no" class="form-control" name="row[server_no]" type="text">
-            </div>
-        </div>
-
-
-        <div class="form-group layer-footer">
-            <label class="control-label col-xs-12 col-sm-2"></label>
-            <div class="col-xs-12 col-sm-8">
-                <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
-                <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
-            </div>
-        </div></div>
-</form>

+ 10 - 5
application/admin/view/offline/offline_recharge/index.html

@@ -1,18 +1,23 @@
 <div class="panel panel-default panel-intro">
-    {:build_heading()}
+    
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+
+    </div>
 
     <div class="panel-body">
         <div id="myTabContent" class="tab-content">
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
-                        <a href="javascript:" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-                        <a href="javascript:;" class="btn btn-success btn-add title="服务器手动报单" ><i class="fa fa-plus"></i> 手动报单</a>
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('offline/offline_recharge/add')?'':'hide'}" title="{:__('Declaration')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
 
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="false"
-                           data-operate-del="false">
+                           data-operate-edit=""
+                           data-operate-del=""
+                           width="100%">
                     </table>
                 </div>
             </div>

+ 1 - 15
application/admin/view/product/transfer/index.html

@@ -7,24 +7,10 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('product/transfer/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
-                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('product/transfer/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
-                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('product/transfer/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-                        
-
-                        <div class="dropdown btn-group {:$auth->check('product/transfer/multi')?'':'hide'}">
-                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
-                            <ul class="dropdown-menu text-left" role="menu">
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
-                            </ul>
-                        </div>
-
+                  
                         
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('product/transfer/edit')}"
-                           data-operate-del="{:$auth->check('product/transfer/del')}"
                            width="100%">
                     </table>
                 </div>

+ 10 - 2
application/api/common.php

@@ -38,8 +38,7 @@ function checkSign(string $msg, $sign, $address): bool
 /**
  * 获取配置
  * @param string $msg
- * @param $sign
- * @return bool
+ * @return string
  */
 function getConfig(string $name): string
 {
@@ -47,3 +46,12 @@ function getConfig(string $name): string
 }
 
 
+/**
+ * 获取配置
+ * @param string $prefix
+ * @return string
+ */
+function getOrderSN(string $prefix = 'ORD'): string
+{  
+    return $prefix.date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 10);
+}

+ 2 - 0
application/api/controller/Order.php

@@ -39,6 +39,7 @@ class Order extends Api
         $order_data['price']     = $order_info['price'];
         $order_data['type_id']   = $productOrder::Popular;
         $order_data['area_id']   = $params['area_id'];
+        $order_data['order_no']  = getOrderSN('R');
         $order_data['user_id']   = $this->auth->id;
         $order_data['status']    = $productOrder::Paid;
         $order_data['num']       = 1;
@@ -169,6 +170,7 @@ class Order extends Api
             $order_data['type_id']   = $productOrder::Transfer;
             $order_data['status']    = $productOrder::Paid;
             $order_data['area_id']   = $order_info['area_id'];
+            $order_data['order_no']  = getOrderSN('Z');
             $order_data['user_id']   = $this->auth->id;
             $order_data['price']     = $order_info['price'];
             $order_data['num']       = 1;

+ 2 - 2
application/api/controller/User.php

@@ -94,11 +94,11 @@ class User extends Api
         // 启动事务
         Db::startTrans();
         try {
-            $list  = $userBalanceLog::where('user_id', $this->auth->id)
+            $list['data']  = $userBalanceLog::where('user_id', $this->auth->id)
                    ->where('type_id', $userBalanceLog::Share)
                    ->order('id desc')
                    ->paginate($this->pageSize);
-
+            $list['statusList'] = $userBalanceLog::getStatusList();
             // 提交事务
             Db::commit();
         } catch (Exception $e) {

+ 5 - 7
application/api/lang/en/home.php

@@ -3,11 +3,9 @@
 return [
 
       'Parameter error'       => 'Parameter error',
-      'Tx_hash'               => '交易哈希',
-      'User_id'               => '用户ID',
-      'Symbol'                => '币种',
-      'Amount'                => '金额',
-      'Status'                => '状态',
-      'Create_time'           => '创建时间',
-      'Update_time'           => '更新时间'
+      'Tx_hash'               => 'Transaction Hash',
+      'User_id'               => 'User ID',
+      'Symbol'                => 'Symbol',
+      'Amount'                => 'Amount',
+      'Status'                => 'Status'
 ];

+ 6 - 0
application/api/lang/en/order.php

@@ -7,4 +7,10 @@ return [
       '抢购已结束'            => 'The sale has ended',
       '交易金额不能为空'       => 'The transaction amount cannot be empty. The',
       '交易Hash不能为空'       => 'transaction hash cannot be empty.',
+      '已下单'                                => 'Ordered',
+      '已付款'                                => 'Paid',
+      '已转让'                                => 'Transferred',
+      '已发货'                                => 'Shipped',
+      '已取消'                                => 'Cancelled',
+      '已完成'                                => 'Completed',
 ];

+ 9 - 3
application/api/lang/en/user.php

@@ -19,7 +19,7 @@ return [
     'Email is incorrect'                    => '邮箱不正确',
     'Account is locked'                     => '账户已经被锁定',
     'Password is incorrect'                 => '密码不正确',
-    'Account is incorrect'                  => '账户不正确',
+    'Account is incorrect'                  => 'Incorrect account',
     'Account not exist'                     => '账户不存在',
     'Account can not be empty'              => '账户不能为空',
     'Username or password is incorrect'     => '用户名或密码不正确',
@@ -31,9 +31,15 @@ return [
     'Captcha is incorrect'                  => '验证码不正确',
     'Logged in successful'                  => '登录成功',
     'Logout successful'                     => '退出成功',
-    'Operation failed'                      => '操作失败',
-    'Invalid parameters'                    => '参数不正确',
+    'Operation failed'                      => 'Operation failed',
+    'Invalid parameters'                    => 'Incorrect parameters',
     'Change password failure'               => '修改密码失败',
     'Change password successful'            => '修改密码成功',
     'Reset password successful'             => '重置密码成功',
+    '热销支付'                               => 'Hot-selling payment',
+    '转让支付'                               => 'Transfer payment',
+    '转让收款'                               => 'Transfer receipt',
+    '充值'                                   => 'Recharge',
+    '提现'                                   => 'Withdraw',
+    '分享'                                   => 'Share',
 ];

+ 6 - 0
application/api/lang/zh-cn/order.php

@@ -8,5 +8,11 @@ return [
 
       '交易金额不能为空'       => '交易金额不能为空',
       '交易Hash不能为空'       => '交易Hash不能为空',
+      '已下单'                                => '已下单',
+      '已付款'                                => '已付款',
+      '已转让'                                => '已转让',
+      '已发货'                                => '已发货',
+      '已取消'                                => '已取消',
+      '已完成'                                => '已完成',
       
 ];

+ 6 - 0
application/api/lang/zh-cn/user.php

@@ -36,4 +36,10 @@ return [
     'Change password failure'               => '修改密码失败',
     'Change password successful'            => '修改密码成功',
     'Reset password successful'             => '重置密码成功',
+    '热销支付'                               => '热销支付',
+    '转让支付'                               => '转让支付',
+    '转让收款'                               => '转让收款',
+    '充值'                                  => '充值',
+    '提现'                                  => '提现',
+    '分享'                                  => '分享',
 ];

+ 22 - 6
application/common/model/ProductOrder.php

@@ -36,7 +36,7 @@ class ProductOrder extends Model
     const Popular           = 0;
     const Transfer          = 1;
 
-    /*
+    /* 
      *  订单状态 '已下单', 1=>'已付款', 2=>'已转让', 3=>'已发货', 4=>'已取消', 5=>'完成'];
      */
     public $order_status = [
@@ -49,14 +49,30 @@ class ProductOrder extends Model
         self::Complete          => '完成',
     ];
 
-    
-    //order_id,product_id,type,area_id  0热销 1转让
+    public static function getStatusList()
+    {
+        return [self::Ordered => __('已下单'), self::Paid  => __('已付款'), self::Transferred => __('已转让'), self::Shipped => __('已发货'), self::Cancelled  => __('已取消'), self::Complete => __('已完成')];
+    }
 
-    // static  0  1支付 2转让 3发货 4取消 5完成   
-   
-    
+    //产品
+    public function products()
+    {
+        return $this->hasOne('ProductLists', 'id', 'product_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+    //用户 user_id
+    public function users()
+    {
+        return $this->hasOne('UserModel', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
 
 
+    //区域
+    public function areas()
+    {
+        return $this->hasOne('ProductArea', 'id', 'area_id', [], 'LEFT')->setEagerlyType(0);
+    }
+    
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 13 - 0
application/common/model/ProductTransfer.php

@@ -33,6 +33,19 @@ class ProductTransfer extends Model
         self::NORMAL            => '正常'
     ];
     
+    //产品
+    public function products()
+    {
+        return $this->hasOne('ProductLists', 'id', 'product_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+    //用户 user_id
+    public function users()
+    {
+        return $this->hasOne('UserModel', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
 
     public function getCreateTimeTextAttr($value, $data)
     {

+ 1 - 5
application/common/model/ProductsModel.php

@@ -19,10 +19,6 @@ class ProductsModel  extends Model
     ];
 
 
-    //产品
-    public function employees()//yewu为第一张表的字段,employee_num为第二张表的字段
-    {
-        return $this->belongsTo('app\admin\model\setting\Employees', 'yewu', 'employee_num', [], 'LEFT')->setEagerlyType(0);
-    }
+  
 
 }

+ 5 - 1
application/common/model/UserBalanceLog.php

@@ -54,8 +54,12 @@ class UserBalanceLog extends Model
         self::Share             => '分享',
     ];
 
+    public static function getStatusList()
+    {
+        return [self::Popular => __('热销支付'), self::Payment  => __('转让支付'), self::Receive => __('转让收款'), self::Recharge => __('充值'), self::Withdraw  => __('提现'), self::Share => __('分享')];
+    }
 
-       /**
+    /**
      * 更新钱包余额并添加账变记录
      * @param int $uid 用户ID
      * @param string $asset 资产类型

+ 11 - 53
public/assets/js/backend/offline/offline_recharge.js

@@ -1,4 +1,4 @@
-define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function ($, undefined, Backend, Table, Form) {
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
 
     var Controller = {
         index: function () {
@@ -28,62 +28,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
-                        {
-                            field: 'order_type', title: '订单类型', searchList: {
-                                '1': '服务器算力',
-                                '2': '租赁服务器',
-                            }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
-                        },
-                        {field: 'user_id', title: __('User_id')},
-                        {field: 'user_address', title: '用户钱包地址'},
                         {field: 'tx_hash', title: __('Tx_hash'), operate: 'LIKE'},
-                        {field: 'pro_name', title: '产品名称', operate: 'LIKE'},
-                        {field: 'server_no', title: '服务器编号', operate: 'LIKE',  editable: true},
+                        {field: 'user_id', title: __('User_id')},
+                        {field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
                         {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
-                        {field: 'power', title: '算力', operate:'BETWEEN'},
-                        {
-                            field: 'status', title: '付款状态', searchList: {
-                                '0': '待支付',
-                                '100': '待确认',
-                                '200': '成功',
-                                '400': '失败',
-                                '500': '取消',
-                            }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
-                        },
-                        {
-                            field: 'express_status', title: '发货状态', searchList: {
-                                '0': '待发货',
-                                '1': '已发货',
-                            }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
-                        },
-                        {field: 'real_name', title: '收货人'},
-                        {field: 'mobile', title: '电话'},
-                        {field: 'province', title: '省'},
-                        {field: 'city', title: '市'},
-                        {field: 'district', title: '区/县'},
-                        {field: 'address', title: '详细地址'},
-                        {field: 'express_name', title: '快递名称'},
-                        {field: 'express_num', title: '单号'},
+                        {field: 'to_address', title: __('To_address'), operate: false},
+                        {field: 'from_address', title: __('From_address'), operate: false},
+                        {field: 'cha_bao', title: __('茶宝'), operate: false},
+                        {field: 'status', title: __('Status'), searchList: { "100":__('待确认'),"200":__('打款成功'),"400":__('失败')}, formatter: Table.api.formatter.status},
+                        {field: 'block_number', title: __('最新扫描的最新区块'), operate: false},
+                        {field: 'note', title: __('Note'), operate: false},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {
-                            field: 'operate', title: '操作', table: table,
-                            events: Table.api.events.operate,
-                            buttons: [{
-                                name: 'delivery',
-                                text: '发货',
-                                title: '订单发货',
-                                classname: 'btn btn-xs btn-primary btn-dialog btn-receivable',
-                                icon: 'fa fa-keyboard-o',
-                                url: 'offline/offline_recharge/delivery',
-                                extend: 'data-area=\'["50%", "50%"]\'',
-                                visible: function (row) {
-                                    // 自定义按钮 动态是否显示
-                                    return row.express_status === 0;
-                                }
-                            },],
-                            formatter: Table.api.formatter.operate,
-                        },
+        
+                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });

+ 9 - 11
public/assets/js/backend/offline/order.js

@@ -25,17 +25,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'order_id', title: __('Order_id')},
-                        {field: 'user_id', title: __('User_id')},
-                        {field: 'product_id', title: __('Product_id')},
-                        {field: 'area_id', title: __('Area_id')},
-                        {field: 'type_id', title: __('Type_id')},
-                        {field: 'price', title: __('Price'), operate:'BETWEEN'},
-                        {field: 'num', title: __('Num')},
-                        {field: 'weigh', title: __('Weigh'), operate: false},
-                        //0已下单 1支付 2转让 3发货 4取消 5完成
-                        {field: 'status', title: __('Status')},
+                        {field: 'id', title: __('Id'), operate: false},
+                        {field: 'users.address', title: __('User_id'),operate:'LIKE'},
+                        {field: 'order_no', title: __('订单号')},
+                        {field: 'order_id', title: __('Order_id'), operate: false},
+                        {field: 'products.zh_name', title: __('Product_id'),operate:'LIKE'},
+                        {field: 'areas.address', title: __('Area_id')},
+                        {field: 'type_id', title: __('Type_id'), searchList: {0:__('热销'), 1:__('转让')}, formatter: Table.api.formatter.status},
+                        {field: 'price', title: __('Price'), operate:false},
+                        {field: 'status', title: __('Status'), searchList: {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('发货'), 4:__('取消'), 5:__('完成')}, formatter: Table.api.formatter.status},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}

+ 7 - 9
public/assets/js/backend/product/transfer.js

@@ -6,11 +6,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'product/transfer/index' + location.search,
-                    add_url: 'product/transfer/add',
-                    edit_url: 'product/transfer/edit',
-                    del_url: 'product/transfer/del',
                     multi_url: 'product/transfer/multi',
                     import_url: 'product/transfer/import',
+                    dragsort_url: "",
                     table: 'product_transfer',
                 }
             });
@@ -26,14 +24,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
-                        {field: 'product_id', title: __('Product_id')},
-                        {field: 'user_id', title: __('User_id')},
-                        {field: 'price', title: __('Price'), operate:'BETWEEN'},
-                        {field: 'fees', title: __('Fees'), operate:'BETWEEN'},
-                        {field: 'status', title: __('Status')},
+                        {field: 'products.zh_name', title: __('Product_id'), operate: 'LIKE'}, 
+                        {field: 'users.address', title: __('User_id'), operate: 'LIKE'},
+                        {field: 'price', title: __('Price'), operate: false},
+                        {field: 'fees', title: __('Fees'), operate: false},
+                        {field: 'status', title: __('Status'), searchList: {'0': '结束','1': '正常'}, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });