Prechádzať zdrojové kódy

Merge branch 'main' of http://124.222.171.90:10880/Southeast-Asia/API-Tou-Biao

afa 1 rok pred
rodič
commit
82ee914f05

+ 1 - 1
application/admin/controller/user/User.php

@@ -176,7 +176,7 @@ class User extends Backend
         }
         if (false === $this->request->isPost()) {
             $bank = json_decode($row->bank_info, true);
-            $row->real_name = $bank['real_name']??'';
+            $row->account_name = $bank['account_name']??'';
             $row->bank_name = $bank['bank_name']??'';
             $row->bank_card = $bank['bank_card']??'';
             $this->view->assign('row', $row);

+ 1 - 1
application/admin/view/user/user/collection.html

@@ -13,7 +13,7 @@
     <div class="form-group">
         <label for="c-real_name" class="control-label col-xs-12 col-sm-2">{:__('Real name')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-real_name" data-rule="required" class="form-control" name="row[real_name]" type="text" value="{$row.real_name|htmlentities}">
+            <input id="c-real_name" data-rule="required" class="form-control" name="row[account_name]" type="text" value="{$row.account_name|htmlentities}">
         </div>
     </div>
     <div class="form-group">

+ 35 - 8
application/api/controller/Money.php

@@ -196,7 +196,30 @@ class Money extends Api
         if(empty($withdraw_info)){
             $this->error(__('无提现信息'));
         }
-        $data = array_merge($data, $withdraw_info);
+
+        $data['usdt']['is_open'] = $withdraw_info['usdt'];
+        $data['bank']['is_open'] = $withdraw_info['bank'];
+
+        if($withdraw_info['usdt']){
+            if(empty($user['usdt_address'])){
+                $this->error(__('出款信息未配置'), '', 402);
+            }
+
+            $data['usdt']['address'] = $user['usdt_address'];
+        }
+
+        if($withdraw_info['bank']){
+            if(empty($user['bank_info'])){
+                $this->error(__('出款信息未配置'), '', 402);
+            }
+            $data['bank']['account_name'] = $data['bank']['bank_name'] = $data['bank']['bank_card'] = '';
+            $bank_info = json_decode($user['bank_info'], true);
+            if(!empty($bank_info)){
+                $data['bank']['account_name'] = $bank_info['account_name'];
+                $data['bank']['bank_name'] = $bank_info['bank_name'];
+                $data['bank']['bank_card'] = $bank_info['bank_card'];
+            }
+        }
 
         $this->success('', $data);
     }
@@ -253,23 +276,27 @@ class Money extends Api
             if(empty($withdraw_info['usdt'])){
                 $this->error(__('参数有误'));
             }
-            $usdt_address = $this->request->post('usdt');
-            if(empty($usdt_address)){
+//            $usdt_address = $this->request->post('usdt');
+            if(empty($user['usdt_address'])){
                 $this->error(__('参数有误'));
             }
 
             $insert_data['order_no']      = 'U' . time() . $user['id'];
-            $insert_data['usdt_address']  = $usdt_address;
+            $insert_data['usdt_address']  = $user['usdt_address'];
         }else{
             if(empty($withdraw_info['bank'])){
                 $this->error(__('参数有误'));
             }
-            $insert_data['bank_name']   = $this->request->post('bank_name');
-            $insert_data['bank_card']   = $this->request->post('bank_card');
-            $insert_data['account_name']= $this->request->post('account_name');
-            if(empty($insert_data['bank_name']) || empty($insert_data['bank_card']) || empty($insert_data['account_name'])){
+
+            if(empty($user['bank_info'])){
                 $this->error(__('参数有误'));
             }
+            $bank_info = json_decode($user['bank_info'], true);
+
+            $insert_data['bank_name']   = $bank_info['bank_name'];
+            $insert_data['bank_card']   = $bank_info['bank_card'];
+            $insert_data['account_name']= $bank_info['account_name'];
+
             $insert_data['order_no']    = 'B' . time() . $user['id'];
         }
 

+ 33 - 9
application/api/controller/Order.php

@@ -8,6 +8,7 @@ use app\common\model\Goods;
 use app\common\model\MoneyLog;
 use app\common\model\Order AS OrderModel;
 use app\common\model\Users;
+use app\common\model\UsersPath;
 use think\Db;
 use think\Exception;
 
@@ -83,6 +84,11 @@ class Order extends Api
         if(!($user['balance'] > 0)){
             $this->error(__('余额不足'), '', 401);
         }
+        $balance_mini = (new Config())->getValue('balance_mini');//允许做单的最低余额
+        if($user['balance'] < $balance_mini){
+            $this->error(__('余额不足'), '', 401);
+        }
+
         $day_tasks_num  = (new Config())->getValue('day_tasks_num');//单日任务数
         $task_income    = (new Config())->getValue('task_income');//单次收益
         $amount_mini    = $user['balance'] * 0.4;
@@ -152,14 +158,16 @@ class Order extends Api
         // 启动事务
         Db::startTrans();
         try {
-            if($freeze){
-                //卡单操作,不扣款,只冻结订单金额
-                $freeze = Users::where('id', $user['id'])->update(['freeze' => -$goods_info['price']]);
-                $order_data['status'] = OrderModel::Default;
-            }else{
-                //正常订单 账变
-                (new MoneyLog())->change($user['id'], -$goods_info['price'], MoneyLog::Pay, '', '');
-            }
+//            if($freeze){
+//                //卡单操作,不扣款,只冻结订单金额
+//                $freeze = Users::where('id', $user['id'])->update(['freeze' => -$goods_info['price']]);
+//                $order_data['status'] = OrderModel::Default;
+//            }else{
+//                //正常订单 账变
+//                (new MoneyLog())->change($user['id'], -$goods_info['price'], MoneyLog::Pay, '', '');
+//            }
+            //正常订单 账变
+            (new MoneyLog())->change($user['id'], -$goods_info['price'], MoneyLog::Pay, '', '');
             // 创建订单
             OrderModel::create($order_data);
 
@@ -247,7 +255,23 @@ class Order extends Api
                     'task_last_time'=>  time()
                 ]);
             //向上级发放
-
+            $parent_ids = (new UsersPath())->where('user_id', $user['id'])->order('distance')->column('parent_id');
+            if(!empty($parent_ids)){
+                for($i = 1; $i <= 3; $i++){
+                    if(!isset($parent_ids[$i - 1])){
+                        //没设置就跳出
+                        break;
+                    }
+                    $radio = (new Config())->getValue('bonus_share_' . $i);
+                    if(!empty($radio) && $radio > 0 && $radio < 1){
+                        $bonus = $radio * $order_info['bonus'];
+                        if($bonus > 0.01){
+                            //上级佣金
+                            (new MoneyLog())->change($parent_ids[$i - 1], $bonus, MoneyLog::Commission, $user['id'], $i . '代会员奖励');
+                        }
+                    }
+                }
+            }
 
             // 提交事务
             Db::commit();

+ 49 - 28
application/api/controller/User.php

@@ -307,42 +307,63 @@ class User extends Api
         $this->success('');
     }
     /**
-     * 手机验证码登录
+     * 提现信息
      *
-     * @ApiMethod (POST)
-     * @param string $mobile  手机号
-     * @param string $captcha 验证码
      */
-    public function mobilelogin()
+    public function withdraw_info()
     {
-        $mobile = $this->request->post('mobile');
-        $captcha = $this->request->post('captcha');
-        if (!$mobile || !$captcha) {
-            $this->error(__('Invalid parameters'));
+        $user = $this->auth->getUser();
+        $withdraw_info = UserModel::getAgentWithdrawInfoByAgentId($user['agent_id']);
+
+        $resdata['usdt']['is_open'] = $withdraw_info['usdt'];
+        $resdata['bank']['is_open'] = $withdraw_info['bank'];
+
+        if($withdraw_info['usdt']){
+            $resdata['usdt']['address'] = $user['usdt_address'];
         }
-        if (!Validate::regex($mobile, "^1\d{10}$")) {
-            $this->error(__('Mobile is incorrect'));
+
+        if($withdraw_info['bank']){
+            $resdata['bank']['account_name'] = $resdata['bank']['bank_name'] = $resdata['bank']['bank_card'] = '';
+            $bank_info = json_decode($user['bank_info'], true);
+            if(!empty($bank_info)){
+                $resdata['bank']['account_name'] = $bank_info['account_name'];
+                $resdata['bank']['bank_name'] = $bank_info['bank_name'];
+                $resdata['bank']['bank_card'] = $bank_info['bank_card'];
+            }
         }
-        if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
-            $this->error(__('Captcha is incorrect'));
+
+        $this->success('', $resdata);
+    }
+    /**
+     * 提现信息修改
+     *
+     */
+    public function withdraw_change()
+    {
+        $user = $this->auth->getUser();
+
+        $fund_pwd = $this->request->post("fund_pwd", '', null);
+        if(md5($fund_pwd) != $user['fund_pwd']){
+            $this->error(__('资金密码有误'));
         }
-        $user = \app\common\model\Users::getByMobile($mobile);
-        if ($user) {
-            if ($user->status != 'normal') {
-                $this->error(__('Account is locked'));
-            }
-            //如果已经有账号则直接登录
-            $ret = $this->auth->direct($user->id);
-        } else {
-            $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, []);
+
+        $updata = [];
+        $withdraw_info = UserModel::getAgentWithdrawInfoByAgentId($user['agent_id']);
+        if($withdraw_info['usdt']){
+            $updata['usdt_address'] = $this->request->post("usdt_address", '', null);
         }
-        if ($ret) {
-            Sms::flush($mobile, 'mobilelogin');
-            $data = ['userinfo' => $this->auth->getUserinfo()];
-            $this->success(__('Logged in successful'), $data);
-        } else {
-            $this->error($this->auth->getError());
+
+        if($withdraw_info['bank']){
+            $bank_info['account_name'] = $this->request->post("account_name", '', null);
+            $bank_info['bank_name'] = $this->request->post("bank_name", '', null);
+            $bank_info['bank_card'] = $this->request->post("bank_card", '', null);
+
+            $updata['bank_info'] = json_encode($bank_info);
         }
+        //dump($updata);
+        (new UserModel())->where('id', $user['id'])->update($updata);
+
+        $this->success(__('完成'));
     }
 
     /**

+ 2 - 1
application/api/lang/zh-cn.php

@@ -16,8 +16,9 @@ return [
     '操作超时'                                          => '操作超时',
     '待支付'                                           => '待支付',
     '待处理'                                           => '待处理',
-    '完成'                                              => '完成',
+    '完成'                                             => '完成',
     '失败'                                             => '失败',
     '取消'                                             => '取消',
     '任务不足'                                          => '今日任务还未完成,不能提现',
+    '出款信息未配置'                                     => '出款信息未配置',
 ];

+ 8 - 8
application/extra/site.php

@@ -1,11 +1,11 @@
 <?php
 
 return array (
-  'name' => '投标系统',
-  'logo' => 'http://dapp-static.oss-cn-shenzhen.aliyuncs.com/tou-biao/202403/logo.png',
+  'name' => 'Etsy',
+  'logo' => 'http://dapp-static.oss-cn-shenzhen.aliyuncs.com/tou-biao/202404/5329329%20%282%29.png',
   'maintain_switch' => '1',
   'day_tasks_num' => '60',
-  'task_income' => '0.006',
+  'task_income' => '0.005',
   'categorytype' => 
   array (
     'default' => 'Default',
@@ -35,7 +35,7 @@ return array (
   ),
   'recharge_usdt_switch' => '1',
   'recharge_usdt_address' => 'ox5454534cccccccccc',
-  'recharge_bank_switch' => '1',
+  'recharge_bank_switch' => '0',
   'recharge_bank_name' => '花旗银行',
   'withdraw_usdt_switch' => '1',
   'withdraw_bank_switch' => '1',
@@ -43,8 +43,8 @@ return array (
   'withdrawal_fee' => '0.2',
   'recharge_bank_card' => '银行卡号号码',
   'recharge_real_name' => '开户人姓名',
-  'balance_min' => '15',
-  'bonus_first' => '0.03',
-  'bonus_secend' => '0.02',
-  'bonus_three' => '0.01',
+  'balance_mini' => '15',
+  'bonus_share_1' => '0.05',
+  'bonus_share_2' => '0.04',
+  'bonus_share_3' => '0.03',
 );

+ 3 - 20
public/assets/js/backend/trade/money_in.js

@@ -29,11 +29,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         },
                         {field: 'users.mobile', title: __('User_id')},
                         {field: 'usdt_address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
-                        {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
-                        {field: 'account_name', title: __('Account_name'), operate: false},
+                        // {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
+                        // {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
+                        // {field: 'account_name', title: __('Account_name'), operate: false},
                         {field: 'amount', title: __('Amount'), operate: false},
-                        {field: 'img_url', title: __('充值截图'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
                         {field: 'img_urls', title: __('Url'), formatter: Table.api.formatter.url, visible: false},
                         {field: 'status', title: __("Status"),
                             searchList: {0:__('待支付'), 100:__('待处理'), 200:__('成功'), 400:__('失败'), 500:__('取消')},
@@ -103,22 +102,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));
-            },
-            formatter: {
-                thumb: function (value, row, index) {
-                    var html = '';
-                    html = '<a href="' + row.img_url + '" target="_blank"><img src="' + row.img_url + '" alt="" style="max-height:60px;max-width:120px"></a>';
-                    return '<div style="width:120px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + html + '</div>';
-                },
-                // url: function (value, row, index) {
-                //     return '<a href="' + row.img_url + '" target="_blank" class="label bg-green">' + row.url + '</a>';
-                // },
-                // filename: function (value, row, index) {
-                //     return '<div style="width:150px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
-                // },
-                // mimetype: function (value, row, index) {
-                //     return '<div style="width:80px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
-                // },
             }
         }
     };