| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\common\model;
- use fast\Asset;
- use fast\Http;
- use fast\Random;
- use think\Cache;
- use think\Log;
- use think\Model;
- use think\Request;
- class UserBalanceLog extends Model
- {
- protected $name = "user_balance_log";
- /*
- * 获取ETC的USDT价格
- */
- //0支付 1转让支付 2 转让收款 3 充值 4 提现
- const Popular = 0;
- const Payment = 1;
- const Receive = 2;
- const Recharge = 3;
- const Withdraw = 4;
- const Share = 5;
- /*
- * 支付状态
- * 0未支付 100支付中 200支付成功 400支付失败
- */
- public $pay_status = [
- '-1' => '全部',
- self::Popular => '热销支付',
- self::Payment => '转让支付',
- self::Receive => '转让收款',
- self::Recharge => '充值',
- self::Withdraw => '提现',
- self::Share => '分享',
- ];
- /**
- * 更新钱包余额并添加账变记录
- * @param int $uid 用户ID
- * @param string $asset 资产类型
- * @param string $amount 金额 正:表示加 负:表示减
- * @param int $action 账变类型
- * @return void
- * @throws Exception
- */
- public static function changeWalletAccount(int $uid, int $type_id, string $amount, int $before, string $after, int $from_id, string $action = '+')
- {
- // 更新钱包余额
- UserModel::updateForRBalance($uid, $amount, $action);
- // 创建账变记录
- $insertRs = self::create([
- 'user_id' => $uid,
- 'from_id' => $from_id,
- 'type_id' => $type_id,
- 'amount' => $amount,
- 'before' => $before,
- 'after' => $after,
- 'action' => $action
- ]);
- if (empty($insertRs)) return false;
- }
- }
|