| 1234567891011121314151617181920212223242526272829303132333435363738394041 | 
							- <?php
 
- namespace app\common\model;
 
- use think\Model;
 
- /**
 
-  * 用户声币流水记录模型
 
-  */
 
- class UserSoundcoinLog extends Model
 
- {
 
-     // 开启自动写入时间戳字段
 
-     protected $autoWriteTimestamp = 'int';
 
-     // 定义时间戳字段名
 
-     protected $createTime = 'createtime';
 
-     /**
 
-      * 用户声币余额变更
 
-      */
 
-     public function addUserSoundcoinLog($user_id, $money, $mode, $before, $detail, $type = 1, $objId = 0)
 
-     {
 
-         if ($mode == "+") {
 
-             $balance = $before + $money;
 
-         } else {
 
-             $balance = $before - $money;
 
-         }
 
-         // 添加当前用户钻石流水记录
 
-         $data = [];
 
-         $data["user_id"] = $user_id;
 
-         $data['type'] = $type;
 
-         $data['obj_id'] = $objId;
 
-         $data["value"] = $money;
 
-         $data["mode"] = $mode;
 
-         $data["before"] = $before;
 
-         $data["balance"] = $balance;
 
-         $data["detail"] = $detail;
 
-         $data["createtime"] = time();
 
-         return $this->insertGetId($data);
 
-     }
 
- }
 
 
  |