Browse Source

解决跨域

Jason 1 year ago
parent
commit
b0417f8554
2 changed files with 3 additions and 12 deletions
  1. 2 11
      application/admin/controller/user/User.php
  2. 1 1
      application/config.php

+ 2 - 11
application/admin/controller/user/User.php

@@ -102,22 +102,13 @@ class User extends Backend
         $result = false;
         Db::startTrans();
         try {
-            $balance = build_amount_compute($params['type'], $params['amount'], $row->balance);
-            //操作记录
-            MoneyLog::create(['user_id'=> $params['id'],
-                'from_id'=> $this->auth->id,
-                'amount'=> $params['amount'],
-                'balance'=> $balance
-            ]);
-            $result = $row->allowField(true)->save(['balance'=>$balance]);
+            (new MoneyLog())->change($params['id'], $params['amount'], MoneyLog::SystemChange, $this->auth->id, '后台操作');
+
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {
             Db::rollback();
             $this->error($e->getMessage());
         }
-        if (false === $result) {
-            $this->error(__('No rows were updated'));
-        }
         $this->success();
     }
 

+ 1 - 1
application/config.php

@@ -302,7 +302,7 @@ return [
         //插件纯净模式,插件启用后是否删除插件目录的application、public和assets文件夹
         'addon_pure_mode'       => true,
         //允许跨域的域名,多个以,分隔
-        'cors_request_domain'   => 'localhost,127.0.0.1',
+        'cors_request_domain'   => '*',
         //版本号
         'version'               => '1.4.0.20230711',
         //API接口地址